summaryrefslogtreecommitdiff
path: root/Views/Image
diff options
context:
space:
mode:
Diffstat (limited to 'Views/Image')
-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;