Skip to content

Commit

Permalink
Fixed color picking from reference
Browse files Browse the repository at this point in the history
  • Loading branch information
CPKreu committed Dec 2, 2021
1 parent 9396971 commit c64d909
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
16 changes: 0 additions & 16 deletions PixiEditor/Models/DataHolders/Document/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,6 @@ public Selection ActiveSelection
}
}

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();

Expand Down
4 changes: 2 additions & 2 deletions PixiEditor/Models/Tools/Tools/ColorPickerTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public SKColor GetColorAt(int x, int y)

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);
Expand Down
10 changes: 1 addition & 9 deletions PixiEditor/Views/UserControls/DrawingViewPort.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c64d909

Please sign in to comment.