Skip to content

Commit b011848

Browse files
author
Carl Chang
committed
tweak how large image is decided
1 parent a37da29 commit b011848

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ViewWindow.xaml.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ private void transform(int ms, Size? newSize = null, Point? transPoint = null, b
120120
var isLarge = false;
121121
//process resizing
122122
if (newSize.HasValue) {
123+
var rW = newSize.Value.Width / IM.Width;
124+
var rH = newSize.Value.Height / IM.Height;
123125
var showScale = true;
124126
if (double.IsNaN(IM.Width) || double.IsNaN(IM.Height)) {
125127
//skip animation when Width or Height is not set
@@ -128,8 +130,8 @@ private void transform(int ms, Size? newSize = null, Point? transPoint = null, b
128130
showScale = false;
129131
}
130132
else if ((!altAnim.HasValue || altAnim.Value) &&
131-
Math.Abs(newSize.Value.Width / IM.Width - 1d) > 0.5d &&
132-
Math.Abs(newSize.Value.Height / IM.Height - 1d) > 0.5d) {
133+
(rW < 0.5d || 2d < rW) && (rH < 0.5d || 2d < rH))
134+
{
133135
isLarge = true;
134136
//for large images, use alternate animation to reduce stutter
135137
var animOp = new DoubleAnimationUsingKeyFrames();

0 commit comments

Comments
 (0)