|
@@ -3,6 +3,7 @@ using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
using System.Windows.Input;
|
|
using Microsoft.Win32;
|
|
using Microsoft.Win32;
|
|
using PixiEditor.Models.Commands;
|
|
using PixiEditor.Models.Commands;
|
|
|
|
+using PixiEditor.Models.Commands.Commands;
|
|
using PixiEditor.Models.Controllers;
|
|
using PixiEditor.Models.Controllers;
|
|
using PixiEditor.Models.IO;
|
|
using PixiEditor.Models.IO;
|
|
using PixiEditor.ViewModels.SubViewModels.Document;
|
|
using PixiEditor.ViewModels.SubViewModels.Document;
|
|
@@ -12,6 +13,8 @@ namespace PixiEditor.Views.UserControls.Layers;
|
|
#nullable enable
|
|
#nullable enable
|
|
internal partial class ReferenceLayer : UserControl
|
|
internal partial class ReferenceLayer : UserControl
|
|
{
|
|
{
|
|
|
|
+ private Command command;
|
|
|
|
+
|
|
public static readonly DependencyProperty DocumentProperty =
|
|
public static readonly DependencyProperty DocumentProperty =
|
|
DependencyProperty.Register(nameof(Document), typeof(DocumentViewModel), typeof(ReferenceLayer), new(null));
|
|
DependencyProperty.Register(nameof(Document), typeof(DocumentViewModel), typeof(ReferenceLayer), new(null));
|
|
|
|
|
|
@@ -23,11 +26,17 @@ internal partial class ReferenceLayer : UserControl
|
|
|
|
|
|
public ReferenceLayer()
|
|
public ReferenceLayer()
|
|
{
|
|
{
|
|
|
|
+ command = CommandController.Current.Commands["PixiEditor.Layer.PasteReferenceLayer"];
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
}
|
|
}
|
|
|
|
|
|
private void ReferenceLayer_DragEnter(object sender, DragEventArgs e)
|
|
private void ReferenceLayer_DragEnter(object sender, DragEventArgs e)
|
|
{
|
|
{
|
|
|
|
+ if (!command.Methods.CanExecute(e.Data))
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
ViewModelMain.Current.ActionDisplays[nameof(ReferenceLayer_Drop)] = "Import as reference layer";
|
|
ViewModelMain.Current.ActionDisplays[nameof(ReferenceLayer_Drop)] = "Import as reference layer";
|
|
e.Handled = true;
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
@@ -35,13 +44,10 @@ internal partial class ReferenceLayer : UserControl
|
|
private void ReferenceLayer_DragLeave(object sender, DragEventArgs e)
|
|
private void ReferenceLayer_DragLeave(object sender, DragEventArgs e)
|
|
{
|
|
{
|
|
ViewModelMain.Current.ActionDisplays[nameof(ReferenceLayer_Drop)] = null;
|
|
ViewModelMain.Current.ActionDisplays[nameof(ReferenceLayer_Drop)] = null;
|
|
- e.Handled = true;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void ReferenceLayer_Drop(object sender, DragEventArgs e)
|
|
private void ReferenceLayer_Drop(object sender, DragEventArgs e)
|
|
{
|
|
{
|
|
- var command = CommandController.Current.Commands["PixiEditor.Layer.PasteReferenceLayer"];
|
|
|
|
-
|
|
|
|
if (!command.Methods.CanExecute(e.Data))
|
|
if (!command.Methods.CanExecute(e.Data))
|
|
{
|
|
{
|
|
return;
|
|
return;
|