Layer panel: zoom and pan; View zoom acts on the focused viewer; Roto Brush hint in the Composition panel (#753)

- The Layer panel keeps its own magnification and pan (`ui.layer_zoom`,
  `ui.layer_pan`) with the Composition panel's magnification menu in its
  footer; the wheel / pinch zooms around the pointer, the Hand tool,
  Space-drag and a middle-drag pan, and the Zoom tool clicks zoom in
  (Alt: out). Navigation never paints or makes Roto Brush strokes.
- View > Zoom In / Zoom Out / Fit / Actual Size act on the Layer panel
  while it is focused, else on the Composition viewer as before.
- A Roto Brush click or drag in the Composition panel says the brush
  works in the Layer panel; double-clicking a layer there with a Roto
  Brush tool opens it in the Layer panel (as After Effects).
- Opening another layer resets the Layer panel to Fit.

Tests: crates/ui-egui/tests/ui_layer_panel_zoom.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
redonion23
2026-10-11 14:41:40 +02:00
co-authored by Claude Opus 5.5
parent 9a7d3e7699
commit afdb958199
6 changed files with 391 additions and 45 deletions
+29 -4
View File
@@ -206,6 +206,8 @@ use super::viewer_overlays::{self as ov, VertexHit};
use super::viewer_tools as vt;
const HANDLE: f32 = 7.0;
/// Shown when a Roto Brush tool is used in the Composition panel (#753).
const ROTO_HINT: &str = "The Roto Brush works in the Layer panel. Double-click the layer to open it.";
thread_local! {
/// The 3D view camera of the viewer being drawn (None = the comp's active camera).
@@ -1419,6 +1421,11 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
Some(Gesture::Marquee { start: press })
}
}
// The Roto Brush paints in the Layer panel only: say so instead of doing nothing.
rt if rt.roto_kind(false).is_some() => {
app.ui.status = crate::i18n::tr(ROTO_HINT).to_string();
None
}
_ => None,
};
if let Some(g) = g {
@@ -1776,6 +1783,13 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
let _ = app.session.execute("mask.selectVertices", json!({"vertices": [me], "add": mods.shift, "toggle": mods.shift}));
}
}
// The Roto Brush paints in the Layer panel only: select as usual and say so.
rt if rt.roto_kind(false).is_some() => {
if pick(app, &ectx, cpt, mods.shift).is_none() {
let _ = app.session.execute("edit.deselectAll", json!({}));
}
app.ui.status = crate::i18n::tr(ROTO_HINT).to_string();
}
_ => {
if pick(app, &ectx, cpt, mods.shift).is_none() {
let _ = app.session.execute("edit.deselectAll", json!({}));
@@ -1807,10 +1821,21 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
&& let Some(pos) = resp.interact_pointer_pos()
{
let cpt = map.to_comp(pos);
if let Some(l) = pick(app, &ectx, cpt, false).and_then(|l| comp.layer(l))
&& let effectcraft_engine::project::LayerSource::Comp { item } = &l.source
{
app.session.open_comp(*item);
let roto = app.ui.tool.roto_kind(false).is_some();
if let Some(l) = pick(app, &ectx, cpt, false).and_then(|l| comp.layer(l)) {
match &l.source {
effectcraft_engine::project::LayerSource::Comp { item } => app.session.open_comp(*item),
// With a Roto Brush tool, double-clicking a layer opens it in the Layer panel,
// where the brush works (After Effects).
_ if roto => {
let id = l.id.0;
match crate::menus::invoke(app, &ctx, "layer.openLayer", json!({"layer": id})) {
Ok(_) => app.ui.status.clear(),
Err(e) => app.ui.status = e,
}
}
_ => {}
}
}
}
// 3D Camera Tracker points, targets and their menu (on top of the viewer's gestures while