mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Add fill and stroke color choices to the Pen tool options bar (#1188)
* Add basic layout - WIP * Add color input min-width -> 80px * First pass implementation - WIP * Allow fill to be None * Fix null Fill color * refactor fill and stroke options into struct * toolbar progress - WIP * Switch is_working_color bool to PenColorType enum * Add todo * Add WorkingColorChanged event * remove unused import * Add WorkingColor[Primary/Secondary] icons * Allow new strokes to have no color * Set to base color when X is pressed (as per req) * Improve icons for new UI layout design * Add radio buttons * Fix menu bar Edit12px -> Edit * Add tooltips to radio buttons * Make the color selector only on custom * Fix edit icon correctly this time (whoops) * Fix working colors icons * Changes to improve the UX * Remove lines obviated by Default::default() * Make Eyedropper tool use working_color_changed event * Fix tests --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -281,9 +281,9 @@ impl core::hash::Hash for Stroke {
|
||||
}
|
||||
|
||||
impl Stroke {
|
||||
pub const fn new(color: Color, weight: f64) -> Self {
|
||||
pub const fn new(color: Option<Color>, weight: f64) -> Self {
|
||||
Self {
|
||||
color: Some(color),
|
||||
color,
|
||||
weight,
|
||||
dash_lengths: Vec::new(),
|
||||
dash_offset: 0.,
|
||||
@@ -439,7 +439,7 @@ impl PathStyle {
|
||||
/// ```
|
||||
/// # use graphene_core::vector::style::{Fill, Stroke, PathStyle};
|
||||
/// # use graphene_core::raster::color::Color;
|
||||
/// let stroke = Stroke::new(Color::GREEN, 42.);
|
||||
/// let stroke = Stroke::new(Some(Color::GREEN), 42.);
|
||||
/// let style = PathStyle::new(Some(stroke.clone()), Fill::None);
|
||||
///
|
||||
/// assert_eq!(style.stroke(), Some(stroke));
|
||||
@@ -477,7 +477,7 @@ impl PathStyle {
|
||||
///
|
||||
/// assert_eq!(style.stroke(), None);
|
||||
///
|
||||
/// let stroke = Stroke::new(Color::GREEN, 42.);
|
||||
/// let stroke = Stroke::new(Some(Color::GREEN), 42.);
|
||||
/// style.set_stroke(stroke.clone());
|
||||
///
|
||||
/// assert_eq!(style.stroke(), Some(stroke));
|
||||
@@ -510,7 +510,7 @@ impl PathStyle {
|
||||
/// ```
|
||||
/// # use graphene_core::vector::style::{Fill, Stroke, PathStyle};
|
||||
/// # use graphene_core::raster::color::Color;
|
||||
/// let mut style = PathStyle::new(Some(Stroke::new(Color::GREEN, 42.)), Fill::None);
|
||||
/// let mut style = PathStyle::new(Some(Stroke::new(Some(Color::GREEN), 42.)), Fill::None);
|
||||
///
|
||||
/// assert!(style.stroke().is_some());
|
||||
///
|
||||
@@ -528,7 +528,7 @@ impl PathStyle {
|
||||
(_, fill) => fill.render(svg_defs, multiplied_transform, bounds, transformed_bounds),
|
||||
};
|
||||
let stroke_attribute = match (view_mode, &self.stroke) {
|
||||
(ViewMode::Outline, _) => Stroke::new(LAYER_OUTLINE_STROKE_COLOR, LAYER_OUTLINE_STROKE_WEIGHT).render(),
|
||||
(ViewMode::Outline, _) => Stroke::new(Some(LAYER_OUTLINE_STROKE_COLOR), LAYER_OUTLINE_STROKE_WEIGHT).render(),
|
||||
(_, Some(stroke)) => stroke.render(),
|
||||
(_, None) => String::new(),
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ impl VectorData {
|
||||
Self {
|
||||
subpaths: Vec::new(),
|
||||
transform: DAffine2::IDENTITY,
|
||||
style: PathStyle::new(Some(Stroke::new(Color::BLACK, 0.)), super::style::Fill::None),
|
||||
style: PathStyle::new(Some(Stroke::new(Some(Color::BLACK), 0.)), super::style::Fill::None),
|
||||
mirror_angle: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user