Browse Source

Fixed displaying Cursor

Frytek 5 years ago
parent
commit
28e304607c

+ 14 - 4
PixiEditor/ViewModels/ViewModelMain.cs

@@ -126,6 +126,18 @@ namespace PixiEditor.ViewModels
             }
         }
 
+        private Cursor _toolCursor;
+
+        public Cursor ToolCursor
+        {
+            get { return _toolCursor; }
+            set {
+                _toolCursor = value;
+                RaisePropertyChanged("ToolCursor");
+            }
+        }
+
+
 
         public BitmapOperationsUtility BitmapUtility { get; set; }
         public PixelChangesController ChangesController { get; set; }
@@ -300,16 +312,14 @@ namespace PixiEditor.ViewModels
         private void SetActiveTool(ToolType tool)
         {
             BitmapUtility.SelectedTool = ToolSet.Find(x=> x.ToolType == tool);
-            Cursor cursor;
             if (tool != ToolType.None && tool != ToolType.ColorPicker)
             {
-               cursor = BitmapUtility.SelectedTool.Cursor;
+               ToolCursor = BitmapUtility.SelectedTool.Cursor;
             }
             else
             {
-                cursor = Cursors.Arrow;
+                ToolCursor = Cursors.Arrow;
             }
-            Mouse.OverrideCursor = cursor;
         }
         /// <summary>
         /// When mouse is up stops recording changes.

+ 1 - 1
PixiEditor/Views/MainDrawingPanel.xaml

@@ -9,7 +9,7 @@
              xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800" x:Name="mainDrawingPanel">
-    <xctk:Zoombox IsAnimated="False" Name="Zoombox" KeepContentInBounds="True" Loaded="Zoombox_Loaded" DragModifiers="Shift" ZoomModifiers="None" >
+    <xctk:Zoombox Cursor="{Binding Cursor}" IsAnimated="False" Name="Zoombox" KeepContentInBounds="True" Loaded="Zoombox_Loaded" DragModifiers="Shift" ZoomModifiers="None" >
         <i:Interaction.Triggers>
             <i:EventTrigger EventName="MouseMove">
                 <i:InvokeCommandAction Command="{Binding MouseMoveCommand, ElementName=mainDrawingPanel, Mode=OneWay}"/>

+ 3 - 4
PixiEditor/Views/MainDrawingPanel.xaml.cs

@@ -26,10 +26,9 @@ namespace PixiEditor.Views
         public MainDrawingPanel()
         {
             InitializeComponent();
-        }
-
-
-
+        }
+
+
         public double MouseX
         {
             get { return (double)GetValue(MouseXProperty); }

+ 1 - 1
PixiEditor/Views/MainWindow.xaml

@@ -69,7 +69,7 @@
         </WrapPanel>
         <Grid Grid.Column="1" Grid.Row="1" Background="#303030" Margin="0,5,5,0">
             <Grid>
-                <vws:MainDrawingPanel CenterOnStart="True">
+                <vws:MainDrawingPanel CenterOnStart="True" Cursor="{Binding ToolCursor}">
                     <vws:MainDrawingPanel.Item>
                         <Canvas Width="{Binding BitmapUtility.ActiveLayer.Width}" Height="{Binding BitmapUtility.ActiveLayer.Height}" VerticalAlignment="Center" HorizontalAlignment="Center">
                             <i:Interaction.Triggers>