mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added undo/redo to profile editor
Added shape anchor point display and movement
This commit is contained in:
1 parent
e9677f2070
commit
c97b479779
25 files changed
+386
-68
No files matched your search
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
|
||||
namespace Artemis.UI.Services.Interfaces
|
||||
{
|
||||
@@ -15,6 +15,8 @@ namespace Artemis.UI.Services.Interfaces
|
||||
void ChangeSelectedProfileElement(ProfileElement profileElement);
|
||||
void UpdateSelectedProfileElement();
|
||||
void UpdateProfilePreview();
|
||||
void UndoUpdateProfile(ProfileModule module);
|
||||
void RedoUpdateProfile(ProfileModule module);
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a new profile is selected
|
||||
@@ -42,8 +44,10 @@ namespace Artemis.UI.Services.Interfaces
|
||||
event EventHandler CurrentTimeChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the profile preview has been updated
|
||||
/// Occurs when the profile preview has been updated
|
||||
/// </summary>
|
||||
event EventHandler ProfilePreviewUpdated;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
|
||||
@@ -72,7 +74,7 @@ namespace Artemis.UI.Services
|
||||
baseLayerProperty.KeyframeEngine?.OverrideProgress(CurrentTime);
|
||||
|
||||
// Force layer shape to redraw
|
||||
layer.LayerShape?.CalculateRenderProperties(layer.PositionProperty.GetCurrentValue(), layer.SizeProperty.GetCurrentValue());
|
||||
layer.LayerShape?.CalculateRenderProperties(layer.PositionProperty.CurrentValue, layer.SizeProperty.CurrentValue);
|
||||
// Update the brush with the delta (which can now be negative ^^)
|
||||
layer.Update(delta.TotalSeconds);
|
||||
}
|
||||
@@ -81,6 +83,32 @@ namespace Artemis.UI.Services
|
||||
OnProfilePreviewUpdated();
|
||||
}
|
||||
|
||||
public void UndoUpdateProfile(ProfileModule module)
|
||||
{
|
||||
_profileService.UndoUpdateProfile(SelectedProfile, module);
|
||||
OnSelectedProfileChanged();
|
||||
|
||||
var elements = SelectedProfile.GetAllLayers().Cast<ProfileElement>().ToList();
|
||||
elements.AddRange(SelectedProfile.GetAllFolders());
|
||||
|
||||
var element = elements.FirstOrDefault(l => l.EntityId == SelectedProfileElement.EntityId);
|
||||
ChangeSelectedProfileElement(element);
|
||||
UpdateProfilePreview();
|
||||
}
|
||||
|
||||
public void RedoUpdateProfile(ProfileModule module)
|
||||
{
|
||||
_profileService.RedoUpdateProfile(SelectedProfile, module);
|
||||
OnSelectedProfileChanged();
|
||||
|
||||
var elements = SelectedProfile.GetAllLayers().Cast<ProfileElement>().ToList();
|
||||
elements.AddRange(SelectedProfile.GetAllFolders());
|
||||
|
||||
var element = elements.FirstOrDefault(l => l.EntityId == SelectedProfileElement.EntityId);
|
||||
ChangeSelectedProfileElement(element);
|
||||
UpdateProfilePreview();
|
||||
}
|
||||
|
||||
public event EventHandler SelectedProfileChanged;
|
||||
public event EventHandler SelectedProfileUpdated;
|
||||
public event EventHandler SelectedProfileElementChanged;
|
||||
|
||||
Reference in new issue
Block a user