diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-05 21:59:50 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-05 21:59:50 +0100 |
| commit | 58c21d8ea2b9dd19fdf2e5579e58ebbef7a401ff (patch) | |
| tree | f6227c1af0b787ae54f19fd457d8982b9b33dc76 /scripts | |
| parent | 1b57c0d7bfbdddfb9060a54df220ee51d9246f05 (diff) | |
fix(timeline-editor): Fix effect dragging offset and property panel updates
Bug Fix #1: Effect Drag Offset Calculation
- Fixed erratic jumping when clicking/dragging effects
- Problem: dragOffset calculated from element edge, not timeline origin
- Old calculation:
dragOffset.x = e.clientX - rect.left (element-relative)
- New calculation:
dragOffset.x = e.clientX - timelineRect.left - currentLeft (timeline-relative)
- Now correctly accounts for element's current position on timeline
- Dragging feels natural, no unexpected jumps
Bug Fix #2: Effect Positioning Relative to Sequence
- Effects now correctly positioned relative to parent sequence
- Problem: Effects were using absolute timeline positions
- Old behavior: effect.startTime = newTime (absolute)
- New behavior: effect.startTime = newTime - seq.startTime (relative)
- Algorithm:
1. Calculate newTime from mouse position (absolute timeline)
2. Convert to relative: relativeTime = newTime - seq.startTime
3. Store relative time in effect
4. Rendering uses: seq.startTime + effect.startTime (absolute)
- Sequence bounds now update correctly after effect moves
Bug Fix #3: Property Panel Updates Trigger Re-render
- Property changes now properly update timeline visual
- Added updateProperties() call after renderTimeline()
- Ensures property panel shows calculated values
- Cascade of events after property change:
a) Update data model (sequence/effect properties)
b) renderTimeline() → recalculates sequence bounds
c) updateProperties() → refreshes property panel display
d) showMessage() → user feedback
- Sequence start/end bounds recalculate correctly
- Visual updates immediately reflect property changes
Technical Details:
- startDrag: dragOffset from timeline origin, not element
- onDrag: Convert absolute position to sequence-relative time
- applyProperties: Call both renderTimeline() and updateProperties()
- Sequence visual bounds: calculated dynamically during render
* seqVisualStart = seq.startTime + min(effect.startTime)
* seqVisualEnd = seq.startTime + max(effect.endTime)
Result: All three operations (drag, property edit, bounds calc) work correctly
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
