mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
Contextual Task Bar: drag it by its handle, pin and reset its position
The grip at the bar's left end now drags the bar anywhere on the canvas
(grab cursor), which always holds it whole, also when the window shrinks.
Unpinned, the bar keeps that offset as it follows the selection (in the
document it was moved in); the "…" button opens a More Options menu with
Hide Bar, Pin Bar Position (checked while pinned: the bar stays where it
is across selection changes and the handle still moves it; unpinned it
follows the selection again from there), Reset Bar Position (unpinned,
back under the selection) and Show Properties Panel, as in Illustrator.
As there, the position and the pin last for the session only.
- UI commands window.taskBar.pin {pinned?} and window.taskBar.reset, so
the control channel and MCP reach them; ui.inspect reports taskBar
{pinned, rect}.
- One opt_bool helper reads the {key?: bool} params of the toggling window
commands (toolbarColumns, floatTools, collapseDock, taskBar.pin).
- New strings in ja, es, zh-hans, zh-hant, pt-br and cs; the dropped
"Hide Contextual Task Bar" tooltip and per-key es messages removed.
- Headless egui test: dragging the grip moves the bar, the offset follows
the selection, pin holds it across selection changes and a shrinking
window, unpin follows from there, reset restores.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d728c47e6f
commit
d11daabdc7
12 files changed
+275
-44
No files matched your search
+2
-1
@@ -4,7 +4,7 @@ VectorCraft is a clean-room, open-source, pure-Rust reimplementation of the Adob
|
||||
|
||||
This file tracks **how far we are and what's left**. Time estimates are wall-clock hours of continuous Claude Opus 5.5 agent work (including builds and the CI gate), given both for **one agent** and for **4–6 parallel agents** on disjoint crates. They are counted from the remaining work (see [Parity estimate](#parity-estimate)), calibrated against measured throughput, and updated as work lands.
|
||||
|
||||
_Last updated: 2026-10-08 (after M4.14–M4.98, M8.1–M8.20, M14.4–M14.7, the MCP prompts, resource templates, completions and logging, the 2026-10-07 issue fixes, the Layers panel rework and the 2026-10-08 community contributions: Pen and shape-tool modifiers, path editing, Layers, Artboards, Swatches/Brushes and dialogs, Japanese composition and PDF text, Hebrew/Arabic type, interface languages (Spanish among them), the font menu, saved selections, MCP and EPS, the missing-font export warning (#319), open paths in the Shape Builder (#374), PDF/`.ai` import keeping strokes live and hidden and nested layers (#372), per-corner Live Corners (#381), SVG type opening at the size it draws at (#396), the Wayland clipboard with copied-file paste (#398), ruler guides that can be selected, moved and deleted (#414), two batches of Preferences options that were stored but unused (#394), skeleton reads with `document.find` for large documents over MCP (#416) and anchors dragged with Direct Selection snapping to points, segments and smart guides, clipped SVG layers opening as clipping layers (#420), PDF/`.ai` layers read on pages of tens of millions of operators (#419), Document Color Mode putting RGB greys on the black plate on request and converting pattern tiles (#421) and movable dialogs with Offset Path's Joins dropdown (#423) and numeric fields scrubbed by dragging their label (#400), stroke weight presets in the stroke unit (#426), the Appearance panel's Opacity popup (#430), type on a path brackets, flip and Type on a Path Options that keep the type in place (#429), Layers rows dragged with a ghost and dropped on the trash or New Layer (#435), tool flyouts opening on a right or corner press (#436), tool flyouts torn off into floating toolbars (#437), the Shape Builder's erase mode deleting edges too (#439), installed fonts registered outside the font folders and fonts installed while the app runs listed in the font menus (#443), alike circular corners on rectangles that aren't square (#442), tool cursors as OS cursors so the pointer no longer trails over the canvas (#444), artboards copied and pasted with their art (#446), guides dragged out of the rulers snapping to the art's side midpoints and the artboards, artboard guides (#451), the toolbar's double arrow and Window › Toolbars › Double Column switching between one and two columns in any window height (#455), the Smart Guides display options and Snapping Tolerance (#394), Font Size and Leading combo boxes with preset lists in the Character and Properties panels and the Control bar (#458), screenshots pasted from the clipboard on macOS, Windows and the web (#457), the Properties panel's Fill and Stroke matching the Control bar's, Illustrator's Window menu panel keys (Shift+F7 for Align…) and Alt-wheel zoom whatever the wheel preference (Discord feedback), the point/area type widget (Discord feedback), groups in legacy Illustrator .ai files (Discord feedback), a rotating desktop log file (#465), image controls in the Control bar and Properties panel: Image Trace with its presets, Mask, Crop Image, Embed/Unembed, and an Image Trace object's preset, Expand and Release (Discord feedback), the Pen working as the Anchor Point tool with Alt held over a selected path's handles and anchors, and anchor buttons that convert, connect and cut paths at the selected anchors (Discord feedback), Japanese hanging punctuation (burasagari, #463), Escape leaving Presentation Mode with no screen mode saved across restarts, documents dropped on the desktop app opening as tabs of their own and a note that an `.ai` file's art off its artboards isn't in the part read (#472), Add/Delete Anchor Point tool icons drawn from the Pen tool's (#479), EPS files from Illustrator 2026, Inkscape/cairo, matplotlib, CorelDRAW, Affinity, LibreOffice and Ghostscript opening as vectors, and a preview that stands in saying why (Discord feedback, #466, #469, #474), chords with modifiers recorded in Edit › Keyboard Shortcuts (#487), Type Object Selection by Path Only (#394), Anti-aliased Artwork (#394), Show Pixel Grid (#394), pen and touch taps pressed and lifted within one frame clicking where they tapped and the Linux/Wayland pen-tablet workaround (#491), bounding-box resizes landing on the other objects' anchors and centres with labels, and the Rotate, Scale, Shear and Reflect tools snapping their drags (#482), Shift-drag marquees that toggle the objects or anchors they reach and a Lasso whose Alt subtraction keeps the rest of the selection (#483), the mouse wheel stepping the focused numeric field, the dialogs' and preferences' drag values made such fields (#485), Show The Home Screen When No Documents Are Open (#394), Numbers Without Units Are Points (#394), Auto-Collapse Iconic Panels (#394); see [Honest assessment](#honest-assessment-2026-10-05))._
|
||||
_Last updated: 2026-10-08 (after M4.14–M4.98, M8.1–M8.20, M14.4–M14.7, the MCP prompts, resource templates, completions and logging, the 2026-10-07 issue fixes, the Layers panel rework and the 2026-10-08 community contributions: Pen and shape-tool modifiers, path editing, Layers, Artboards, Swatches/Brushes and dialogs, Japanese composition and PDF text, Hebrew/Arabic type, interface languages (Spanish among them), the font menu, saved selections, MCP and EPS, the missing-font export warning (#319), open paths in the Shape Builder (#374), PDF/`.ai` import keeping strokes live and hidden and nested layers (#372), per-corner Live Corners (#381), SVG type opening at the size it draws at (#396), the Wayland clipboard with copied-file paste (#398), ruler guides that can be selected, moved and deleted (#414), two batches of Preferences options that were stored but unused (#394), skeleton reads with `document.find` for large documents over MCP (#416) and anchors dragged with Direct Selection snapping to points, segments and smart guides, clipped SVG layers opening as clipping layers (#420), PDF/`.ai` layers read on pages of tens of millions of operators (#419), Document Color Mode putting RGB greys on the black plate on request and converting pattern tiles (#421) and movable dialogs with Offset Path's Joins dropdown (#423) and numeric fields scrubbed by dragging their label (#400), stroke weight presets in the stroke unit (#426), the Appearance panel's Opacity popup (#430), type on a path brackets, flip and Type on a Path Options that keep the type in place (#429), Layers rows dragged with a ghost and dropped on the trash or New Layer (#435), tool flyouts opening on a right or corner press (#436), tool flyouts torn off into floating toolbars (#437), the Shape Builder's erase mode deleting edges too (#439), installed fonts registered outside the font folders and fonts installed while the app runs listed in the font menus (#443), alike circular corners on rectangles that aren't square (#442), tool cursors as OS cursors so the pointer no longer trails over the canvas (#444), artboards copied and pasted with their art (#446), guides dragged out of the rulers snapping to the art's side midpoints and the artboards, artboard guides (#451), the toolbar's double arrow and Window › Toolbars › Double Column switching between one and two columns in any window height (#455), the Smart Guides display options and Snapping Tolerance (#394), Font Size and Leading combo boxes with preset lists in the Character and Properties panels and the Control bar (#458), screenshots pasted from the clipboard on macOS, Windows and the web (#457), the Properties panel's Fill and Stroke matching the Control bar's, Illustrator's Window menu panel keys (Shift+F7 for Align…) and Alt-wheel zoom whatever the wheel preference (Discord feedback), the point/area type widget (Discord feedback), groups in legacy Illustrator .ai files (Discord feedback), a rotating desktop log file (#465), image controls in the Control bar and Properties panel: Image Trace with its presets, Mask, Crop Image, Embed/Unembed, and an Image Trace object's preset, Expand and Release (Discord feedback), the Pen working as the Anchor Point tool with Alt held over a selected path's handles and anchors, and anchor buttons that convert, connect and cut paths at the selected anchors (Discord feedback), Japanese hanging punctuation (burasagari, #463), Escape leaving Presentation Mode with no screen mode saved across restarts, documents dropped on the desktop app opening as tabs of their own and a note that an `.ai` file's art off its artboards isn't in the part read (#472), Add/Delete Anchor Point tool icons drawn from the Pen tool's (#479), EPS files from Illustrator 2026, Inkscape/cairo, matplotlib, CorelDRAW, Affinity, LibreOffice and Ghostscript opening as vectors, and a preview that stands in saying why (Discord feedback, #466, #469, #474), chords with modifiers recorded in Edit › Keyboard Shortcuts (#487), Type Object Selection by Path Only (#394), Anti-aliased Artwork (#394), Show Pixel Grid (#394), pen and touch taps pressed and lifted within one frame clicking where they tapped and the Linux/Wayland pen-tablet workaround (#491), bounding-box resizes landing on the other objects' anchors and centres with labels, and the Rotate, Scale, Shear and Reflect tools snapping their drags (#482), Shift-drag marquees that toggle the objects or anchors they reach and a Lasso whose Alt subtraction keeps the rest of the selection (#483), the mouse wheel stepping the focused numeric field, the dialogs' and preferences' drag values made such fields (#485), Show The Home Screen When No Documents Are Open (#394), Numbers Without Units Are Points (#394), Auto-Collapse Iconic Panels (#394), the Contextual Task Bar moved by its handle and its More Options menu pinning and resetting its position; see [Honest assessment](#honest-assessment-2026-10-05))._
|
||||
|
||||
## Where we are
|
||||
|
||||
@@ -97,6 +97,7 @@ grade by behaviour against `plan/illustrator/`, not by whether a menu item exist
|
||||
- **UI:** Illustrator 2026 layout restyled to measured values:
|
||||
- Medium Dark theme, categorized and Advanced toolbars (a tool group's flyout opens on a right press, a long press or a press on its corner triangle), 35 pt document tabs, 33 pt panel tabs.
|
||||
- Hint bar, contextual task bar, 19 dock panels with ≡ menus.
|
||||
- The contextual task bar's handle drags it anywhere on the canvas (kept whole on it as the window resizes); unpinned it keeps that offset as it follows the selection, and its More Options menu hides it, pins its position across selection changes (`window.taskBar.pin`), resets it under the selection (`window.taskBar.reset`) and shows the Properties panel. As in Illustrator the position isn't kept across launches. Not done: the bar's tool-specific variants (only the selection tools show it).
|
||||
- Tool flyouts tear off: dragging or clicking the tear-off bar on a flyout's right side (or releasing the long press over it) floats its group as a strip of tool buttons, moved by the same bar and put back in the toolbar by the × at its top (`window.floatTools`). While a group floats, the presses that would open its flyout raise the strip instead. Floating strips are kept with the preferences and in user workspaces. Not done: turning a strip vertical, docking it.
|
||||
- The dock's double arrow collapses Properties, Layers and Libraries to icons at the top of the icon column, popping out like the other icon panels, and expands them again (`window.collapseDock`, kept with the preferences and in saved workspaces). The icon column's own arrow (expanding the icon panels into a full column) is not done.
|
||||
- Localised UI: menus (in-window and native), panels, dialogs, toolbar and Preferences read from per-language catalogs (`crates/ui-egui/src/i18n`, see `docs/development.md`); Traditional Chinese (Taiwan), Simplified Chinese (mainland), Japanese and Spanish ship complete, and Czech and Brazilian Portuguese cover every menu label (and more), with system-locale detection on macOS, Windows, Linux and the web (the browser's languages, or `?lang=`), a VectorCraft ▸ Language menu and a Language preference. Names are never translated (fonts and their styles, layers, artboards, saved presets, user libraries, custom workspaces, recent files, plug-ins).
|
||||
|
||||
+162
-14
@@ -1,7 +1,7 @@
|
||||
//! The document canvas: rendering, rulers, navigation, pointer routing to tools and on-canvas
|
||||
//! selection visuals (bounding box, anchors, handles, smart-guide style labels).
|
||||
|
||||
use egui::{Color32, CornerRadius, Pos2, Sense, Shape, Stroke, StrokeKind, Ui, pos2, vec2};
|
||||
use egui::{Color32, CornerRadius, Pos2, Sense, Shape, Stroke, StrokeKind, Ui, Vec2, pos2, vec2};
|
||||
use serde_json::json;
|
||||
use vectorcraft_doc::{Node, NodeKind, Unit};
|
||||
use vectorcraft_geom::{Affine, BezPath, PathEl, Point, Rect};
|
||||
@@ -1629,7 +1629,20 @@ fn upload(app: &mut VectorcraftApp, ctx: &egui::Context, img: &vectorcraft_rende
|
||||
}
|
||||
}
|
||||
|
||||
/// The Contextual Task Bar's area.
|
||||
fn task_bar_id() -> egui::Id {
|
||||
egui::Id::new("task-bar")
|
||||
}
|
||||
|
||||
/// Where the Contextual Task Bar was last drawn (none while it isn't shown).
|
||||
pub(crate) fn task_bar_rect(ctx: &egui::Context) -> Option<egui::Rect> {
|
||||
let id = task_bar_id();
|
||||
ctx.memory(|m| m.areas().is_visible(&egui::LayerId::new(egui::Order::Middle, id)).then(|| m.area_rect(id)).flatten())
|
||||
}
|
||||
|
||||
/// The Contextual Task Bar: a floating pill under the selection with the most likely next actions.
|
||||
/// Its handle drags it anywhere on the canvas; unpinned it keeps that offset as it follows the
|
||||
/// selection, pinned it stays put ([`crate::state::TaskBarPlace`]).
|
||||
fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let Some(st) = app.session.active() else { return };
|
||||
@@ -1662,12 +1675,36 @@ fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
|
||||
}
|
||||
items.push((tl!("Duplicate"), "copy", "edit.duplicate"));
|
||||
let fill = first.as_ref().map(|f| f.appearance.fill_paint()).unwrap_or_default();
|
||||
let doc = st.uid;
|
||||
let anchor = xf.to_screen(Point::new(b.center().x, b.y1));
|
||||
let est_w = 118.0 + items.iter().map(|(l, _, _)| l.len() as f32 * 7.2 + 44.0).sum::<f32>();
|
||||
let x = (anchor.x - est_w / 2.0).clamp(xf.rect.left() + 8.0, (xf.rect.right() - est_w - 8.0).max(xf.rect.left() + 8.0));
|
||||
let y = (anchor.y + 28.0).min(xf.rect.bottom() - 56.0);
|
||||
let mut run: Option<String> = None;
|
||||
egui::Area::new(egui::Id::new("task-bar")).order(egui::Order::Middle).fixed_pos(pos2(x, y)).show(ui.ctx(), |ui| {
|
||||
// Its place under the selection, then where the handle moved it, kept on the canvas (with the
|
||||
// bar's size last frame, the estimate before it first shows).
|
||||
let under = pos2(anchor.x - est_w / 2.0, anchor.y + 28.0);
|
||||
let id = task_bar_id();
|
||||
let size = egui::AreaState::load(ui.ctx(), id).and_then(|s| s.size).unwrap_or(vec2(est_w, 44.0));
|
||||
let bounds = xf.rect.shrink(8.0);
|
||||
let keep_in = |p: Pos2| p.clamp(bounds.min, (bounds.max - size).max(bounds.min));
|
||||
let place = &mut app.ui.task_bar_place;
|
||||
// Just unpinned: follow the selection from the pinned spot.
|
||||
if !place.pinned
|
||||
&& let Some(at) = place.pin_at.take()
|
||||
{
|
||||
place.offset = Some((doc, xf.rect.min + at - under));
|
||||
}
|
||||
let pos = keep_in(match place.pin_at {
|
||||
Some(at) => xf.rect.min + at,
|
||||
None => under + place.offset.filter(|(d, _)| *d == doc).map_or(Vec2::ZERO, |(_, o)| o),
|
||||
});
|
||||
place.shown_at = Some(pos - xf.rect.min);
|
||||
// Pinned before it ever showed: hold it here.
|
||||
if place.pinned && place.pin_at.is_none() {
|
||||
place.pin_at = place.shown_at;
|
||||
}
|
||||
let pinned = place.pinned;
|
||||
let mut moved = Vec2::ZERO;
|
||||
let mut run: Option<(&str, serde_json::Value)> = None;
|
||||
egui::Area::new(id).order(egui::Order::Middle).fixed_pos(pos).show(ui.ctx(), |ui| {
|
||||
egui::Frame::NONE
|
||||
.fill(t.panel)
|
||||
.stroke(Stroke::new(1.0, t.tool_active))
|
||||
@@ -1677,8 +1714,15 @@ fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
|
||||
.show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 6.0;
|
||||
let (g, _) = ui.allocate_exact_size(vec2(4.0, 28.0), Sense::hover());
|
||||
ui.painter().rect_filled(g.shrink2(vec2(0.5, 4.0)), CornerRadius::same(2), t.button_border);
|
||||
let (g, grip) = ui.allocate_exact_size(vec2(4.0, 28.0), Sense::drag());
|
||||
let active = grip.hovered() || grip.dragged();
|
||||
ui.painter().rect_filled(g.shrink2(vec2(0.5, 4.0)), CornerRadius::same(2), if active { t.text_dim } else { t.button_border });
|
||||
if grip.dragged() {
|
||||
ui.ctx().set_cursor_icon(egui::CursorIcon::Grabbing);
|
||||
moved = grip.drag_delta();
|
||||
} else if grip.hovered() {
|
||||
ui.ctx().set_cursor_icon(egui::CursorIcon::Grab);
|
||||
}
|
||||
for (label, icon, cmd) in &items {
|
||||
let galley = ui.painter().layout_no_wrap(label.to_string(), egui::FontId::proportional(13.0), t.text_strong);
|
||||
let (r, resp) = ui.allocate_exact_size(vec2(galley.size().x + 38.0, 30.0), Sense::click());
|
||||
@@ -1689,7 +1733,7 @@ fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
|
||||
crate::icons::paint(ui, icon, egui::Rect::from_min_size(r.min + vec2(8.0, 7.0), vec2(16.0, 16.0)), t.icon);
|
||||
ui.painter().galley(pos2(r.left() + 30.0, r.center().y - galley.size().y / 2.0), galley, t.text_strong);
|
||||
if resp.clicked() {
|
||||
run = Some(cmd.to_string());
|
||||
run = Some((*cmd, json!({})));
|
||||
}
|
||||
}
|
||||
let (r, resp) = ui.allocate_exact_size(vec2(26.0, 30.0), Sense::click());
|
||||
@@ -1705,16 +1749,41 @@ fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
|
||||
app.ui.open_panel = Some("swatches".into());
|
||||
}
|
||||
if widgets::icon_button(ui, "lock", tl!("Lock (⌘2)"), false, 30.0).clicked() {
|
||||
run = Some("object.lock".into());
|
||||
}
|
||||
if widgets::icon_button(ui, "ellipsis", tl!("Hide Contextual Task Bar"), false, 30.0).clicked() {
|
||||
run = Some("window.taskBar".into());
|
||||
run = Some(("object.lock", json!({})));
|
||||
}
|
||||
let more = widgets::icon_button(ui, "ellipsis", tl!("More Options"), false, 30.0);
|
||||
egui::Popup::menu(&more).show(|ui| {
|
||||
ui.set_min_width(170.0);
|
||||
let bar = [
|
||||
(tl!("Hide Bar"), "window.taskBar", false),
|
||||
(tl!("Pin Bar Position"), "window.taskBar.pin", pinned),
|
||||
(tl!("Reset Bar Position"), "window.taskBar.reset", false),
|
||||
];
|
||||
for (label, cmd, checked) in bar {
|
||||
if widgets::menu_item(ui, label, true, checked) {
|
||||
run = Some((cmd, json!({})));
|
||||
}
|
||||
}
|
||||
ui.separator();
|
||||
if widgets::menu_item(ui, tl!("Show Properties Panel"), true, false) {
|
||||
run = Some(("window.panel", json!({"panel": "properties"})));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
if let Some(c) = run {
|
||||
crate::menus::invoke(app, &c, json!({}));
|
||||
if moved != Vec2::ZERO {
|
||||
let to = keep_in(pos + moved);
|
||||
let place = &mut app.ui.task_bar_place;
|
||||
if place.pinned {
|
||||
place.pin_at = Some(to - xf.rect.min);
|
||||
} else {
|
||||
place.offset = Some((doc, to - under));
|
||||
}
|
||||
ui.ctx().request_repaint();
|
||||
}
|
||||
if let Some((c, p)) = run {
|
||||
crate::menus::invoke(app, c, p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2817,4 +2886,83 @@ mod tests {
|
||||
assert_eq!(doc.selection.objects, vec![vectorcraft_doc::NodeId(id)]);
|
||||
assert_eq!(doc.doc.art_bounds(), before, "the tap moved nothing");
|
||||
}
|
||||
|
||||
/// The Contextual Task Bar's handle drags it: unpinned it keeps that offset as it follows the
|
||||
/// selection, pinned it stays put when the selection changes, unpinned again it follows from
|
||||
/// there, and Reset Bar Position puts it back under the selection. It never leaves the canvas,
|
||||
/// also when the window shrinks.
|
||||
#[test]
|
||||
fn the_task_bar_is_dragged_by_its_handle_pinned_and_reset() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap();
|
||||
let mut square =
|
||||
|x: f64, y: f64| app.session.execute("shape.rectangle", &json!({"x": x, "y": y, "width": 40, "height": 40})).unwrap()["id"].clone();
|
||||
let (a, b) = (square(120.0, 40.0), square(220.0, 150.0));
|
||||
app.select_tool("selection");
|
||||
let ctx = egui::Context::default();
|
||||
let bar = || task_bar_rect(&ctx).expect("the task bar shows");
|
||||
let select = |app: &mut VectorcraftApp, id: &serde_json::Value| {
|
||||
app.session.execute("select.set", &json!({"ids": [id]})).unwrap();
|
||||
frame(app, &ctx, vec![]);
|
||||
frame(app, &ctx, vec![]);
|
||||
bar().min
|
||||
};
|
||||
let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
|
||||
let drag = |app: &mut VectorcraftApp, by: Vec2| {
|
||||
let grip = pos2(bar().left() + 11.0, bar().center().y);
|
||||
frame(app, &ctx, vec![egui::Event::PointerMoved(grip)]);
|
||||
frame(app, &ctx, vec![button(grip, true)]);
|
||||
frame(app, &ctx, vec![egui::Event::PointerMoved(grip + by)]);
|
||||
frame(app, &ctx, vec![button(grip + by, false)]);
|
||||
frame(app, &ctx, vec![]);
|
||||
bar().min
|
||||
};
|
||||
let near = |p: Pos2, q: Pos2| assert!((p - q).length() < 1.5, "{p:?} is not at {q:?}");
|
||||
let (under_a, under_b) = (select(&mut app, &a), select(&mut app, &b));
|
||||
assert!(under_b.y > under_a.y + 100.0, "each bar sits under its selection");
|
||||
|
||||
// Dragged unpinned: it keeps its offset from the selection.
|
||||
select(&mut app, &a);
|
||||
let by = vec2(40.0, -30.0);
|
||||
near(drag(&mut app, by), under_a + by);
|
||||
near(select(&mut app, &b), under_b + by);
|
||||
assert!(!app.ui.task_bar_place.pinned);
|
||||
|
||||
// Pinned: it stays where it is across selection changes, and the handle still moves it.
|
||||
assert_eq!(app.run("window.taskBar.pin", json!({})).unwrap(), json!(true));
|
||||
assert_eq!(crate::menus::checked(&app, "window.taskBar.pin", &json!({})), Some(true));
|
||||
near(select(&mut app, &a), under_b + by);
|
||||
let spot = drag(&mut app, vec2(-20.0, 10.0));
|
||||
near(spot, under_b + by + vec2(-20.0, 10.0));
|
||||
near(select(&mut app, &b), spot);
|
||||
|
||||
// Unpinned: it follows the selection from where it is, kept on the canvas.
|
||||
assert_eq!(app.run("window.taskBar.pin", json!({"pinned": false})).unwrap(), json!(false));
|
||||
near(select(&mut app, &a), spot);
|
||||
let canvas = app.canvas_rect.unwrap();
|
||||
let last = canvas.max - vec2(8.0, 8.0) - bar().size();
|
||||
near(select(&mut app, &b), (under_b + (spot - under_a)).min(last));
|
||||
assert!(app.run("window.taskBar.pin", json!({"pinned": "yes"})).is_err());
|
||||
|
||||
// Kept on the canvas: dragged far off, then pinned in the corner of a shrinking window.
|
||||
near(drag(&mut app, vec2(-2000.0, -2000.0)), canvas.min + vec2(8.0, 8.0));
|
||||
app.run("window.taskBar.pin", json!({"pinned": true})).unwrap();
|
||||
drag(&mut app, vec2(2000.0, 2000.0));
|
||||
near(bar().max, canvas.max - vec2(8.0, 8.0));
|
||||
let small = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(640.0, 480.0))), ..Default::default() };
|
||||
for _ in 0..2 {
|
||||
let mut out = ctx.run_ui(small.clone(), |ui| show(&mut app, ui));
|
||||
out.textures_delta.clear();
|
||||
}
|
||||
let canvas = app.canvas_rect.unwrap();
|
||||
assert!(canvas.width() < 700.0, "the canvas shrank: {canvas:?}");
|
||||
near(bar().max, canvas.max - vec2(8.0, 8.0));
|
||||
|
||||
// Reset: back under the selection, unpinned.
|
||||
frame(&mut app, &ctx, vec![]);
|
||||
app.run("window.taskBar.reset", json!({})).unwrap();
|
||||
assert!(!app.ui.task_bar_place.pinned);
|
||||
near(select(&mut app, &a), under_a);
|
||||
near(select(&mut app, &b), under_b);
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,11 @@ pub fn inspect(app: &VectorcraftApp, ctx: &egui::Context) -> Value {
|
||||
"ui": serde_json::to_value(&app.ui).unwrap_or_default(),
|
||||
// Not saved with the UI state, so not in `ui`: 0 normal … 3 Presentation Mode.
|
||||
"screenMode": app.ui.screen_mode,
|
||||
// The Contextual Task Bar: pinned (not saved either) and where it shows.
|
||||
"taskBar": {
|
||||
"pinned": app.ui.task_bar_place.pinned,
|
||||
"rect": crate::canvas::task_bar_rect(ctx).map(|r| json!([r.left(), r.top(), r.width(), r.height()])),
|
||||
},
|
||||
"view": app.view().map(|v| serde_json::to_value(v).unwrap_or_default()),
|
||||
"canvasRect": app.canvas_rect.map(|c| json!([c.left(), c.top(), c.width(), c.height()])),
|
||||
"window": [r.width(), r.height()],
|
||||
|
||||
@@ -490,6 +490,8 @@
|
||||
Manage Workspaces… Spravovat pracovní prostory…
|
||||
Control Ovládací panel
|
||||
Contextual Task Bar Kontextový panel úloh
|
||||
Pin Bar Position Připnout polohu panelu
|
||||
Reset Bar Position Obnovit polohu panelu
|
||||
Tools Nástroje
|
||||
Toolbars Panely nástrojů
|
||||
Advanced Rozšířený
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -435,6 +435,8 @@
|
||||
Construction Guides Guías de construcción
|
||||
Contextual Alternates Alternativas contextuales
|
||||
Contextual Task Bar Barra de tareas contextual
|
||||
Pin Bar Position Fijar posición de la barra
|
||||
Reset Bar Position Restablecer posición de la barra
|
||||
Contrast Contraste
|
||||
Control Control
|
||||
Convert Convertir
|
||||
@@ -1089,7 +1091,9 @@
|
||||
Hide Artboards Ocultar mesas de trabajo
|
||||
Hide Bounding Box Ocultar cuadro delimitador
|
||||
Hide Code Ocultar código
|
||||
Hide Contextual Task Bar Ocultar barra de tareas contextual
|
||||
Hide Bar Ocultar barra
|
||||
More Options Más opciones
|
||||
Show Properties Panel Mostrar panel Propiedades
|
||||
Hide Corner Widget Ocultar widget de esquina
|
||||
Hide Corner Widget for angles greater than Ocultar widget de esquina para ángulos mayores que
|
||||
Hide Edges Ocultar bordes
|
||||
@@ -3213,7 +3217,6 @@ axis Both Ambos
|
||||
@msg choose a folder to export to elige una carpeta a la que exportar
|
||||
@msg choose a location for the package elige una ubicación para el paquete
|
||||
@msg clipboard is empty el portapapeles está vacío
|
||||
@msg collapsed must be true or false collapsed debe ser true o false
|
||||
@msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` no es un color como "#ff8800"
|
||||
@msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: como máximo {MAX_TABLE} colores
|
||||
@msg command `{0}` is not available right now: {1} el comando `{0}` no está disponible ahora: {1}
|
||||
@@ -3568,7 +3571,5 @@ axis Both Ambos
|
||||
@msg The graphics were lost and couldn't be restarted. Se perdieron los gráficos y no se pudieron reiniciar.
|
||||
@msg Your unsaved changes are kept in this browser: reload the page to get them back. Tus cambios sin guardar se conservan en este navegador: vuelve a cargar la página para recuperarlos.
|
||||
@msg Reload the page to go on (changes not saved yet may be lost). Vuelve a cargar la página para continuar (los cambios que aún no se guardaron podrían perderse).
|
||||
@msg floating must be true or false floating debe ser true o false
|
||||
@msg tool (a tool id) is required se requiere tool (un id de herramienta)
|
||||
@msg {tool} isn't in a toolbar group of several tools {tool} no está en un grupo de la barra de herramientas con varias herramientas
|
||||
@msg double must be true or false double debe ser true o false
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -511,6 +511,8 @@
|
||||
Manage Workspaces… ワークスペースを管理…
|
||||
Control コントロール
|
||||
Contextual Task Bar コンテキストタスクバー
|
||||
Pin Bar Position バーの位置を固定
|
||||
Reset Bar Position バーの位置をリセット
|
||||
Tools ツール
|
||||
Toolbars ツールバー
|
||||
Advanced 詳細
|
||||
@@ -1372,7 +1374,9 @@
|
||||
Height: 高さ:
|
||||
Help › Search Commands… ヘルプ › コマンドを検索…
|
||||
Hide Code コードを隠す
|
||||
Hide Contextual Task Bar コンテキストタスクバーを隠す
|
||||
Hide Bar バーを隠す
|
||||
More Options その他のオプション
|
||||
Show Properties Panel プロパティパネルを表示
|
||||
Hide Corner Widget for angles greater than 次の角度より大きい場合はコーナーウィジェットを隠す
|
||||
Hide Note メモを隠す
|
||||
Hide Options オプションを隠す
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -447,6 +447,8 @@
|
||||
Construction Guides Guias de Construção
|
||||
Contextual Alternates Variantes Contextuais
|
||||
Contextual Task Bar Barra de Tarefas Contextual
|
||||
Pin Bar Position Fixar Posição da Barra
|
||||
Reset Bar Position Redefinir Posição da Barra
|
||||
Control Controle
|
||||
Convert Converter
|
||||
Convert All Spot Colors to Process Converter Todas as Cores Spot em Processo
|
||||
@@ -1006,7 +1008,9 @@
|
||||
Hide Artboards Ocultar Mesas de Trabalho
|
||||
Hide Bounding Box Ocultar Caixa Delimitadora
|
||||
Hide Code Ocultar Código
|
||||
Hide Contextual Task Bar Ocultar Barra de Tarefas Contextual
|
||||
Hide Bar Ocultar Barra
|
||||
More Options Mais Opções
|
||||
Show Properties Panel Mostrar Painel Propriedades
|
||||
Hide Corner Widget Ocultar Widget de Canto
|
||||
Hide Corner Widget for angles greater than Ocultar Widget de Canto para ângulos maiores que
|
||||
Hide Edges Ocultar Bordas
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -436,6 +436,8 @@
|
||||
Construction Guides 构造参考线
|
||||
Contextual Alternates 上下文替代
|
||||
Contextual Task Bar 上下文任务栏
|
||||
Pin Bar Position 固定任务栏位置
|
||||
Reset Bar Position 重置任务栏位置
|
||||
Contrast 对比
|
||||
Control 控制栏
|
||||
Convert 转换
|
||||
@@ -1080,7 +1082,9 @@
|
||||
Hide Artboards 隐藏画板
|
||||
Hide Bounding Box 隐藏定界框
|
||||
Hide Code 隐藏代码
|
||||
Hide Contextual Task Bar 隐藏快捷工作列
|
||||
Hide Bar 隐藏任务栏
|
||||
More Options 更多选项
|
||||
Show Properties Panel 显示属性面板
|
||||
Hide Corner Widget 隐藏角控件
|
||||
Hide Corner Widget for angles greater than 角度大于此值时隐藏圆角控件
|
||||
Hide Edges 隐藏边缘
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -450,6 +450,8 @@
|
||||
Construction Guides 建構參考線
|
||||
Contextual Alternates 前後關聯替代字
|
||||
Contextual Task Bar 快捷工作列
|
||||
Pin Bar Position 釘選工作列位置
|
||||
Reset Bar Position 重設工作列位置
|
||||
Contrast 對比
|
||||
Control 控制
|
||||
Convert 轉換
|
||||
@@ -1106,7 +1108,9 @@
|
||||
Hide Artboards 隱藏工作區域
|
||||
Hide Bounding Box 隱藏邊框
|
||||
Hide Code 隱藏程式碼
|
||||
Hide Contextual Task Bar 隱藏快捷工作列
|
||||
Hide Bar 隱藏工作列
|
||||
More Options 更多選項
|
||||
Show Properties Panel 顯示內容面板
|
||||
Hide Corner Widget 隱藏轉角 Widget
|
||||
Hide Corner Widget for angles greater than 角度大於以下數值時隱藏轉角 Widget
|
||||
Hide Edges 隱藏邊緣
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
+46
-20
@@ -216,6 +216,13 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"{tool: id, floating?: bool} float the toolbar group holding `tool` (in the current Basic or Advanced layout) as its own strip of tool buttons (true), put it back in the toolbar (false) or toggle (omitted), as dragging or clicking a flyout's tear-off bar and the strip's × do; returns the new state",
|
||||
),
|
||||
("window.taskBar", "Contextual Task Bar", "", "{}"),
|
||||
(
|
||||
"window.taskBar.pin",
|
||||
"Pin Bar Position",
|
||||
"",
|
||||
"{pinned?: bool} keep the Contextual Task Bar where it is instead of following the selection (true), let it follow the selection again from where it is (false) or toggle (omitted), as the bar's More Options menu does; returns the new state",
|
||||
),
|
||||
("window.taskBar.reset", "Reset Bar Position", "", "{} unpin the Contextual Task Bar and put it back under the selection"),
|
||||
("window.dock", "Panels", "Tab", "{} show/hide all panels"),
|
||||
("window.panel", "Show Panel", "", "{panel: id} e.g. layers, swatches, stroke (case-insensitive; display labels like \"Layers\" work too)"),
|
||||
(
|
||||
@@ -770,6 +777,15 @@ fn normalize_panel(input: &str) -> Option<&'static str> {
|
||||
crate::state::all_panels().find(|(id, label)| name.eq_ignore_ascii_case(id) || name.eq_ignore_ascii_case(label)).map(|(id, _)| id)
|
||||
}
|
||||
|
||||
/// An optional `{key?: bool}` param: none when it is omitted or null (the commands then toggle).
|
||||
fn opt_bool(p: &Value, key: &str) -> Result<Option<bool>, String> {
|
||||
match p.get(key) {
|
||||
None | Some(Value::Null) => Ok(None),
|
||||
Some(Value::Bool(b)) => Ok(Some(*b)),
|
||||
Some(_) => Err(format!("`{key}` must be true or false")),
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle a UI command. `None` = not a UI command (the engine handles it).
|
||||
pub fn run_ui_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<Value, String>> {
|
||||
if id == "app.language" {
|
||||
@@ -994,25 +1010,38 @@ pub fn run_ui_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<R
|
||||
}
|
||||
"window.control" => flag(&mut app.ui.control_bar),
|
||||
"window.toolbar" => flag(&mut app.ui.toolbar),
|
||||
"window.toolbarColumns" => {
|
||||
app.ui.toolbar_double = match p.get("double") {
|
||||
None | Some(Value::Null) => !app.ui.toolbar_double,
|
||||
Some(Value::Bool(b)) => *b,
|
||||
Some(_) => return Some(Err("double must be true or false".into())),
|
||||
};
|
||||
Ok(json!(app.ui.toolbar_double))
|
||||
}
|
||||
"window.toolbarColumns" => opt_bool(p, "double").map(|on| {
|
||||
let on = on.unwrap_or(!app.ui.toolbar_double);
|
||||
app.ui.toolbar_double = on;
|
||||
json!(on)
|
||||
}),
|
||||
"window.toolbarAdvanced" => flag(&mut app.ui.toolbar_advanced),
|
||||
"window.floatTools" => {
|
||||
let floating = match p.get("floating") {
|
||||
None | Some(Value::Null) => None,
|
||||
Some(Value::Bool(b)) => Some(*b),
|
||||
Some(_) => return Some(Err("floating must be true or false".into())),
|
||||
let floating = match opt_bool(p, "floating") {
|
||||
Ok(on) => on,
|
||||
Err(e) => return Some(Err(e)),
|
||||
};
|
||||
let Some(tool) = s("tool") else { return Some(Err("tool (a tool id) is required".into())) };
|
||||
crate::toolbar::float_group(app, &tool, floating).map(Value::Bool)
|
||||
}
|
||||
"window.taskBar" => flag(&mut app.ui.task_bar),
|
||||
"window.taskBar.pin" => {
|
||||
let place = &mut app.ui.task_bar_place;
|
||||
opt_bool(p, "pinned").map(|pinned| {
|
||||
let pinned = pinned.unwrap_or(!place.pinned);
|
||||
// Pinning holds the bar where it shows; unpinning lets it follow the selection from
|
||||
// there (the bar turns its pinned spot into an offset when it is next drawn).
|
||||
if pinned && !place.pinned {
|
||||
place.pin_at = place.shown_at;
|
||||
}
|
||||
place.pinned = pinned;
|
||||
json!(pinned)
|
||||
})
|
||||
}
|
||||
"window.taskBar.reset" => {
|
||||
app.ui.task_bar_place = Default::default();
|
||||
Ok(Value::Null)
|
||||
}
|
||||
"window.dock" => {
|
||||
let on = !(app.ui.dock && app.ui.toolbar);
|
||||
app.ui.dock = on;
|
||||
@@ -1020,15 +1049,11 @@ pub fn run_ui_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<R
|
||||
app.ui.control_bar = on;
|
||||
Ok(json!(on))
|
||||
}
|
||||
"window.collapseDock" => {
|
||||
let collapsed = match p.get("collapsed") {
|
||||
None | Some(Value::Null) => !app.ui.dock_collapsed,
|
||||
Some(Value::Bool(b)) => *b,
|
||||
Some(_) => return Some(Err("collapsed must be true or false".into())),
|
||||
};
|
||||
"window.collapseDock" => opt_bool(p, "collapsed").map(|collapsed| {
|
||||
let collapsed = collapsed.unwrap_or(!app.ui.dock_collapsed);
|
||||
crate::dock::set_collapsed(app, collapsed);
|
||||
Ok(json!(collapsed))
|
||||
}
|
||||
json!(collapsed)
|
||||
}),
|
||||
"window.panel" => {
|
||||
let raw = s("panel").unwrap_or_default();
|
||||
// Canonical id (case-insensitive; display labels work too), then the
|
||||
@@ -1340,6 +1365,7 @@ pub fn checked(app: &VectorcraftApp, id: &str, p: &Value) -> Option<bool> {
|
||||
app.ui.floating_flyouts.iter().any(|f| f.tools.iter().any(|id| id == tool))
|
||||
}
|
||||
"window.taskBar" => app.ui.task_bar,
|
||||
"window.taskBar.pin" => app.ui.task_bar_place.pinned,
|
||||
"window.panel" => {
|
||||
let panel = p.get("panel").and_then(Value::as_str).unwrap_or("");
|
||||
let canonical = normalize_panel(panel);
|
||||
|
||||
@@ -258,6 +258,10 @@ pub struct UiState {
|
||||
pub toolbar_advanced: bool,
|
||||
#[serde(default = "yes")]
|
||||
pub task_bar: bool,
|
||||
/// Where the Contextual Task Bar was dragged or pinned. Not saved, as in Illustrator: the bar
|
||||
/// starts under the selection at every launch.
|
||||
#[serde(skip)]
|
||||
pub task_bar_place: TaskBarPlace,
|
||||
/// Last tool shown in each toolbar slot (keyed by the slot's first tool id).
|
||||
#[serde(default)]
|
||||
pub slot_tool: std::collections::BTreeMap<String, String>,
|
||||
@@ -389,6 +393,24 @@ pub struct FloatingFlyout {
|
||||
pub pos: [f32; 2],
|
||||
}
|
||||
|
||||
/// Where the Contextual Task Bar sits once its handle has moved it (`window.taskBar.pin`,
|
||||
/// `window.taskBar.reset`).
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct TaskBarPlace {
|
||||
/// More Options › Pin Bar Position: the bar stays where it is instead of following the selection.
|
||||
pub pinned: bool,
|
||||
/// Where a pinned bar's top-left corner sits from the canvas's top-left (none when it was
|
||||
/// pinned before it ever showed, until it is drawn). Unpinning leaves it for the next frame
|
||||
/// to turn into `offset`.
|
||||
pub pin_at: Option<egui::Vec2>,
|
||||
/// Where the bar was last drawn, from the canvas's top-left: where pinning holds it.
|
||||
pub shown_at: Option<egui::Vec2>,
|
||||
/// How far an unpinned bar was dragged from its place under the selection, which it keeps while
|
||||
/// it follows the selection, and the document (`DocState::uid`) it was moved in: in another
|
||||
/// document the bar starts under the selection again.
|
||||
pub offset: Option<(u64, egui::Vec2)>,
|
||||
}
|
||||
|
||||
impl UiState {
|
||||
/// Clear transient state after loading saved preferences.
|
||||
pub fn sanitized(mut self) -> Self {
|
||||
@@ -427,6 +449,7 @@ impl Default for UiState {
|
||||
toolbar_double: false,
|
||||
toolbar_advanced: false,
|
||||
task_bar: true,
|
||||
task_bar_place: TaskBarPlace::default(),
|
||||
slot_tool: Default::default(),
|
||||
floating_flyouts: vec![],
|
||||
status_bar: true,
|
||||
|
||||
@@ -18,7 +18,7 @@ so only enable it while you use it. Transport: `apps/vectorcraft/src/control_ser
|
||||
| `engine.execute` | `{command, params}` | run any engine or UI command (see `engine.commands`) |
|
||||
| `engine.commands` | | every command with label, shortcut, params doc, enablement |
|
||||
| `document.inspect` | `{depth?, childLimit?}` | layer tree, selection, history, paint defaults; the options slice the layer tree as `document.node {summary: true}` does |
|
||||
| `ui.inspect` | | tool, UI state, `screenMode` (0 normal, 1 full screen with menu bar, 2 full screen, 3 Presentation Mode), view, canvas rect, window size, perf, background saves and exports still running |
|
||||
| `ui.inspect` | | tool, UI state, `screenMode` (0 normal, 1 full screen with menu bar, 2 full screen, 3 Presentation Mode), `taskBar` (`pinned`, and `rect` `[x, y, w, h]` while the Contextual Task Bar shows), view, canvas rect, window size, perf, background saves and exports still running |
|
||||
| `ui.menu.list` / `ui.menu.invoke` | `{command, params}` | the full menu tree / invoke an item |
|
||||
| `ui.contextMenu.list` | | the canvas context menu for the current selection, flattened like `ui.menu.list` (`path` holds its submenus). `ui.click {x, y, button: "right"}` on the canvas opens it, after selecting the object there unless it is already selected |
|
||||
| `ui.tool.select` / `ui.tool.list` | `{tool}` | |
|
||||
@@ -205,6 +205,15 @@ that open its flyout raise the strip instead. The strips (`ui.floating_flyouts`
|
||||
and the strip's top-left corner) are saved with the preferences and in user workspaces; the built-in workspaces
|
||||
float none.
|
||||
|
||||
The Contextual Task Bar: its handle (the grip at its left end) drags it anywhere on the canvas, which always holds
|
||||
it whole, also when the window shrinks. Unpinned, the bar keeps that offset as it follows the selection, until
|
||||
another document becomes active. Its More Options (…) menu has Hide Bar (`window.taskBar`); Pin Bar Position
|
||||
(`window.taskBar.pin {pinned?}`, omitted toggles, checked while pinned), which holds the bar where it is across
|
||||
selection changes (the handle still moves it) and, turned off, lets it follow the selection again from there; Reset
|
||||
Bar Position (`window.taskBar.reset`), which unpins it and puts it back under the selection; and Show Properties
|
||||
Panel. As in Illustrator, neither the position nor the pin is saved: each launch starts with the bar under the
|
||||
selection.
|
||||
|
||||
Flatten Transparency: `ui.flattenTransparencyDialog` opens the `flattenTransparency` dialog for the selection
|
||||
(fields `preset`: a preset name, setting it loads that preset's options; the option keys of
|
||||
`object.flattenTransparency`: `balance` 0–100, `lineArtPpi` and `gradientPpi` 1–2400, `textToOutlines`,
|
||||
|
||||
Reference in new issue
Block a user