summaryrefslogtreecommitdiff
path: root/Views/Image/ImageControl.xaml.cs
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2019-12-24 16:45:22 +0100
committerDennis Brentjes <d.brentjes@gmail.com>2019-12-24 16:45:22 +0100
commitfbe866f7b26c10bb54d72c029f8c628988a90be2 (patch)
tree7617f1209333ff40c31aa156d541e8ea59e991ed /Views/Image/ImageControl.xaml.cs
parent0f98b398520a3f5cc6a299e7fd3b8fab494480d7 (diff)
downloadavalar-fbe866f7b26c10bb54d72c029f8c628988a90be2.tar.gz
avalar-fbe866f7b26c10bb54d72c029f8c628988a90be2.tar.bz2
avalar-fbe866f7b26c10bb54d72c029f8c628988a90be2.zip
Started on the resizing step of the pipeline + pipeline design.
Diffstat (limited to 'Views/Image/ImageControl.xaml.cs')
-rw-r--r--Views/Image/ImageControl.xaml.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Views/Image/ImageControl.xaml.cs b/Views/Image/ImageControl.xaml.cs
index 2189bb0..e806d6f 100644
--- a/Views/Image/ImageControl.xaml.cs
+++ b/Views/Image/ImageControl.xaml.cs
@@ -21,7 +21,11 @@ namespace Avalar.Views.Image
{
InitializeComponent();
- Image = this.FindResource("ImageBrush") as ImageBrush ?? throw new System.ArgumentException("ImageBrush");
+ var brushName = "ImageBrush";
+ string message = $"The brush with name {brushName} could not be found in the Xaml Resources";
+#pragma warning disable CA1303 // Do not pass literals as localized parameters
+ Image = (this).FindResource(brushName) as ImageBrush ?? throw new ArgumentException(message);
+#pragma warning restore CA1303 // Do not pass literals as localized parameters
ImageCanvas = this.FindControl<Canvas>("ImageCanvas");
}
@@ -73,7 +77,7 @@ namespace Avalar.Views.Image
public void OnPointerWheelChanged(object sender, PointerWheelEventArgs e)
{
var invOldZoom = InvCurrentZoom;
- var zoomFactor = e.Delta.Y * ZoomTick + 1.0;
+ var zoomFactor = (e?.Delta.Y ?? 0) * ZoomTick + 1.0;
CurrentZoom = Math.Clamp(CurrentZoom * zoomFactor, 1, double.PositiveInfinity);
var sourceRect = Image.SourceRect.Rect;