EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge pull request #1561 from AyberkA0/pen-shift-45
BFlat5bb76bf50cb3
diff --cc crates/ui-egui/src/panels/viewer.rsindex 1064854f0,98d86568d..01398264f--- a/crates/ui-egui/src/panels/viewer.rs+++ b/crates/ui-egui/src/panels/viewer.rs@@@ -2289,11 -2288,24 +2295,25 @@@ fn pen_press});}+ /// `to` moved onto the nearest line through `from` at a multiple of 45° (horizontal, vertical or+ /// diagonal), as far along it as `to` lies: the Pen's Shift-click.+ fn constrain_45(from: [f64; 2], to: [f64; 2]) -> [f64; 2] {+ let (dx, dy) = (to[0] - from[0], to[1] - from[1]);+ if !(dx.is_finite() && dy.is_finite()) || (dx == 0.0 && dy == 0.0) {+ return to;+ }+ let step = std::f64::consts::FRAC_PI_4;+ let a = (dy.atan2(dx) / step).round() * step;+ let (ux, uy) = (a.cos(), a.sin());+ let along = dx * ux + dy * uy;+ [from[0] + ux * along, from[1] + uy * along]+ }+/// Visible, unlocked layers eligible for viewer hit tests, in front-to-back order.-/// Solo scope matches the renderer: only active AV layers activate it, even when hidden or locked.+/// Solo scope matches the renderer: any soloed AV layer activates it at every time (as in After+/// Effects), even when hidden, locked or outside its in-out range.pub(crate) fn selectable_layers(comp: &Comp, time: Tick) -> impl Iterator<Item = &Layer> {- let any_solo = comp.layers.iter().any(|l| l.switches.solo && l.source.is_av() && l.is_active_at(time));+ let any_solo = comp.layers.iter().any(|l| l.switches.solo && l.source.is_av());comp.layers.iter().filter(move |l| l.is_active_at(time) && l.switches.video && !l.switches.locked && !l.is_camera() && !l.is_light() && (!any_solo || l.switches.solo))