mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-19 17:05:55 +01:00
Control bar: Hide Shape Widgets hides the selected live shapes' widgets
With the Rectangle, Rounded Rectangle, Ellipse, Polygon or Star tool, the
Control bar starts the tool's options with a Hide Shape Widgets button,
which reads Show Shape Widgets while the widgets are hidden
(`view.shapeWidgets {on?}`). Hidden, a selected live rectangle's or
polygon's corner widgets, a live ellipse's pie widgets and a live
polygon's side widget are not drawn, and the Selection tool and the shape
tools do not answer a press, a double-click or the cursor on them. The
bounding box and its handles, the center point and Direct Selection's
corner widgets (View › Hide Corner Widget) stay as they are.
The setting is on by default, saved with the interface state and kept
across tool switches; it adds no undo step. Its scope beyond the shape
tools, its default and what it leaves shown are VectorCraft's own rules.
The help page describes the button:
https://helpx.adobe.com/illustrator/using/live-shapes.html
This commit is contained in:
1 parent
4e3175bbbf
commit
0904472ffc
51 files changed
+389
-16
No files matched your search
@@ -35,6 +35,9 @@ pub struct ViewInfo {
|
||||
pub snap_to_glyph: bool,
|
||||
/// View → Show Corner Widget.
|
||||
pub corner_widgets: bool,
|
||||
/// The Control bar's Show Shape Widgets: selected live shapes show their corner, pie and side
|
||||
/// widgets to the Selection tool and the shape tools.
|
||||
pub shape_widgets: bool,
|
||||
/// The document window (none headless): screen-fixed widgets sit in it.
|
||||
pub screen: Option<vectorcraft_tools::ScreenFrame>,
|
||||
/// The view's active artboard (an index): artboard rulers measure from it.
|
||||
@@ -55,6 +58,7 @@ impl Default for ViewInfo {
|
||||
snap_to_point: true,
|
||||
snap_to_glyph: false,
|
||||
corner_widgets: true,
|
||||
shape_widgets: true,
|
||||
screen: None,
|
||||
artboard: 0,
|
||||
}
|
||||
@@ -381,6 +385,7 @@ impl Session {
|
||||
snap_to_glyph: view.snap_to_glyph && smart_guides && !view.snap_to_grid,
|
||||
glyph_snap: self.prefs.glyph_snap,
|
||||
corner_widgets: view.corner_widgets,
|
||||
shape_widgets: view.shape_widgets,
|
||||
fill_active: self.fill_active,
|
||||
gradient_stop: self.selected_stop(),
|
||||
appearance_item: self.appearance_item(),
|
||||
|
||||
@@ -201,6 +201,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
("view.pixelPreview", "Pixel Preview", "Cmd+Alt+Y", "{}"),
|
||||
("view.trimView", "Trim View", "", "{} toggle: hide everything outside the artboards"),
|
||||
("view.cornerWidget", "Hide Corner Widget", "", "{} toggle the live corner widgets"),
|
||||
(
|
||||
"view.shapeWidgets",
|
||||
"Hide Shape Widgets",
|
||||
"",
|
||||
"{on?: bool} hide or show selected live shapes' corner, pie and side widgets for the Selection tool and the shape tools (the shape tools' Control bar button); without `on` it toggles; returns the new state. Direct Selection's corner widgets follow view.cornerWidget alone",
|
||||
),
|
||||
(
|
||||
"view.snapToPixel",
|
||||
"Snap to Pixel",
|
||||
|
||||
@@ -222,6 +222,10 @@ pub struct ToolContext<'a> {
|
||||
pub glyph_snap: GlyphSnap,
|
||||
/// View → Show Corner Widget: paths show draggable Live Corners widgets in their corners.
|
||||
pub corner_widgets: bool,
|
||||
/// The Control bar's Show Shape Widgets: selected live shapes show their corner, pie and side
|
||||
/// widgets to the Selection tool and the shape tools. Direct Selection's corner widgets follow
|
||||
/// [`Self::corner_widgets`] alone.
|
||||
pub shape_widgets: bool,
|
||||
/// Which paint proxy is in front (true = Fill): the one the Gradient tool edits.
|
||||
pub fill_active: bool,
|
||||
/// The selected gradient stop (`gradient.selectStop`), marked on the gradient annotator.
|
||||
|
||||
@@ -132,9 +132,11 @@ impl CornerWidgets {
|
||||
Self::of(doc, selection, zoom, any_path)?.within_angle(max_angle)
|
||||
}
|
||||
|
||||
/// The widgets the active tool can drag (Direct Selection: `any_path`).
|
||||
/// The widgets the active tool can drag (Direct Selection: `any_path`). The live shapes' widgets
|
||||
/// of the other tools also need Show Shape Widgets.
|
||||
pub fn for_tool(cx: &ToolContext, any_path: bool) -> Option<Self> {
|
||||
Self::showing(cx.doc, cx.selection, cx.zoom, any_path, cx.corner_widgets, cx.corner_widget_max_angle)
|
||||
let on = cx.corner_widgets && (any_path || cx.shape_widgets);
|
||||
Self::showing(cx.doc, cx.selection, cx.zoom, any_path, on, cx.corner_widget_max_angle)
|
||||
}
|
||||
|
||||
/// The centres of the widgets that show.
|
||||
|
||||
@@ -406,6 +406,28 @@ fn widgets_off_or_elsewhere_keep_the_tools_behaviour() {
|
||||
assert_eq!(a[0], Action::Begin("Move".into()));
|
||||
}
|
||||
|
||||
/// With Show Shape Widgets off, a live rectangle's widgets hide from the Selection tool and the
|
||||
/// shape tools, and a drag from one moves the object; Direct Selection still shows and drags them
|
||||
/// while Show Corner Widget is on.
|
||||
#[test]
|
||||
fn hidden_shape_widgets_leave_direct_selections_corners() {
|
||||
let (d, id) = live_rect(0.0, Affine::translate((100.0, 100.0)));
|
||||
let s = selected(id);
|
||||
let p = paint();
|
||||
let c = ToolContext { shape_widgets: false, ..cx(&d, &s, &p) };
|
||||
let at = Point::new(110.0, 110.0);
|
||||
assert!(CornerWidgets::for_tool(&c, false).is_none());
|
||||
assert!(!over_widget(&c, at, false) && double_click(&c, at, false).is_none());
|
||||
assert!(CornerWidgets::for_tool(&c, true).is_some_and(|w| w.visible().count() == 4));
|
||||
assert!(over_widget(&c, at, true));
|
||||
let mut t = crate::create("selection");
|
||||
t.pointer(&c, &PointerEvent::new(PointerKind::Down, at.x, at.y));
|
||||
assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 130.0, 110.0))[0], Action::Begin("Move".into()));
|
||||
// Show Corner Widget off hides Direct Selection's too.
|
||||
let off = ToolContext { corner_widgets: false, ..c };
|
||||
assert!(CornerWidgets::for_tool(&off, true).is_none());
|
||||
}
|
||||
|
||||
/// #511: Direct Selection shows a widget in each of a star's ten corners (the Selection tool
|
||||
/// none: a star isn't a live shape); dragging a tip's inward rounds them all as one step.
|
||||
#[test]
|
||||
|
||||
@@ -610,6 +610,7 @@ pub(crate) mod testutil {
|
||||
snap_to_glyph: false,
|
||||
glyph_snap: GlyphSnap::default(),
|
||||
corner_widgets: true,
|
||||
shape_widgets: true,
|
||||
fill_active: true,
|
||||
gradient_stop: None,
|
||||
appearance_item: None,
|
||||
|
||||
@@ -115,9 +115,9 @@ impl PieWidget {
|
||||
out
|
||||
}
|
||||
|
||||
/// The widgets the Selection tool can drag (its bounding box showing).
|
||||
/// The widgets the Selection tool can drag (its bounding box and the shape widgets showing).
|
||||
pub fn for_tool(cx: &ToolContext) -> Vec<Self> {
|
||||
if !cx.show_bbox {
|
||||
if !cx.show_bbox || !cx.shape_widgets {
|
||||
return vec![];
|
||||
}
|
||||
Self::of(cx.doc, cx.selection, cx.zoom)
|
||||
@@ -248,9 +248,14 @@ mod tests {
|
||||
let w = PieWidget::of(&d, &s, 1.0);
|
||||
assert!(near(w[0].on, Point::new(200.0, 100.0)) && near(w[0].at, Point::new(200.0, 88.0)), "{w:?}");
|
||||
assert!(near(w[1].at, Point::new(312.0, 150.0)), "{w:?}");
|
||||
// No widgets with the bounding box hidden, with nothing selected, or on another shape.
|
||||
// No widgets with the bounding box or the shape widgets hidden, with nothing selected, or on
|
||||
// another shape.
|
||||
let p = paint();
|
||||
assert_eq!(PieWidget::for_tool(&cx(&d, &s, &p)).len(), 2);
|
||||
assert!(PieWidget::for_tool(&ToolContext { show_bbox: false, ..cx(&d, &s, &p) }).is_empty());
|
||||
let hidden = ToolContext { shape_widgets: false, ..cx(&d, &s, &p) };
|
||||
assert!(PieWidget::for_tool(&hidden).is_empty());
|
||||
assert!(!over_widget(&hidden, w[1].at) && double_click(&hidden, w[1].at).is_none());
|
||||
assert!(PieWidget::of(&d, &Selection::default(), 1.0).is_empty());
|
||||
let (d, id) = doc_with_rect();
|
||||
let mut s = Selection::default();
|
||||
|
||||
@@ -1148,6 +1148,64 @@ fn a_shape_tool_drags_a_polygons_side_widget() {
|
||||
assert!(matches!(a.last(), Some(Action::Preview(cmd, _)) if cmd == "shape.line"), "{a:?}");
|
||||
}
|
||||
|
||||
/// With Show Shape Widgets off, the shape tools neither show nor take a selected live rectangle's
|
||||
/// corner widget, a live ellipse's pie widget or a live polygon's side widget: the pointer there is
|
||||
/// the tool's own, a drag from there draws a new shape and a double-click asks for nothing. With it
|
||||
/// on, the same drag adjusts the widget.
|
||||
#[test]
|
||||
fn hidden_shape_widgets_do_not_answer_a_shape_tool() {
|
||||
use vectorcraft_doc::{Appearance, LiveShape, Node, NodeKind};
|
||||
let live = |shape: LiveShape| {
|
||||
let mut d = vectorcraft_doc::Document::new(500.0, 500.0);
|
||||
let (l, id) = (d.layers[0].id, d.alloc_id());
|
||||
let mut n = Node::path(id, shape.to_path(), Appearance::default_art());
|
||||
if let NodeKind::Path { live: slot, .. } = &mut n.kind {
|
||||
*slot = Some(Box::new(shape));
|
||||
}
|
||||
d.insert(Some(l), 0, n).unwrap();
|
||||
let mut s = Selection::default();
|
||||
s.add(id);
|
||||
(d, s)
|
||||
};
|
||||
let xf = Affine::translate((100.0, 100.0));
|
||||
let p = paint();
|
||||
let rect = live(LiveShape::Rectangle { w: 100.0, h: 100.0, radii: [0.0; 4], kinds: Default::default(), radii_relative: false, xf });
|
||||
let ellipse = live(LiveShape::Ellipse { w: 200.0, h: 100.0, pie: (0.0, 360.0), xf });
|
||||
let polygon = live(LiveShape::Polygon {
|
||||
radius: 80.0,
|
||||
sides: 5,
|
||||
xf: Affine::translate((250.0, 250.0)),
|
||||
radii: vec![],
|
||||
kinds: vec![],
|
||||
radii_relative: false,
|
||||
});
|
||||
let side = crate::sidewidget::SideWidget::for_tool(&cx(&polygon.0, &polygon.1, &p)).expect("a side widget").0.at;
|
||||
// The corner widget 10 px inside the box's top-left corner, the pie widgets 12 px right of the
|
||||
// ellipse, and the side widget.
|
||||
let (far, m) = (Point::new(480.0, 480.0), Mods::default());
|
||||
for ((d, s), at) in [(&rect, Point::new(110.0, 110.0)), (&ellipse, Point::new(312.0, 150.0)), (&polygon, side)] {
|
||||
let shown = cx(d, s, &p);
|
||||
let hidden = ToolContext { shape_widgets: false, ..cx(d, s, &p) };
|
||||
let drag = |t: &mut ShapeTool, c: &ToolContext| {
|
||||
t.pointer(c, &PointerEvent::new(PointerKind::Down, at.x, at.y));
|
||||
let a = t.pointer(c, &PointerEvent::new(PointerKind::Drag, at.x + 20.0, at.y + 25.0));
|
||||
t.pointer(c, &PointerEvent::new(PointerKind::Up, at.x + 20.0, at.y + 25.0));
|
||||
a
|
||||
};
|
||||
for id in ["rectangle", "roundedRectangle", "ellipse", "polygon", "star"] {
|
||||
let mut t = ShapeTool::new(id);
|
||||
assert_ne!(t.cursor(&shown, at, m), t.cursor(&shown, far, m), "{id} at {at:?}");
|
||||
assert_eq!(t.cursor(&hidden, at, m), t.cursor(&hidden, far, m), "{id} at {at:?}");
|
||||
let a = drag(&mut t, &shown);
|
||||
assert!(matches!(a.last(), Some(Action::Preview(cmd, _)) if cmd == "object.setLiveShape"), "{id} at {at:?}: {a:?}");
|
||||
let a = drag(&mut t, &hidden);
|
||||
assert!(matches!(a.last(), Some(Action::Preview(cmd, _)) if cmd.starts_with("shape.")), "{id} at {at:?}: {a:?}");
|
||||
assert!(t.pointer(&hidden, &PointerEvent::new(PointerKind::DoubleClick, at.x, at.y)).is_empty(), "{id} at {at:?}");
|
||||
assert!(!t.busy(), "{id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A double-click on a corner widget of a selected live shape, with a shape tool that shows the
|
||||
/// widgets, asks for the Transform panel and nothing else: neither click draws, edits or begins an
|
||||
/// undo step, and the tool stays idle. Line Segment, a plain path, a pie widget, a hidden or
|
||||
|
||||
@@ -54,10 +54,10 @@ impl SideWidget {
|
||||
(at.x.is_finite() && at.y.is_finite()).then_some(Self { id, at, sides: *sides })
|
||||
}
|
||||
|
||||
/// The widget the tool can drag (its bounding box showing).
|
||||
/// The widget the tool can drag (its bounding box and the shape widgets showing).
|
||||
pub fn for_tool(cx: &ToolContext) -> Option<(Self, OrientedBox)> {
|
||||
// One object or none: a larger selection's box is not measured.
|
||||
if cx.selection.objects.len() != 1 {
|
||||
if !cx.shape_widgets || cx.selection.objects.len() != 1 {
|
||||
return None;
|
||||
}
|
||||
let bx = shown_box(cx)?;
|
||||
@@ -226,8 +226,12 @@ mod tests {
|
||||
assert!(w.at.distance(want(1.0)) < 1e-9, "{w:?} {bx:?}");
|
||||
assert!(SideWidget::of(&d, &s, &bx, 4.0).unwrap().at.distance(want(4.0)) < 1e-9);
|
||||
assert!(over_widget(&c, w.at) && !over_widget(&c, w.at + vectorcraft_geom::Vec2::new(0.0, 8.0)));
|
||||
// Hidden with the bounding box hidden, with an anchor or segment selected, or with no zoom.
|
||||
// Hidden with the bounding box or the shape widgets hidden, with an anchor or segment
|
||||
// selected, or with no zoom.
|
||||
assert!(SideWidget::for_tool(&ToolContext { show_bbox: false, ..cx(&d, &s, &p) }).is_none());
|
||||
let hidden = ToolContext { shape_widgets: false, ..cx(&d, &s, &p) };
|
||||
assert!(SideWidget::for_tool(&hidden).is_none() && !over_widget(&hidden, w.at));
|
||||
assert!(SideDrag::hit(&hidden, &PointerEvent::new(PointerKind::Down, w.at.x, w.at.y)).is_none());
|
||||
let mut part = s.clone();
|
||||
part.segments.insert(id, Default::default());
|
||||
assert!(SideWidget::of(&d, &part, &bx, 1.0).is_none());
|
||||
|
||||
@@ -48,6 +48,12 @@ pub fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui, reserve: f32) -> bool
|
||||
}
|
||||
fit.separator(ui);
|
||||
}
|
||||
// The tools with live shape widgets: Hide/Show Shape Widgets first, so a narrow bar leaves out
|
||||
// the shape's fields before it.
|
||||
if vectorcraft_tools::shape::shows_shape_widgets(&tool) {
|
||||
shape_widgets_button(app, ui, fit);
|
||||
fit.separator(ui);
|
||||
}
|
||||
|
||||
match active_shape.as_str() {
|
||||
"ellipse" => draw_ellipse_controls(app, ui, fit, &opts, selected_custom),
|
||||
@@ -60,6 +66,15 @@ pub fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui, reserve: f32) -> bool
|
||||
true
|
||||
}
|
||||
|
||||
/// Hide Shape Widgets, or Show Shape Widgets while they are hidden (`view.shapeWidgets`), at least 52
|
||||
/// points wide and wider for a longer translated label, while `fit` has room for it.
|
||||
fn shape_widgets_button(app: &mut VectorcraftApp, ui: &mut Ui, fit: &mut Fit) {
|
||||
let label = if app.ui.view.shape_widgets { tl!("Hide Shape Widgets") } else { tl!("Show Shape Widgets") };
|
||||
if fit.room(ui, &[widgets::flat_button_fit_width(ui, label, 52.0)]) && widgets::flat_button_fit(ui, label, 52.0).clicked() {
|
||||
app.run("view.shapeWidgets", json!({})).ok();
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `fit` has room in the row `ui` for the label `text` with a field `field` wide after it.
|
||||
fn field_room(ui: &Ui, fit: &mut Fit, text: &egui::RichText, field: f32) -> bool {
|
||||
fit.room(ui, &[widgets::text_width(ui, text.clone()), field])
|
||||
|
||||
@@ -132,6 +132,7 @@ impl VectorcraftApp {
|
||||
snap_to_point: self.ui.view.snap_to_point,
|
||||
snap_to_glyph: self.ui.view.snap_to_glyph,
|
||||
corner_widgets: self.ui.view.corner_widgets && self.ui.view.edges,
|
||||
shape_widgets: self.ui.view.shape_widgets,
|
||||
screen: self.screen_frame(),
|
||||
artboard: self.view().map_or(0, |v| v.artboard),
|
||||
}
|
||||
|
||||
@@ -216,15 +216,16 @@ pub(super) fn selection_overlay(app: &mut VectorcraftApp, p: &egui::Painter, xf:
|
||||
anchor_square(p, xf.to_screen(a.p), color, false, anchor(direct));
|
||||
}
|
||||
}
|
||||
// Live Corners widgets (Selection and the shape tools on a live rectangle or polygon, Direct
|
||||
// Selection on any path).
|
||||
// Live Corners widgets (Selection and the shape tools on a live rectangle or polygon while Show
|
||||
// Shape Widgets is on, Direct Selection on any path).
|
||||
let shape_widgets = app.ui.view.shape_widgets;
|
||||
if (matches!(tool, "selection" | "directSelection") || (shape_tool && !drawing))
|
||||
&& let Some(w) = vectorcraft_tools::corners::CornerWidgets::showing(
|
||||
&st.doc,
|
||||
&st.selection,
|
||||
xf.zoom,
|
||||
tool == "directSelection",
|
||||
app.ui.view.corner_widgets,
|
||||
app.ui.view.corner_widgets && (tool == "directSelection" || shape_widgets),
|
||||
app.session.prefs.hide_corner_widget_above,
|
||||
)
|
||||
{
|
||||
@@ -256,16 +257,21 @@ pub(super) fn selection_overlay(app: &mut VectorcraftApp, p: &egui::Painter, xf:
|
||||
p.circle_stroke(c, r, Stroke::new(1.0, color));
|
||||
}
|
||||
// A live polygon's side widget: a diamond beside the middle of the box's right side, drawn
|
||||
// only while the box is drawn (the box hides during a turn and during a drag of the widget).
|
||||
if !drawing_boxed && let Some(w) = vectorcraft_tools::sidewidget::SideWidget::of(&st.doc, &st.selection, &b, xf.zoom) {
|
||||
// only while the box and the shape widgets are drawn (the box hides during a turn and during
|
||||
// a drag of the widget).
|
||||
if !drawing_boxed
|
||||
&& shape_widgets
|
||||
&& let Some(w) = vectorcraft_tools::sidewidget::SideWidget::of(&st.doc, &st.selection, &b, xf.zoom)
|
||||
{
|
||||
let (c, r) = (xf.to_screen(w.at), vectorcraft_tools::sidewidget::RADIUS_PX);
|
||||
let diamond = vec![c + vec2(0.0, -r), c + vec2(r, 0.0), c + vec2(0.0, r), c + vec2(-r, 0.0)];
|
||||
p.add(Shape::convex_polygon(diamond, Color32::WHITE, Stroke::new(1.0, color)));
|
||||
}
|
||||
}
|
||||
// Pie widgets (Selection tool, with View › Show Bounding Box, on live ellipses): each joined
|
||||
// by a line to the outline's point at its angle. They stay while one is dragged.
|
||||
if (tool == "selection" || (shape_tool && !drawing)) && app.ui.view.bounding_box {
|
||||
// Pie widgets (Selection tool, with View › Show Bounding Box and Show Shape Widgets, on live
|
||||
// ellipses): each joined by a line to the outline's point at its angle. They stay while one is
|
||||
// dragged.
|
||||
if (tool == "selection" || (shape_tool && !drawing)) && app.ui.view.bounding_box && shape_widgets {
|
||||
for w in vectorcraft_tools::pie::PieWidget::of(&st.doc, &st.selection, xf.zoom) {
|
||||
let (on, c, r, color) = (xf.to_screen(w.on), xf.to_screen(w.at), vectorcraft_tools::pie::RADIUS_PX, c32(st.doc.layer_color(w.id)));
|
||||
p.line_segment([on, c], Stroke::new(1.0, color));
|
||||
|
||||
@@ -6593,6 +6593,75 @@ fn a_selected_polygon_shows_its_side_widget() {
|
||||
assert_eq!(widgets(&mut app), 0, "an ellipse has none");
|
||||
}
|
||||
|
||||
/// Hide Shape Widgets (`view.shapeWidgets`) hides a selected live rectangle's and polygon's corner
|
||||
/// widgets, a polygon's side widget and an ellipse's pie widgets with the Selection tool and the
|
||||
/// shape tools, and leaves the bounding box and its eight handles; the Selection tool then shows no
|
||||
/// corner cursor over a hidden widget. Direct Selection keeps its corner widgets, which follow View ›
|
||||
/// Hide Corner Widget alone. Show Shape Widgets brings them back, neither adds an undo step, and a
|
||||
/// tool switch keeps the setting.
|
||||
#[test]
|
||||
fn hidden_shape_widgets_leave_the_bounding_box() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap();
|
||||
let id = |v: serde_json::Value| v["id"].as_u64().unwrap();
|
||||
let rect = id(app.session.execute("shape.rectangle", &json!({"x": 20, "y": 20, "width": 80, "height": 80})).unwrap());
|
||||
let polygon = id(app.session.execute("shape.polygon", &json!({"cx": 200, "cy": 150, "radius": 50, "sides": 5})).unwrap());
|
||||
let ellipse = id(app.session.execute("shape.ellipse", &json!({"x": 280, "y": 100, "width": 100, "height": 60})).unwrap());
|
||||
let ctx = egui::Context::default();
|
||||
let side = 2.0 * vectorcraft_tools::sidewidget::RADIUS_PX;
|
||||
let diamond = |ps: &egui::epaint::PathShape| {
|
||||
let span = |f: fn(&egui::Pos2) -> f32| {
|
||||
let v: Vec<f32> = ps.points.iter().map(f).collect();
|
||||
v.iter().copied().fold(f32::MIN, f32::max) - v.iter().copied().fold(f32::MAX, f32::min)
|
||||
};
|
||||
ps.closed && ps.points.len() == 4 && ps.fill == Color32::WHITE && (span(|p| p.x) - side).abs() < 0.01 && (span(|p| p.y) - side).abs() < 0.01
|
||||
};
|
||||
// The selection's corner, pie and side widgets drawn, and the bounding box's handles.
|
||||
let drawn = |app: &mut VectorcraftApp, id: u64| {
|
||||
app.session.execute("select.set", &json!({"ids": [id]})).unwrap();
|
||||
let (_, handles) = bounding_box_drawn(app, &ctx);
|
||||
let all = shapes(app, &ctx);
|
||||
let circles = |r: f32| all.iter().filter(|s| matches!(s, Shape::Circle(c) if c.radius == r && c.fill == Color32::WHITE)).count();
|
||||
let diamonds = all.iter().filter(|s| matches!(s, Shape::Path(ps) if diamond(ps))).count();
|
||||
(circles(3.0), circles(vectorcraft_tools::pie::RADIUS_PX), diamonds, handles)
|
||||
};
|
||||
let steps = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len();
|
||||
for tool in ["selection", "polygon", "rectangle"] {
|
||||
app.select_tool(tool);
|
||||
assert_eq!(drawn(&mut app, rect), (4, 0, 0, 8), "{tool}");
|
||||
assert_eq!(drawn(&mut app, polygon), (5, 0, 1, 8), "{tool}");
|
||||
assert_eq!(drawn(&mut app, ellipse), (0, 2, 0, 8), "{tool}");
|
||||
let before = steps(&app);
|
||||
assert_eq!(app.run("view.shapeWidgets", json!({})).unwrap(), json!(false));
|
||||
assert_eq!(steps(&app), before, "{tool}: the setting adds no undo step");
|
||||
assert_eq!(drawn(&mut app, rect), (0, 0, 0, 8), "{tool}");
|
||||
assert_eq!(drawn(&mut app, polygon), (0, 0, 0, 8), "{tool}");
|
||||
assert_eq!(drawn(&mut app, ellipse), (0, 0, 0, 8), "{tool}");
|
||||
assert_eq!(app.run("view.shapeWidgets", json!({})).unwrap(), json!(true));
|
||||
}
|
||||
// Direct Selection: the corner widgets stay until View › Hide Corner Widget.
|
||||
app.run("view.shapeWidgets", json!({"on": false})).unwrap();
|
||||
app.select_tool("directSelection");
|
||||
assert_eq!(drawn(&mut app, rect).0, 4);
|
||||
app.run("view.cornerWidget", json!({})).unwrap();
|
||||
assert_eq!(drawn(&mut app, rect).0, 0);
|
||||
app.run("view.cornerWidget", json!({})).unwrap();
|
||||
// The Selection tool shows no corner cursor over a hidden widget, and the tool switches kept the
|
||||
// setting.
|
||||
app.select_tool("selection");
|
||||
assert!(!app.ui.view.shape_widgets);
|
||||
drawn(&mut app, rect);
|
||||
let at = {
|
||||
let st = app.session.active().unwrap();
|
||||
vectorcraft_tools::corners::CornerWidgets::of(&st.doc, &st.selection, app.view_info().zoom, false).unwrap().visible().next().unwrap()
|
||||
};
|
||||
let view = app.view_info();
|
||||
assert_ne!(app.session.cursor(at, Mods::default(), view), Cursor::CornerRadius);
|
||||
app.run("view.shapeWidgets", json!({"on": true})).unwrap();
|
||||
let view = app.view_info();
|
||||
assert_eq!(app.session.cursor(at, Mods::default(), view), Cursor::CornerRadius);
|
||||
}
|
||||
|
||||
/// A selected Objects on Path group shows its Rotate All widget with the Selection and Objects on
|
||||
/// Path tools.
|
||||
#[test]
|
||||
|
||||
@@ -2459,6 +2459,71 @@ fn full_screen_modes_fill_the_screen_and_normal_mode_restores_the_window() {
|
||||
assert!(sent(&mut app, true).is_empty(), "still full screen, as the user had it");
|
||||
}
|
||||
|
||||
/// The Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools show Hide Shape Widgets in the
|
||||
/// Control bar, with a selection and without one; a click hides the widgets and the button then reads
|
||||
/// Show Shape Widgets, and a second click shows them again. The button comes before the shape's own
|
||||
/// fields, so a window too narrow for the Polygon tool's Reset button still shows it. The Selection,
|
||||
/// Spiral and Line Segment tools show no such button.
|
||||
#[test]
|
||||
fn the_shape_tools_control_bar_hides_and_shows_the_shape_widgets() {
|
||||
struct RestoreLanguage(crate::i18n::Lang);
|
||||
impl Drop for RestoreLanguage {
|
||||
fn drop(&mut self) {
|
||||
crate::i18n::set_current(self.0);
|
||||
}
|
||||
}
|
||||
let _language = RestoreLanguage(crate::i18n::current());
|
||||
crate::i18n::set_current(crate::i18n::Lang::EN);
|
||||
let mut app = crate::VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
ctx.enable_accesskit();
|
||||
crate::theme::install_fonts(&ctx);
|
||||
let frame_in = |app: &mut crate::VectorcraftApp, width: f32, events: Vec<egui::Event>| {
|
||||
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(width, 400.0));
|
||||
let mut out = ctx.run_ui(egui::RawInput { events, screen_rect: Some(screen), ..Default::default() }, |ui| super::control_bar(app, ui));
|
||||
out.textures_delta.clear();
|
||||
out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default()
|
||||
};
|
||||
let frame = |app: &mut crate::VectorcraftApp, events: Vec<egui::Event>| frame_in(app, 1600.0, events);
|
||||
let button_in = |app: &mut crate::VectorcraftApp, width: f32, name: &str| {
|
||||
frame_in(app, width, vec![]);
|
||||
frame_in(app, width, vec![]).into_iter().find(|(_, n)| n.label() == Some(name)).and_then(|(_, n)| n.bounds())
|
||||
};
|
||||
let button = |app: &mut crate::VectorcraftApp, name: &str| button_in(app, 1600.0, name);
|
||||
let click = |app: &mut crate::VectorcraftApp, name: &str| {
|
||||
let b = button(app, name).unwrap_or_else(|| panic!("no {name}"));
|
||||
let at = egui::pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32);
|
||||
let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
|
||||
frame(app, vec![egui::Event::PointerMoved(at), press(true)]);
|
||||
frame(app, vec![press(false)]);
|
||||
};
|
||||
let id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 30, "height": 20})).unwrap()["id"].clone();
|
||||
for ids in [json!([id]), json!([])] {
|
||||
app.run("select.set", json!({ "ids": ids })).unwrap();
|
||||
for tool in ["rectangle", "roundedRectangle", "ellipse", "polygon", "star"] {
|
||||
app.select_tool(tool);
|
||||
assert!(button(&mut app, "Hide Shape Widgets").is_some(), "{tool} {ids}");
|
||||
click(&mut app, "Hide Shape Widgets");
|
||||
assert!(!app.ui.view.shape_widgets, "{tool} {ids}");
|
||||
assert!(button(&mut app, "Hide Shape Widgets").is_none(), "{tool} {ids}");
|
||||
click(&mut app, "Show Shape Widgets");
|
||||
assert!(app.ui.view.shape_widgets, "{tool} {ids}");
|
||||
}
|
||||
}
|
||||
// Narrower and narrower: once the Polygon tool's Reset button is left out, the toggle still shows.
|
||||
app.select_tool("polygon");
|
||||
let reset = button(&mut app, "Reset").expect("Reset in a wide window");
|
||||
let toggle = button(&mut app, "Hide Shape Widgets").expect("the toggle in a wide window");
|
||||
assert!(toggle.x1 <= reset.x0, "the toggle comes first: {toggle:?} {reset:?}");
|
||||
let narrow = (400..1600).step_by(10).rev().map(|w| w as f32).find(|w| button_in(&mut app, *w, "Reset").is_none()).expect("a width without Reset");
|
||||
assert!(button_in(&mut app, narrow, "Hide Shape Widgets").is_some(), "{narrow} wide");
|
||||
for tool in ["selection", "spiral", "lineSegment"] {
|
||||
app.select_tool(tool);
|
||||
assert!(button(&mut app, "Hide Shape Widgets").is_none(), "{tool}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Snapping quick access includes the existing glyph and alignment settings. Pointer clicks use
|
||||
/// their commands, and reopening reads the same state as View and Preferences (#6164).
|
||||
#[test]
|
||||
|
||||
@@ -1525,6 +1525,8 @@ font-technology Variable Променливи
|
||||
More Options Още опции
|
||||
Show Properties Panel Показване на панела със свойства
|
||||
Hide Corner Widget Скриване на приспособлението за ъгли
|
||||
Hide Shape Widgets Скриване на приспособленията за фигури
|
||||
Show Shape Widgets Показване на приспособленията за фигури
|
||||
Hide Corner Widget for angles greater than Скриване на приспособлението за ъгли за ъгли, по-големи от
|
||||
Hide Edges Скриване на ръбовете
|
||||
Hide Gradient Annotator Скриване на анотатора за градиент
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -641,6 +641,8 @@
|
||||
Hide Gradient Annotator Sakrij anotator gradijenta
|
||||
Show Gradient Annotator Prikaži anotator gradijenta
|
||||
Hide Corner Widget Sakrij widget ugla
|
||||
Hide Shape Widgets Sakrij widgete oblika
|
||||
Show Shape Widgets Prikaži widgete oblika
|
||||
Show Corner Widget Prikaži widget ugla
|
||||
Guides Vodilice
|
||||
Hide Guides Sakrij vodilice
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -4375,6 +4375,8 @@ digits Malayalam Malaiàlam
|
||||
Show Color Groups Mostra els grups de colors
|
||||
Show Color Swatches Mostra les mostres de color
|
||||
Show Corner Widget Mostra el giny de cantonada
|
||||
Hide Shape Widgets Amaga els ginys de forma
|
||||
Show Shape Widgets Mostra els ginys de forma
|
||||
Show Cross Hairs Mostra la retícula
|
||||
Show East Asian Options Mostra les opcions d’Àsia oriental
|
||||
Show Edges Mostra les vores
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -654,6 +654,8 @@
|
||||
Hide Gradient Annotator Skrýt ovladač přechodu
|
||||
Show Gradient Annotator Zobrazit ovladač přechodu
|
||||
Hide Corner Widget Skrýt ovladač rohů
|
||||
Hide Shape Widgets Skrýt ovladače tvarů
|
||||
Show Shape Widgets Zobrazit ovladače tvarů
|
||||
Show Corner Widget Zobrazit ovladač rohů
|
||||
Guides Vodítka
|
||||
Hide Guides Skrýt vodítka
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3293,6 +3293,8 @@ liquify-list-end {0}, {1} {0} og {1}
|
||||
Hide Gradient Annotator Skjul gradientanmærkning
|
||||
Show Gradient Annotator Vis gradientanmærkning
|
||||
Hide Corner Widget Skjul hjørnehåndtag
|
||||
Hide Shape Widgets Skjul formhåndtag
|
||||
Show Shape Widgets Vis formhåndtag
|
||||
Show Corner Widget Vis hjørnehåndtag
|
||||
Guides Hjælpelinjer
|
||||
Hide Guides Skjul hjælpelinjer
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1575,6 +1575,8 @@ file-filter Templates Vorlagen
|
||||
More Options Weitere Optionen
|
||||
Show Properties Panel Bedienfeld „Eigenschaften“ einblenden
|
||||
Hide Corner Widget Ecken-Widget ausblenden
|
||||
Hide Shape Widgets Form-Widgets ausblenden
|
||||
Show Shape Widgets Form-Widgets einblenden
|
||||
Hide Corner Widget for angles greater than Ecken-Widget ausblenden bei Winkeln größer als
|
||||
Hide Edges Kanten ausblenden
|
||||
Hide Gradient Annotator Verlaufsoptimierer ausblenden
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1507,6 +1507,8 @@ font-technology Variable Μεταβλητές
|
||||
More Options Περισσότερες επιλογές
|
||||
Show Properties Panel Εμφάνιση πίνακα ιδιοτήτων
|
||||
Hide Corner Widget Απόκρυψη χειριστηρίου γωνιών
|
||||
Hide Shape Widgets Απόκρυψη χειριστηρίων σχημάτων
|
||||
Show Shape Widgets Εμφάνιση χειριστηρίων σχημάτων
|
||||
Hide Corner Widget for angles greater than Απόκρυψη χειριστηρίου γωνιών για γωνίες μεγαλύτερες από
|
||||
Hide Edges Απόκρυψη ακμών
|
||||
Hide Gradient Annotator Απόκρυψη χειριστηρίου ντεγκραντέ
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1590,6 +1590,8 @@ font-technology Variable Variables
|
||||
More Options Más opciones
|
||||
Show Properties Panel Mostrar panel Propiedades
|
||||
Hide Corner Widget Ocultar widget de esquina
|
||||
Hide Shape Widgets Ocultar widgets de forma
|
||||
Show Shape Widgets Mostrar widgets de forma
|
||||
Hide Corner Widget for angles greater than Ocultar widget de esquina para ángulos mayores que
|
||||
Hide Edges Ocultar bordes
|
||||
Hide Gradient Annotator Ocultar anotador de degradado
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -645,6 +645,8 @@
|
||||
Hide Gradient Annotator Piilota liukuvärin säädin
|
||||
Show Gradient Annotator Näytä liukuvärin säädin
|
||||
Hide Corner Widget Piilota kulmasäädin
|
||||
Hide Shape Widgets Piilota muotosäätimet
|
||||
Show Shape Widgets Näytä muotosäätimet
|
||||
Show Corner Widget Näytä kulmasäädin
|
||||
Guides Apuviivat
|
||||
Hide Guides Piilota apuviivat
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1580,6 +1580,8 @@ font-technology Variable Variables
|
||||
More Options Plus d’options
|
||||
Show Properties Panel Afficher le panneau Propriétés
|
||||
Hide Corner Widget Masquer le widget d’angle
|
||||
Hide Shape Widgets Masquer les widgets de forme
|
||||
Show Shape Widgets Afficher les widgets de forme
|
||||
Hide Corner Widget for angles greater than Masquer le widget d’angle pour les angles supérieurs à
|
||||
Hide Edges Masquer les contours
|
||||
Hide Gradient Annotator Masquer l’annotateur de dégradé
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1663,6 +1663,8 @@
|
||||
Hide Bounding Box બાઉન્ડિંગ બૉક્સ છુપાવો
|
||||
Hide Code કોડ છુપાવો
|
||||
Hide Corner Widget કૉર્નર વિજેટ છુપાવો
|
||||
Hide Shape Widgets શેપ વિજેટ્સ છુપાવો
|
||||
Show Shape Widgets શેપ વિજેટ્સ બતાવો
|
||||
Hide Corner Widget for angles greater than આથી વધુ એંગલ માટે કૉર્નર વિજેટ છુપાવો
|
||||
Hide Edges કિનારીઓ છુપાવો
|
||||
Hide Font Height Options ફોન્ટ ઊંચાઈ વિકલ્પો છુપાવો
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -2288,6 +2288,8 @@ antiAlias Sharp शार्प
|
||||
Hide Bounding Box बाउंडिंग बॉक्स छिपाएँ
|
||||
Hide Code कोड छुपाएं
|
||||
Hide Corner Widget हिडन कॉर्नर विजेट
|
||||
Hide Shape Widgets शेप विजेट छिपाएँ
|
||||
Show Shape Widgets शेप विजेट दिखाएँ
|
||||
Hide Corner Widget for angles greater than से अधिक कोणों के लिए छुपा कॉर्नर विजेट
|
||||
Hide Edges हाइड एज
|
||||
Hide Extension Lines एक्सटेंशन लाइन छिपाएँ
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1996,6 +1996,8 @@ file-filter Templates Sablonok
|
||||
Hide Bounding Box Befoglaló keret elrejtése
|
||||
Hide Code Kód elrejtése
|
||||
Hide Corner Widget Sarokfogantyú elrejtése
|
||||
Hide Shape Widgets Alakzatfogantyúk elrejtése
|
||||
Show Shape Widgets Alakzatfogantyúk megjelenítése
|
||||
Hide Corner Widget for angles greater than Sarokfogantyú elrejtése, ha a szög nagyobb, mint
|
||||
Hide Edges Élek elrejtése
|
||||
Hide Gradient Annotator Színátmenet-jelölő elrejtése
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -600,6 +600,8 @@
|
||||
Hide Gradient Annotator Sembunyikan anotator gradien
|
||||
Show Gradient Annotator Tampilkan anotator gradien
|
||||
Hide Corner Widget Sembunyikan widget sudut
|
||||
Hide Shape Widgets Sembunyikan widget bentuk
|
||||
Show Shape Widgets Tampilkan widget bentuk
|
||||
Show Corner Widget Tampilkan widget sudut
|
||||
Guides Panduan
|
||||
Hide Guides Sembunyikan panduan
|
||||
|
||||
|
@@ -1609,6 +1609,8 @@ file-filter Templates Modelli
|
||||
More Options Altre opzioni
|
||||
Show Properties Panel Mostra pannello Proprietà
|
||||
Hide Corner Widget Nascondi widget angolo
|
||||
Hide Shape Widgets Nascondi widget forma
|
||||
Show Shape Widgets Mostra widget forma
|
||||
Hide Corner Widget for angles greater than Nascondi widget angolo per angoli maggiori di
|
||||
Hide Edges Nascondi bordi
|
||||
Hide Gradient Annotator Nascondi annotatore sfumatura
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -688,6 +688,8 @@ digits Malayalam マラヤーラム数字
|
||||
Hide Text Threads テキストのスレッドを隠す
|
||||
Hide Gradient Annotator グラデーションガイドを隠す
|
||||
Hide Corner Widget コーナーウィジェットを隠す
|
||||
Hide Shape Widgets シェイプウィジェットを隠す
|
||||
Show Shape Widgets シェイプウィジェットを表示
|
||||
Guides ガイド
|
||||
Hide Guides ガイドを隠す
|
||||
Lock Guides ガイドをロック
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2661,6 +2661,8 @@
|
||||
Hide Gradient Annotator გრადიენტის მაჩვენებლის დამალვა
|
||||
Show Gradient Annotator გრადიენტის მაჩვენებლის ჩვენება
|
||||
Hide Corner Widget კუთხის ვიჯეტის დამალვა
|
||||
Hide Shape Widgets ფიგურის ვიჯეტების დამალვა
|
||||
Show Shape Widgets ფიგურის ვიჯეტების ჩვენება
|
||||
Show Corner Widget კუთხის ვიჯეტის ჩვენება
|
||||
Guides დამხმარე ხაზები
|
||||
Hide Guides დამხმარე ხაზების დამალვა
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -683,6 +683,8 @@ digits Malayalam 말라얄람어
|
||||
Hide Text Threads 문자 연결선 숨기기
|
||||
Hide Gradient Annotator 그레이디언트 주석 숨기기
|
||||
Hide Corner Widget 모퉁이 위젯 숨기기
|
||||
Hide Shape Widgets 모양 위젯 숨기기
|
||||
Show Shape Widgets 모양 위젯 표시
|
||||
Guides 안내선
|
||||
Hide Guides 안내선 숨기기
|
||||
Lock Guides 안내선 잠그기
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1168,6 +1168,8 @@ liquify-list-end {0}, {1} {0} en {1}
|
||||
Hide Gradient Annotator Verloopaanduiding verbergen
|
||||
Show Gradient Annotator Verloopaanduiding tonen
|
||||
Hide Corner Widget Hoekwidget verbergen
|
||||
Hide Shape Widgets Vormwidgets verbergen
|
||||
Show Shape Widgets Vormwidgets tonen
|
||||
Show Corner Widget Hoekwidget tonen
|
||||
Guides Hulplijnen
|
||||
Hide Guides Hulplijnen verbergen
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -611,6 +611,8 @@
|
||||
Hide Gradient Annotator Ukryj wskaźnik gradientu
|
||||
Show Gradient Annotator Pokaż wskaźnik gradientu
|
||||
Hide Corner Widget Ukryj widżet narożników
|
||||
Hide Shape Widgets Ukryj widżety kształtów
|
||||
Show Shape Widgets Pokaż widżety kształtów
|
||||
Show Corner Widget Pokaż widżet narożników
|
||||
Guides Linie pomocnicze
|
||||
Hide Guides Ukryj linie pomocnicze
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1373,6 +1373,8 @@ antiAlias Sharp Nítido
|
||||
More Options Mais Opções
|
||||
Show Properties Panel Mostrar Painel Propriedades
|
||||
Hide Corner Widget Ocultar Widget de Canto
|
||||
Hide Shape Widgets Ocultar Widgets de Forma
|
||||
Show Shape Widgets Mostrar Widgets de Forma
|
||||
Hide Corner Widget for angles greater than Ocultar Widget de Canto para ângulos maiores que
|
||||
Hide Edges Ocultar Bordas
|
||||
Hide Gradient Annotator Ocultar Anotador de Gradiente
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1600,6 +1600,8 @@ file-filter Templates Шаблоны
|
||||
More Options Дополнительные параметры
|
||||
Show Properties Panel Показать панель «Свойства»
|
||||
Hide Corner Widget Скрыть угловой виджет
|
||||
Hide Shape Widgets Скрыть виджеты фигур
|
||||
Show Shape Widgets Показать виджеты фигур
|
||||
Hide Corner Widget for angles greater than Скрывать угловой виджет для углов больше
|
||||
Hide Edges Скрыть края
|
||||
Hide Gradient Annotator Скрыть аннотатор градиента
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1543,6 +1543,8 @@ font-technology Variable Variabla
|
||||
More Options Fler alternativ
|
||||
Show Properties Panel Visa panelen Egenskaper
|
||||
Hide Corner Widget Dölj hörnwidget
|
||||
Hide Shape Widgets Dölj formwidgetar
|
||||
Show Shape Widgets Visa formwidgetar
|
||||
Hide Corner Widget for angles greater than Dölj hörnwidget för vinklar större än
|
||||
Hide Edges Dölj kanter
|
||||
Hide Gradient Annotator Dölj gradientreglage
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1822,6 +1822,7 @@ fn toggled_labels() -> Vec<String> {
|
||||
"view.outline",
|
||||
"view.edges",
|
||||
"view.cornerWidget",
|
||||
"view.shapeWidgets",
|
||||
"view.textThreads",
|
||||
"type.hiddenCharacters",
|
||||
"view.gradientAnnotator",
|
||||
|
||||
@@ -1500,6 +1500,8 @@ font-technology Variable Değişken
|
||||
More Options Daha Fazla Seçenek
|
||||
Show Properties Panel Özellikler Panelini Göster
|
||||
Hide Corner Widget Köşe Widget'ını Gizle
|
||||
Hide Shape Widgets Şekil Widget'larını Gizle
|
||||
Show Shape Widgets Şekil Widget'larını Göster
|
||||
Hide Corner Widget for angles greater than Şu değerden daha büyük açılar için Köşe Widget'ını gizle:
|
||||
Hide Edges Kenarları Gizle
|
||||
Hide Gradient Annotator Degrade Açıklayıcıyı Gizle
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1603,6 +1603,8 @@ file-filter Templates Шаблони
|
||||
More Options Додаткові параметри
|
||||
Show Properties Panel Показати панель «Властивості»
|
||||
Hide Corner Widget Приховати кутовий віджет
|
||||
Hide Shape Widgets Приховати віджети фігур
|
||||
Show Shape Widgets Показати віджети фігур
|
||||
Hide Corner Widget for angles greater than Приховувати кутовий віджет для кутів, більших за
|
||||
Hide Edges Приховати краї
|
||||
Hide Gradient Annotator Приховати маркер градієнта
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1838,6 +1838,8 @@ file-filter Templates Mẫu
|
||||
Hide Bounding Box Ẩn hộp giới hạn
|
||||
Hide Code Ẩn mã
|
||||
Hide Corner Widget Ẩn tiện ích góc
|
||||
Hide Shape Widgets Ẩn tiện ích hình dạng
|
||||
Show Shape Widgets Hiện tiện ích hình dạng
|
||||
Hide Corner Widget for angles greater than Ẩn tiện ích góc với góc lớn hơn
|
||||
Hide Edges Ẩn cạnh
|
||||
Hide Gradient Annotator Ẩn chú thích chuyển sắc
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 205 and column 5.
|
@@ -1537,6 +1537,8 @@ file-filter Templates 模板
|
||||
More Options 更多选项
|
||||
Show Properties Panel 显示属性面板
|
||||
Hide Corner Widget 隐藏角控件
|
||||
Hide Shape Widgets 隐藏形状控件
|
||||
Show Shape Widgets 显示形状控件
|
||||
Hide Corner Widget for angles greater than 角度大于此值时隐藏圆角控件
|
||||
Hide Edges 隐藏边缘
|
||||
Hide Gradient Annotator 隐藏渐变批注器
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1574,6 +1574,8 @@ file-filter Templates 範本
|
||||
More Options 更多選項
|
||||
Show Properties Panel 顯示內容面板
|
||||
Hide Corner Widget 隱藏轉角 Widget
|
||||
Hide Shape Widgets 隱藏形狀 Widget
|
||||
Show Shape Widgets 顯示形狀 Widget
|
||||
Hide Corner Widget for angles greater than 角度大於以下數值時隱藏轉角 Widget
|
||||
Hide Edges 隱藏邊緣
|
||||
Hide Gradient Annotator 隱藏漸層註解者
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -21,6 +21,7 @@ pub const TOGGLES: &[&str] = &[
|
||||
"view.edges",
|
||||
"view.template",
|
||||
"view.cornerWidget",
|
||||
"view.shapeWidgets",
|
||||
"view.textThreads",
|
||||
"type.hiddenCharacters",
|
||||
"view.gradientAnnotator",
|
||||
|
||||
@@ -22,6 +22,7 @@ fn view_toggle_label(app: &VectorcraftApp, id: &str) -> Option<String> {
|
||||
"view.edges" => if v.edges { "Hide Edges" } else { "Show Edges" }.into(),
|
||||
"view.template" => if v.templates { "Hide Template" } else { "Show Template" }.into(),
|
||||
"view.cornerWidget" => if v.corner_widgets { "Hide Corner Widget" } else { "Show Corner Widget" }.into(),
|
||||
"view.shapeWidgets" => if v.shape_widgets { "Hide Shape Widgets" } else { "Show Shape Widgets" }.into(),
|
||||
"view.textThreads" => if v.text_threads { "Hide Text Threads" } else { "Show Text Threads" }.into(),
|
||||
"type.hiddenCharacters" => if v.hidden_chars { "Hide Hidden Characters" } else { "Show Hidden Characters" }.into(),
|
||||
"view.gradientAnnotator" => if v.gradient_annotator { "Hide Gradient Annotator" } else { "Show Gradient Annotator" }.into(),
|
||||
|
||||
@@ -281,6 +281,12 @@ fn run_ui_part3(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
|
||||
"view.pixelPreview" => flag(&mut app.ui.view.pixel_preview),
|
||||
"view.trimView" => flag(&mut app.ui.view.trim_view),
|
||||
"view.cornerWidget" => flag(&mut app.ui.view.corner_widgets),
|
||||
// Hide/Show Shape Widgets: `on` sets the state, and without it the state flips.
|
||||
"view.shapeWidgets" => opt_bool(p, "on").map(|on| {
|
||||
let v = &mut app.ui.view.shape_widgets;
|
||||
*v = on.unwrap_or(!*v);
|
||||
json!(*v)
|
||||
}),
|
||||
// New View: the engine stores the current zoom, centre and rotation under the given name.
|
||||
"view.saved.new" if p.get("zoom").is_none() => {
|
||||
let Some(v) = app.view().copied() else { return Some(Err("no document".into())) };
|
||||
|
||||
@@ -843,6 +843,32 @@ fn recent_fonts_and_corner_widget_toggle() {
|
||||
assert_eq!(dynamic_label(&app, "view.cornerWidget", ""), "Show Corner Widget");
|
||||
}
|
||||
|
||||
/// Hide Shape Widgets (`view.shapeWidgets`, the shape tools' Control bar button) flips its label and
|
||||
/// the setting, `on` sets it, a non-boolean `on` is an error that leaves it, the setting is saved
|
||||
/// with the interface state, and state saved before the setting existed loads with the widgets on.
|
||||
#[test]
|
||||
fn shape_widgets_command_toggles_and_takes_on() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
assert!(app.ui.view.shape_widgets, "on by default");
|
||||
assert_eq!(dynamic_label(&app, "view.shapeWidgets", ""), "Hide Shape Widgets");
|
||||
assert_eq!(app.run("view.shapeWidgets", json!({})).unwrap(), json!(false));
|
||||
assert_eq!(dynamic_label(&app, "view.shapeWidgets", ""), "Show Shape Widgets");
|
||||
assert!(!app.view_info().shape_widgets);
|
||||
assert_eq!(app.run("view.shapeWidgets", json!({"on": false})).unwrap(), json!(false));
|
||||
assert!(app.run("view.shapeWidgets", json!({"on": "yes"})).is_err());
|
||||
assert!(!app.ui.view.shape_widgets, "a bad `on` changes nothing");
|
||||
assert_eq!(app.run("view.shapeWidgets", json!({"on": true})).unwrap(), json!(true));
|
||||
assert!(app.view_info().shape_widgets);
|
||||
app.ui.view.shape_widgets = false;
|
||||
let mut saved = serde_json::to_value(&app.ui).unwrap();
|
||||
let loaded: crate::UiState = serde_json::from_value(saved.clone()).unwrap();
|
||||
assert!(!loaded.view.shape_widgets, "the setting is saved");
|
||||
saved["view"].as_object_mut().unwrap().remove("shape_widgets");
|
||||
let older: crate::UiState = serde_json::from_value(saved).unwrap();
|
||||
assert!(older.view.shape_widgets, "older saved state shows the widgets");
|
||||
assert!(UI_COMMANDS.iter().any(|c| c.0 == "view.shapeWidgets" && c.2.is_empty()), "no default key");
|
||||
}
|
||||
|
||||
/// View › Precise Cursors has no menu item or default key, but the command (assignable in Keyboard Shortcuts)
|
||||
/// writes General › Use Precise Cursors, the value the dialog and the saved preferences read.
|
||||
#[test]
|
||||
|
||||
@@ -202,6 +202,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
("view.pixelPreview", "Pixel Preview", "Cmd+Alt+Y", "{}"),
|
||||
("view.trimView", "Trim View", "", "{} toggle: hide everything outside the artboards"),
|
||||
("view.cornerWidget", "Hide Corner Widget", "", "{} toggle the live corner widgets"),
|
||||
(
|
||||
"view.shapeWidgets",
|
||||
"Hide Shape Widgets",
|
||||
"",
|
||||
"{on?: bool} hide or show selected live shapes' corner, pie and side widgets for the Selection tool and the shape tools (the shape tools' Control bar button); without `on` it toggles; returns the new state. Direct Selection's corner widgets follow view.cornerWidget alone",
|
||||
),
|
||||
(
|
||||
"view.snapToPixel",
|
||||
"Snap to Pixel",
|
||||
|
||||
@@ -270,6 +270,10 @@ pub struct ViewFlags {
|
||||
pub trim_view: bool,
|
||||
/// View → Hide/Show Corner Widget (live corner widgets on rectangles).
|
||||
pub corner_widgets: bool,
|
||||
/// The Control bar's Hide/Show Shape Widgets with a shape tool: selected live shapes' corner, pie
|
||||
/// and side widgets with the Selection tool and the shape tools.
|
||||
#[serde(default = "yes")]
|
||||
pub shape_widgets: bool,
|
||||
/// View → Snap to Pixel.
|
||||
pub snap_to_pixel: bool,
|
||||
/// View → Snap to Glyph.
|
||||
@@ -310,6 +314,7 @@ impl Default for ViewFlags {
|
||||
edges: true,
|
||||
trim_view: false,
|
||||
corner_widgets: true,
|
||||
shape_widgets: true,
|
||||
snap_to_pixel: false,
|
||||
snap_to_glyph: false,
|
||||
text_threads: true,
|
||||
|
||||
@@ -6398,6 +6398,13 @@ outlining in red those that reach their limit; the Selection tool shows the widg
|
||||
the Direct Selection tool those of any path. Several objects each with their own corners are one call:
|
||||
`items: [{id, corners?}]` in place of `ids` and `corners`. Alt-clicking one cycles their kind and double-clicking one opens Corners (`ui.corners {id?, corners?}`,
|
||||
dialog `corners`: `kind`, `radius`; OK runs `object.setLiveShape`).
|
||||
`view.shapeWidgets {on?}` (desktop app, the Hide Shape Widgets and Show Shape Widgets button in the Control bar of the
|
||||
Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools) hides or shows the corner widgets of selected live
|
||||
rectangles and polygons, the pie widgets of live ellipses and the side widget of a live polygon, for the Selection tool
|
||||
and those shape tools: hidden widgets are not drawn, and those tools do not answer a press, a double-click or the cursor
|
||||
on them. `on` sets the state and is an error when it is not `true` or `false`; without it the command toggles. The
|
||||
reply is the new state (`true` when shown, the default). The bounding box, the center point and Direct Selection's
|
||||
corner widgets, which follow `view.cornerWidget` alone, stay as they are, and no undo step is added.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"object.setLiveShape","params":{"id":12,"corners":[1],"radius":16}}}
|
||||
|
||||
@@ -1261,6 +1261,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Live Corners:** drag a live rectangle's corner widgets (Selection or Direct Selection) to round all corners, with a radius readout; with Direct Selection, select corner anchors to show and round just those corners (#381). Each corner keeps its own radius and kind (Round, Inverted Round, Chamfer): Alt-click a widget to cycle the kind, double-click it for the Corners dialog, and the Properties and Transform radius fields set the selected corners (`object.setLiveShape {corners, radius, kind}`). A link toggle behind Corner Radius (the `singleCornerRadius` preference) switches the panels to a field for each corner of a live rectangle: Top Left, Top Right, Bottom Right and Bottom Left. Corners stay circular when the rectangle is scaled unevenly or along its own sides when rotated (the radius keeps its size, or scales by the mean scale with Scale Corners on); only a shear distorts them. On a rectangle that isn't square every corner is the same circle: a radius past half the shorter side stops there for all of them, the widgets sit on the corners as drawn and turn the edited corners red at that limit, CSS export writes the drawn radii, and rectangles saved stretched by older versions get circular corners when their corners are next set (#442). Live Corners work on any path's corners too, as on a rectangle's (#511): a star's, a live polygon's (which also shows them to the Selection tool, has a Corner Radius field in the Properties and Transform panels and keeps its radius as its sides change) and a pen path's, wherever two sides meet at an angle at an anchor that isn't smooth: curved sides too, trimmed to what the cut leaves of them (#1144). Direct Selection shows the widgets of every corner, or of the corners holding selected anchors; each corner is a circle tangent to both sides, drawn no larger than takes its cut halfway along its shorter side; a path keeps its uncut outline so its corners stay editable, and the same command, dialog, angle preference and View › Hide Corner Widget apply. With Direct Selection a click on a widget (no drag) selects its corner, as a click on the corner's anchor does, so the next drag on it rounds that corner alone; Shift-click toggles it (#1239). While a corner widget is dragged with the Selection tool the bounding box hides, so the rounding shows against the path alone (#1229). A round corner next to a curved side curves smoothly instead of sticking out of the shape (#1547, fixes #1512).
|
||||
View › Hide Edges hides the Live Corners widgets, the bounding box and the type widget, and the selection tools then do not answer a press on them or change the cursor over them.
|
||||
- **Polygon side widget:** a selected live polygon shows a small diamond beside the middle of the right side of its bounding box, with the Selection tool and with the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools, while the bounding box and the edges are shown. Dragging the widget sets the polygon's side count, from 3 to 11, as [the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/add-or-remove-sides-from-polygons.html) describes; typed counts in the Transform panel and `object.setLiveShape` still go from 3 to 1000. A drag down adds one side and a drag up removes one for every 12 screen pixels along the box's own vertical axis, and the pointer shows the count while measurement labels are on. A polygon of more than 11 sides keeps its count until the drag goes up, which gives it 11. The drag sends `object.setLiveShape {sides}`, so the polygon keeps its center, radius and rotation; the release adds one undo step when the count changed and none when it ends where it began, and Escape puts the count back. The widget's look and place, the drag direction, the step and the rule for more than 11 sides are VectorCraft's own (`crates/tools/src/sidewidget.rs`).
|
||||
- **Hide/Show Shape Widgets:** with the Rectangle, Rounded Rectangle, Ellipse, Polygon or Star tool, the Control bar shows a Hide Shape Widgets button, which reads Show Shape Widgets while the widgets are hidden (`view.shapeWidgets {on?}`). [The help page](https://helpx.adobe.com/illustrator/using/live-shapes.html) describes this Control panel button, offered with any live shape drawing tool, as switching the on-canvas widgets of selected shapes off and on. While they are hidden, a selected live rectangle's or polygon's corner widgets, a live ellipse's pie widgets and a live polygon's side widget are not drawn, and the Selection tool and those shape tools do not answer a press, a double-click or the cursor on their place (a shape tool draws from there). The bounding box and its handles, the center point and Direct Selection's corner widgets (View › Hide Corner Widget) stay as they are. The setting is on by default, kept with the interface state across sessions and tool switches, and adds no undo step. Its scope beyond the shape tools, its default and what it leaves shown are VectorCraft's own rules (tests `hidden_shape_widgets_leave_the_bounding_box`, `the_shape_tools_control_bar_hides_and_shows_the_shape_widgets`, `shape_widgets_command_toggles_and_takes_on`, `hidden_shape_widgets_do_not_answer_a_shape_tool` and `hidden_shape_widgets_leave_direct_selections_corners`).
|
||||
- **Blend spine Anchor Point tool (#2544):** on a selected blend, dragging a spine corner makes symmetric Smooth handles; the tool displays and picks existing spine handles when switched to, drags one independently or retracts it on click, and clicking a point with handles retracts both. The spine is edited live without moving its key objects. Windows native canvas checks and screenshots reviewed: symmetric and independent handles, corner/retraction, Shift constraints and perpendicular reshaping, tool switching, key preservation, Undo/Redo, save/reopen, hidden handles and overlapping Path/Blend priority (PR #2643). Behaviour reference: [public path-editing documentation](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html).
|
||||
- **Blend spine points by marquee:** with Direct Selection, a marquee picks the spine points inside it on a selected blend, the topmost one when several are selected, and the picked points drag together as Shift-clicked ones do; Shift-marquee adds points or takes picked ones away, a plain marquee around none of them drops the picks, and Escape during the marquee keeps them. Unselected, locked and hidden blends are skipped. The spine's points are anchor points edited with Direct Selection ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/modify-spine-of-blended-objects.html)), and a boundary drag with the tool selects anchor points ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/select-anchor-points-in-paths.html)); the rules for selected, topmost and Shift are VectorCraft's own (`crates/tools/src/direct/tests.rs`, `marquee_picks_selected_blend_spine_points_which_drag_together`, `shift_marquee_toggles_selected_blend_spine_points`, `marquee_skips_unselected_locked_and_hidden_blend_spines`, `escape_cancels_a_marquee_and_keeps_the_picked_spine_points`).
|
||||
- **Blend steps of brushed strokes:** the steps interpolate the pen pressure, tilt, bearing and rotation recorded with the Paintbrush, so a Calligraphic, Scatter or Art brush that varies with the pen changes gradually from one key to the next. A key without a recording counts as half pressure, half tilt and 0°, as brushes read it, and angles turn the shorter way round. When the blend starts a key's path at another anchor (an open path run from its end, a closed one turned to another start), the key's recordings, width profile, arrowheads, dashes and a gradient along or across the stroke turn with the path. Different brushes still switch halfway (VectorCraft's own rule; strokes blend their options, as [Blended objects overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blended-objects-overview.html) describes; `crates/doc/src/blend.rs`, `pen_pressure_tilt_and_angles_interpolate_for_brushes`, `stroke_profiles_turn_with_a_key_path_started_elsewhere`, `stroke_gradients_and_dashes_turn_with_a_key_path_started_elsewhere`).
|
||||
|
||||
Reference in new issue
Block a user