Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Merge remote-tracking branch 'origin/main' into space-hold-pan

helgehelge123bb59018de674
diff --cc crates/ui-egui/src/control.rs
index 372c135dc,caacbc590..73c8bc2c2
--- a/crates/ui-egui/src/control.rs
+++ b/crates/ui-egui/src/control.rs
@@@ -590,13 -600,208 +600,217 @@@ pub fn export_active(app: &mut Lightcra
Ok(out)
}
- pub fn save_screenshot(app: &mut LightcraftApp, image: &egui::ColorImage, path: Option<&str>) -> Value {
+ /// Resolve one queued synthetic-input control request against the **current** layout.
+ ///
+ /// Called by the app only after a completed UI pass newer than admission (plan §4.5). Widget rects
+ /// and the image rect therefore come from that pass; nothing is retargeted. A successful return
+ /// has pushed the events onto `app.synthetic`; the app answers the request once the UI consumed
+ /// them.
+ pub(crate) fn gesture_events(app: &mut LightcraftApp, ctx: &egui::Context, method: &str, p: &Value) -> Result<GestureOutcome, String> {
+ let s = |k: &str| p.get(k).and_then(Value::as_str);
+ let f = |k: &str| p.get(k).and_then(Value::as_f64);
+ match method {
+ "ui.clickWidget" | "ui.dragWidget" | "ui.hoverWidget" => {
+ let Some(id) = s("id") else { return Err("missing `id`".into()) };
+ let Some(r) = widget_rect(app, id) else { return Err(format!("no widget `{id}` on screen (see ui.widgets)")) };
+ let m = modifiers(p);
+ let (fx, fy) = (f("fx").unwrap_or(0.5), f("fy").unwrap_or(0.5));
+ let at = egui::pos2(r.left() + r.width() * fx as f32, r.top() + r.height() * fy as f32);
+ if !fx.is_finite() || !fy.is_finite() || !at.is_finite() {
+ return Err(format!("{method}: fx and fy must resolve to a finite point"));
+ }
+ let hover = method == "ui.hoverWidget";
+ if hover && !widget_target_visible(ctx, widget_hit(app, id), at) {
+ return Err(format!("ui.hoverWidget: widget `{id}` has no visible interaction area at the requested point"));
+ }
+ if hover {
+ app.synthetic.push(egui::Event::PointerMoved(at));
+ } else if method == "ui.clickWidget" {
+ let n = p.get("count").and_then(Value::as_u64).unwrap_or(1).min(MAX_CLICKS);
+ let button = if s("button") == Some("right") { egui::PointerButton::Secondary } else { egui::PointerButton::Primary };
+ app.synthetic.push(egui::Event::PointerMoved(at));
+ for _ in 0..n {
+ app.synthetic.push(egui::Event::PointerButton { pos: at, button, pressed: true, modifiers: m });
+ app.synthetic.push(egui::Event::PointerButton { pos: at, button, pressed: false, modifiers: m });
+ }
+ } else {
+ let to = egui::pos2(
+ f("toX").map(|v| v as f32).unwrap_or(at.x + f("dx").unwrap_or(0.0) as f32),
+ f("toY").map(|v| v as f32).unwrap_or(at.y + f("dy").unwrap_or(0.0) as f32),
+ );
+ push_drag(app, at, to, p.get("steps").and_then(Value::as_u64).unwrap_or(10).min(MAX_DRAG_STEPS), m);
+ }
+ ctx.request_repaint();
+ Ok(GestureOutcome {
+ result: json!({"rect": rect_json(r)}),
+ target: Some(GestureTarget { id: id.to_string(), rect: r, at, check_release: method == "ui.clickWidget", check_visible: hover }),
+ })
+ }
+ "ui.move" => {
+ app.synthetic.push(egui::Event::PointerMoved(egui::pos2(f("x").unwrap_or(0.0) as f32, f("y").unwrap_or(0.0) as f32)));
+ ctx.request_repaint();
+ Ok(GestureOutcome::done(Value::Null))
+ }
+ "ui.click" | "ui.drag" => {
+ let a = egui::pos2(f("x").unwrap_or(0.0) as f32, f("y").unwrap_or(0.0) as f32);
+ let m = modifiers(p);
+ let button = if s("button") == Some("right") { egui::PointerButton::Secondary } else { egui::PointerButton::Primary };
+ if method == "ui.drag" {
+ let b = egui::pos2(f("toX").unwrap_or(0.0) as f32, f("toY").unwrap_or(0.0) as f32);
+ push_drag(app, a, b, p.get("steps").and_then(Value::as_u64).unwrap_or(10).min(MAX_DRAG_STEPS), m);
+ } else {
+ app.synthetic.push(egui::Event::PointerMoved(a));
+ for _ in 0..p.get("count").and_then(Value::as_u64).unwrap_or(1).min(MAX_CLICKS) {
+ app.synthetic.push(egui::Event::PointerButton { pos: a, button, pressed: true, modifiers: m });
+ app.synthetic.push(egui::Event::PointerButton { pos: a, button, pressed: false, modifiers: m });
+ }
+ }
+ ctx.request_repaint();
+ Ok(GestureOutcome::done(Value::Null))
+ }
+ "ui.pointer" => {
+ let Some(img) = app.image_rect else { return Err("no image on screen (switch to Detail view)".into()) };
+ let Some(events) = p.get("events").and_then(Value::as_array) else { return Err("missing `events`".into()) };
+ let m = modifiers(p);
+ for e in events {
+ let x = e.get("x").and_then(Value::as_f64).unwrap_or(0.5) as f32;
+ let y = e.get("y").and_then(Value::as_f64).unwrap_or(0.5) as f32;
+ let pos = egui::pos2(img.left() + x * img.width(), img.top() + y * img.height());
+ match e.get("kind").and_then(Value::as_str).unwrap_or("move") {
+ "down" => {
+ app.synthetic.push(egui::Event::PointerMoved(pos));
+ app.synthetic.push(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: true, modifiers: m });
+ }
+ "up" => {
+ app.synthetic.push(egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: false, modifiers: m })
+ }
+ _ => app.synthetic.push(egui::Event::PointerMoved(pos)),
+ }
+ }
+ ctx.request_repaint();
+ Ok(GestureOutcome::done(json!({"events": events.len()})))
+ }
+ "ui.key" => {
+ let Some(k) = s("key").and_then(key_from) else { return Err("unknown or missing `key`".into()) };
+ let m = modifiers(p);
- app.synthetic.push(egui::Event::Key { key: k, physical_key: None, pressed: true, repeat: false, modifiers: m });
- app.synthetic.push(egui::Event::Key { key: k, physical_key: None, pressed: false, repeat: false, modifiers: m });
++ // {action?: "press" | "down" | "up"}: down … up holds the key across other input (Space
++ // held over a drag); a press is both in one frame
++ let (down, up) = match s("action").unwrap_or("press") {
++ "press" => (true, true),
++ "down" => (true, false),
++ "up" => (false, true),
++ other => return Err(format!("ui.key: action {other:?} (press, down or up)")),
++ };
++ for pressed in [down.then_some(true), up.then_some(false)].into_iter().flatten() {
++ app.synthetic.push(egui::Event::Key { key: k, physical_key: None, pressed, repeat: false, modifiers: m });
++ }
+ ctx.request_repaint();
+ Ok(GestureOutcome::done(Value::Null))
+ }
+ "ui.text" => {
+ app.synthetic.push(egui::Event::Text(s("text").unwrap_or("").to_string()));
+ ctx.request_repaint();
+ Ok(GestureOutcome::done(Value::Null))
+ }
+ "ui.clipboard" => {
+ // RequestPaste is a viewport command, not an event: the prompt/library input barrier
+ // cannot inspect it after the fact. Refuse the command while either barrier owns input,
+ // including a window created after this pass began resolving the gesture. Without
+ // `text` this only queues RequestPaste in egui; it is not a host-dispatch or delivery
+ // acknowledgement. egui 0.37 documents RequestPaste as asking the host to paste into
+ // the focused text edit, with no completion or correlation id. egui-winit emits a later
+ // Event::Paste only for non-empty text (or a PasteImage fallback; Wayland reads finish
+ // later), so a barrier created after the request can drop that later event; the reply
+ // below cannot promise dispatch or delivery. With `text`, the synthetic
+ // Event::Paste is filtered and canceled like other injected input.
+ let barrier = if crate::panels::notices::blocks_input(app) {
+ Some("a modal prompt")
+ } else if crate::panels::library_problem::blocks_dialog_input(app) {
+ Some("the blocking library window")
+ } else {
+ None
+ };
+ if let Some(barrier) = barrier {
+ return Err(format!("ui.clipboard: {barrier} is blocking background input"));
+ }
+ if !ctx.text_edit_focused() {
+ return Err("ui.clipboard: no text field has the focus (click one first)".into());
+ }
+ match s("action") {
+ Some("cut") => app.synthetic.push(egui::Event::Cut),
+ Some("copy") => app.synthetic.push(egui::Event::Copy),
+ Some("paste") => match s("text") {
+ Some(text) => app.synthetic.push(egui::Event::Paste(text.to_string())),
+ None => ctx.send_viewport_cmd(egui::ViewportCommand::RequestPaste),
+ },
+ _ => return Err("ui.clipboard: `action` is cut, copy or paste".into()),
+ }
+ ctx.request_repaint();
+ Ok(GestureOutcome::done(Value::Null))
+ }
+ "ui.scroll" => {
+ // Omitted keys keep the pre-0.37 request meaning; all other values are validated
+ // before anything is queued.
+ let source = match s("source") {
+ None | Some("unknown") => egui::MouseWheelSource::Unknown,
+ Some("wheel") => egui::MouseWheelSource::Wheel,
+ Some("trackpad") => egui::MouseWheelSource::Trackpad,
+ Some("momentum") => egui::MouseWheelSource::Momentum,
+ Some(other) => return Err(format!("ui.scroll: `source` is wheel, trackpad, momentum or unknown, not {other:?}")),
+ };
+ let unit = match s("unit") {
+ None | Some("point") => egui::MouseWheelUnit::Point,
+ Some("line") => egui::MouseWheelUnit::Line,
+ Some("page") => egui::MouseWheelUnit::Page,
+ Some(other) => return Err(format!("ui.scroll: `unit` is point, line or page, not {other:?}")),
+ };
+ let phase = match s("phase") {
+ None | Some("move") => egui::TouchPhase::Move,
+ Some("start") => egui::TouchPhase::Start,
+ Some("end") => egui::TouchPhase::End,
+ Some("cancel") => egui::TouchPhase::Cancel,
+ Some(other) => return Err(format!("ui.scroll: `phase` is start, move, end or cancel, not {other:?}")),
+ };
+ app.synthetic.push(egui::Event::MouseWheel {
+ unit,
+ delta: egui::vec2(f("dx").unwrap_or(0.0) as f32, f("dy").unwrap_or(0.0) as f32),
+ phase,
+ source,
+ modifiers: modifiers(p),
+ });
+ ctx.request_repaint();
+ Ok(GestureOutcome::done(Value::Null))
+ }
+ "ui.zoom" => {
+ let Some(factor) = f("factor").map(|v| v as f32).filter(|v| v.is_finite() && *v > 0.0) else {
+ return Err("ui.zoom: factor must be a finite positive number (1 = unchanged)".into());
+ };
+ app.synthetic.push(egui::Event::Zoom(factor));
+ ctx.request_repaint();
+ Ok(GestureOutcome::done(Value::Null))
+ }
+ other => Err(format!("not a synthetic-input gesture: `{other}`")),
+ }
+ }
+
+ /// Encode `image` as PNG and write it to the capture's pinned target, returning the control
+ /// protocol's JSON result. The destination is revalidated before encoding; a new path is written
+ /// with create-new semantics (never replacing a file that appeared), and a missing encoder or
+ /// writer is an error. `None` only reports the image size without writing.
+ pub fn save_screenshot(app: &mut LightcraftApp, image: &egui::ColorImage, target: Option<&lightcraft_engine::originals::WriteTarget>) -> Value {
let [w, h] = image.size;
- let Some(path) = path else {
+ let Some(target) = target else {
return json!({"ok": true, "result": {"width": w, "height": h}});
};
- let rgba: Vec<u8> = image.pixels.iter().flat_map(|c| c.to_array()).collect();
- let Some(img) = lightcraft_raster::Rgba8::from_bytes(w, h, &rgba) else {
+ // Re-check the pinned destination immediately before encoding/writing. This is the point the
+ // asynchronous renderer callback and the CPU fallback share.
+ if let Err(error) = app.session.revalidate_write_target(target) {
+ return json!({"ok": false, "error": error});
+ }
+ // Rgba8's buffer is the only extra full-image allocation while encoding (the PNG bytes are
+ // the second transient; see MAX_SHOT_WORKING_SET_BYTES in `lib.rs`). Building it straight from
+ // the `Color32` pixels avoids the former flat `Vec<u8>` copy of the same image.
+ let Some(img) = lightcraft_raster::Rgba8::from_pixels(w, h, image.pixels.iter().map(|c| c.to_array())) else {
return json!({"ok": false, "error": "bad screenshot buffer"});
};
let Some(png) = app.services.png.as_ref() else { return json!({"ok": false, "error": "no encoder"}) };
diff --cc crates/ui-egui/src/lib.rs
index 4ca7b1bdd,be1a9e879..28622bbbe
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@@ -439,12 -498,16 +501,18 @@@ pub struct LightcraftApp
/// drawn last (`ui.inspect` → `scroll`).
pub grid_scroll: Option<f32>,
pub film_scroll: Option<f32>,
- /// Widget registry from the last frame (automation ids → rects).
+ /// Widget registry from the last completed, nondiscarded frame (automation ids → rects).
pub widgets: Vec<(String, egui::Rect)>,
+ /// Egui hit owners for [`Self::widgets`] from the same completed pass. A press is delivered
+ /// only when this id still owns egui's pointer hit (see `control::widget_target_visible`).
+ pub widget_hits: Vec<(String, widgets::WidgetHit)>,
+ /// Registry collected by the pass being laid out, published only if that pass completes.
+ next_widgets: Vec<(String, egui::Rect)>,
+ next_widget_hits: Vec<(String, widgets::WidgetHit)>,
/// In-progress on-canvas gesture (brush stroke points, gradient drag…).
pub gesture: Option<panels::detail::Gesture>,
+ /// Space is held over a tool on the photo: the view's hand has the pointer ([`space_hand`]).
+ pub space_hand: Option<space_hand::SpaceHand>,
/// The brush stroke being painted, as drawn on the photo until it's committed (issue #517).
pub brush_live: Option<brush_live::LiveStroke>,
/// What the loupe drew last frame: photo and source ("render", "cached", "embedded", "small",
@@@ -573,8 -659,10 +664,11 @@@ impl LightcraftApp
grid_scroll: None,
film_scroll: None,
widgets: vec![],
+ widget_hits: vec![],
+ next_widgets: vec![],
+ next_widget_hits: vec![],
gesture: None,
+ space_hand: None,
brush_live: None,
loupe_shown: None,
region_view: None,
@@@ -1457,21 -2374,13 +2380,23 @@@
if self.synthetic.is_empty() {
return;
}
- let n = match self.synthetic[0] {
- egui::Event::PointerMoved(_) | egui::Event::PointerButton { .. } | egui::Event::MouseWheel { .. } => 1,
- _ => self.synthetic.iter().position(|e| matches!(e, egui::Event::Key { pressed: false, .. })).map_or(self.synthetic.len(), |i| i + 1),
+ let pointer =
+ |e: &egui::Event| matches!(e, egui::Event::PointerMoved(_) | egui::Event::PointerButton { .. } | egui::Event::MouseWheel { .. });
+ let n = if pointer(&self.synthetic[0]) {
+ 1
+ } else {
+ // a key sequence up to its release; a key held down (no release yet) stops before the
+ // pointer events that follow, which then still come one per frame
+ let release = self.synthetic.iter().position(|e| matches!(e, egui::Event::Key { pressed: false, .. })).map(|i| i + 1);
+ let next_pointer = self.synthetic.iter().position(pointer);
+ match (release, next_pointer) {
+ (Some(r), Some(q)) => r.min(q),
+ (r, q) => r.or(q).unwrap_or(self.synthetic.len()),
+ }
};
- if let Some(egui::Event::PointerMoved(p) | egui::Event::PointerButton { pos: p, .. }) = self.synthetic.first() {
+ // A press needs the pointer at its position before the button event; the move that is
+ // itself the first event is delivered by the drain below, so it must not be sent twice.
+ if let Some(egui::Event::PointerButton { pos: p, .. }) = self.synthetic.first() {
raw.events.push(egui::Event::PointerMoved(*p));
}
// egui's `input.modifiers` follow `ModifiersChanged` events, not the modifiers carried by
diff --cc crates/ui-egui/src/shortcuts.rs
index 6a9e19a4f,8ea82f68d..7bf9b778d
--- a/crates/ui-egui/src/shortcuts.rs
+++ b/crates/ui-egui/src/shortcuts.rs
@@@ -349,9 -363,10 +363,12 @@@ fn keyboard_owned(app: &LightcraftApp,
})
}
+ /// Dispatch the global shortcut pass. It yields while a dialog, prompt, blocking library window,
+ /// text field, name edit or shortcut recording owns input, then fires saved command bindings,
+ /// aliases and fixed photo keys, respecting native menu ownership and open popups.
pub fn handle(app: &mut LightcraftApp, ctx: &egui::Context) {
+ // Space held over a tool ends when the key is up, whoever has the keyboard by then
+ crate::space_hand::tick(app, ctx);
if !matches!(app.ui.dialog, Some(crate::state::Dialog::Shortcuts)) {
app.recording_shortcut = None;
}
diff --cc docs/control-protocol.md
index 8acbbe8a5,3b4c7ed95..4fe43b686
--- a/docs/control-protocol.md
+++ b/docs/control-protocol.md
@@@ -79,13 -81,13 +81,13 @@@ filmstrip is visible
| `ui.menu.tree` | — | The menu bar as shown (File … Help): items `{id, params?, label, shortcut?, enabled, checked?}`, separators, submenus — the model behind the native macOS menu bar and the in-window menus |
| `ui.inspect` | — | UI state, window, `loupe` (`source`, `pending`, `failed` = why its render failed, else `null`, and `region: {full, window, pending}` when a zoomed view also renders the window on screen at no more than 100 % — `full` is the frame it is cut from, `window` its `[x, y, w, h]` — and `regionBefore` for the Before side of a Before/After view), canvas/image rects, `scroll: {grid, filmstrip}` (scroll offsets in points, `null` until drawn), active photo, selection, perf (`frameMs` = layout, `logicMs` = per-frame logic before it, `updateMs` = both, `maxUpdateMs`, `fps`, render queue …, `gpu` = adapter in use, `gpuReason` = why renders don't use the GPU, `gpuFallback` = latest render redone on the CPU and why — see `docs/gpu-pipeline.md`), status, memory (bytes per cache, see `library.memory`; plus stage caches — `budgetBytes`, `trimmed`, `sharedSourceBytes` (the one device copy of a big original) — and textures), `export: {running: {total, done, current} \| null, last}`, `notices` (warnings waiting to be shown, e.g. a damaged settings file; OK = `button:noticeOk`), `quitPrompt` (why quitting was stopped: tasks that would be cut short are running — `button:quitAnyway` cancels them and quits, `button:quitCancel` keeps working — or unsaved changes: `button:quitRetry` / `button:quitAnyway` / `button:quitCancel`), `import: {done, total, imported, cancelled} \| null` (an import runs on a worker thread), `tasks` (other background work: `Find Missing Photos`, `Auto Import`), `activity` (every long-running task in flight as the activity stack in the top-left corner shows it, same shape as `activity.list`; a row appears once its task is 0.5 s old, ids `activity:row:<id>`, ✕ = `activity:cancel:<id>`, `activity:more` expands past 3 rows), `fileDialogs` (commands waiting on a native file dialog, which runs off the UI thread; they run again with the answer when it closes), `copied` (the text the UI last put on the clipboard, `null` until something is copied) |
| `ui.widgets` | `{filter?}` | On-screen widgets `{id, rect: [x, y, w, h]}` (screen points) |
- | `ui.clickWidget` / `ui.dragWidget` / `ui.hoverWidget` | `{id, count?, button?, fx?, fy?}` (`button: "right"` right-clicks) / `{id, toX?, toY?, dx?, dy?, steps?}` / `{id, fx?, fy?}` | Real egui input on a widget (hover: the pointer rests on it, e.g. for preset/profile previews) |
- | `ui.move` / `ui.click` / `ui.drag` | `{x, y, count?, button?}` / `{x, y, toX, toY, steps?}` | Raw pointer input, screen points |
+ | `ui.clickWidget` / `ui.dragWidget` / `ui.hoverWidget` | `{id, count?, button?, fx?, fy?}` (`button: "right"` right-clicks; `count` is capped at 16) / `{id, toX?, toY?, dx?, dy?, steps?}` (steps are capped at 1000) / `{id, fx?, fy?}` | Real egui input on a widget (hover: the pointer rests on it, e.g. for preset/profile previews). `fx`/`fy` are fractions of the registered rect and may lie outside `[0,1]`; the resulting point must still be inside egui's clipped interaction rect, and a non-finite fraction or resolved point is rejected before any input is queued. Geometry comes from the latest completed layout; if the widget moves before the first event or before a press, or its latest clipped rect no longer contains the point, the request fails with an error instead of clicking another widget or retargeting. A target below an ordinary modal dialog may succeed as a no-op or a backdrop click, because egui routes that input to the dialog; a target covered by a non-modal overlay fails. The blocking library-problem/launch-list window is explicit: its dim takes the modal layer, but a background target fails instead of reporting a no-op success, and only that window's own controls (`button:library…`) pass. Its creation frame is shielded and redrawn with empty input like a prompt's, so background text/pointer input cannot act while the new modal areas settle. A quit prompt or settings notice is a real egui modal scope with a foreground backdrop. Only its own buttons (`button:quit…`, `button:noticeOk`) accept a `ui.clickWidget`; background targets fail, and background keystrokes, text/clipboard input, wheel/zoom input and AccessKit actions are dropped before panels see them. The prompt itself takes Tab/Shift+Tab, Enter/Space on the focused button, and Escape/Enter for the safe default Cancel; AccessKit Focus/Click works when targeted at a prompt button. Its first creation frame (including a Tasks→Unsaved or notice→next-notice transition) is shielded and redrawn with empty input, so a press/release in that frame, or a held press from before it, cannot act underneath it; a synthetic drag already in progress is canceled. Once settled, raw `ui.click`/`ui.drag`/`ui.pointer` and backdrop clicks are still delivered to the prompt backdrop as no-ops, and the prompt's own button clicks work normally. The area/layer check cannot see a different widget covering the point in the same layer. A `ui.clickWidget` whose widget disappears before its release also fails, after canceling the pointer press without a click or drag (the same rules apply when a click spans several host frames) |
+ | `ui.move` / `ui.click` / `ui.drag` | `{x, y, count?, button?}` / `{x, y, toX, toY, steps?}` | Raw pointer input, screen points (the same click and step caps apply) |
| `ui.pointer` | `{events: [{kind: down\|drag\|up, x, y}], alt?, shift?, cmd?}` | Gesture in normalized image coordinates (Detail view) |
- | `ui.key` | `{key, action?: press\|down\|up, cmd?, shift?, alt?, ctrl?}` | Key press (default), or the key going `down` and staying held until an `up` (Space held over a `ui.pointer` drag) |
-| `ui.key` | `{key, cmd?, shift?, alt?, ctrl?}` | Key press; while a prompt is up only its Tab/Shift+Tab, Enter, Space and Escape are delivered, every other key is dropped |
++| `ui.key` | `{key, action?: press\|down\|up, cmd?, shift?, alt?, ctrl?}` | Key press (default), or the key going `down` and staying held until an `up` (Space held over a `ui.pointer` drag); while a prompt is up only its Tab/Shift+Tab, Enter, Space and Escape are delivered, every other key is dropped |
| `ui.text` | `{text}` | Text input |
- | `ui.clipboard` | `{action: cut\|copy\|paste, text?}` | Cut, copy or paste in the focused text field, as the system does for ⌘X / ⌘C / ⌘V; `paste` pastes `text`, or the system clipboard without it. Refused when no text field has the focus (outside one, ⌘C / ⌘V are the commands `develop.copy` / `develop.paste`). In the desktop app cut and copy write the system clipboard. `ui.inspect` → `copied` is the text the UI last put on the clipboard |
- | `ui.scroll` | `{dx, dy, cmd?, ctrl?, shift?, alt?}` | Wheel / two-finger scroll at the current pointer; pans over the image, modifier-scroll zooms |
+ | `ui.clipboard` | `{action: cut\|copy\|paste, text?}` | Cut, copy or paste in the focused text field, as the system does for ⌘X / ⌘C / ⌘V; `paste` pastes `text`, or the system clipboard without it. Refused when no text field has the focus (outside one, ⌘C / ⌘V are the commands `develop.copy` / `develop.paste`). In the desktop app cut and copy write the system clipboard. Refused while a prompt or the blocking library window owns input, including a window in its creation frame. A `paste` without `text` queues egui's `RequestPaste` viewport command for the host: egui 0.37 gives that command no completion/correlation id, and egui-winit emits a later `Event::Paste` only for non-empty text (or a `PasteImage` fallback; asynchronous clipboard reads finish later), so the reply confirms the request was queued in egui, not that the host dispatched it or that it was delivered; a barrier created after the request can drop that later event. `paste` with `text` is synthetic and is canceled like other injected input. `ui.inspect` → `copied` is the text the UI last put on the clipboard |
+ | `ui.scroll` | `{dx, dy, source?, unit?, phase?, cmd?, ctrl?, shift?, alt?}` | Wheel / two-finger scroll at the current pointer; pans over the image, modifier-scroll zooms. `source` is `unknown` (default), `wheel`, `trackpad` or `momentum`; `unit` is `point` (default), `line` or `page`; `phase` is `move` (default), `start`, `end` or `cancel`. Wheel/line events drive the grid/filmstrip one-third wheel step and the loupe's notch zoom; trackpad/momentum phases drive kinetic scrolling and rubber-band boundaries. Invalid values are refused and queue nothing |
| `ui.zoom` | `{factor}` | Pinch zoom at the current pointer (positive scale multiplier; 1 = unchanged). Position it first with `ui.move` or `ui.hoverWidget` |
| `ui.set` | partial UI state, e.g. `{"view": "detail"}` | Resulting UI state |
| `ui.dialog.confirm` / `ui.dialog.cancel` | — | Close the open dialog (confirm runs its action; Synchronize Folder on a folder that is up to date answers `{"upToDate": true}` and starts nothing) |