mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-09 09:51:47 -06:00
Follow-up to #2716: addItem applies in before out; anchor takes exactly [x, y]
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4b7767401b
commit
2a7888d2c0
@@ -279,6 +279,7 @@ fn anchor_param(p: &Value, cmd: &str) -> Result<Option<[f64; 2]>> {
|
||||
None | Some(Value::Null) => Ok(None),
|
||||
Some(v) => v
|
||||
.as_array()
|
||||
.filter(|a| a.len() == 2)
|
||||
.and_then(|a| Some([a.first()?.as_f64()?, a.get(1)?.as_f64()?]))
|
||||
.filter(|c| c.iter().all(|x| x.is_finite() && x.abs() <= MAX_PLACEMENT))
|
||||
.map(Some)
|
||||
@@ -361,12 +362,13 @@ pub(super) fn add_item(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
l.out_point = fr.snap_nearest(end).max(start + fr.frame_duration());
|
||||
// `in` / `out` are comp times like `layer.timing`'s; each keeps at least one frame.
|
||||
let fd = fr.frame_duration();
|
||||
if let Some(o) = out_p {
|
||||
l.out_point = fr.snap_nearest(o).max(l.in_point + fd);
|
||||
}
|
||||
// In first, as `layer.timing` does, so an `out` before the layer's start still lands.
|
||||
if let Some(i) = in_p {
|
||||
l.in_point = fr.snap_nearest(i).min(l.out_point - fd);
|
||||
}
|
||||
if let Some(o) = out_p {
|
||||
l.out_point = fr.snap_nearest(o).max(l.in_point + fd);
|
||||
}
|
||||
place(&mut l, position);
|
||||
set_anchor(&mut l, anchor);
|
||||
insert_layer_at(proj, st, cid, l, index)
|
||||
|
||||
Reference in New Issue
Block a user