mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 08:56:30 +00:00
rework autoupdate to script only
zoom fix
This commit is contained in:
@@ -126,9 +126,26 @@ public class CanvasEditor : Canvas
|
||||
|
||||
public void SetImageSource(ImageSource? source)
|
||||
{
|
||||
SetZoom();
|
||||
_backgroundImage.Source = source;
|
||||
}
|
||||
|
||||
private void SetZoom(Matrix? matrix = null)
|
||||
{
|
||||
if (matrix == null)
|
||||
{
|
||||
_matrixTransform.Matrix = Matrix.Identity;
|
||||
_isZoomedIn = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_matrixTransform.Matrix = matrix.Value;
|
||||
_isZoomedIn = true;
|
||||
}
|
||||
foreach (var detection in CurrentDetections)
|
||||
detection.UpdateAdornerScale(scale: _matrixTransform.Matrix.M11);
|
||||
}
|
||||
|
||||
private void CanvasWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (Keyboard.Modifiers != ModifierKeys.Control)
|
||||
@@ -139,19 +156,12 @@ public class CanvasEditor : Canvas
|
||||
|
||||
var matrix = _matrixTransform.Matrix;
|
||||
if (scale < 1 && matrix.M11 * scale < 1.0)
|
||||
{
|
||||
_matrixTransform.Matrix = Matrix.Identity;
|
||||
_isZoomedIn = false;
|
||||
}
|
||||
SetZoom();
|
||||
else
|
||||
{
|
||||
matrix.ScaleAt(scale, scale, mousePos.X, mousePos.Y);
|
||||
_matrixTransform.Matrix = matrix;
|
||||
_isZoomedIn = true;
|
||||
SetZoom(matrix);
|
||||
}
|
||||
|
||||
foreach (var detection in CurrentDetections)
|
||||
detection.UpdateAdornerScale(scale: _matrixTransform.Matrix.M11);
|
||||
}
|
||||
|
||||
private void Init(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user