CapturePointer() 공개 메소드

public CapturePointer ( [ value ) : bool
value [
리턴 bool
 public static void OnPointerPressed(UIElement sender, TouchSliderC slider, PointerRoutedEventArgs e)
 {
     sender.CapturePointer(e.Pointer);
     _lastPoint = e.GetCurrentPoint(slider);
     _isDragActive = true;
     e.Handled = true;
 }
예제 #2
0
        private void PointerPressed(PointerPoint pointerPoint, UIElement target, Pointer pointer)
        {
            // To convert from DIPs (device independent pixels) to screen resolution pixels.
            var dipFactor = DisplayProperties.LogicalDpi / 96.0f;
            var pos = new Vector2((float)pointerPoint.Position.X, (float)pointerPoint.Position.Y) * dipFactor;

            var isTouch = pointerPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Touch;

            _touchQueue.Enqueue((int)pointerPoint.PointerId, TouchLocationState.Pressed, pos, !isTouch);
            
            if (!isTouch)
            {
                // Mouse or stylus event.
                UpdateMouse(pointerPoint);

                // Capture future pointer events until a release.		
                if (target != null)
                    target.CapturePointer(pointer);
            }
        }
예제 #3
0
        /// <summary>
        /// Handler for the event when the user starts dragging the dragElement.
        /// </summary>
        /// <param name="child">UIElement being dragged</param>
        /// <param name="position">Position in the child where the user clicked</param>
        /// <param name="pointer">Pointer</param>
        internal async Task BeginFluidDragAsync(UIElement child, Point position, Pointer pointer)
        {
            if ((child == null) || (!IsComposing))
                return;

            // Call the event handler core on the Dispatcher. (Improves efficiency!)
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                child.Opacity = DragOpacity;
                child.SetValue(Canvas.ZIndexProperty, Z_INDEX_DRAG);
                // Capture further mouse events
                child.CapturePointer(pointer);
                _dragElement = child;
                _lastDragElement = null;

                // Since we are scaling the dragElement by DragScale, the clickPoint also shifts
                _dragStartPoint = new Point(position.X * DragScale, position.Y * DragScale);
            });
        }
        /// <summary>
        /// Handler for the event when the user starts dragging the dragElement.
        /// </summary>
        /// <param name="child">UIElement being dragged</param>
        /// <param name="position">Position in the child where the user clicked</param>
        /// <param name="pointer">Pointer</param>
        internal void BeginFluidDrag(UIElement child, Point position, Pointer pointer)
        {
            if ((child == null) || (!IsComposing))
                return;

            child.SetValue(Canvas.ZIndexProperty, ZIndexDrag);
            // Capture further pointer events
            child.CapturePointer(pointer);
            _dragElement = child;

            var visual = _fluidVisuals[_dragElement];
            visual.Opacity = (float)DragOpacity;
            visual.CenterPoint = new Vector3((float)position.X, (float)position.Y, 0);
            visual.Scale = new Vector3((float)DragScale, (float)DragScale, 1);
            visual.ImplicitAnimations = _implicitDragAnimationCollection;

            // Set the starting position of the drag
            _dragStartPoint = new Point(position.X, position.Y);
        }