diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index dbeca76c63..ef5a95cadd 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -1706,9 +1706,9 @@ impl SelectionTool { if let Some(a) = release_guide_at(cx, p, m) { return vec![a]; } - // A selected blend's widget takes a plain double-click: the artwork under it is neither - // edited nor isolated. - if blendwidget::over_widget(cx, p) { + // A selected blend's widget and a selected polygon's side widget take a plain double-click: + // the artwork under them is neither edited nor isolated. + if blendwidget::over_widget(cx, p) || sidewidget::over_widget(cx, p) { return vec![]; } if crate::rulerguide::guide_at(cx, p).is_some() { diff --git a/crates/tools/src/sidewidget.rs b/crates/tools/src/sidewidget.rs index 75b5504cff..90ea127829 100644 --- a/crates/tools/src/sidewidget.rs +++ b/crates/tools/src/sidewidget.rs @@ -401,4 +401,23 @@ mod tests { vec![Action::Preview("object.setLiveShape".into(), json!({ "id": id.0, "sides": 7 })), Action::Commit] ); } + + /// A double-click on the widget with the Selection tool does nothing to the artwork under it. + #[test] + fn a_double_click_on_the_widget_leaves_the_artwork_under_it_alone() { + let (mut d, _, s) = polygon_doc(5, Affine::translate((300.0, 300.0))); + let p = paint(); + let (w, _) = SideWidget::for_tool(&cx(&d, &s, &p)).unwrap(); + let l = d.layers[0].id; + let under = d.alloc_id(); + let at = d.layers[0].children().map_or(0, |c| c.len()); + let r = vectorcraft_geom::Rect::new(w.at.x - 20.0, w.at.y - 20.0, w.at.x + 20.0, w.at.y + 20.0); + d.insert(Some(l), at, Node::path(under, vectorcraft_geom::shapes::rectangle(r), Appearance::default_art())).unwrap(); + let c = cx(&d, &s, &p); + assert!(over_widget(&c, w.at)); + let mut t = SelectionTool::default(); + assert!(t.pointer(&c, &ev(PointerKind::DoubleClick, w.at)).is_empty()); + // Beside the widget, the double-click reaches the artwork. + assert!(!t.pointer(&c, &ev(PointerKind::DoubleClick, w.at + vectorcraft_geom::Vec2::new(0.0, 15.0))).is_empty()); + } }