mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-20 09:23:10 +01:00
Merge pull request #8669 from storytold/train/carry7992
Add localized menu access keys and nested keyboard navigation (#7992)
This commit is contained in:
9 files changed
+2203
-34
No files matched your search
@@ -17,7 +17,9 @@ impl VectorcraftApp {
|
||||
if self.fonts_ready {
|
||||
tools_float::cancel_move_on_escape(self, ctx);
|
||||
crate::custom_toolbars::cancel_move_on_escape(self, ctx);
|
||||
shortcuts::handle(self, ctx);
|
||||
if !crate::menus::handle_keyboard_input(self, ctx) {
|
||||
shortcuts::handle(self, ctx);
|
||||
}
|
||||
}
|
||||
// A Copy taken in this UI phase (an egui copy event, or a command it runs) is published in
|
||||
// this same pass: waiting for the next `tick` can leave the command unissued when an idle
|
||||
|
||||
@@ -46,6 +46,7 @@ mod bar;
|
||||
mod context;
|
||||
mod entries;
|
||||
mod invoke;
|
||||
mod keyboard;
|
||||
mod labels;
|
||||
mod run;
|
||||
mod slots;
|
||||
@@ -71,6 +72,9 @@ pub(crate) use invoke::graph_dialog;
|
||||
#[cfg(test)]
|
||||
pub(crate) use invoke::with_held_keys;
|
||||
pub use invoke::{click_target, invoke, invoke_from_system_menu};
|
||||
pub(crate) use keyboard::handle_input as handle_keyboard_input;
|
||||
// Shared numeric fields preserve their caret when a transient menu returns their focus.
|
||||
pub(crate) use keyboard::restoring_field_focus;
|
||||
pub(crate) use labels::lists_plugin;
|
||||
pub(crate) use labels::shows_a_name;
|
||||
pub use labels::{CONTEXT_LABELS, DYNAMIC_LABELS, display_label, dynamic_label, item_shortcut, menu_strings};
|
||||
|
||||
+106
-29
@@ -1,33 +1,37 @@
|
||||
use super::entries::{Row, entry, shown_shortcut};
|
||||
use super::invoke::{field_event, focused_text_field, invoke, to_field, with_held_keys};
|
||||
use super::keyboard::{self, AccessRow, SourcePath};
|
||||
use super::tree::menu_tree_named;
|
||||
use super::{Entry, Item, Tokens, Value, VectorcraftApp, widgets};
|
||||
|
||||
/// Render the menu bar.
|
||||
/// The in-window menu bar. Returns where its titles end (x): the bar itself takes the full width.
|
||||
pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let ctx = ui.ctx().clone();
|
||||
// The press that opens a menu takes the keyboard from a focused text field: the field and its
|
||||
// selection are kept while the menus are open, so their Select All, Cut, Copy and Paste act on
|
||||
// its text (#516), the frame after the click that chose them (that click takes the keyboard
|
||||
// from it again).
|
||||
type Field = (egui::Id, egui::text_edit::TextEditState);
|
||||
let (field_key, chosen_key) = (egui::Id::unique("menu-bar-field"), egui::Id::unique("menu-bar-field-event"));
|
||||
let chosen_key = egui::Id::unique("menu-bar-field-event").with(ctx.viewport_id());
|
||||
if let Some(((field, state), e)) = ctx.data(|d| d.get_temp::<(Field, egui::Event)>(chosen_key)) {
|
||||
ctx.data_mut(|d| d.remove::<(Field, egui::Event)>(chosen_key));
|
||||
state.store(&ctx, field);
|
||||
keyboard::restore_field(&ctx, field, state);
|
||||
to_field(&ctx, field, e);
|
||||
}
|
||||
if let Some(field) = focused_text_field(&ctx).and_then(|id| Some((id, egui::TextEdit::load_state(&ctx, id)?))) {
|
||||
ctx.data_mut(|d| d.insert_temp::<Field>(field_key, field));
|
||||
}
|
||||
let mut clicked: Option<(String, Value)> = None;
|
||||
let mut file_open = false;
|
||||
keyboard::remember_field(&ctx);
|
||||
keyboard::begin_bar(&ctx);
|
||||
let tree = menu_tree_named(app.session.prefs.font_names_in_english);
|
||||
// No application menu in the window: the bar starts at File on every
|
||||
// platform. The VectorCraft menu stays in the tree: the native Mac bar takes it from there.
|
||||
let tree: Vec<(&str, Vec<Item>)> = tree.into_iter().filter(|(title, _)| *title != "VectorCraft").collect();
|
||||
let root_rows = keyboard::root_rows(&tree);
|
||||
let show_cues = keyboard::cues(&ctx);
|
||||
// Only the bar temporarily sees no resting pointer while keyboard navigation owns it.
|
||||
// Real movement/clicks keep normal pointer menus; restore before refresh/invoke/other UI.
|
||||
let pointer = keyboard::suppress_stationary_hover(&ctx).then(|| ctx.input_mut(|i| std::mem::take(&mut i.pointer)));
|
||||
let mut clicked: Option<(String, Value)> = None;
|
||||
let mut file_open = false;
|
||||
// A menu bar for its layout and menu-button style, but the titles use `Popup::menu` directly:
|
||||
// egui 0.37's `MenuButton` opens the title under a resting pointer while another menu is open,
|
||||
// and the app switches titles on movement only (`switch_on_hover`, the native behaviour).
|
||||
@@ -35,10 +39,12 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 {
|
||||
.ui(ui, |ui| {
|
||||
let mut titles = Vec::with_capacity(tree.len());
|
||||
for (title, items) in tree.iter() {
|
||||
let text = egui::RichText::new(tl!(title)).size(13.0).color(t.text);
|
||||
let resp = ui.add(egui::Button::new(text));
|
||||
let cue = root_rows.iter().find(|r| r.label == crate::i18n::t(title)).and_then(|r| r.cue.as_ref()).filter(|_| show_cues);
|
||||
let text = keyboard::text(ui, crate::i18n::t(title), "", cue, Some(13.0));
|
||||
let resp = ui.push_id(("menu-bar-root", *title), |ui| ui.add(egui::Button::new(text))).inner;
|
||||
crate::palette::note_spot(ui, resp.rect, || crate::palette::SpotAt::Menu((*title).to_string()));
|
||||
egui::Popup::menu(&resp).show(|ui| menu_body(app, ui, items, &mut clicked));
|
||||
keyboard::bind_root(&ctx, title, &resp);
|
||||
egui::Popup::menu(&resp).show(|ui| bar_menu_body(app, ui, items, &keyboard::root_path(title), &mut clicked));
|
||||
if *title == "File" {
|
||||
file_open = egui::Popup::is_id_open(ui.ctx(), egui::Popup::default_response_id(&resp));
|
||||
}
|
||||
@@ -47,6 +53,10 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 {
|
||||
(ui.cursor().min.x, switch_on_hover(ui.ctx(), &titles))
|
||||
})
|
||||
.inner;
|
||||
if let Some(pointer) = pointer {
|
||||
ctx.input_mut(|i| i.pointer = pointer);
|
||||
}
|
||||
keyboard::finish_bar(&ctx, open, clicked.is_some());
|
||||
// The File menu opening reads the Scripts folder again, for File › Scripts.
|
||||
let file_key = egui::Id::unique("menu-bar-file-open");
|
||||
let file_was_open = ctx.data(|d| d.get_temp::<bool>(file_key)).unwrap_or(false);
|
||||
@@ -58,9 +68,9 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 {
|
||||
// while one is, or the menu would open under them.
|
||||
ctx.data_mut(|d| d.insert_temp(menu_open_id(), open));
|
||||
|
||||
let field = ctx.data(|d| d.get_temp::<Field>(field_key));
|
||||
if !open && focused_text_field(&ctx).is_none() {
|
||||
ctx.data_mut(|d| d.remove::<Field>(field_key));
|
||||
let field = keyboard::field(&ctx);
|
||||
if !open && !keyboard::active(&ctx) && focused_text_field(&ctx).is_none() {
|
||||
keyboard::forget_field(&ctx);
|
||||
}
|
||||
if let Some((id, p)) = clicked {
|
||||
match field.and_then(|f| Some((f, field_event(app, &id)?))) {
|
||||
@@ -123,10 +133,37 @@ pub(super) fn menu_body(app: &VectorcraftApp, ui: &mut egui::Ui, items: &[Item],
|
||||
});
|
||||
}
|
||||
|
||||
fn bar_menu_body(app: &VectorcraftApp, ui: &mut egui::Ui, items: &[Item], path: &SourcePath, clicked: &mut Option<(String, Value)>) {
|
||||
if !keyboard::active(ui.ctx()) && !keyboard::cues(ui.ctx()) {
|
||||
menu_body(app, ui, items, clicked);
|
||||
return;
|
||||
}
|
||||
widgets::menu_scroll(ui, |ui| {
|
||||
widgets::menu_min_width(ui, 230.0);
|
||||
render_items_scoped(app, ui, items, true, Some(path), clicked);
|
||||
});
|
||||
}
|
||||
|
||||
/// `items` as menu buttons; with `checks`, items that can be on or off show a check mark (or the
|
||||
/// room for one).
|
||||
pub(super) fn render_items(app: &VectorcraftApp, ui: &mut egui::Ui, items: &[Item], checks: bool, clicked: &mut Option<(String, Value)>) {
|
||||
render_items_scoped(app, ui, items, checks, None, clicked);
|
||||
}
|
||||
|
||||
fn render_items_scoped(
|
||||
app: &VectorcraftApp,
|
||||
ui: &mut egui::Ui,
|
||||
items: &[Item],
|
||||
checks: bool,
|
||||
path: Option<&SourcePath>,
|
||||
clicked: &mut Option<(String, Value)>,
|
||||
) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let rows = path.map(|p| keyboard::level(app, p, items)).unwrap_or_default();
|
||||
let mut rows = rows.iter();
|
||||
if let Some(path) = path {
|
||||
keyboard::note_level(ui.ctx(), path);
|
||||
}
|
||||
for e in items.iter().filter_map(|it| entry(app, it)) {
|
||||
match e {
|
||||
Entry::Sep => {
|
||||
@@ -136,14 +173,40 @@ pub(super) fn render_items(app: &VectorcraftApp, ui: &mut egui::Ui, items: &[Ite
|
||||
ui.label(egui::RichText::new(h).size(11.0).color(t.text_dim));
|
||||
}
|
||||
Entry::Sub(label, children) => {
|
||||
ui.menu_button(label, |ui| {
|
||||
widgets::menu_scroll(ui, |ui| {
|
||||
widgets::menu_min_width(ui, 200.0);
|
||||
render_items(app, ui, children, checks || shows_marks(app, children), clicked);
|
||||
if let Some(access) = rows.next() {
|
||||
ui.push_id(access.key.salt(), |ui| {
|
||||
let cue = access.cue.as_ref().filter(|_| keyboard::cues(ui.ctx()));
|
||||
let text = keyboard::text(ui, label, "", cue, None);
|
||||
if !ui.is_sizing_pass() {
|
||||
keyboard::prepare_submenu(ui.ctx(), access, ui.next_auto_id());
|
||||
}
|
||||
let (response, _) = egui::menu::SubMenuButton::new(text).ui(ui, |ui| {
|
||||
widgets::menu_scroll(ui, |ui| {
|
||||
widgets::menu_min_width(ui, 200.0);
|
||||
render_items_scoped(
|
||||
app,
|
||||
ui,
|
||||
children,
|
||||
checks || shows_marks(app, children),
|
||||
Some(&keyboard::child_path(&access.key)),
|
||||
clicked,
|
||||
);
|
||||
});
|
||||
});
|
||||
if !ui.is_sizing_pass() {
|
||||
keyboard::bind_response(ui.ctx(), access, &response);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
ui.menu_button(label, |ui| {
|
||||
widgets::menu_scroll(ui, |ui| {
|
||||
widgets::menu_min_width(ui, 200.0);
|
||||
render_items(app, ui, children, checks || shows_marks(app, children), clicked);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Entry::Item(row) => render_row(app, ui, &row, checks, clicked),
|
||||
Entry::Item(row) => render_row(app, ui, &row, checks, rows.next(), clicked),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,24 +226,28 @@ fn only_toggles(app: &VectorcraftApp, items: &[Item]) -> bool {
|
||||
|
||||
/// One menu item: its label (with a check mark, or the room for one, under `checks`), its shortcut,
|
||||
/// and Type › Font's samples.
|
||||
fn render_row(app: &VectorcraftApp, ui: &mut egui::Ui, row: &Row, checks: bool, clicked: &mut Option<(String, Value)>) {
|
||||
fn render_row(app: &VectorcraftApp, ui: &mut egui::Ui, row: &Row, checks: bool, access: Option<&AccessRow>, clicked: &mut Option<(String, Value)>) {
|
||||
let sc = row.shortcut.map(shown_shortcut).unwrap_or_default();
|
||||
let Some((id, p)) = row.command else {
|
||||
ui.add_enabled_ui(false, |ui| {
|
||||
ui.add(egui::Button::new(row.label.as_ref()).shortcut_text(sc));
|
||||
let cue = access.and_then(|r| r.cue.as_ref()).filter(|_| keyboard::cues(ui.ctx()));
|
||||
let text = keyboard::text(ui, row.label.as_ref(), "", cue, None);
|
||||
ui.add(egui::Button::new(text).shortcut_text(sc));
|
||||
})
|
||||
.response
|
||||
.on_disabled_hover_text(tl!("Coming soon — tracked in the parity plan"));
|
||||
return;
|
||||
};
|
||||
let text = match row.checked.filter(|_| checks) {
|
||||
Some(true) => format!("✓ {}", row.label),
|
||||
Some(false) => format!(" {}", row.label),
|
||||
None => row.label.to_string(),
|
||||
let prefix = match row.checked.filter(|_| checks) {
|
||||
Some(true) => "✓ ",
|
||||
Some(false) => " ",
|
||||
None => "",
|
||||
};
|
||||
let cue = access.and_then(|r| r.cue.as_ref()).filter(|_| keyboard::cues(ui.ctx()));
|
||||
let text = keyboard::text(ui, row.label.as_ref(), prefix, cue, None);
|
||||
// Type → Font: each family's sample after its name (Enable in-menu font previews).
|
||||
let sampled = p.get("font").and_then(Value::as_str).filter(|_| id == "text.setStyle" && app.session.prefs.font_preview);
|
||||
let r = match sampled {
|
||||
let draw = |ui: &mut egui::Ui| match sampled {
|
||||
Some(family) => {
|
||||
let slot = egui::IdSalt::new(("font-sample", family));
|
||||
let button = egui::Button::new(text).right_text(egui::Atom::custom(slot, crate::font_menu::MENU_SAMPLE_SIZE));
|
||||
@@ -192,12 +259,22 @@ fn render_row(app: &VectorcraftApp, ui: &mut egui::Ui, row: &Row, checks: bool,
|
||||
}
|
||||
None => ui.add_enabled(row.enabled, egui::Button::new(text).shortcut_text(sc)),
|
||||
};
|
||||
let r = match access {
|
||||
Some(access) => ui.push_id(access.key.salt(), draw).inner,
|
||||
None => draw(ui),
|
||||
};
|
||||
let keyboard_chosen = !ui.is_sizing_pass() && access.is_some_and(|access| keyboard::bind_response(ui.ctx(), access, &r));
|
||||
let r = match (row.enabled, disabled_hint(app, id)) {
|
||||
(false, Some(why)) => r.on_disabled_hover_text(why),
|
||||
_ => r,
|
||||
};
|
||||
if r.clicked() {
|
||||
*clicked = row.target().map(|target| with_held_keys(target, ui.input(|i| i.modifiers)));
|
||||
if r.clicked() || keyboard_chosen {
|
||||
*clicked = row.target().map(|target| {
|
||||
if access.is_none() || r.clicked_by(egui::PointerButton::Primary) { with_held_keys(target, ui.input(|i| i.modifiers)) } else { target } // access-key Alt is not an Alt-click alternate action
|
||||
});
|
||||
if access.is_some() {
|
||||
keyboard::chosen(ui.ctx());
|
||||
}
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,940 @@
|
||||
//! Access keys for the in-window menu bar. Native menu labels and command shortcuts stay separate.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::ops::Range;
|
||||
|
||||
use egui::{Context, Event, Id, Key, Modifiers, Response};
|
||||
use serde_json::Value;
|
||||
|
||||
use super::{Entry, Item, VectorcraftApp, entry};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub(super) struct SubKey {
|
||||
source: String,
|
||||
contents: Id,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub(super) struct SourcePath {
|
||||
root: String,
|
||||
parents: Vec<SubKey>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
enum Kind {
|
||||
Sub(SubKey),
|
||||
Command(String, Value),
|
||||
Unavailable(String),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub(super) struct TargetKey {
|
||||
path: SourcePath,
|
||||
kind: Kind,
|
||||
// Dynamic slots can keep their command id while naming a different saved item.
|
||||
binding: Id,
|
||||
}
|
||||
|
||||
impl TargetKey {
|
||||
pub(super) fn salt(&self) -> String {
|
||||
format!("menu-access:{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(super) struct Cue {
|
||||
folded: String,
|
||||
range: Range<usize>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(super) struct AccessRow {
|
||||
pub key: TargetKey,
|
||||
pub label: String,
|
||||
pub cue: Option<Cue>,
|
||||
pub enabled: bool,
|
||||
preferred: Option<char>,
|
||||
}
|
||||
|
||||
type Field = (Id, egui::text_edit::TextEditState);
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
struct State {
|
||||
active: bool,
|
||||
root: Option<String>,
|
||||
open: bool,
|
||||
path: Vec<SubKey>,
|
||||
focus: Option<TargetKey>,
|
||||
focus_request: Option<TargetKey>,
|
||||
scroll_request: Option<TargetKey>,
|
||||
first_request: Option<SourcePath>,
|
||||
root_request: bool,
|
||||
activate: Option<TargetKey>,
|
||||
collision: Option<(String, Vec<TargetKey>, usize)>,
|
||||
invalidated: bool,
|
||||
alt_down: bool,
|
||||
alt_armed: bool,
|
||||
alt_used: bool,
|
||||
composing: bool,
|
||||
modifiers: Modifiers,
|
||||
keyboard_pointer: bool,
|
||||
origin: Option<Id>,
|
||||
document: Option<u64>,
|
||||
titles: Vec<(String, Id, Id)>,
|
||||
registry: Vec<(Id, TargetKey)>,
|
||||
shown: Vec<SourcePath>,
|
||||
}
|
||||
|
||||
fn state_id(ctx: &Context) -> Id {
|
||||
Id::unique("menu-bar-access").with(ctx.viewport_id())
|
||||
}
|
||||
|
||||
fn read(ctx: &Context) -> State {
|
||||
let id = state_id(ctx);
|
||||
ctx.data(|d| d.get_temp(id)).unwrap_or_default()
|
||||
}
|
||||
|
||||
fn write(ctx: &Context, state: State) {
|
||||
let id = state_id(ctx);
|
||||
ctx.data_mut(|d| d.insert_temp(id, state));
|
||||
}
|
||||
|
||||
// Row rendering borrows the stored state in place: never clone its whole growing registry.
|
||||
// Context/focus/scroll calls belong outside this data lock.
|
||||
fn with_state<R>(ctx: &Context, f: impl FnOnce(&mut State) -> R) -> R {
|
||||
let id = state_id(ctx);
|
||||
ctx.data_mut(|d| f(d.get_temp_mut_or_default::<State>(id)))
|
||||
}
|
||||
|
||||
fn field_id(ctx: &Context) -> Id {
|
||||
Id::unique("menu-bar-field").with(ctx.viewport_id())
|
||||
}
|
||||
|
||||
pub(super) fn remember_field(ctx: &Context) {
|
||||
if let Some(id) = super::invoke::focused_text_field(ctx)
|
||||
&& let Some(state) = egui::TextEdit::load_state(ctx, id)
|
||||
{
|
||||
let key = field_id(ctx);
|
||||
ctx.data_mut(|d| d.insert_temp(key, (id, state)));
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn field(ctx: &Context) -> Option<Field> {
|
||||
let id = field_id(ctx);
|
||||
ctx.data(|d| d.get_temp(id))
|
||||
}
|
||||
|
||||
// A menu's focus return resumes the same edit, rather than beginning a new numeric edit.
|
||||
// Keep the marker for every pass of this frame; a sizing/discard pass must not reselect all.
|
||||
fn restoration_id(ctx: &Context, field: Id) -> Id {
|
||||
field.with(("menu-bar-resume-selection", ctx.viewport_id()))
|
||||
}
|
||||
|
||||
pub(super) fn restore_field(ctx: &Context, id: Id, saved: egui::text_edit::TextEditState) {
|
||||
let marker = restoration_id(ctx, id);
|
||||
let frame = ctx.cumulative_frame_nr();
|
||||
ctx.data_mut(|d| d.insert_temp(marker, frame));
|
||||
saved.store(ctx, id);
|
||||
ctx.memory_mut(|m| m.request_focus(id));
|
||||
}
|
||||
|
||||
pub(crate) fn restoring_field_focus(ctx: &Context, field: Id) -> bool {
|
||||
let marker = restoration_id(ctx, field);
|
||||
let frame = ctx.cumulative_frame_nr();
|
||||
ctx.data_mut(|d| {
|
||||
let restoring = d.get_temp::<u64>(marker) == Some(frame);
|
||||
if !restoring {
|
||||
d.remove_temp::<u64>(marker);
|
||||
}
|
||||
restoring
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn forget_field(ctx: &Context) {
|
||||
let id = field_id(ctx);
|
||||
ctx.data_mut(|d| d.remove::<Field>(id));
|
||||
}
|
||||
|
||||
fn supported(ctx: &Context) -> bool {
|
||||
matches!(ctx.os(), egui::os::OperatingSystem::Windows | egui::os::OperatingSystem::Nix)
|
||||
}
|
||||
|
||||
pub(super) fn active(ctx: &Context) -> bool {
|
||||
with_state(ctx, |state| state.active)
|
||||
}
|
||||
|
||||
fn cancel(ctx: &Context, state: &mut State, restore: bool) {
|
||||
for (_, _, popup) in &state.titles {
|
||||
egui::Popup::close_id(ctx, *popup);
|
||||
}
|
||||
state.active = false;
|
||||
state.open = false;
|
||||
state.root_request = false;
|
||||
state.focus_request = None;
|
||||
state.scroll_request = None;
|
||||
state.first_request = None;
|
||||
state.activate = None;
|
||||
state.collision = None;
|
||||
state.path.clear();
|
||||
if restore {
|
||||
if let Some((id, saved)) = field(ctx) {
|
||||
restore_field(ctx, id, saved);
|
||||
} else if let Some(id) = state.origin {
|
||||
ctx.memory_mut(|m| m.request_focus(id));
|
||||
} else if let Some(id) = ctx.memory(|m| m.focused()) {
|
||||
ctx.memory_mut(|m| m.surrender_focus(id));
|
||||
}
|
||||
}
|
||||
if !restore
|
||||
&& let Some(focused) = ctx.memory(|m| m.focused())
|
||||
&& (state.titles.iter().any(|(_, id, _)| *id == focused) || state.registry.iter().any(|(id, _)| *id == focused))
|
||||
{
|
||||
ctx.memory_mut(|m| m.surrender_focus(focused));
|
||||
}
|
||||
state.origin = None;
|
||||
ctx.request_repaint();
|
||||
}
|
||||
|
||||
fn enter(app: &VectorcraftApp, ctx: &Context, state: &mut State) {
|
||||
if !state.active {
|
||||
remember_field(ctx);
|
||||
state.origin = ctx.memory(|m| m.focused());
|
||||
state.document = app.session.active().map(|d| d.uid);
|
||||
state.active = true;
|
||||
}
|
||||
state.keyboard_pointer = true;
|
||||
}
|
||||
|
||||
fn choose_root(app: &VectorcraftApp, ctx: &Context, state: &mut State, root: String, open: bool) {
|
||||
enter(app, ctx, state);
|
||||
for (_, _, popup) in &state.titles {
|
||||
egui::Popup::close_id(ctx, *popup);
|
||||
}
|
||||
// Closing a popup alone keeps egui's open-submenu state for the next pass. A newly
|
||||
// selected root must discard those descendants before reopening in this same pass.
|
||||
ctx.data_mut(|data| data.remove_by_type::<egui::containers::menu::MenuState>());
|
||||
state.root = Some(root.clone());
|
||||
state.invalidated = false;
|
||||
state.open = open;
|
||||
state.path.clear();
|
||||
state.focus = None;
|
||||
state.focus_request = None;
|
||||
state.scroll_request = None;
|
||||
state.activate = None;
|
||||
state.collision = None;
|
||||
state.root_request = true;
|
||||
state.first_request = open.then_some(SourcePath { root, parents: vec![] });
|
||||
ctx.request_repaint();
|
||||
}
|
||||
|
||||
fn folded(text: &str) -> String {
|
||||
text.chars().flat_map(char::to_lowercase).collect()
|
||||
}
|
||||
|
||||
fn characters(label: &str) -> Vec<Cue> {
|
||||
let mut out = vec![];
|
||||
let mut seen = HashSet::new();
|
||||
let mut push = |at: usize, ch: char| {
|
||||
let key = folded(&ch.to_string());
|
||||
if seen.insert(key.clone()) {
|
||||
out.push(Cue { folded: key, range: at..at + ch.len_utf8() });
|
||||
}
|
||||
};
|
||||
// Word initials first, then all letters/digits. Literal punctuation is a last resort for a
|
||||
// user-named row containing no other character; it is never interpreted as markup.
|
||||
let mut initial = true;
|
||||
for (at, ch) in label.char_indices() {
|
||||
if ch.is_alphanumeric() && initial {
|
||||
push(at, ch);
|
||||
}
|
||||
initial = !ch.is_alphanumeric();
|
||||
}
|
||||
for (at, ch) in label.char_indices().filter(|(_, c)| c.is_alphanumeric()) {
|
||||
push(at, ch);
|
||||
}
|
||||
for (at, ch) in label.char_indices().filter(|(_, c)| !c.is_whitespace() && !c.is_control()) {
|
||||
push(at, ch);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn assign(rows: &mut [AccessRow]) {
|
||||
let mut occupied = HashSet::new();
|
||||
// Reserve the reported paths before earlier siblings take their letters.
|
||||
for row in rows.iter_mut() {
|
||||
if let Some(wanted) = row.preferred.map(|c| folded(&c.to_string()))
|
||||
&& let Some(cue) = characters(&row.label).into_iter().find(|c| c.folded == wanted)
|
||||
{
|
||||
occupied.insert(cue.folded.clone());
|
||||
row.cue = Some(cue);
|
||||
}
|
||||
}
|
||||
for row in rows.iter_mut().filter(|r| r.cue.is_none()) {
|
||||
let choices = characters(&row.label);
|
||||
row.cue = choices.iter().find(|c| !occupied.contains(&c.folded)).or_else(|| choices.first()).cloned();
|
||||
if let Some(cue) = &row.cue {
|
||||
occupied.insert(cue.folded.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn roots(app: &VectorcraftApp) -> Vec<(&'static str, Vec<Item>)> {
|
||||
super::menu_tree_named(app.session.prefs.font_names_in_english).into_iter().filter(|(name, _)| *name != "VectorCraft").collect()
|
||||
}
|
||||
|
||||
pub(super) fn root_rows(tree: &[(&str, Vec<Item>)]) -> Vec<AccessRow> {
|
||||
let mut rows: Vec<_> = tree
|
||||
.iter()
|
||||
.map(|(source, _)| AccessRow {
|
||||
key: TargetKey {
|
||||
path: SourcePath { root: (*source).into(), parents: vec![] },
|
||||
kind: Kind::Unavailable((*source).into()),
|
||||
binding: Id::unique(("menu-root-binding", source, crate::i18n::t(source))),
|
||||
},
|
||||
label: crate::i18n::t(source).into(),
|
||||
cue: None,
|
||||
enabled: true,
|
||||
preferred: match *source {
|
||||
"File" => Some('f'),
|
||||
"Edit" => Some('e'),
|
||||
"Object" => Some('o'),
|
||||
"Type" => Some('t'),
|
||||
"Select" => Some('s'),
|
||||
"Effect" => Some('c'),
|
||||
"View" => Some('v'),
|
||||
"Window" => Some('w'),
|
||||
"Help" => Some('h'),
|
||||
_ => None,
|
||||
},
|
||||
})
|
||||
.collect();
|
||||
assign(&mut rows);
|
||||
rows
|
||||
}
|
||||
|
||||
fn sub_key(source: &str, items: &[Item]) -> SubKey {
|
||||
// Source names, command ids and params (not translated labels or visible row positions).
|
||||
// A changed dynamic folder definition invalidates its old selection rather than retargeting it.
|
||||
SubKey { source: source.into(), contents: Id::unique(("menu-submenu-definition", format!("{items:?}"))) }
|
||||
}
|
||||
|
||||
pub(super) fn root_path(source: &str) -> SourcePath {
|
||||
SourcePath { root: source.into(), parents: vec![] }
|
||||
}
|
||||
|
||||
pub(super) fn child_path(key: &TargetKey) -> SourcePath {
|
||||
let mut path = key.path.clone();
|
||||
if let Kind::Sub(sub) = &key.kind {
|
||||
path.parents.push(sub.clone());
|
||||
}
|
||||
path
|
||||
}
|
||||
|
||||
pub(super) fn level(app: &VectorcraftApp, path: &SourcePath, items: &[Item]) -> Vec<AccessRow> {
|
||||
let mut rows = vec![];
|
||||
for item in items {
|
||||
match entry(app, item) {
|
||||
Some(Entry::Sub(label, children)) => {
|
||||
let Item::Sub(source, _) = item else { continue };
|
||||
rows.push(AccessRow {
|
||||
key: TargetKey {
|
||||
path: path.clone(),
|
||||
kind: Kind::Sub(sub_key(source, children)),
|
||||
binding: Id::unique(("menu-submenu-binding", source, label)),
|
||||
},
|
||||
label: label.into(),
|
||||
cue: None,
|
||||
enabled: true,
|
||||
preferred: (path.root == "Object" && path.parents.is_empty() && *source == "Path").then_some('p'),
|
||||
});
|
||||
}
|
||||
Some(Entry::Item(row)) => {
|
||||
let target = row.target();
|
||||
let preferred = row.command.and_then(|(id, _)| match id {
|
||||
"object.path.offsetPath" => Some('o'),
|
||||
"select.save" if path.root == "Select" && path.parents.is_empty() => Some('s'),
|
||||
"select.editSaved" if path.root == "Select" && path.parents.is_empty() => Some('e'),
|
||||
_ => None,
|
||||
});
|
||||
rows.push(AccessRow {
|
||||
key: TargetKey {
|
||||
path: path.clone(),
|
||||
kind: target.map_or_else(|| Kind::Unavailable(row.source.into()), |(id, params)| Kind::Command(id, params)),
|
||||
binding: Id::unique(("menu-row-binding", row.source, row.label.as_ref())),
|
||||
},
|
||||
label: row.label.into_owned(),
|
||||
cue: None,
|
||||
enabled: row.enabled && row.command.is_some(),
|
||||
preferred,
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
assign(&mut rows);
|
||||
rows
|
||||
}
|
||||
|
||||
fn current_rows(app: &VectorcraftApp, state: &State) -> Option<Vec<AccessRow>> {
|
||||
let root = state.root.as_deref()?;
|
||||
let tree = roots(app);
|
||||
let (_, items) = tree.iter().find(|(name, _)| *name == root)?;
|
||||
let mut items = items.as_slice();
|
||||
for wanted in &state.path {
|
||||
items = items.iter().find_map(|item| match item {
|
||||
Item::Sub(source, children) if *source == wanted.source.as_str() && sub_key(source, children) == *wanted => Some(children.as_slice()),
|
||||
_ => None,
|
||||
})?;
|
||||
}
|
||||
Some(level(app, &SourcePath { root: root.into(), parents: state.path.clone() }, items))
|
||||
}
|
||||
|
||||
fn mnemonic(rows: &[AccessRow], text: &str) -> Vec<TargetKey> {
|
||||
let folded = folded(text);
|
||||
rows.iter().filter(|r| r.enabled && r.cue.as_ref().is_some_and(|c| c.folded == folded)).map(|r| r.key.clone()).collect()
|
||||
}
|
||||
|
||||
fn letter(app: &VectorcraftApp, ctx: &Context, state: &mut State, text: &str, fallback: Option<&str>, root_chord: bool) -> bool {
|
||||
// A newly pressed Alt chord addresses the bar, even while a submenu is open.
|
||||
let rows = if state.active && state.open && !root_chord { current_rows(app, state) } else { Some(root_rows(&roots(app))) };
|
||||
let Some(rows) = rows else {
|
||||
cancel(ctx, state, true);
|
||||
return true;
|
||||
};
|
||||
let mut matches = mnemonic(&rows, text);
|
||||
if matches.is_empty()
|
||||
&& let Some(fallback) = fallback
|
||||
{
|
||||
matches = mnemonic(&rows, fallback);
|
||||
}
|
||||
if matches.is_empty() {
|
||||
return state.active;
|
||||
}
|
||||
if root_chord || !state.active || !state.open {
|
||||
if let Some(target) = matches.first() {
|
||||
choose_root(app, ctx, state, target.path.root.clone(), true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
let chosen = if matches.len() == 1 {
|
||||
state.collision = None;
|
||||
matches.first().cloned()
|
||||
} else {
|
||||
let token = folded(text);
|
||||
let index = match &state.collision {
|
||||
Some((old, keys, at)) if old == &token && keys == &matches => (at + 1) % matches.len(),
|
||||
_ => 0,
|
||||
};
|
||||
let chosen = matches.get(index).cloned();
|
||||
state.collision = Some((token, matches, index));
|
||||
chosen
|
||||
};
|
||||
if let Some(chosen) = chosen {
|
||||
state.invalidated = false;
|
||||
state.focus_request = Some(chosen.clone());
|
||||
state.focus = Some(chosen.clone());
|
||||
// A submenu mnemonic focuses its genuine button; real Right/Enter enters it through
|
||||
// egui, including its RTL and stationary-pointer handling. Collisions require Enter.
|
||||
if matches!(chosen.kind, Kind::Command(..)) && state.collision.is_none() {
|
||||
state.activate = Some(chosen);
|
||||
}
|
||||
state.keyboard_pointer = true;
|
||||
ctx.request_repaint();
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn owner_blocks(app: &VectorcraftApp, ctx: &Context, state: &State) -> bool {
|
||||
!supported(ctx)
|
||||
|| !ctx.input(|i| i.focused)
|
||||
|| app.file_dialog_open()
|
||||
|| app.ui.dialog.is_some()
|
||||
|| app.ui.palette_open
|
||||
|| app.ui.screen_mode == 3
|
||||
|| app.ui.tools_drawer
|
||||
|| crate::updates_ui::blocks_input(app)
|
||||
|| !app.held_tool.is_empty()
|
||||
|| app.session.tool_busy()
|
||||
|| app.session.tool_composing()
|
||||
|| state.composing
|
||||
|| crate::scrub::phase(ctx) != crate::scrub::Phase::Idle
|
||||
|| crate::canvas::dragging(ctx)
|
||||
|| ctx.dragged_id().is_some()
|
||||
}
|
||||
|
||||
fn update_composition(ctx: &Context, state: &mut State, events: &[Event]) -> bool {
|
||||
if !events.iter().any(|e| matches!(e, Event::ModifiersChanged(_) | Event::Key { .. })) {
|
||||
state.modifiers = ctx.input(|i| i.modifiers);
|
||||
}
|
||||
let mut ime = false;
|
||||
for event in events {
|
||||
match event {
|
||||
Event::Ime(egui::ImeEvent::Preedit { text, .. }) => {
|
||||
state.composing = !text.is_empty();
|
||||
ime = true;
|
||||
}
|
||||
Event::Ime(egui::ImeEvent::Commit(_)) => {
|
||||
state.composing = false;
|
||||
ime = true;
|
||||
}
|
||||
#[allow(deprecated)]
|
||||
Event::Ime(egui::ImeEvent::Disabled) => {
|
||||
state.composing = false;
|
||||
ime = true;
|
||||
}
|
||||
Event::Ime(_) => ime = true,
|
||||
Event::WindowFocused(false) => {
|
||||
state.alt_down = false;
|
||||
state.alt_armed = false;
|
||||
state.composing = false;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
ime
|
||||
}
|
||||
|
||||
fn prepare_input(app: &VectorcraftApp, ctx: &Context, state: &mut State, events: &[Event]) -> Option<bool> {
|
||||
let ime = update_composition(ctx, state, events);
|
||||
if ime || owner_blocks(app, ctx, state) {
|
||||
if state.active {
|
||||
cancel(ctx, state, ime && app.ui.dialog.is_none());
|
||||
}
|
||||
state.alt_armed = false;
|
||||
return None;
|
||||
}
|
||||
if !state.active && egui::Popup::is_any_open(ctx) {
|
||||
if let Some((source, _, _)) = state.titles.iter().find(|(_, _, id)| egui::Popup::is_id_open(ctx, *id)).cloned() {
|
||||
enter(app, ctx, state);
|
||||
state.root = Some(source);
|
||||
state.open = true;
|
||||
state.keyboard_pointer = false;
|
||||
} else {
|
||||
state.alt_armed = false;
|
||||
return None; // context menu/popover owns its own keys
|
||||
}
|
||||
}
|
||||
refresh_targets(app, ctx, state);
|
||||
let pointer_activity = ctx.input(|i| i.pointer.delta() != egui::Vec2::ZERO || i.pointer.any_click() || i.pointer.any_down());
|
||||
if pointer_activity {
|
||||
state.invalidated = false;
|
||||
state.keyboard_pointer = false;
|
||||
state.alt_armed = false;
|
||||
}
|
||||
Some(pointer_activity)
|
||||
}
|
||||
|
||||
fn refresh_targets(app: &VectorcraftApp, ctx: &Context, state: &mut State) {
|
||||
if state.active && state.document != app.session.active().map(|d| d.uid) {
|
||||
cancel(ctx, state, false);
|
||||
}
|
||||
if !state.root_request
|
||||
&& !state.invalidated
|
||||
&& let Some(focused) = ctx.memory(|m| m.focused())
|
||||
&& let Some((_, key)) = state.registry.iter().find(|(id, _)| *id == focused)
|
||||
{
|
||||
state.focus = Some(key.clone());
|
||||
state.path = key.path.parents.clone();
|
||||
}
|
||||
// Re-resolve current labels/targets; a vanished dynamic target never invokes its replacement.
|
||||
if state.active && state.open {
|
||||
match current_rows(app, state) {
|
||||
Some(rows) => {
|
||||
if state.focus.as_ref().is_some_and(|key| !rows.iter().any(|r| &r.key == key)) {
|
||||
if let Some(id) = ctx.memory(|m| m.focused()) {
|
||||
ctx.memory_mut(|m| m.surrender_focus(id));
|
||||
}
|
||||
state.invalidated = true;
|
||||
state.first_request = None;
|
||||
state.scroll_request = None;
|
||||
state.focus = None;
|
||||
state.focus_request = None;
|
||||
state.activate = None;
|
||||
state.collision = None;
|
||||
}
|
||||
}
|
||||
None => {
|
||||
if let Some(id) = ctx.memory(|m| m.focused()) {
|
||||
ctx.memory_mut(|m| m.surrender_focus(id));
|
||||
}
|
||||
state.invalidated = true;
|
||||
state.first_request = None;
|
||||
state.scroll_request = None;
|
||||
state.path.clear();
|
||||
state.focus = None;
|
||||
state.focus_request = None;
|
||||
state.activate = None;
|
||||
state.collision = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn modifiers_changed(app: &VectorcraftApp, ctx: &Context, state: &mut State, m: &Modifiers, pointer_activity: bool, owned: &mut bool) {
|
||||
let plain_alt = m.alt && !m.ctrl && !m.command && !m.mac_cmd;
|
||||
if plain_alt && !state.alt_down {
|
||||
state.alt_armed = !pointer_activity;
|
||||
state.alt_used = false;
|
||||
}
|
||||
if !m.alt && state.alt_down {
|
||||
if state.alt_armed && !state.alt_used {
|
||||
*owned = true;
|
||||
if state.active {
|
||||
cancel(ctx, state, true);
|
||||
} else {
|
||||
choose_root(app, ctx, state, "File".into(), false);
|
||||
}
|
||||
}
|
||||
state.alt_armed = false;
|
||||
}
|
||||
if m.ctrl || m.command || m.mac_cmd {
|
||||
state.alt_armed = false;
|
||||
state.alt_used = true;
|
||||
if state.active {
|
||||
cancel(ctx, state, true);
|
||||
}
|
||||
*owned = false;
|
||||
}
|
||||
state.alt_down = m.alt;
|
||||
}
|
||||
|
||||
fn consume_event(consumed: &mut [bool], at: usize) {
|
||||
if let Some(c) = consumed.get_mut(at) {
|
||||
*c = true;
|
||||
}
|
||||
}
|
||||
|
||||
fn horizontal_navigation(app: &VectorcraftApp, ctx: &Context, state: &mut State, key: Key) -> bool {
|
||||
let towards = if ctx.global_style().right_to_left { Key::ArrowLeft } else { Key::ArrowRight };
|
||||
let submenu = state.focus.as_ref().is_some_and(|f| matches!(f.kind, Kind::Sub(_)));
|
||||
if key != towards || !submenu {
|
||||
let roots = roots(app);
|
||||
if let Some(index) = roots.iter().position(|(s, _)| Some(*s) == state.root.as_deref()) {
|
||||
let forward = (key == Key::ArrowRight) != ctx.global_style().right_to_left;
|
||||
let next = if forward { (index + 1) % roots.len() } else { (index + roots.len() - 1) % roots.len() };
|
||||
if let Some((root, _)) = roots.get(next) {
|
||||
let was_open = state.open;
|
||||
choose_root(app, ctx, state, (*root).into(), was_open);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn navigation_key(app: &VectorcraftApp, ctx: &Context, state: &mut State, key: Key, consumed: &mut [bool], at: usize, owned: &mut bool) -> bool {
|
||||
match key {
|
||||
Key::Enter | Key::Space if state.invalidated => {
|
||||
// A disappeared item is not permission to activate the next slot,
|
||||
// including when egui gives that replacement its default focus.
|
||||
consume_event(consumed, at);
|
||||
*owned = true;
|
||||
true
|
||||
}
|
||||
Key::Escape if state.path.is_empty() => {
|
||||
cancel(ctx, state, true);
|
||||
*owned = true;
|
||||
consume_event(consumed, at);
|
||||
true
|
||||
}
|
||||
Key::Escape | Key::ArrowUp | Key::ArrowDown | Key::ArrowLeft | Key::ArrowRight | Key::Enter | Key::Space => {
|
||||
if matches!(key, Key::ArrowLeft | Key::ArrowRight) && state.path.is_empty() {
|
||||
if horizontal_navigation(app, ctx, state, key) {
|
||||
consume_event(consumed, at);
|
||||
}
|
||||
} else if !state.open && matches!(key, Key::ArrowDown | Key::Enter | Key::Space) {
|
||||
if let Some(root) = state.root.clone() {
|
||||
choose_root(app, ctx, state, root, true);
|
||||
}
|
||||
consume_event(consumed, at);
|
||||
}
|
||||
*owned = true;
|
||||
true // egui owns the remaining navigation keys
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn pressed_key(app: &VectorcraftApp, ctx: &Context, state: &mut State, events: &[Event], at: usize, consumed: &mut [bool], owned: &mut bool) {
|
||||
let Event::Key { key, physical_key, pressed: true, repeat, modifiers } = &events[at] else {
|
||||
return;
|
||||
};
|
||||
if modifiers.ctrl || modifiers.command || modifiers.mac_cmd || (modifiers.alt && matches!(key, Key::Tab | Key::Space)) {
|
||||
state.alt_armed = false;
|
||||
state.alt_used = true;
|
||||
if state.active {
|
||||
cancel(ctx, state, true);
|
||||
*owned = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
let access = state.active || modifiers.alt;
|
||||
if !access {
|
||||
return;
|
||||
}
|
||||
if modifiers.alt && crate::shortcuts::runs_a_shortcut(key.name(), physical_key.unwrap_or(*key).name(), *modifiers) {
|
||||
state.alt_armed = false;
|
||||
state.alt_used = true;
|
||||
if state.active {
|
||||
cancel(ctx, state, true);
|
||||
*owned = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if state.active {
|
||||
state.keyboard_pointer = true;
|
||||
if matches!(key, Key::ArrowUp | Key::ArrowDown | Key::ArrowLeft | Key::ArrowRight) {
|
||||
state.invalidated = false;
|
||||
}
|
||||
if navigation_key(app, ctx, state, *key, consumed, at, owned) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let root_chord = modifiers.alt && !state.alt_used;
|
||||
state.alt_used = true;
|
||||
state.alt_armed = false;
|
||||
// Native input is Key then Text. Prefer its delivered Unicode text, while keeping
|
||||
// the logical/Latin key as fallback. The pair is consumed together, exactly once.
|
||||
let text_at = events
|
||||
.iter()
|
||||
.enumerate()
|
||||
.skip(at + 1)
|
||||
.take_while(|(_, e)| !matches!(e, Event::Key { pressed: true, .. } | Event::Ime(_)))
|
||||
.find_map(|(i, e)| matches!(e, Event::Text(_)).then_some(i));
|
||||
let text = text_at.and_then(|i| events.get(i)).and_then(|e| if let Event::Text(t) = e { Some(t.as_str()) } else { None });
|
||||
let fallback = key.name();
|
||||
if !*repeat && letter(app, ctx, state, text.unwrap_or(fallback), Some(fallback), root_chord) || state.active {
|
||||
*owned = true;
|
||||
consume_event(consumed, at);
|
||||
if let Some(i) = text_at {
|
||||
consume_event(consumed, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn text_event(app: &VectorcraftApp, ctx: &Context, state: &mut State, text: &str, consumed: &mut [bool], at: usize, owned: &mut bool) {
|
||||
if state.modifiers.ctrl || state.modifiers.command || state.modifiers.mac_cmd {
|
||||
state.alt_armed = false;
|
||||
state.alt_used = true;
|
||||
if state.active {
|
||||
cancel(ctx, state, true);
|
||||
}
|
||||
*owned = false;
|
||||
// AltGr/Ctrl text belongs downstream, even without a Key event.
|
||||
} else if state.active || state.alt_down && state.alt_armed {
|
||||
let root_chord = state.alt_down && !state.alt_used;
|
||||
state.alt_used = true;
|
||||
state.alt_armed = false;
|
||||
if letter(app, ctx, state, text, None, root_chord) || state.active {
|
||||
*owned = true;
|
||||
consume_event(consumed, at);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Called only by App's existing once-per-frame gate, BEFORE ordinary shortcuts.
|
||||
pub(crate) fn handle_input(app: &mut VectorcraftApp, ctx: &Context) -> bool {
|
||||
let mut state = read(ctx);
|
||||
let events = ctx.input(|i| i.events.clone());
|
||||
let Some(pointer_activity) = prepare_input(app, ctx, &mut state, &events) else {
|
||||
write(ctx, state);
|
||||
return false;
|
||||
};
|
||||
let mut owned = state.active;
|
||||
let mut consumed = vec![false; events.len()];
|
||||
for (at, event) in events.iter().enumerate() {
|
||||
if consumed.get(at).copied().unwrap_or(false) {
|
||||
continue;
|
||||
}
|
||||
match event {
|
||||
Event::ModifiersChanged(m)
|
||||
| Event::Key { modifiers: m, .. }
|
||||
| Event::PointerButton { modifiers: m, .. }
|
||||
| Event::MouseWheel { modifiers: m, .. } => state.modifiers = *m,
|
||||
_ => {}
|
||||
}
|
||||
match event {
|
||||
Event::ModifiersChanged(m) => modifiers_changed(app, ctx, &mut state, m, pointer_activity, &mut owned),
|
||||
Event::Key { pressed: true, .. } => pressed_key(app, ctx, &mut state, &events, at, &mut consumed, &mut owned),
|
||||
Event::Text(text) => text_event(app, ctx, &mut state, text, &mut consumed, at, &mut owned),
|
||||
Event::PointerButton { .. } | Event::MouseWheel { .. } => {
|
||||
// Preserve event order: wheel hands scrolling to the real pointer, but a later
|
||||
// navigation key owns it again. Smoothed wheel tails must not undo that choice.
|
||||
state.keyboard_pointer = false;
|
||||
state.alt_armed = false;
|
||||
state.alt_used = true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
ctx.input_mut(|i| {
|
||||
let mut at = 0;
|
||||
i.events.retain(|_| {
|
||||
let keep = !consumed.get(at).copied().unwrap_or(false);
|
||||
at += 1;
|
||||
keep
|
||||
});
|
||||
});
|
||||
write(ctx, state);
|
||||
owned
|
||||
}
|
||||
|
||||
pub(super) fn begin_bar(ctx: &Context) {
|
||||
with_state(ctx, |state| {
|
||||
state.registry.clear();
|
||||
state.shown.clear();
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn cues(ctx: &Context) -> bool {
|
||||
supported(ctx) && with_state(ctx, |state| state.active || state.alt_down && state.alt_armed)
|
||||
}
|
||||
|
||||
pub(super) fn suppress_stationary_hover(ctx: &Context) -> bool {
|
||||
let keyboard = with_state(ctx, |state| state.active && state.keyboard_pointer);
|
||||
keyboard && ctx.input(|i| i.pointer.delta() == egui::Vec2::ZERO && !i.pointer.any_click() && !i.pointer.any_down())
|
||||
}
|
||||
|
||||
pub(super) fn bind_root(ctx: &Context, source: &str, response: &Response) {
|
||||
let popup = egui::Popup::default_response_id(response);
|
||||
let requested = with_state(ctx, |state| {
|
||||
if let Some(root) = state.titles.iter_mut().find(|(name, _, _)| name == source) {
|
||||
*root = (source.into(), response.id, popup);
|
||||
} else {
|
||||
state.titles.push((source.into(), response.id, popup));
|
||||
}
|
||||
if state.active && state.root_request && state.root.as_deref() == Some(source) {
|
||||
state.root_request = false;
|
||||
Some(state.open)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
if let Some(open) = requested {
|
||||
response.request_focus();
|
||||
if open {
|
||||
egui::Popup::open_id(ctx, popup);
|
||||
} else {
|
||||
egui::Popup::close_id(ctx, popup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn note_level(ctx: &Context, path: &SourcePath) {
|
||||
with_state(ctx, |state| state.shown.push(path.clone()));
|
||||
}
|
||||
|
||||
// The public SubMenuButton uses this same next_auto_id for its genuine button. Let its own
|
||||
// Right/Enter/RTL path open it. Only request focus after releasing the data lock.
|
||||
pub(super) fn prepare_submenu(ctx: &Context, row: &AccessRow, id: Id) {
|
||||
let request = with_state(ctx, |state| {
|
||||
let focus_here = match &state.focus_request {
|
||||
Some(wanted) => wanted == &row.key,
|
||||
None => state.first_request.as_ref() == Some(&row.key.path),
|
||||
};
|
||||
if state.active && row.enabled && focus_here {
|
||||
state.focus = Some(row.key.clone());
|
||||
state.focus_request = None;
|
||||
state.first_request = None;
|
||||
state.scroll_request = Some(row.key.clone());
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
});
|
||||
if request {
|
||||
ctx.memory_mut(|m| m.request_focus(id));
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn bind_response(ctx: &Context, row: &AccessRow, response: &Response) -> bool {
|
||||
let has_focus = response.has_focus();
|
||||
let (request_focus, scroll, activate) = with_state(ctx, |state| {
|
||||
state.registry.push((response.id, row.key.clone()));
|
||||
let scroll = state.scroll_request.as_ref() == Some(&row.key);
|
||||
if scroll {
|
||||
state.scroll_request = None;
|
||||
}
|
||||
let focus_here = match &state.focus_request {
|
||||
Some(wanted) => wanted == &row.key,
|
||||
None => state.first_request.as_ref() == Some(&row.key.path),
|
||||
};
|
||||
let request_focus = state.active && row.enabled && focus_here;
|
||||
if request_focus {
|
||||
state.focus_request = None;
|
||||
state.first_request = None;
|
||||
state.focus = Some(row.key.clone());
|
||||
}
|
||||
if has_focus && !state.invalidated {
|
||||
state.focus = Some(row.key.clone());
|
||||
}
|
||||
// Real egui arrow navigation changes focus without a helper focus_request.
|
||||
// Keep that keyboard row visible, while pointer/wheel scrolling keeps its own position.
|
||||
let focused_keyboard_row = state.active && state.keyboard_pointer && !state.invalidated && row.enabled && has_focus;
|
||||
let activate = state.active && row.enabled && state.activate.as_ref() == Some(&row.key);
|
||||
if activate {
|
||||
state.activate = None;
|
||||
state.active = false;
|
||||
state.open = false;
|
||||
state.root_request = false;
|
||||
}
|
||||
(request_focus, scroll || request_focus || focused_keyboard_row, activate)
|
||||
});
|
||||
if request_focus {
|
||||
response.request_focus();
|
||||
}
|
||||
if scroll {
|
||||
response.scroll_to_me(None);
|
||||
}
|
||||
activate
|
||||
}
|
||||
|
||||
pub(super) fn chosen(ctx: &Context) {
|
||||
with_state(ctx, |state| {
|
||||
state.active = false;
|
||||
state.open = false;
|
||||
state.activate = None;
|
||||
state.root_request = false;
|
||||
state.collision = None;
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn finish_bar(ctx: &Context, open: bool, command_chosen: bool) {
|
||||
let mut state = read(ctx);
|
||||
if state.active {
|
||||
if let Some((source, _, _)) = state.titles.iter().find(|(_, _, id)| egui::Popup::is_id_open(ctx, *id)).cloned() {
|
||||
state.root = Some(source.clone());
|
||||
state.open = true;
|
||||
state.path =
|
||||
state.shown.iter().filter(|p| p.root == source).max_by_key(|p| p.parents.len()).map(|p| p.parents.clone()).unwrap_or_default();
|
||||
} else if !open && (state.open || ctx.input(|i| i.pointer.any_click())) {
|
||||
// Bare Alt exposes cues without a popup; an outside click still ends access mode.
|
||||
let restore = !command_chosen && !ctx.input(|i| i.pointer.any_click());
|
||||
cancel(ctx, &mut state, restore);
|
||||
}
|
||||
}
|
||||
write(ctx, state);
|
||||
}
|
||||
|
||||
/// A layout job changes only presentation; literal '&'/'_' and all native/shared labels survive.
|
||||
pub(super) fn text(ui: &egui::Ui, label: &str, prefix: &str, cue: Option<&Cue>, size: Option<f32>) -> egui::WidgetText {
|
||||
let Some(cue) = cue else {
|
||||
let text = format!("{prefix}{label}");
|
||||
return match size {
|
||||
Some(size) => egui::RichText::new(text).size(size).color(super::Tokens::get(ui.ctx()).text).into(),
|
||||
None => text.into(),
|
||||
};
|
||||
};
|
||||
let Some((before, rest)) = label.split_at_checked(cue.range.start) else { return format!("{prefix}{label}").into() };
|
||||
let Some((letter, after)) = rest.split_at_checked(cue.range.len()) else { return format!("{prefix}{label}").into() };
|
||||
let mut font = egui::TextStyle::Button.resolve(ui.style());
|
||||
if let Some(size) = size {
|
||||
font.size = size;
|
||||
}
|
||||
let format = egui::TextFormat { font_id: font, color: ui.visuals().text_color(), ..Default::default() };
|
||||
let mut job = egui::text::LayoutJob::default();
|
||||
job.append(&format!("{prefix}{before}"), 0.0, format.clone());
|
||||
job.append(letter, 0.0, egui::TextFormat { underline: egui::Stroke::new(1.0, format.color), ..format.clone() });
|
||||
job.append(after, 0.0, format);
|
||||
job.into()
|
||||
}
|
||||
@@ -200,7 +200,11 @@ pub(super) fn select_all_on_focus(ui: &Ui, resp: &Response, text: &str) {
|
||||
d.remove_temp::<egui::Pos2>(press_pos);
|
||||
});
|
||||
}
|
||||
if !(resp.gained_focus() && !pressed || resp.double_clicked() || clicked_focus && !dragged) {
|
||||
// Returning from a transient menu resumes its saved caret/selection. This is not the
|
||||
// keyboard focus that starts a new numeric edit; pointer taps/double-clicks still select all.
|
||||
// The menu helper's data borrow ends here, before TextEdit's state is loaded below.
|
||||
let restored_focus = crate::menus::restoring_field_focus(ui.ctx(), resp.id);
|
||||
if !(resp.gained_focus() && !pressed && !restored_focus || resp.double_clicked() || clicked_focus && !dragged) {
|
||||
return;
|
||||
}
|
||||
if let Some(st) = egui::TextEdit::load_state(ui.ctx(), resp.id) {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -1,6 +1,6 @@
|
||||
# Roadmap: milestones and what's next
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: M4: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, #8128; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the customLine truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: M4: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, #8128; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › EdiLine truncated
|
||||
>
|
||||
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
|
||||
>
|
||||
@@ -244,6 +244,7 @@ not take the artwork yet. Overflow-menu drag remains separate. Scores and hours
|
||||
| 2026-11-16 | minor | Eraser review (#6582): hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving visible fitted gradients. Visible unsupported paint branches retain existing fitting. Scores and estimates unchanged. |
|
||||
| 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. |
|
||||
| 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. |
|
||||
| 2026-11-15 | minor | M14: localized Windows/Linux menu access keys and nested navigation, including Select Save/Edit (#6596); estimates unchanged. |
|
||||
| 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. |
|
||||
| 2026-11-15 | minor | M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimates unchanged |
|
||||
| 2026-11-14 | minor | #7717: Backquote/~ arrow nudges for selected pattern fills and strokes retain normal increment/Shift and idle-tool behavior. Scores and estimates unchanged. |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Parity with Adobe Illustrator
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged;Line truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuatLine truncated
|
||||
>
|
||||
> Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5).
|
||||
>
|
||||
@@ -1154,6 +1154,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- A Recent Commands button beside the Help › Search Commands field lists the last five commands, tools, panels and effects picked from the palette, most recent first, with a command picked again moved to the top. Choosing a row closes the palette and runs it as a pick of the same result does; with no picks yet the list shows a dimmed No recent commands row, and a command that is not available now, such as a filter of a plug-in that is not loaded, is left out until it comes back. The ids are saved with the UI state. While the list is open, Up and Down move through its rows, wrapping at the ends, and Escape closes the list before the palette. This is VectorCraft's own addition and does not raise a score (#6376; `palette` tests `recent_commands_*`, `a_recent_command_runs_what_its_pick_runs`, `the_keys_wrap_within_recent_commands`, `escape_closes_recent_commands_before_the_palette`).
|
||||
- The app bar's search control is a field showing a magnifier, "Search commands" and the Help › Search Commands… shortcut. The field shows no shortcut when the shortcut is cleared or too long to fit beside the text; the tooltip and the screen-reader name still give it. A click on the field, or Enter or Space while it has the keyboard focus, toggles the command palette as the shortcut does, and the palette's popup holds the text field. While the field has the focus, the app's existing rule for a focused control keeps the app's own keys off, so Enter does not open Move and Tab moves the focus on. While a dialog is open the field and the icon are drawn disabled and do nothing, as the shortcut does. Screen readers name the field and the icon Search commands, with the shortcut. As the bar narrows, the community button goes first, then Explore tutorials, then the field becomes the magnifier icon, then the workspace switcher narrows to 64 points, then the icon goes; Safe Mode's label keeps its room first. The field is wider than the icon, so the community button and Explore tutorials go at wider bars than they did beside the icon. This is VectorCraft's own addition and does not raise a score (`chrome::tests`: `the_app_bar_gives_up_its_right_hand_controls_in_order`, `a_wide_app_bar_shows_a_search_field_with_the_palette_shortcut`, `the_search_field_follows_the_palettes_shortcut`, `a_long_shortcut_leaves_the_search_hint_readable`, `a_click_on_the_search_field_opens_the_palette`, `the_search_icon_has_the_fields_name_and_both_are_disabled_under_a_dialog`, `the_keyboard_opens_the_palette_from_the_search_field`, `a_narrowing_app_bar_turns_the_search_field_into_the_icon`).
|
||||
- The Learn panel (Window › Learn, or Explore tutorials beside the search field on the app bar) has a For you tab with a Get started section and a Quick skill guide card, and a Skills tab that lists VectorCraft's own skills with their progress rings and counts of tutorials finished; a skill lists its tutorials, a tutorial shows its numbered steps, and Back goes up a level; `learn.list`, `learn.tab {tab}`, `learn.skill {skill}`, `learn.show {tutorial}` and `learn.back` script it, and the tab buttons, the rows and Back run them ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`).
|
||||
- **Windows/Linux menu access keys (#6596):** Alt+letter opens any of the nine in-window menu roots, with access letters underlined in the current language; letters and arrow keys reach visible nested and dynamic menus. Alt+O, P, Right, O opens Offset Path; in English, Alt+S, S opens Save Selection and Alt+S, E opens Edit Selection. Disabled items stay unavailable, colliding letters cycle choices for Enter, and changed menus discard stale choices. Escape and focus loss dismiss menu access while text editing, IME/AltGr input, custom shortcuts and active tool/pointer gestures keep their normal ownership. Keyboard focus reveals rows in long menus and wheel scrolling returns control to the pointer (`crates/ui-egui/tests/menu_access_keys.rs`).
|
||||
- A tool's name in a Learn tutorial step is a blue link that shows where the tool is without choosing it (`learn.locateTool {tool}`): its toolbar button is marked, a collapsed group's flyout opens with the tool's row marked, a torn-off strip comes to the front, and a tool no shown toolbar holds is marked in the All Tools drawer. The mark, its 3 seconds and the hidden-toolbar cases are VectorCraft's own rules ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`, the `a_learn_link_*` tests in `toolbar::tests`).
|
||||
- Under a tutorial's steps, View more opens the tutorial's own practice sample as a new untitled document, and once the tutorial is finished, Next Up moves to the next tutorial in the same skill, as the help page describes ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html)). The samples are VectorCraft's own drawings. A Finish tutorial button that shows once the sample is open, the untitled copy, Back to skills in place of Next Up after a skill's last tutorial, and Next Up showing the next tutorial without opening its sample are VectorCraft's own rules. `learn.openSample`, `learn.finish`, `learn.next` and `learn.skills` (Back to skills) script them. Not done: the help page's short video. Regression tests: `view_more_opens_the_tutorial_s_sample_as_a_new_untitled_document`, `finishing_a_tutorial_offers_next_up_in_its_skill`, `the_practice_controls_work_from_the_keyboard`, `the_last_tutorial_of_a_skill_offers_back_to_skills`, `learn_finish_and_learn_next_follow_the_practice`, `learn_skills_shows_the_list_of_skills`, `the_practice_commands_reject_a_missing_or_unknown_tutorial`, `every_tutorial_has_its_own_readable_sample` and `the_next_tutorial_is_the_next_one_in_the_same_skill` in `crates/ui-egui/src/panels/learn/tests.rs`.
|
||||
- A Learn tutorial's steps are marked complete as the learner works, and a skill's progress ring fills as its tutorials are finished, as the help page describes ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html)). Each step has a check box that marks it done once the tutorial's sample is open (`learn.markStep`); Finish tutorial marks every step done; a skill's count shows its tutorials finished of all, and a finished tutorial has a check mark in its skill's list. Marking steps by hand, the count, keeping the progress in the preferences (the web build keeps it while the page is open) and Reset progress (`learn.resetProgress`) are VectorCraft's own rules; `learn.list` reports the progress. Regression tests: `a_step_s_check_box_marks_only_that_step`, `a_step_s_check_box_works_from_the_keyboard`, `finishing_tutorials_fills_their_skill_s_ring_and_count`, `a_skill_with_no_tutorials_shows_0_of_0`, `learn_mark_step_checks_its_params`, `reset_progress_clears_only_the_progress`, `the_preferences_keep_the_progress` and `saved_progress_is_read_leniently` in `crates/ui-egui/src/panels/learn/tests.rs`.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# UI and interaction parity
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Layers panel: Alt over the list shows the copy cursor while rows or the selected-art square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Remove Background in the Contextual Task Bar, Properties › Quick Actions and the Control bar; previously minor: Ruler origin: the corner drag snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; #3380Line truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Layers panel: Alt over the list shows the copy cursor while rows or the selected-art square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Remove Background in the Contextual Task Bar, Properties › Quick Actions and the Control bar; previously minor: Ruler origin: the corner drag snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on Line truncated
|
||||
>
|
||||
> Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5).
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user