From 2fbc916c795cdc3f88f09038d8baab0e1293c315 Mon Sep 17 00:00:00 2001 From: Peter Slattery Date: Sun, 8 Mar 2020 14:57:34 -0700 Subject: [PATCH] Fixed problem where overlapping animation clips would trigger multiple drag animation block commands. --- src/panels/foldhaus_panel_animation_timeline.h | 13 +++++++++---- todo.txt | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/panels/foldhaus_panel_animation_timeline.h b/src/panels/foldhaus_panel_animation_timeline.h index 9da1f78..f148ffb 100644 --- a/src/panels/foldhaus_panel_animation_timeline.h +++ b/src/panels/foldhaus_panel_animation_timeline.h @@ -485,6 +485,7 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta // Animation Blocks b32 MouseDownAndNotHandled = MouseButtonTransitionedDown(Mouse.LeftButtonState); + gs_list_handle DragBlockHandle = {0}; for (u32 i = 0; i < AnimationSystem->Blocks.Used; i++) { gs_list_entry* AnimationBlockEntry = AnimationSystem->Blocks.GetEntryAtIndex(i); @@ -508,15 +509,19 @@ DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_sta BlockColor = PinkV4; } rect BlockBounds = DrawAnimationBlock(AnimationBlockAt, BlockColor, AdjustedViewRange, TimelineBounds, RenderBuffer); - if (PointIsInRange(Mouse.Pos, BlockBounds.Min, BlockBounds.Max) - && MouseButtonTransitionedDown(Mouse.LeftButtonState)) + if (PointIsInRange(Mouse.Pos, BlockBounds.Min, BlockBounds.Max)) { - MouseDownAndNotHandled = false; - SelectAndBeginDragAnimationBlock(CurrentBlockHandle, AdjustedViewRange, TimelineBounds, State); + DragBlockHandle = CurrentBlockHandle; } } } + if (MouseDownAndNotHandled && ListHandleIsValid(DragBlockHandle)) + { + MouseDownAndNotHandled = false; + SelectAndBeginDragAnimationBlock(DragBlockHandle, AdjustedViewRange, TimelineBounds, State); + } + // Time Slider if (FrameIsInRange(AnimationSystem->CurrentFrame, AdjustedViewRange)) { diff --git a/todo.txt b/todo.txt index 9cc8e05..8811130 100644 --- a/todo.txt +++ b/todo.txt @@ -78,7 +78,7 @@ Ground Up Reengineering x display more than one layer x add/remove layers - layer masks by sculpture - - blend modes - create a copy of the led's per layer, handle blending outside of patterns + x blend modes - create a copy of the led's per layer, handle blending outside of patterns - interface for animation system - add/remove layers - select blend modes