Skip to content

Commit 7672250

Browse files
authored
Fix transition direction (#5099)
* Fix transition direction detection bug, when clips are overlapping * Fix transition direction detection bug, when clips are overlapping on the same layer
1 parent c1442b5 commit 7672250

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/windows/views/webview.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,20 @@ def update_transition_data(self, transition_json, only_basic_props=True,
388388
# For example, the left side of a clip, or the right side, so we can determine
389389
# which direction the wipe should be moving in
390390
is_forward_direction = True
391+
diff_from_edge = 9999
391392
for intersecting_clip in Clip.filter(intersect=position, layer=layer):
392-
log.debug(f"Intersecting Clip: {intersecting_clip}")
393393
diff_from_start = abs(intersecting_clip.data.get("position", 0.0) - position)
394394
diff_from_end = abs((intersecting_clip.data.get("position", 0.0) + \
395395
(intersecting_clip.data.get("end", 0.0) - intersecting_clip.data.get("start", 0.0))) \
396396
- position)
397-
if diff_from_end < diff_from_start:
398-
is_forward_direction = False
399-
log.debug(f"Is transition moving a forward direction? {is_forward_direction}")
397+
smallest_diff = min(diff_from_start, diff_from_end)
398+
if smallest_diff < diff_from_edge:
399+
diff_from_edge = smallest_diff
400+
if diff_from_end < diff_from_start:
401+
is_forward_direction = False
402+
else:
403+
is_forward_direction = True
404+
log.debug(f"Is transition moving in a forward direction? {is_forward_direction}")
400405

401406
# Determine existing brightness and contrast ranges (if any)
402407
brightness_range = []

0 commit comments

Comments
 (0)