Skip to content

Commit

Permalink
Fix transition direction (#5099)
Browse files Browse the repository at this point in the history
* Fix transition direction detection bug, when clips are overlapping

* Fix transition direction detection bug, when clips are overlapping on the same layer
  • Loading branch information
jonoomph committed Jan 16, 2023
1 parent c1442b5 commit 7672250
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/windows/views/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,20 @@ def update_transition_data(self, transition_json, only_basic_props=True,
# For example, the left side of a clip, or the right side, so we can determine
# which direction the wipe should be moving in
is_forward_direction = True
diff_from_edge = 9999
for intersecting_clip in Clip.filter(intersect=position, layer=layer):
log.debug(f"Intersecting Clip: {intersecting_clip}")
diff_from_start = abs(intersecting_clip.data.get("position", 0.0) - position)
diff_from_end = abs((intersecting_clip.data.get("position", 0.0) + \
(intersecting_clip.data.get("end", 0.0) - intersecting_clip.data.get("start", 0.0))) \
- position)
if diff_from_end < diff_from_start:
is_forward_direction = False
log.debug(f"Is transition moving a forward direction? {is_forward_direction}")
smallest_diff = min(diff_from_start, diff_from_end)
if smallest_diff < diff_from_edge:
diff_from_edge = smallest_diff
if diff_from_end < diff_from_start:
is_forward_direction = False
else:
is_forward_direction = True
log.debug(f"Is transition moving in a forward direction? {is_forward_direction}")

# Determine existing brightness and contrast ranges (if any)
brightness_range = []
Expand Down

0 comments on commit 7672250

Please sign in to comment.