Node editor - Added preview mode

in this mode the editor is read-only and rescales itself to fit it's container
This commit is contained in:
Robert committed 2022-04-01 00:48:56 +02:00
1 parent 7c83d5345f
commit 8fd18b9565
16 files changed
+299 -21

No files matched your search

@@ -0,0 +1,53 @@
using System;
using Artemis.Core;
namespace Artemis.UI.Shared.Services.ProfileEditor.Commands;
/// <summary>
/// Represents a profile editor command that can be used to change the display condition of a profile element.
/// </summary>
public class ChangeElementDisplayCondition : IProfileEditorCommand, IDisposable
{
private readonly ICondition? _condition;
private readonly ICondition? _oldCondition;
private readonly RenderProfileElement _profileElement;
private bool _executed;
/// <summary>
/// Creates a new instance of the <see cref="ChangeElementDisplayCondition" /> class.
/// </summary>
/// <param name="profileElement">The render profile element whose display condition to change.</param>
/// <param name="condition">The new display condition.</param>
public ChangeElementDisplayCondition(RenderProfileElement profileElement, ICondition? condition)
{
_profileElement = profileElement;
_condition = condition;
_oldCondition = profileElement.DisplayCondition;
}
/// <inheritdoc />
public void Dispose()
{
if (_executed)
_oldCondition?.Dispose();
else
_condition?.Dispose();
}
/// <inheritdoc />
public string DisplayName => "Change display condition mode";
/// <inheritdoc />
public void Execute()
{
_profileElement.DisplayCondition = _condition;
_executed = true;
}
/// <inheritdoc />
public void Undo()
{
_profileElement.DisplayCondition = _oldCondition;
_executed = false;
}
}