コード例 #1
0
        protected override void OnPointerReleased(PointerRoutedEventArgs e)
        {
            base.OnPointerReleased(e);
            base.OnPointerPressed(e);
            var currentPoint = e.GetCurrentPoint(this);
            var point = new Point(currentPoint.Position.X, currentPoint.Position.Y);

            var args = new FingerManipulationEventArgs { Point = point, Handled = true };

            OnFingerUp(args);
        }
コード例 #2
0
        private void FrameOfReferenceOnMouseMove(object sender, FingerManipulationEventArgs args)
        {
            if (!IsDragging)
            {
                IsDragging = true;
                OnDragStarted();
            }

            var position = args.GetPosition(FrameOfReference);

            DragOperation.NotifyNewPosition(position);        
        }
コード例 #3
0
        private void UIElementOnPointerReleased(object sender, PointerRoutedEventArgs pointerRoutedEventArgs)
        {
            var corePoint = pointerRoutedEventArgs.GetCurrentPoint(null);
            if (corePoint.Properties.IsLeftButtonPressed)
            {

                var fingerManipulationEventArgs = new FingerManipulationEventArgs();

                OnFingerUp(fingerManipulationEventArgs);

                pointerRoutedEventArgs.Handled = fingerManipulationEventArgs.Handled;
            }
        }
コード例 #4
0
        private void UIElementOnPointerPressed(object sender, PointerRoutedEventArgs pointerRoutedEventArgs)
        {
            var pointerPoint = pointerRoutedEventArgs.GetCurrentPoint(null);
            if (pointerPoint.Properties.IsLeftButtonPressed)
            {
                var pointer = pointerRoutedEventArgs.Pointer;
                var corePoint = Mapper.Map<Point>(pointerPoint.Position);
                var fingerManipulationEventArgs = new FingerManipulationEventArgs { Pointer = pointer, Point = corePoint };

                OnFingerDown(fingerManipulationEventArgs);

                pointerRoutedEventArgs.Handled = fingerManipulationEventArgs.Handled;
            }
        }
コード例 #5
0
        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();
            }
        }
コード例 #6
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();
            }
        }
コード例 #7
0
        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();
            }
        }
コード例 #8
0
        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;
        }
コード例 #9
0
        protected override void OnPointerPressed(PointerRoutedEventArgs e)
        {
            base.OnPointerPressed(e);
            var currentPoint = e.GetCurrentPoint(this);

            if (currentPoint.Properties.IsLeftButtonPressed)
            {
                var point = new Point(currentPoint.Position.X, currentPoint.Position.Y);
                var args = new FingerManipulationEventArgs
                           {
                               Point = point, Handled = true, Pointer = e.Pointer,
                           };

                OnFingerDown(args);
            }
        }
コード例 #10
0
        private void UIElementOnPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs mouseButtonEventArgs)
        {
            var corePoint = mouseButtonEventArgs.GetPosition(null);
            var point = Mapper.Map<Point>(corePoint);

            var fingerManipulationEventArgs = new FingerManipulationEventArgs();
            OnFingerUp(fingerManipulationEventArgs);

            mouseButtonEventArgs.Handled = fingerManipulationEventArgs.Handled;
        }
コード例 #11
0
        private void UIElementOnMouseMove(object sender, MouseEventArgs mouseEventArgs)
        {
            var corePoint = mouseEventArgs.GetPosition(null);
            var point = Mapper.Map<Point>(corePoint);

            var fingerManipulationEventArgs = new FingerManipulationEventArgs();
            OnFingerMove(fingerManipulationEventArgs);
            mouseEventArgs.Handled = fingerManipulationEventArgs.Handled;
        }
コード例 #12
0
 protected virtual void OnFingerUp(FingerManipulationEventArgs args)
 {
     var handler = FingerUp;
     if (handler != null) handler(this, args);
 }
コード例 #13
0
 private void UIElementOnPointerMoved(object sender, PointerRoutedEventArgs pointerRoutedEventArgs)
 {
     var fingerManipulationEventArgs = new FingerManipulationEventArgs();
     OnFingerMove(fingerManipulationEventArgs);
     pointerRoutedEventArgs.Handled = fingerManipulationEventArgs.Handled;
 }
コード例 #14
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;            
        }
コード例 #15
0
 private void OnFingerUp(FingerManipulationEventArgs args)
 {
     var handler = FingerUp;
     if (handler != null) handler(this, args);
 }
コード例 #16
0
 protected override void OnFingerDown(FingerManipulationEventArgs args)
 {
     base.OnFingerDown(args);
     RaiseNoneSpecified();
 }