|
@@ -7,8 +7,8 @@ using PixiEditor.ChangeableDocument.Actions.Generated;
|
|
using PixiEditor.ChangeableDocument.Changeables.Interfaces;
|
|
using PixiEditor.ChangeableDocument.Changeables.Interfaces;
|
|
using PixiEditor.ChangeableDocument.Enums;
|
|
using PixiEditor.ChangeableDocument.Enums;
|
|
using PixiEditor.Helpers;
|
|
using PixiEditor.Helpers;
|
|
-using PixiEditor.Models.BitmapActions;
|
|
|
|
using PixiEditor.Models.DocumentModels;
|
|
using PixiEditor.Models.DocumentModels;
|
|
|
|
+using PixiEditor.Models.DocumentPassthroughActions;
|
|
using PixiEditor.Models.Position;
|
|
using PixiEditor.Models.Position;
|
|
using SkiaSharp;
|
|
using SkiaSharp;
|
|
|
|
|
|
@@ -35,7 +35,10 @@ internal class DocumentViewModel : NotifyableObject
|
|
public int Width => size.X;
|
|
public int Width => size.X;
|
|
public int Height => size.Y;
|
|
public int Height => size.Y;
|
|
|
|
|
|
- public StructureMemberViewModel? SelectedStructureMember => FindFirstSelectedMember();
|
|
|
|
|
|
+ public StructureMemberViewModel? SelectedStructureMember { get; private set; } = null;
|
|
|
|
+
|
|
|
|
+ private HashSet<StructureMemberViewModel> softSelectedStructureMembers = new();
|
|
|
|
+ public IReadOnlyCollection<StructureMemberViewModel> SoftSelectedStructureMembers => softSelectedStructureMembers;
|
|
|
|
|
|
public Dictionary<ChunkResolution, WriteableBitmap> Bitmaps { get; set; } = new()
|
|
public Dictionary<ChunkResolution, WriteableBitmap> Bitmaps { get; set; } = new()
|
|
{
|
|
{
|
|
@@ -155,42 +158,60 @@ internal class DocumentViewModel : NotifyableObject
|
|
PreviewSurface = SKSurface.Create(new SKImageInfo(previewSize.X, previewSize.Y, SKColorType.Bgra8888), PreviewBitmap.BackBuffer, PreviewBitmap.BackBufferStride);
|
|
PreviewSurface = SKSurface.Create(new SKImageInfo(previewSize.X, previewSize.Y, SKColorType.Bgra8888), PreviewBitmap.BackBuffer, PreviewBitmap.BackBufferStride);
|
|
|
|
|
|
Helpers.ActionAccumulator.AddFinishedActions(new CreateStructureMember_Action(StructureRoot.GuidValue, testLayerGuid, 0, StructureMemberType.Layer));
|
|
Helpers.ActionAccumulator.AddFinishedActions(new CreateStructureMember_Action(StructureRoot.GuidValue, testLayerGuid, 0, StructureMemberType.Layer));
|
|
|
|
+ SetSelectedMember(testLayerGuid);
|
|
}
|
|
}
|
|
|
|
|
|
- public void InternalSetSize(VecI size)
|
|
|
|
- {
|
|
|
|
- this.size = size;
|
|
|
|
- RaisePropertyChanged(nameof(SizeBindable));
|
|
|
|
- RaisePropertyChanged(nameof(Width));
|
|
|
|
- RaisePropertyChanged(nameof(Height));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- #region Symmetry
|
|
|
|
-
|
|
|
|
- public void SetVerticalSymmetryAxisEnabled(bool verticalSymmetryAxisEnabled)
|
|
|
|
|
|
+ #region Internal Methods
|
|
|
|
+ // these are intended to only be called from DocumentUpdater
|
|
|
|
+ public void InternalSetVerticalSymmetryAxisEnabled(bool verticalSymmetryAxisEnabled)
|
|
{
|
|
{
|
|
this.verticalSymmetryAxisEnabled = verticalSymmetryAxisEnabled;
|
|
this.verticalSymmetryAxisEnabled = verticalSymmetryAxisEnabled;
|
|
RaisePropertyChanged(nameof(VerticalSymmetryAxisEnabledBindable));
|
|
RaisePropertyChanged(nameof(VerticalSymmetryAxisEnabledBindable));
|
|
}
|
|
}
|
|
|
|
|
|
- public void SetHorizontalSymmetryAxisEnabled(bool horizontalSymmetryAxisEnabled)
|
|
|
|
|
|
+ public void InternalSetHorizontalSymmetryAxisEnabled(bool horizontalSymmetryAxisEnabled)
|
|
{
|
|
{
|
|
this.horizontalSymmetryAxisEnabled = horizontalSymmetryAxisEnabled;
|
|
this.horizontalSymmetryAxisEnabled = horizontalSymmetryAxisEnabled;
|
|
RaisePropertyChanged(nameof(HorizontalSymmetryAxisEnabledBindable));
|
|
RaisePropertyChanged(nameof(HorizontalSymmetryAxisEnabledBindable));
|
|
}
|
|
}
|
|
|
|
|
|
- public void SetVerticalSymmetryAxisX(int verticalSymmetryAxisX)
|
|
|
|
|
|
+ public void InternalSetVerticalSymmetryAxisX(int verticalSymmetryAxisX)
|
|
{
|
|
{
|
|
this.verticalSymmetryAxisX = verticalSymmetryAxisX;
|
|
this.verticalSymmetryAxisX = verticalSymmetryAxisX;
|
|
RaisePropertyChanged(nameof(VerticalSymmetryAxisXBindable));
|
|
RaisePropertyChanged(nameof(VerticalSymmetryAxisXBindable));
|
|
}
|
|
}
|
|
|
|
|
|
- public void SetHorizontalSymmetryAxisY(int horizontalSymmetryAxisY)
|
|
|
|
|
|
+ public void InternalSetHorizontalSymmetryAxisY(int horizontalSymmetryAxisY)
|
|
{
|
|
{
|
|
this.horizontalSymmetryAxisY = horizontalSymmetryAxisY;
|
|
this.horizontalSymmetryAxisY = horizontalSymmetryAxisY;
|
|
RaisePropertyChanged(nameof(HorizontalSymmetryAxisYBindable));
|
|
RaisePropertyChanged(nameof(HorizontalSymmetryAxisYBindable));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void InternalSetSize(VecI size)
|
|
|
|
+ {
|
|
|
|
+ this.size = size;
|
|
|
|
+ RaisePropertyChanged(nameof(SizeBindable));
|
|
|
|
+ RaisePropertyChanged(nameof(Width));
|
|
|
|
+ RaisePropertyChanged(nameof(Height));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void InternalUpdateSelectionPath(SKPath selectionPath)
|
|
|
|
+ {
|
|
|
|
+ (var toDispose, this.selectionPath) = (this.selectionPath, selectionPath);
|
|
|
|
+ toDispose.Dispose();
|
|
|
|
+ RaisePropertyChanged(nameof(SelectionPathBindable));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void InternalSetSelectedMember(StructureMemberViewModel? member)
|
|
|
|
+ {
|
|
|
|
+ SelectedStructureMember = member;
|
|
|
|
+ RaisePropertyChanged(nameof(SelectedStructureMember));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void InternalClearSoftSelectedMembers() => softSelectedStructureMembers.Clear();
|
|
|
|
+
|
|
|
|
+ public void InternalAddSoftSelectedMember(StructureMemberViewModel member) => softSelectedStructureMembers.Add(member);
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
public void AddOrUpdateViewport(ViewportInfo info)
|
|
public void AddOrUpdateViewport(ViewportInfo info)
|
|
@@ -203,6 +224,21 @@ internal class DocumentViewModel : NotifyableObject
|
|
Helpers.ActionAccumulator.AddActions(new RemoveViewport_PassthroughAction(viewportGuid));
|
|
Helpers.ActionAccumulator.AddActions(new RemoveViewport_PassthroughAction(viewportGuid));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void SetSelectedMember(Guid memberGuid)
|
|
|
|
+ {
|
|
|
|
+ Helpers.ActionAccumulator.AddActions(new SetSelectedMember_PassthroughAction(memberGuid));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void AddSoftSelectedMember(Guid memberGuid)
|
|
|
|
+ {
|
|
|
|
+ Helpers.ActionAccumulator.AddActions(new AddSoftSelectedMember_PassthroughAction(memberGuid));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void ClearSoftSelectedMembers()
|
|
|
|
+ {
|
|
|
|
+ Helpers.ActionAccumulator.AddActions(new ClearSoftSelectedMembers_PassthroughAction());
|
|
|
|
+ }
|
|
|
|
+
|
|
public void OnKeyDown(Key args)
|
|
public void OnKeyDown(Key args)
|
|
{
|
|
{
|
|
|
|
|
|
@@ -244,11 +280,4 @@ internal class DocumentViewModel : NotifyableObject
|
|
drawing = false;
|
|
drawing = false;
|
|
Helpers.ActionAccumulator.AddFinishedActions(new EndLineBasedPen_Action());
|
|
Helpers.ActionAccumulator.AddFinishedActions(new EndLineBasedPen_Action());
|
|
}
|
|
}
|
|
-
|
|
|
|
- public void InternalUpdateSelectionPath(SKPath selectionPath)
|
|
|
|
- {
|
|
|
|
- (var toDispose, this.selectionPath) = (this.selectionPath, selectionPath);
|
|
|
|
- toDispose.Dispose();
|
|
|
|
- RaisePropertyChanged(nameof(SelectionPathBindable));
|
|
|
|
- }
|
|
|
|
}
|
|
}
|