Skip to content

Commit d2709d3

Browse files
committed
#79 Update ScreenCutAdorner.cs
#79 Update ScreenCutAdorner.cs
1 parent 6e34dea commit d2709d3

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCutAdorner.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,24 @@ private Thumb GetResizeThumb(Cursor cur, HorizontalAlignment hor, VerticalAlignm
159159
if (newHeight > 0 && top <= canvas.ActualHeight)
160160
{
161161
element.Height = newHeight;
162-
ScaleWidth(thumb, element, newHeight);
162+
if(_isRatioScale)
163+
ScaleWidth(thumb, element, newHeight);
163164
}
164165
}
165166
break;
166167

167168
case VerticalAlignment.Top:
168169
if (element.Height - e.VerticalChange > MINIMAL_SIZE)
169170
{
170-
171171
var newHeight = element.Height - e.VerticalChange;
172172
var top = Canvas.GetTop(element);
173-
ScaleWidth(thumb, element, newHeight);
173+
if (newHeight > 0 && top + e.VerticalChange >= 0)
174+
{
175+
element.Height = newHeight;
176+
Canvas.SetTop(element, top + e.VerticalChange);
177+
if (_isRatioScale)
178+
ScaleWidth(thumb, element, newHeight);
179+
}
174180
}
175181

176182
break;
@@ -187,7 +193,8 @@ private Thumb GetResizeThumb(Cursor cur, HorizontalAlignment hor, VerticalAlignm
187193
{
188194
element.Width = newWidth;
189195
Canvas.SetLeft(element, left + e.HorizontalChange);
190-
ScaleHeight(thumb, element, newWidth);
196+
if (_isRatioScale)
197+
ScaleHeight(thumb, element, newWidth);
191198
}
192199
}
193200

@@ -200,7 +207,8 @@ private Thumb GetResizeThumb(Cursor cur, HorizontalAlignment hor, VerticalAlignm
200207
if (newWidth > 0 && left <= canvas.ActualWidth)
201208
{
202209
element.Width = newWidth;
203-
ScaleHeight(thumb, element, newWidth);
210+
if (_isRatioScale)
211+
ScaleHeight(thumb, element, newWidth);
204212
}
205213
}
206214
break;

0 commit comments

Comments
 (0)