Browse Source

Fixed color picking from reference

CPKreuz 3 years ago
parent
commit
c64d9099d0

+ 0 - 16
PixiEditor/Models/DataHolders/Document/Document.cs

@@ -95,22 +95,6 @@ namespace PixiEditor.Models.DataHolders
             }
         }
 
-        private double mouseXonReference;
-
-        public double MouseXOnReference
-        {
-            get => mouseXonReference;
-            set => SetProperty(ref mouseXonReference, value);
-        }
-
-        private double mouseYonReference;
-
-        public double MouseYOnReference
-        {
-            get => mouseYonReference;
-            set => SetProperty(ref mouseYonReference, value);
-        }
-
         public ExecutionTrigger<Size> CenterViewportTrigger { get; } = new();
         public ExecutionTrigger<double> ZoomViewportTrigger { get; } = new();
 

+ 2 - 2
PixiEditor/Models/Tools/Tools/ColorPickerTool.cs

@@ -41,8 +41,8 @@ namespace PixiEditor.Models.Tools.Tools
 
             if (Keyboard.IsKeyDown(Key.LeftCtrl) && (referenceLayer = _docProvider.GetReferenceLayer()) is not null)
             {
-                double actualX = activeDocument.MouseXOnReference * referenceLayer.Width / activeDocument.Width;
-                double actualY = activeDocument.MouseYOnReference * referenceLayer.Height / activeDocument.Height;
+                double actualX = activeDocument.MouseXOnCanvas * referenceLayer.Width / activeDocument.Width;
+                double actualY = activeDocument.MouseYOnCanvas * referenceLayer.Height / activeDocument.Height;
 
                 x = (int)Round(actualX, MidpointRounding.ToZero);
                 y = (int)Round(actualY, MidpointRounding.ToZero);

+ 1 - 9
PixiEditor/Views/UserControls/DrawingViewPort.xaml

@@ -54,20 +54,12 @@
                     </ImageBrush>
                 </Canvas.Background>
 
-                <!--<local:ReferenceLayerView Document="{Binding}"/>-->
-
                 <Image Source="{Binding ReferenceLayerRenderer.FinalBitmap}"
                        VerticalAlignment="Stretch" Stretch="Uniform"
                        Visibility="{Binding ReferenceLayer.IsVisible, Converter={BoolToVisibilityConverter}}"
                        HorizontalAlignment="Stretch"
                        Width="{Binding Width}" Height="{Binding Height}"
-                       RenderOptions.BitmapScalingMode="NearestNeighbor">
-                    <i:Interaction.Behaviors>
-                        <behaviors:MouseBehavior
-                                     MouseX="{Binding MouseXOnReference, Mode=TwoWay}"
-                                     MouseY="{Binding MouseYOnReference, Mode=TwoWay}" />
-                    </i:Interaction.Behaviors>
-                </Image>
+                       RenderOptions.BitmapScalingMode="NearestNeighbor"/>
 
                 <Image Source="{Binding PreviewLayerRenderer.FinalBitmap}" Panel.ZIndex="2"
                                    RenderOptions.BitmapScalingMode="NearestNeighbor" Stretch="Uniform"