mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-21 09:54:09 +01:00
Merge pull request #8759 from dotCooCoo/fix/live-paint-bucket-eyedropper-stop
Live Paint: the bucket keeps its colors through the stop eyedropper and a Cmd-click
This commit is contained in:
17 files changed
+166
-21
No files matched your search
@@ -63,7 +63,7 @@ fn select_stop(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
// No document is needed for the default paint's gradient, so this does not use `refuse_symbol_part`.
|
||||
// While the Live Paint Bucket is active the proxies show the default paint, whose stops can be
|
||||
// selected with a part picked.
|
||||
if s.tool_id() != super::paint::LIVE_PAINT_BUCKET && s.active().is_some_and(|st| st.selection.symbol_part.is_some()) {
|
||||
if !s.bucket_paints() && s.active().is_some_and(|st| st.selection.symbol_part.is_some()) {
|
||||
return Err(super::brushsym::part_only());
|
||||
}
|
||||
let index = match p.get("index") {
|
||||
@@ -111,7 +111,7 @@ impl StopOwner {
|
||||
part: st.is_some_and(|d| d.selection.symbol_part.is_some()),
|
||||
fill: s.fill_active,
|
||||
item: s.appearance_item(),
|
||||
bucket: s.tool_id() == super::paint::LIVE_PAINT_BUCKET,
|
||||
bucket: s.bucket_paints(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ impl Session {
|
||||
/// the first selected object (so the last selection's once nothing is selected). Not while the
|
||||
/// Live Paint Bucket is the active tool: the fill and stroke are the colors it paints with.
|
||||
pub(crate) fn inherit_new_art(&mut self) {
|
||||
if self.prefs.new_art_basic || self.tool_id() == super::paint::LIVE_PAINT_BUCKET {
|
||||
if self.prefs.new_art_basic || self.bucket_paints() {
|
||||
return;
|
||||
}
|
||||
let Some(st) = self.active() else { return };
|
||||
|
||||
@@ -203,10 +203,11 @@ impl Session {
|
||||
/// The object whose fill (or stroke) the proxy shows, with the Appearance panel's active item
|
||||
/// when it stands for it (see [`Session::proxy_paints`]); None: the defaults for new art. With
|
||||
/// an object of a dynamic symbol instance selected ([`DocState::selected_symbol_part`]), that
|
||||
/// object as the instance draws it. None while the Live Paint Bucket is the active tool: the
|
||||
/// proxies show the colors it paints with.
|
||||
/// object as the instance draws it. None while the Live Paint Bucket is the active tool (or
|
||||
/// another tool works for it, [`Session::bucket_paints`]): the proxies show the colors it
|
||||
/// paints with.
|
||||
pub(crate) fn proxy_source(&self, stroke: bool) -> Option<(Cow<'_, Node>, Option<usize>)> {
|
||||
if self.tool_id() == LIVE_PAINT_BUCKET {
|
||||
if self.bucket_paints() {
|
||||
return None;
|
||||
}
|
||||
let st = self.active()?;
|
||||
@@ -378,11 +379,28 @@ impl DocState {
|
||||
}
|
||||
|
||||
impl Session {
|
||||
/// Do the fill and stroke proxies, and the paint commands that name no objects, stand for the
|
||||
/// colors the Live Paint Bucket paints with? They do while the bucket is the active tool, while
|
||||
/// a Cmd+click with the bucket uses the Selection tool, and while the Eyedropper samples into a
|
||||
/// stop of the bucket's gradient for the Gradient panel's eyedropper, up to and including the
|
||||
/// sample its click takes before it switches back to the bucket.
|
||||
pub fn bucket_paints(&self) -> bool {
|
||||
let for_bucket = |t: &dyn vectorcraft_tools::Tool| t.id() == LIVE_PAINT_BUCKET || t.returns_to() == Some(LIVE_PAINT_BUCKET);
|
||||
// A Cmd+click lends the Selection tool to the bucket, or to the Eyedropper armed for it.
|
||||
self.back_to_bucket || for_bucket(self.tool.as_ref()) || self.lender.as_deref().is_some_and(for_bucket)
|
||||
}
|
||||
|
||||
/// The tool the active tool's armed one-shot pick switches back to after its click
|
||||
/// ([`vectorcraft_tools::Tool::returns_to`]).
|
||||
pub fn tool_returns_to(&self) -> Option<String> {
|
||||
self.tool.returns_to().map(str::to_string)
|
||||
}
|
||||
|
||||
/// [`DocState::proxy_mixed`] of the active document for the Appearance panel's active item.
|
||||
/// A gradient mesh with points picked ([`Session::fill_mesh_points`]) counts with their colors.
|
||||
/// Neither is mixed while the Live Paint Bucket is the active tool ([`Session::proxy_source`]).
|
||||
pub fn proxy_mixed(&self) -> (bool, bool) {
|
||||
if self.tool_id() == LIVE_PAINT_BUCKET {
|
||||
if self.bucket_paints() {
|
||||
return (false, false);
|
||||
}
|
||||
self.active().map_or((false, false), |st| st.proxy_mixed_with(self.appearance_item(), &self.fill_mesh_points()))
|
||||
@@ -737,12 +755,13 @@ pub(crate) fn apply_paint(s: &mut Session, p: &Value, paint: Paint, fill: bool)
|
||||
Ok(json!({"objects": ids.iter().collect::<std::collections::BTreeSet<_>>().len()}))
|
||||
}
|
||||
|
||||
/// Is the Live Paint Bucket the active tool while `p` names no `ids`, `id` or `item`? A fill,
|
||||
/// Is the Live Paint Bucket the active tool ([`Session::bucket_paints`]) while `p` names no `ids`,
|
||||
/// `id` or `item`? A fill,
|
||||
/// stroke or stroke weight chosen then is what the bucket paints with, so it goes to the defaults
|
||||
/// and the selection keeps its paint.
|
||||
pub(crate) fn for_bucket(s: &Session, p: &Value) -> bool {
|
||||
// A null `ids` or `id` is no target, as `given_nodes` reads it; `item: null` names the top row.
|
||||
s.tool_id() == LIVE_PAINT_BUCKET && ["ids", "id"].iter().all(|k| p.get(k).is_none_or(Value::is_null)) && p.get("item").is_none()
|
||||
s.bucket_paints() && ["ids", "id"].iter().all(|k| p.get(k).is_none_or(Value::is_null)) && p.get("item").is_none()
|
||||
}
|
||||
|
||||
/// `p` with `ids: []` when [`for_bucket`]: the paint goes to the defaults only. None otherwise.
|
||||
|
||||
@@ -445,7 +445,7 @@ impl Session {
|
||||
/// selection's stroke.
|
||||
pub fn shown_stroke(&self) -> Option<StrokeLayer> {
|
||||
let st = self.active()?;
|
||||
if self.tool_id() == super::paint::LIVE_PAINT_BUCKET {
|
||||
if self.bucket_paints() {
|
||||
return Some(self.new_art_stroke());
|
||||
}
|
||||
if let Some(part) = st.selected_symbol_part() {
|
||||
|
||||
@@ -74,6 +74,10 @@ pub struct Session {
|
||||
/// While Cmd lends `tool` (a selection tool) for a drag: the tool it was lent to, which comes
|
||||
/// back as it was at the release ([`Session::pointer`]).
|
||||
pub(crate) lender: Option<Box<dyn Tool>>,
|
||||
/// Set while tool actions that end by switching back to the Live Paint Bucket are applied (the
|
||||
/// Eyedropper's sample into a stop of the bucket's gradient): their paint commands change the
|
||||
/// colors the bucket paints with ([`Session::bucket_paints`]).
|
||||
pub(crate) back_to_bucket: bool,
|
||||
/// Pointer and key input that came while the tool computed an edit on another thread, each with
|
||||
/// its number and view, made in order once the edit is applied.
|
||||
held_input: std::collections::VecDeque<(u64, tooling::HeldInput, ViewInfo)>,
|
||||
|
||||
@@ -55,6 +55,7 @@ impl Session {
|
||||
histories_seen: None,
|
||||
tool: vectorcraft_tools::create("selection"),
|
||||
lender: None,
|
||||
back_to_bucket: false,
|
||||
held_input: Default::default(),
|
||||
input_count: 0,
|
||||
edit_started_by: None,
|
||||
|
||||
@@ -323,7 +323,7 @@ impl Session {
|
||||
}
|
||||
// While the Live Paint Bucket is active, paint previews change only the bucket's colors, so
|
||||
// each preview starts from the colors the interaction began with.
|
||||
let bucket = self.tool_id() == cmd::LIVE_PAINT_BUCKET;
|
||||
let bucket = self.bucket_paints();
|
||||
let (paint, restore_paint) = {
|
||||
let menu = self.menu.clone();
|
||||
let st = self.doc_mut()?;
|
||||
@@ -485,7 +485,7 @@ impl Session {
|
||||
self.pending_paint = None;
|
||||
// While the Live Paint Bucket is active, a previewed color is the bucket's color, which the
|
||||
// cancel puts back as well.
|
||||
let bucket = self.tool_id() == cmd::LIVE_PAINT_BUCKET;
|
||||
let bucket = self.bucket_paints();
|
||||
if let Some(paint) = self
|
||||
.active()
|
||||
.and_then(|st| st.interaction.as_ref())
|
||||
|
||||
@@ -3434,6 +3434,65 @@ fn live_paint_bucket_gradient_preset_and_sampled_stop_follow_the_active_proxy()
|
||||
assert_eq!(node(&s, rect), art, "the selection keeps its paint");
|
||||
}
|
||||
|
||||
/// The Gradient panel's eyedropper, used on a stop of the Live Paint Bucket's gradient, samples the
|
||||
/// color clicked into that stop of the bucket's fill, and the selection keeps its paint. A Cmd-click
|
||||
/// with the bucket, or with the Eyedropper armed for it, which the selection tool takes, leaves the
|
||||
/// bucket's colors as they were.
|
||||
#[test]
|
||||
fn live_paint_bucket_keeps_its_colors_through_the_stop_eyedropper_and_a_cmd_click() {
|
||||
let v = ViewInfo::default();
|
||||
let click = |s: &mut Session, mods: Mods| {
|
||||
for kind in [PointerKind::Down, PointerKind::Up] {
|
||||
s.pointer(&PointerEvent::new(kind, 320.0, 320.0).with_mods(mods), v).unwrap();
|
||||
}
|
||||
};
|
||||
let mut s = session();
|
||||
live(&mut s);
|
||||
let rect = rect(&mut s, 300.0, 300.0, 40.0, 40.0);
|
||||
s.execute("paint.setFill", &json!({"color": "#00ff00", "ids": [rect.0]})).unwrap();
|
||||
s.execute("appearance.setNewArtBasic", &json!({"on": false})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [rect.0]})).unwrap();
|
||||
s.select_tool("livePaintBucket", v).unwrap();
|
||||
s.execute("paint.editGradient", &json!({"stroke": false, "kind": "linear"})).unwrap();
|
||||
s.execute("gradient.selectStop", &json!({"index": 1})).unwrap();
|
||||
let art = node(&s, rect);
|
||||
// The panel's eyedropper (`stop_eyedropper`): the Eyedropper, set to switch back to the bucket.
|
||||
s.select_tool("eyedropper", v).unwrap();
|
||||
s.set_tool_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(s.selected_stop(), Some(1), "the bucket's stop stays selected for the pick");
|
||||
// A Cmd-click while the pick is armed selects the rectangle and leaves the bucket's gradient.
|
||||
let fill = s.paint.fill.clone();
|
||||
s.execute("select.set", &json!({"ids": []})).unwrap();
|
||||
click(&mut s, Mods { cmd: true, ..Mods::default() });
|
||||
assert_eq!(s.doc().unwrap().selection.objects, vec![rect], "the selection tool took the click");
|
||||
assert_eq!((s.paint.fill.clone(), s.selected_stop()), (fill, Some(1)), "the bucket's fill and stop stay");
|
||||
click(&mut s, Mods::default());
|
||||
let Paint::Gradient(g) = &s.paint.fill else { panic!("the bucket's fill is not a gradient") };
|
||||
assert_eq!(g.gradient.stops[1].color, Color::from_hex("#00ff00").unwrap(), "the sampled stop");
|
||||
assert_eq!(node(&s, rect), art, "the selection keeps its paint");
|
||||
// A Cmd-click selects the rectangle; the bucket keeps its gradient.
|
||||
s.select_tool("livePaintBucket", v).unwrap();
|
||||
let fill = s.paint.fill.clone();
|
||||
s.execute("select.set", &json!({"ids": []})).unwrap();
|
||||
click(&mut s, Mods { cmd: true, ..Mods::default() });
|
||||
assert_eq!(s.doc().unwrap().selection.objects, vec![rect], "the selection tool took the click");
|
||||
assert_eq!(s.paint.fill, fill, "the bucket's fill stays");
|
||||
// Armed again, a Cmd-click on another object deselects the stop; the next click (a Shift-click,
|
||||
// which would sample a color) ends the pick and leaves the bucket's gradient.
|
||||
let other = self::rect(&mut s, 400.0, 400.0, 40.0, 40.0);
|
||||
s.execute("select.set", &json!({"ids": [rect.0]})).unwrap();
|
||||
s.execute("gradient.selectStop", &json!({"index": 1})).unwrap();
|
||||
s.select_tool("eyedropper", v).unwrap();
|
||||
s.set_tool_option("stop", &json!("livePaintBucket"));
|
||||
for mods in [Mods { cmd: true, ..Mods::default() }, Mods { shift: true, ..Mods::default() }] {
|
||||
for kind in [PointerKind::Down, PointerKind::Up] {
|
||||
s.pointer(&PointerEvent::new(kind, 420.0, 420.0).with_mods(mods), v).unwrap();
|
||||
}
|
||||
}
|
||||
assert_eq!(s.doc().unwrap().selection.objects, vec![other], "the Cmd-click selected the other object");
|
||||
assert_eq!((s.paint.fill.clone(), s.tool_returns_to()), (fill, None), "the pick ended without a sample");
|
||||
}
|
||||
|
||||
/// A gradient stop selected on the selection's gradient is not selected once the Live Paint
|
||||
/// Bucket is active (its proxies show the default paint), and one selected on the bucket's
|
||||
/// gradient is not selected once another tool is chosen.
|
||||
|
||||
@@ -1578,6 +1578,10 @@ impl Session {
|
||||
/// Apply tool actions. Errors from previews are reported but keep the interaction alive.
|
||||
pub fn apply_actions(&mut self, acts: Vec<Action>) -> Result<Vec<UiRequest>> {
|
||||
let outer = std::mem::replace(&mut self.in_tool_actions, true);
|
||||
let outer_bucket = self.back_to_bucket;
|
||||
// The Eyedropper's sample into a stop of the Live Paint Bucket's gradient, which switches back to the bucket.
|
||||
self.back_to_bucket |=
|
||||
self.tool.id() == "eyedropper" && acts.iter().any(|a| matches!(a, Action::SwitchTool(t) if t == crate::cmd::LIVE_PAINT_BUCKET));
|
||||
// A preview that settling applied (typing kept as its own step before a drag begins) shows
|
||||
// its warning in the status bar, as the tool's own commit shows its preview's.
|
||||
let r = if !outer && self.depth == 0 {
|
||||
@@ -1587,6 +1591,7 @@ impl Session {
|
||||
self.apply_tool_actions(acts)
|
||||
};
|
||||
self.in_tool_actions = outer;
|
||||
self.back_to_bucket = outer_bucket;
|
||||
if !outer && self.depth == 0 {
|
||||
self.trim_histories();
|
||||
}
|
||||
|
||||
@@ -230,6 +230,11 @@ pub trait Tool: Send {
|
||||
fn wants_text(&self) -> bool {
|
||||
false
|
||||
}
|
||||
/// The tool a gradient stop's one-shot pick switches back to after its click (the Eyedropper
|
||||
/// armed by the Gradient panel's eyedropper); None when no such pick is armed.
|
||||
fn returns_to(&self) -> Option<&str> {
|
||||
None
|
||||
}
|
||||
fn text_input(&mut self, _cx: &ToolContext, _s: &str) -> Vec<Action> {
|
||||
vec![]
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
//!
|
||||
//! The Gradient panel's eyedropper sets the `stop` option (the tool to return to): the next click
|
||||
//! samples the colour under the cursor into the selected gradient stop (`paint.sampleColor
|
||||
//! {stop}`) and switches back to that tool.
|
||||
//! {stop}`) and switches back to that tool. Armed for the Live Paint Bucket, a click once its stop
|
||||
//! is no longer selected ends the pick without sampling and switches back to the bucket.
|
||||
//!
|
||||
//! Gradient mesh points picked with the Mesh tool, Direct Selection or the Lasso before switching
|
||||
//! to the Eyedropper stay picked (its `meshPoints` option), and go back to one of those tools
|
||||
@@ -536,6 +537,15 @@ impl Tool for EyedropperTool {
|
||||
self.stop = None;
|
||||
return vec![Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&c) })), Action::SwitchTool(back)];
|
||||
}
|
||||
// A pick for a stop of the Live Paint Bucket's gradient (the default paint's) ends without
|
||||
// sampling once that stop is no longer selected (a Cmd-click selected another object) or no
|
||||
// longer there (another paint was chosen): the click switches back.
|
||||
let bucket_paint = if cx.fill_active { &cx.paint.fill } else { &cx.paint.stroke };
|
||||
let bucket_stop = cx.gradient_stop.filter(|i| matches!(bucket_paint, Paint::Gradient(g) if *i < g.gradient.stops.len()));
|
||||
if self.stop.as_deref() == Some("livePaintBucket") && bucket_stop.is_none() {
|
||||
self.stop = None;
|
||||
return vec![Action::SwitchTool("livePaintBucket".into())];
|
||||
}
|
||||
let stop = self.stop.as_ref().zip(cx.gradient_stop);
|
||||
// A plain click on a selected gradient mesh gives the fill color to the point there, else
|
||||
// to the four points of the patch there.
|
||||
@@ -660,6 +670,10 @@ impl Tool for EyedropperTool {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn returns_to(&self) -> Option<&str> {
|
||||
self.stop.as_deref().filter(|_| !self.brush_key_color && self.image_trace_ignore_color.is_none())
|
||||
}
|
||||
|
||||
/// Escape is the tool's while a pick is armed, so it switches back and ends nothing else.
|
||||
fn claims_key(&self, _cx: &ToolContext, key: ToolKey) -> bool {
|
||||
key == ToolKey::Escape && self.picking()
|
||||
@@ -838,6 +852,27 @@ mod tests {
|
||||
]
|
||||
);
|
||||
assert_eq!(t.options(), json!({"stop": null, "brushKeyColor": false}), "one sample only");
|
||||
// Armed for the Live Paint Bucket with its stop no longer selected, a click ends the pick.
|
||||
cx.gradient_stop = None;
|
||||
t.set_option("stop", &json!("livePaintBucket"));
|
||||
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 150.0));
|
||||
assert_eq!(a, vec![Action::SwitchTool("livePaintBucket".into())]);
|
||||
assert_eq!(t.returns_to(), None);
|
||||
// So does a click once the default paint has no such stop (here, a solid fill).
|
||||
cx.gradient_stop = Some(1);
|
||||
assert!(!matches!(cx.paint.fill, Paint::Gradient(_)));
|
||||
t.set_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(t.returns_to(), Some("livePaintBucket"));
|
||||
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 150.0));
|
||||
assert_eq!(a, vec![Action::SwitchTool("livePaintBucket".into())]);
|
||||
// Neither a Key Color pick nor an Image Trace ignored-color pick is a gradient stop's.
|
||||
t.set_option("brushKeyColor", &json!(true));
|
||||
t.set_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(t.returns_to(), None);
|
||||
let mut t = EyedropperTool::default();
|
||||
t.set_option("imageTraceIgnoreColor", &json!({"dialog": "imageTrace"}));
|
||||
t.set_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(t.returns_to(), None);
|
||||
}
|
||||
|
||||
/// #8024: Escape ends a gradient stop's pick and a Key Color pick without sampling and
|
||||
|
||||
@@ -341,10 +341,10 @@ pub(crate) fn current_paints(app: &VectorcraftApp) -> (Paint, Paint) {
|
||||
/// document revision, Appearance panel item and picked gradient mesh points (picking points
|
||||
/// changes no revision).
|
||||
pub(crate) fn mixed_paints(app: &VectorcraftApp, ctx: &egui::Context) -> (bool, bool) {
|
||||
type Key = (u64, u64, Option<usize>, Vec<(NodeId, Vec<usize>)>, &'static str);
|
||||
type Key = (u64, u64, Option<usize>, Vec<(NodeId, Vec<usize>)>, bool);
|
||||
let Some(st) = app.session.active() else { return (false, false) };
|
||||
// The tool too: while the Live Paint Bucket is active the proxies show its colors.
|
||||
let key: Key = (st.uid, st.revision, app.session.appearance_item(), app.session.fill_mesh_points(), app.session.tool_id());
|
||||
// Whether the proxies show the Live Paint Bucket's colors too.
|
||||
let key: Key = (st.uid, st.revision, app.session.appearance_item(), app.session.fill_mesh_points(), app.session.bucket_paints());
|
||||
match pstate::<Option<(Key, (bool, bool))>>(ctx, "proxy-mixed") {
|
||||
Some((k, mixed)) if k == key => mixed,
|
||||
_ => {
|
||||
@@ -373,7 +373,7 @@ pub(crate) fn stroke_mixed(app: &VectorcraftApp, ctx: &egui::Context) -> StrokeM
|
||||
if character::text_editing(app).is_some() {
|
||||
return StrokeMixed { can_align: true, ..Default::default() };
|
||||
}
|
||||
if app.session.tool_id() == "livePaintBucket" {
|
||||
if app.session.bucket_paints() {
|
||||
return StrokeMixed { can_align: true, ..Default::default() };
|
||||
}
|
||||
let Some(st) = app.session.active() else { return StrokeMixed::default() };
|
||||
|
||||
@@ -999,6 +999,12 @@ fn a_mixed_selection_has_no_colour_to_edit() {
|
||||
frame(&mut app, &ctx, vec![], egui::Modifiers::NONE);
|
||||
assert_eq!(crate::panels::mixed_paints(&app, &ctx), (true, false));
|
||||
let _ = ctx.run_ui(Default::default(), |ui| assert_eq!(target(&app, ui).color(), None));
|
||||
// The Eyedropper armed for a stop of the Live Paint Bucket's gradient shows the bucket's color.
|
||||
app.select_tool("eyedropper");
|
||||
assert_eq!(crate::panels::mixed_paints(&app, &ctx), (true, false));
|
||||
app.session.set_tool_option("stop", &json!("livePaintBucket"));
|
||||
assert_eq!(crate::panels::mixed_paints(&app, &ctx), (false, false), "arming the pick recomputes it");
|
||||
app.session.set_tool_option("stop", &serde_json::Value::Null);
|
||||
app.run("paint.setFill", json!({"color": "#0000ff"})).unwrap();
|
||||
assert_eq!(crate::panels::mixed_paints(&app, &ctx), (false, false), "a new revision recomputes it");
|
||||
}
|
||||
|
||||
@@ -708,9 +708,11 @@ fn ramp_row(app: &mut VectorcraftApp, ui: &mut Ui, g: &Gradient, is_grad: bool)
|
||||
}
|
||||
|
||||
/// The stop's eyedropper: the Eyedropper tool samples the next colour clicked on the art into the
|
||||
/// selected stop, then hands back to the current tool.
|
||||
/// selected stop, then hands back to the current tool (or, while a pick is already armed, to the
|
||||
/// tool that armed it).
|
||||
pub(crate) fn stop_eyedropper(app: &mut VectorcraftApp) {
|
||||
let back = app.session.tool_id();
|
||||
let tool = app.session.tool_id();
|
||||
let back = (tool == "eyedropper").then(|| app.session.tool_returns_to()).flatten().unwrap_or_else(|| tool.to_string());
|
||||
app.select_tool("eyedropper");
|
||||
app.session.set_tool_option("stop", &json!(back));
|
||||
}
|
||||
|
||||
@@ -740,6 +740,9 @@ fn the_stop_eyedropper_arms_the_eyedropper_for_the_stop() {
|
||||
assert!(texts.iter().any(|(t, _)| t == "#FFFFFF"), "the stop's colour row: {texts:?}");
|
||||
stop_eyedropper(&mut app);
|
||||
assert_eq!((app.session.tool_id(), app.session.tool_options()), ("eyedropper", json!({"stop": "gradient", "brushKeyColor": false})));
|
||||
// A second click on the eyedropper while the pick is armed still hands back to the Gradient tool.
|
||||
stop_eyedropper(&mut app);
|
||||
assert_eq!(app.session.tool_options()["stop"], "gradient");
|
||||
}
|
||||
|
||||
/// #8024: Escape ends the stop eyedropper's pick and returns to the Gradient tool. The stop keeps
|
||||
|
||||
@@ -514,7 +514,7 @@ pub(crate) const PROFILE_DROPDOWN_WIDTH: f32 = 100.0;
|
||||
/// member's.
|
||||
pub(crate) fn brush_keeps_size(app: &VectorcraftApp, ctx: &egui::Context, shown: Option<&StrokeLayer>) -> Option<bool> {
|
||||
let st = app.session.active()?;
|
||||
let bucket = app.session.tool_id() == "livePaintBucket";
|
||||
let bucket = app.session.bucket_paints();
|
||||
if bucket || (st.selection.objects.is_empty() && st.selection.subjects().is_empty()) {
|
||||
let s = shown?;
|
||||
let name = s.brush.as_deref()?;
|
||||
|
||||
+7
-1
@@ -4811,7 +4811,13 @@ already walks Image Trace. Short agent entry points:
|
||||
Appearance panel's active row changes. The Fill and Stroke proxies (`paint.proxies`) show those colors, never mixed, the Stroke panel shows
|
||||
that stroke as it does with nothing selected, and with New Art Has Basic Appearance off the selection's appearance
|
||||
does not replace them after a command. They are also the fill and stroke for new art, so another tool chosen
|
||||
afterwards keeps them until a command or a new selection changes them.
|
||||
afterwards keeps them until a command or a new selection changes them. All of this also holds while a Cmd/Ctrl-click
|
||||
with the bucket uses the Selection tool, and while the Eyedropper samples into a stop of the bucket's gradient for
|
||||
the Gradient panel's eyedropper (`tool.select {tool: "eyedropper"}`, then
|
||||
`tool.setOption {tool: "eyedropper", values: {stop: "livePaintBucket"}}`): the stop
|
||||
stays selected, and the click's `paint.sampleColor {color, stop}` recolors that stop of the bucket's gradient and
|
||||
leaves the selection's paint as it is. Once that stop is no longer selected (a Cmd/Ctrl-click selected another
|
||||
object), the next click ends the pick without sampling and switches back to the bucket.
|
||||
With the Live Paint Bucket selected and no drag in progress, Left and Right without Shift, Alt or Cmd/Ctrl (which
|
||||
keep their shortcuts) run `paint.setFill {swatch, ids: []}` (or
|
||||
`paint.setStroke` when the Stroke proxy is in front) with the color swatch before or after the active paint in the
|
||||
|
||||
Reference in new issue
Block a user