|
@@ -15,8 +15,12 @@ using PixiEditor.AvaloniaUI.Helpers.UI;
|
|
using PixiEditor.AvaloniaUI.Models.Controllers.InputDevice;
|
|
using PixiEditor.AvaloniaUI.Models.Controllers.InputDevice;
|
|
using PixiEditor.AvaloniaUI.Models.DocumentModels;
|
|
using PixiEditor.AvaloniaUI.Models.DocumentModels;
|
|
using PixiEditor.AvaloniaUI.Models.Position;
|
|
using PixiEditor.AvaloniaUI.Models.Position;
|
|
|
|
+using PixiEditor.AvaloniaUI.ViewModels;
|
|
using PixiEditor.AvaloniaUI.ViewModels.Document;
|
|
using PixiEditor.AvaloniaUI.ViewModels.Document;
|
|
|
|
+using PixiEditor.AvaloniaUI.ViewModels.Tools.ToolSettings.Toolbars;
|
|
using PixiEditor.AvaloniaUI.Views.Overlays;
|
|
using PixiEditor.AvaloniaUI.Views.Overlays;
|
|
|
|
+using PixiEditor.AvaloniaUI.Views.Overlays.BrushShapeOverlay;
|
|
|
|
+using PixiEditor.AvaloniaUI.Views.Overlays.SymmetryOverlay;
|
|
using PixiEditor.AvaloniaUI.Views.Visuals;
|
|
using PixiEditor.AvaloniaUI.Views.Visuals;
|
|
using PixiEditor.DrawingApi.Core.Numerics;
|
|
using PixiEditor.DrawingApi.Core.Numerics;
|
|
using PixiEditor.DrawingApi.Core.Surface;
|
|
using PixiEditor.DrawingApi.Core.Surface;
|
|
@@ -288,8 +292,11 @@ internal partial class Viewport : UserControl, INotifyPropertyChanged
|
|
public Guid GuidValue { get; } = Guid.NewGuid();
|
|
public Guid GuidValue { get; } = Guid.NewGuid();
|
|
|
|
|
|
private MouseUpdateController? mouseUpdateController;
|
|
private MouseUpdateController? mouseUpdateController;
|
|
|
|
+
|
|
private GridLines _gridLinesOverlay;
|
|
private GridLines _gridLinesOverlay;
|
|
|
|
|
|
|
|
+ private SymmetryOverlay _symmetryOverlay;
|
|
|
|
+
|
|
static Viewport()
|
|
static Viewport()
|
|
{
|
|
{
|
|
DocumentProperty.Changed.Subscribe(OnDocumentChange);
|
|
DocumentProperty.Changed.Subscribe(OnDocumentChange);
|
|
@@ -302,7 +309,7 @@ internal partial class Viewport : UserControl, INotifyPropertyChanged
|
|
{
|
|
{
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
|
|
|
|
- _gridLinesOverlay = new GridLines();
|
|
|
|
|
|
+ InitBuiltInOverlays();
|
|
MainImage!.Loaded += OnImageLoaded;
|
|
MainImage!.Loaded += OnImageLoaded;
|
|
MainImage.SizeChanged += OnMainImageSizeChanged;
|
|
MainImage.SizeChanged += OnMainImageSizeChanged;
|
|
Loaded += OnLoad;
|
|
Loaded += OnLoad;
|
|
@@ -313,6 +320,12 @@ internal partial class Viewport : UserControl, INotifyPropertyChanged
|
|
viewportGrid.AddHandler(PointerPressedEvent, Image_MouseDown, RoutingStrategies.Bubble);
|
|
viewportGrid.AddHandler(PointerPressedEvent, Image_MouseDown, RoutingStrategies.Bubble);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void InitBuiltInOverlays()
|
|
|
|
+ {
|
|
|
|
+ _gridLinesOverlay = new GridLines();
|
|
|
|
+ _symmetryOverlay = new SymmetryOverlay();
|
|
|
|
+ }
|
|
|
|
+
|
|
public Panel? MainImage => zoombox != null ? (Panel?)((Grid?)((Border?)zoombox.AdditionalContent)?.Child)?.Children[0] : null;
|
|
public Panel? MainImage => zoombox != null ? (Panel?)((Grid?)((Border?)zoombox.AdditionalContent)?.Child)?.Children[0] : null;
|
|
public Scene Scene => scene;
|
|
public Scene Scene => scene;
|
|
public Grid BackgroundGrid => viewportGrid;
|
|
public Grid BackgroundGrid => viewportGrid;
|
|
@@ -338,9 +351,9 @@ internal partial class Viewport : UserControl, INotifyPropertyChanged
|
|
|
|
|
|
private void InitializeOverlays()
|
|
private void InitializeOverlays()
|
|
{
|
|
{
|
|
- /*brushShapeOverlay.MouseEventSource = BackgroundGrid;
|
|
|
|
|
|
+ brushShapeOverlay.MouseEventSource = BackgroundGrid;
|
|
brushShapeOverlay.MouseReference = MainImage;
|
|
brushShapeOverlay.MouseReference = MainImage;
|
|
- brushShapeOverlay.Initialize();*/
|
|
|
|
|
|
+ brushShapeOverlay.Initialize();
|
|
}
|
|
}
|
|
|
|
|
|
private static void OnDocumentChange(AvaloniaPropertyChangedEventArgs<DocumentViewModel> e)
|
|
private static void OnDocumentChange(AvaloniaPropertyChangedEventArgs<DocumentViewModel> e)
|