|
@@ -14,6 +14,9 @@ public partial class ImageZoomView : UserControl
|
|
|
InitializeComponent();
|
|
|
}
|
|
|
|
|
|
+ private bool _mousePressed = false;
|
|
|
+ private Point _previousPoint;
|
|
|
+
|
|
|
public void ZoomImage(object? source, PinchEventArgs args)
|
|
|
{
|
|
|
this.GetControl<ZoomBorder>("ZoomBorder").ZoomTo(args.Scale,args.ScaleOrigin.X,args.ScaleOrigin.Y);
|
|
@@ -26,7 +29,29 @@ public partial class ImageZoomView : UserControl
|
|
|
|
|
|
public void ZoomImageToDefault(object? source, RoutedEventArgs args)
|
|
|
{
|
|
|
- var zoomBorder = this.GetControl<ZoomBorder>("ZoomBorder");
|
|
|
- zoomBorder.Uniform();
|
|
|
+ this.GetControl<ZoomBorder>("ZoomBorder").Uniform();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void PanStart(object? source, PointerPressedEventArgs args)
|
|
|
+ {
|
|
|
+ _mousePressed = true;
|
|
|
+ _previousPoint = args.GetPosition(this.GetControl<ZoomBorder>("ZoomBorder"));
|
|
|
}
|
|
|
+
|
|
|
+ public void PanImage(object? source, PointerEventArgs args)
|
|
|
+ {
|
|
|
+ if (_mousePressed)
|
|
|
+ {
|
|
|
+ var zoomBorder = this.GetControl<ZoomBorder>("ZoomBorder");
|
|
|
+ var point = args.GetPosition(zoomBorder);
|
|
|
+ zoomBorder.PanDelta(point.X-_previousPoint.X,point.Y-_previousPoint.Y);
|
|
|
+ _previousPoint = point;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void PanStop(object? source, PointerReleasedEventArgs args)
|
|
|
+ {
|
|
|
+ _mousePressed = false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|