private void HandleOnMouseLeftButtonDown(object sender, FingerManipulationEventArgs args)
        {
            args.Handled = true;

            var inputElement = (IUserInputReceiver)sender;

            var handlePoint = Handles[inputElement];

            var absolutePoint = ConvertProportionalToAbsolute(handlePoint);

            ResizeOperation = new ResizeOperation(CanvasItem, absolutePoint, SnappingEngine);            
            Parent.CaptureInput(null);

            Parent.FingerMove += ParentOnMouseMove;
            Parent.FingerUp += ParentOnMouseLeftButtonUp;
        }
        private void ParentOnMouseLeftButtonUp(object sender, FingerManipulationEventArgs args)
        {
            if (ResizeOperation != null)
            {
                var position = args.GetPosition(Parent);
                ResizeOperation.UpdateHandlePosition(position);
                Parent.ReleaseInput(null);
                Parent.FingerMove -= ParentOnMouseMove;
                ResizeOperation.Dispose();
                ResizeOperation = null;
                SnappingEngine.ClearSnappedEdges();

                IsDragging = false;
                //OnDragEnd();
            }
        }
Esempio n. 3
0
        public void IncreaseWidthTopRight()
        {
            var canvasItem = new CanvasModelItem
                             {
                                 Width = 30,
                                 Height = 30,
                                 Left = 10,
                                 Top = 20,
                             };

            var hookPoint = new Point(40, 20);
            var newPoint = new Point(50, 20);

            var resizeOperation = new ResizeOperation(canvasItem, newPoint , new NoEffectsCanvasItemSnappingEngine());
            resizeOperation.UpdateHandlePosition(newPoint);
            Assert.AreEqual(40D, canvasItem.Width);
        }
        private void HandleOnMouseLeftButtonDown(object sender, MouseButtonEventArgs mouseButtonEventArgs)
        {
            mouseButtonEventArgs.Handled = true;

            var inputElement = (IInputElement)sender;

            var handlePoint = Handles[inputElement];

            var absolutePoint = ConvertProportionalToAbsolute(handlePoint);

            ResizeOperation = new ResizeOperation(CanvasItem, absolutePoint, SnappingEngine);
            Parent.CaptureMouse();

            Parent.MouseMove += ParentOnMouseMove;
            Parent.MouseLeftButtonUp += ParentOnMouseLeftButtonUp;
        }