Skip to content

Commit aec742b

Browse files
committed
Extracted UpdateMaskArea out of UpdatedSelectedRect, renamed to UpdateSelectionThumbs
1 parent eaf4de2 commit aec742b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Media/ImageCropper/ImageCropper.Logic.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ private void UpdateImageLayoutWithViewport(Rect viewport, Rect viewportImageRect
7575
var endPoint = GetSafePoint(_restrictedSelectRect, new Point(
7676
selectedRect.X + selectedRect.Width,
7777
selectedRect.Y + selectedRect.Height));
78+
7879
if (animate)
7980
{
8081
AnimateUIElementOffset(new Point(_imageTransform.TranslateX, _imageTransform.TranslateY), _animationDuration, _sourceImage);
@@ -87,7 +88,8 @@ private void UpdateImageLayoutWithViewport(Rect viewport, Rect viewportImageRect
8788
targetVisual.Scale = new Vector3((float)imageScale);
8889
}
8990

90-
UpdateSelectedRect(startPoint, endPoint, animate);
91+
UpdateSelectionThumbs(startPoint, endPoint, animate);
92+
UpdateMaskArea(animate);
9193
}
9294

9395
/// <summary>
@@ -277,17 +279,18 @@ private void UpdateCroppedRect(ThumbPosition position, Point diffPos)
277279
}
278280
else
279281
{
280-
UpdateSelectedRect(startPoint, endPoint);
282+
UpdateSelectionThumbs(startPoint, endPoint);
283+
UpdateMaskArea();
281284
}
282285
}
283286

284287
/// <summary>
285-
/// Update selection area.
288+
/// Positions the thumbs for the selection rectangle.
286289
/// </summary>
287290
/// <param name="startPoint">The point on the upper left corner.</param>
288291
/// <param name="endPoint">The point on the lower right corner.</param>
289292
/// <param name="animate">Whether animation is enabled.</param>
290-
private void UpdateSelectedRect(Point startPoint, Point endPoint, bool animate = false)
293+
private void UpdateSelectionThumbs(Point startPoint, Point endPoint, bool animate = false)
291294
{
292295
_startX = startPoint.X;
293296
_startY = startPoint.Y;
@@ -417,8 +420,6 @@ private void UpdateSelectedRect(Point startPoint, Point endPoint, bool animate =
417420
{
418421
storyboard.Begin();
419422
}
420-
421-
UpdateMaskArea(animate);
422423
}
423424

424425
/// <summary>

0 commit comments

Comments
 (0)