| File was renamed from Utils/Resize.cs |
| | |
| | | double oldLeft = double.IsNaN(Canvas.GetLeft(target)) ? 0 : Canvas.GetLeft(target), |
| | | oldTop = double.IsNaN(Canvas.GetTop(target)) ? 0 : Canvas.GetTop(target), |
| | | oldWidth = double.IsNaN(target.ActualWidth) ? 0 : target.ActualWidth, |
| | | oldHeight = double.IsNaN(target.ActualHeight) ? 0 : target.ActualHeight;
|
| | | oldHeight = double.IsNaN(target.ActualHeight) ? 0 : target.ActualHeight; |
| | | |
| | | double left, top, width, height; |
| | | double x = e.HorizontalChange, y = e.VerticalChange; |
| | | bool toLeft = x < 0, toTop = y < 0;
|
| | | bool isLeft = thumb.HorizontalAlignment == HorizontalAlignment.Left,
|
| | | isTop = thumb.VerticalAlignment == VerticalAlignment.Top;
|
| | | bool toLeft = x < 0, toTop = y < 0; |
| | | bool isLeft = thumb.HorizontalAlignment == HorizontalAlignment.Left, |
| | | isTop = thumb.VerticalAlignment == VerticalAlignment.Top; |
| | | if (isLeft) |
| | | { |
| | | // 左侧的拖拽 |
| | |
| | | if (top + height > parent.ActualHeight) height = parent.ActualHeight - top; |
| | | } |
| | | |
| | | if (thumb.HorizontalAlignment != HorizontalAlignment.Center &&
|
| | | if (thumb.HorizontalAlignment != HorizontalAlignment.Center && |
| | | thumb.HorizontalAlignment != HorizontalAlignment.Stretch) |
| | | { |
| | | // 水平方向最终判断 |
| | | Canvas.SetLeft(target, left); |
| | | target.Width = width; |
| | | //if ((isLeft && toLeft && left >= 0) ||
|
| | | // (isLeft && !toLeft && width >= MinWidth) ||
|
| | | // (!isLeft && toLeft && width >= MinWidth) ||
|
| | | // (!isLeft && !toLeft && (left + width) <= parent.ActualWidth))
|
| | | //{
|
| | | //if ((isLeft && toLeft && left >= 0) || |
| | | // (isLeft && !toLeft && width >= MinWidth) || |
| | | // (!isLeft && toLeft && width >= MinWidth) || |
| | | // (!isLeft && !toLeft && (left + width) <= parent.ActualWidth)) |
| | | //{ |
| | | // Canvas.SetLeft(target, left); |
| | | // target.Width = width; |
| | | //} |
| | | } |
| | | |
| | | if (thumb.VerticalAlignment != VerticalAlignment.Center &&
|
| | | if (thumb.VerticalAlignment != VerticalAlignment.Center && |
| | | thumb.VerticalAlignment != VerticalAlignment.Stretch) |
| | | { |
| | | // 垂直方向最终判断 |
| | | Canvas.SetTop(target, top);
|
| | | Canvas.SetTop(target, top); |
| | | target.Height = height; |
| | | //if ((isTop && toTop && top >= 0) ||
|
| | | // (isTop && !toTop && height >= MinHeight) ||
|
| | | // (!isTop && toTop && height >= MinHeight) ||
|
| | | // (!isTop && !toTop && (top + height) <= parent.ActualHeight))
|
| | | //{
|
| | | //if ((isTop && toTop && top >= 0) || |
| | | // (isTop && !toTop && height >= MinHeight) || |
| | | // (!isTop && toTop && height >= MinHeight) || |
| | | // (!isTop && !toTop && (top + height) <= parent.ActualHeight)) |
| | | //{ |
| | | // Canvas.SetTop(target, top); |
| | | // target.Height = height; |
| | | //} |