From 52906218dc493abb935202796f6ff4219f9772a8 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 11 Jan 2021 22:12:31 +0100 Subject: [PATCH] Profile editor - Fixed segment length dialog this closes #523 --- src/Artemis.UI/Artemis.UI.csproj | 2 +- .../Timeline/TimelineSegmentViewModel.cs | 33 +++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index 6e57854a1..db296971a 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -8,7 +8,7 @@ Artemis en-US Provides advanced unified lighting across many different brands RGB peripherals - Copyright © Robert Beekman - 2020 + Copyright © Robert Beekman - 2021 2.0.0.0 bin\$(Platform)\$(Configuration)\ true diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineSegmentViewModel.cs index 96b5a3e10..09be9d296 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineSegmentViewModel.cs @@ -327,28 +327,35 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline newTime = TimeSpan.FromMilliseconds(Math.Round(newTime.TotalMilliseconds / 50.0) * 50.0); } - UpdateLength(newTime); + UpdateEndPosition(newTime); } - public void UpdateLength(TimeSpan newTime) + public void UpdateEndPosition(TimeSpan end) { - if (newTime < TimeSpan.FromMilliseconds(100)) - newTime = TimeSpan.FromMilliseconds(100); + if (end < TimeSpan.FromMilliseconds(100)) + end = TimeSpan.FromMilliseconds(100); + + if (Segment == SegmentViewModelType.Start) + SelectedProfileElement.Timeline.StartSegmentEndPosition = end; + else if (Segment == SegmentViewModelType.Main) + SelectedProfileElement.Timeline.MainSegmentEndPosition = end; + else if (Segment == SegmentViewModelType.End) + SelectedProfileElement.Timeline.EndSegmentEndPosition = end; - TimeSpan difference = newTime - SegmentEnd; + Update(); + } - if (difference > TimeSpan.Zero) - ShiftNextSegment(difference); + public void UpdateLength(TimeSpan length) + { + if (length < TimeSpan.FromMilliseconds(100)) + length = TimeSpan.FromMilliseconds(100); if (Segment == SegmentViewModelType.Start) - SelectedProfileElement.Timeline.StartSegmentEndPosition = newTime; + SelectedProfileElement.Timeline.StartSegmentLength = length; else if (Segment == SegmentViewModelType.Main) - SelectedProfileElement.Timeline.MainSegmentEndPosition = newTime; + SelectedProfileElement.Timeline.MainSegmentLength = length; else if (Segment == SegmentViewModelType.End) - SelectedProfileElement.Timeline.EndSegmentEndPosition = newTime; - - if (difference < TimeSpan.Zero) - ShiftNextSegment(difference); + SelectedProfileElement.Timeline.EndSegmentLength = length; Update(); }