Viewer: Pan Behind Alt-drag, Shift-drag and Ctrl+double-click to center (#162)

The Pan Behind gesture ignored modifiers other than Ctrl (snapping): it
always moved Anchor Point and Position together and never constrained the
move, and the tool's button had no double-click action.

- Alt held as the drag begins moves the Anchor Point alone (Position is
  left as it is, so the layer shifts).
- Shift keeps the move to the axis dragged along most; Move and Pan
  Behind now share that rule (one_axis).
- Ctrl+double-clicking the Pan Behind tool's button runs
  layer.centerAnchor (Center Anchor Point in Layer Content).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-07 13:44:46 +07:00
co-authored by Claude Opus 5.5
parent 83f17dda37
commit 72b039c6d5
3 changed files with 76 additions and 12 deletions
+8
View File
@@ -62,6 +62,14 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
if resp.clicked() {
app.ui.tool = cur;
}
// Ctrl+double-click Pan Behind: Center Anchor Point in Layer Content.
if cur == Tool::PanBehind
&& resp.double_clicked()
&& ui.input(|i| i.modifiers.command)
&& let Err(e) = crate::menus::invoke(app, ui.ctx(), "layer.centerAnchor", json!({}))
{
app.ui.status = e;
}
if slot.len() > 1 {
resp.context_menu(|ui| {
for tool in slot.iter() {