Exemplo n.º 1
0
        private void FrameOfReferenceOnMouseMove(object sender, FingerManipulationEventArgs args)
        {
            if (!IsDragging)
            {
                IsDragging = true;
                OnDragStarted();
            }

            var position = args.GetPosition(FrameOfReference);

            DragOperation.NotifyNewPosition(position);
        }
Exemplo n.º 2
0
        private void TargetOnPreviewMouseLeftButtonDown(object sender, FingerManipulationEventArgs fingerManipulationEventArgs)
        {
            fingerManipulationEventArgs.Handled = true;

            Pointer = fingerManipulationEventArgs.Pointer;

            var startingPoint = fingerManipulationEventArgs.GetPosition(FrameOfReference);

            DragOperation = new DragOperation(ItemToDrag, startingPoint, SnappingEngine);

            FrameOfReference.CaptureInput(Pointer);

            FrameOfReference.FingerMove += FrameOfReferenceOnMouseMove;
            FrameOfReference.FingerUp   += FrameOfReferenceOnMouseLeftButtonUp;
        }
Exemplo n.º 3
0
        private void FrameOfReferenceOnMouseLeftButtonUp(object sender, FingerManipulationEventArgs args)
        {
            if (DragOperation != null)
            {
                var position = args.GetPosition(FrameOfReference);
                DragOperation.NotifyNewPosition(Mapper.Map <Point>(position));
                FrameOfReference.ReleaseInput(Pointer);
                FrameOfReference.FingerMove -= FrameOfReferenceOnMouseMove;
                DragOperation = null;
                SnappingEngine.ClearSnappedEdges();

                IsDragging = false;
                Pointer    = null;
                OnDragEnd();
            }
        }
        private void ParentOnMouseMove(object sender, FingerManipulationEventArgs args)
        {
            var position      = args.GetPosition(Parent);
            var parentPositon = ((IUIElement)Parent).GetPosition();
            var finalPoint    = position.Add(parentPositon);

            var newPoint = Mapper.Map <Point>(finalPoint);

            ResizeOperation.UpdateHandlePosition(newPoint);

            if (!IsDragging)
            {
                IsDragging = true;
                //OnDragStarted();
            }
        }
        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();
            }
        }