1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Events - Fixed copy mode

Timelines - Added a limit of 15 to extra timelines
This commit is contained in:
SpoinkyNL 2020-11-08 19:41:53 +01:00
parent 427d3d2521
commit f80a7d658c
2 changed files with 12 additions and 9 deletions

View File

@ -244,8 +244,6 @@ namespace Artemis.Core
if (Renderer.Canvas == null || Renderer.Path == null || Renderer.Paint == null) if (Renderer.Canvas == null || Renderer.Path == null || Renderer.Paint == null)
throw new ArtemisCoreException("Failed to open folder render context"); throw new ArtemisCoreException("Failed to open folder render context");
// Renderer.ApplyClip(canvas);
foreach (BaseLayerEffect baseLayerEffect in LayerEffects.Where(e => e.Enabled)) foreach (BaseLayerEffect baseLayerEffect in LayerEffects.Where(e => e.Enabled))
baseLayerEffect.PreProcess(Renderer.Canvas, Renderer.Path, Renderer.Paint); baseLayerEffect.PreProcess(Renderer.Canvas, Renderer.Path, Renderer.Paint);

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Storage.Entities.Profile; using Artemis.Storage.Entities.Profile;
using Stylet; using Stylet;
@ -11,6 +12,8 @@ namespace Artemis.Core
/// </summary> /// </summary>
public class Timeline : PropertyChangedBase, IStorageModel public class Timeline : PropertyChangedBase, IStorageModel
{ {
private const int MaxExtraTimelines = 15;
/// <summary> /// <summary>
/// Creates a new instance of the <see cref="Timeline" /> class /// Creates a new instance of the <see cref="Timeline" /> class
/// </summary> /// </summary>
@ -34,6 +37,11 @@ namespace Artemis.Core
private Timeline(Timeline parent) private Timeline(Timeline parent)
{ {
Parent = parent; Parent = parent;
StartSegmentLength = Parent.StartSegmentLength;
MainSegmentLength = Parent.MainSegmentLength;
EndSegmentLength = Parent.EndSegmentLength;
_extraTimelines = new List<Timeline>();
} }
#region Extra timelines #region Extra timelines
@ -44,6 +52,8 @@ namespace Artemis.Core
public void AddExtraTimeline() public void AddExtraTimeline()
{ {
_extraTimelines.Add(new Timeline(this)); _extraTimelines.Add(new Timeline(this));
if (_extraTimelines.Count > MaxExtraTimelines)
_extraTimelines.RemoveAt(0);
} }
/// <summary> /// <summary>
@ -135,7 +145,7 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// Gets a boolean indicating whether the timeline has finished its run /// Gets a boolean indicating whether the timeline has finished its run
/// </summary> /// </summary>
public bool IsFinished => Position > Length || Length == TimeSpan.Zero; public bool IsFinished => (Position > Length || Length == TimeSpan.Zero) && !ExtraTimelines.Any();
/// <summary> /// <summary>
/// Gets a boolean indicating whether the timeline progress has been overridden /// Gets a boolean indicating whether the timeline progress has been overridden
@ -310,6 +320,7 @@ namespace Artemis.Core
Position = MainSegmentStartPosition + TimeSpan.FromMilliseconds(Position.TotalMilliseconds % MainSegmentLength.TotalMilliseconds); Position = MainSegmentStartPosition + TimeSpan.FromMilliseconds(Position.TotalMilliseconds % MainSegmentLength.TotalMilliseconds);
} }
_extraTimelines.RemoveAll(t => t.IsFinished);
foreach (Timeline extraTimeline in _extraTimelines) foreach (Timeline extraTimeline in _extraTimelines)
extraTimeline.Update(delta, false); extraTimeline.Update(delta, false);
} }
@ -327,8 +338,6 @@ namespace Artemis.Core
Delta = TimeSpan.Zero - Position; Delta = TimeSpan.Zero - Position;
Position = TimeSpan.Zero; Position = TimeSpan.Zero;
_extraTimelines.Clear();
} }
} }
@ -344,8 +353,6 @@ namespace Artemis.Core
Delta = EndSegmentStartPosition - Position; Delta = EndSegmentStartPosition - Position;
Position = EndSegmentStartPosition; Position = EndSegmentStartPosition;
_extraTimelines.Clear();
} }
} }
@ -361,8 +368,6 @@ namespace Artemis.Core
Delta = EndSegmentEndPosition - Position; Delta = EndSegmentEndPosition - Position;
Position = EndSegmentEndPosition; Position = EndSegmentEndPosition;
_extraTimelines.Clear();
} }
} }