Viewer: the Snapping menu has After Effects' two options
The Tools bar's Snapping options menu (#265) offered per-feature toggles (Edges, Corners, Centers, Anchor Points, Mask and Shape Path Points) that After Effects' Snapping menu doesn't have. It now has the two After Effects has: - Snap Edges Extended (as before). - Snap to Features in Collapsed Compositions and Text Layers: the visible layers inside a precomp layer with Collapse Transformations on are snap targets too, mapped into the outer comp (points always, edge lines while the precomp layer is unrotated); a snap highlights the precomp layer. Nested collapsed precomps are followed eight deep. Every layer feature snaps again (corners, edge midpoints, centre, anchor point, mask and shape path points); the snapping engine itself is unchanged. `view.snappingOptions` takes `edgesExtended` and `collapsedFeatures` (and `toggle` of either); the old keys are refused. Test: collapsed_precomp_features_snap (fails before: no such option), snapping_options_command_sets_and_toggles (the per-feature keys are refused), snapping_options_pick_the_targets (AE behaviour kept: edges extended or not, hidden layers, guides only), and the Snapping menu UI test (only the two options are listed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b9d1f79f7d
commit
6ce58040fd
@@ -251,8 +251,8 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Snapping options menu beside the checkbox: Snap Edges Extended and which layer features
|
||||
/// snap (`view.snappingOptions`).
|
||||
/// The Snapping options menu beside the checkbox: After Effects' Snap Edges Extended and Snap to
|
||||
/// Features in Collapsed Compositions and Text Layers (`view.snappingOptions`).
|
||||
fn snapping_options(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect) {
|
||||
let t = app.tokens;
|
||||
let pop = egui::Id::new("snap-options");
|
||||
@@ -263,19 +263,9 @@ fn snapping_options(app: &mut EffectcraftApp, ui: &mut egui::Ui, r: Rect) {
|
||||
if !widgets::popup_is_open(ui, pop) {
|
||||
return;
|
||||
}
|
||||
// Snap Edges Extended, then the features ("" keys the separator).
|
||||
let f = app.session.state.snap_features;
|
||||
let mut keys = vec![];
|
||||
let mut items = vec![];
|
||||
for (i, (k, label)) in vw::SnapFeatures::OPTIONS.into_iter().enumerate() {
|
||||
if i == 1 {
|
||||
keys.push("");
|
||||
items.push("-".to_string());
|
||||
}
|
||||
keys.push(k);
|
||||
items.push(widgets::check_label(f.option(k), label));
|
||||
}
|
||||
if let Some(k) = widgets::popup_menu(ui, pop, r.left_bottom(), &items, None).and_then(|i| keys.get(i))
|
||||
let items: Vec<String> = vw::SnapFeatures::OPTIONS.iter().map(|(k, label)| widgets::check_label(f.option(k), label)).collect();
|
||||
if let Some((k, _)) = widgets::popup_menu(ui, pop, r.left_bottom(), &items, None).and_then(|i| vw::SnapFeatures::OPTIONS.get(i))
|
||||
&& let Err(e) = app.session.execute("view.snappingOptions", json!({"toggle": k}))
|
||||
{
|
||||
app.ui.status = e.to_string();
|
||||
|
||||
Reference in New Issue
Block a user