private void RegisterHandles() { UIResizeOperationHandleConnector = new UIResizeOperationHandleConnector(CanvasItem, FrameOfReference, SnappingEngine); WindowsSizeCursorsThumbCursorConverter = new WindowsSizeCursorsThumbCursorConverter(); var thumbContainer = (UIElement)Template.FindName("PART_ThumbContainer", this); var enumerable = LogicalTreeHelper.GetChildren(thumbContainer); var logicalChildren = enumerable.OfType <FrameworkElement>(); foreach (var logicalChild in logicalChildren) { var rectRelativeToParent = Mapper.Map <Rect>(logicalChild.GetRectRelativeToParent()); var childRect = rectRelativeToParent; var parentRect = Mapper.Map <Rect>(CanvasItem.Rect()); var handlePoint = childRect.GetHandlePoint(parentRect.Size); var uiElement = new UIElementAdapter(logicalChild); UIResizeOperationHandleConnector.RegisterHandle(uiElement, handlePoint); SetCursorToHandle(logicalChild); } }
private void RegisterHandles() { UIResizeOperationHandleConnector = new UIResizeOperationHandleConnector(CanvasItem, FrameOfReference, SnappingEngine); var thumbContainer = (UIElement)FindName("PART_ThumbContainer"); Debug.Assert(thumbContainer != null, "ThumbContainer part not found!"); var visualChildren = new List <DependencyObject>(); for (var i = 0; i < VisualTreeHelper.GetChildrenCount(thumbContainer); i++) { visualChildren.Add(VisualTreeHelper.GetChild(thumbContainer, i)); } var logicalChildren = visualChildren.OfType <FrameworkElement>(); foreach (var logicalChild in logicalChildren) { var childRect = this.GetRectRelativeToParent(logicalChild); var parentRect = CanvasItem.Rect(); var handlePoint = childRect.GetHandlePoint(parentRect.Size); UIResizeOperationHandleConnector.RegisterHandle(new UIElementAdapter(logicalChild), handlePoint); } }
public ResizeOperation(ICanvasItem child, IPoint handlePoint, ISnappingEngine snappingEngine) { Child = child; HandlePoint = handlePoint; SetCanResize(child, handlePoint); Opposite = HandlePoint.GetOpposite(child.Rect().MiddlePoint()); SnappingEngine = snappingEngine; this.recordingScope = RecordingServices.DefaultRecorder.OpenScope(string.Format( "Resize {0}", this.child.GetName() )); }
public ResizeOperation(ICanvasItem child, IPoint handlePoint, ISnappingEngine snappingEngine) { Child = child; HandlePoint = handlePoint; SetCanResize(child, handlePoint); Opposite = HandlePoint.GetOpposite(child.Rect().MiddlePoint()); SnappingEngine = snappingEngine; this.recordingScope = RecordingServices.DefaultRecorder.OpenScope(string.Format("Resize {0}", this.child.GetName())); }
public ResizeOperation(ICanvasItem child, IPoint handlePoint, ISnappingEngine snappingEngine) { Child = child; HandlePoint = handlePoint; SetCanResize(child, handlePoint); Opposite = HandlePoint.GetOpposite(child.Rect().MiddlePoint()); SnappingEngine = snappingEngine; this.recordingScope = CanvasModelItem.Recorder.StartAtomicScope("Resize", false); }
private void SetCanResize(ICanvasItem canvasItem, IPoint handlePoint) { var rect = canvasItem.Rect(); var middlePoint = rect.MiddlePoint(); var distanceX = Math.Abs(middlePoint.X - handlePoint.X); var distanceY = Math.Abs(middlePoint.Y - handlePoint.Y); double delta = 0.3; CanChangeHorizontalPosition = distanceX > delta*canvasItem.Width; CanChangeVerticalPosition = distanceY > delta * canvasItem.Height; }
private void SetCanResize(ICanvasItem canvasItem, IPoint handlePoint) { var rect = canvasItem.Rect(); var middlePoint = rect.MiddlePoint(); var distanceX = Math.Abs(middlePoint.X - handlePoint.X); var distanceY = Math.Abs(middlePoint.Y - handlePoint.Y); double delta = 0.3; CanChangeHorizontalPosition = distanceX > delta * canvasItem.Width; CanChangeVerticalPosition = distanceY > delta * canvasItem.Height; }