Esempio n. 1
0
            public static EventBase MakeEvent(TouchPhase phase, Vector2 position, EventModifiers modifiers = EventModifiers.None, MouseButton button = MouseButton.LeftMouse)
            {
                var touch = MakeDefaultTouch();

                touch.position = position;
                touch.phase    = phase;

                if (button != MouseButton.LeftMouse)
                {
                    PointerDeviceState.PressButton(touch.fingerId, (int)button);
                }

                switch (touch.phase)
                {
                case TouchPhase.Began:
                    return(PointerDownEvent.GetPooled(touch, modifiers));

                case TouchPhase.Moved:
                    return(PointerMoveEvent.GetPooled(touch, modifiers));

                case TouchPhase.Ended:
                    return(PointerUpEvent.GetPooled(touch, modifiers));

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
Esempio n. 2
0
        private EventBase MakeTouchEvent(Touch touch, EventModifiers modifiers)
        {
            // Flip Y Coordinates.
            touch.position      = new Vector2(touch.position.x, Screen.height - touch.position.y);
            touch.rawPosition   = new Vector2(touch.rawPosition.x, Screen.height - touch.rawPosition.y);
            touch.deltaPosition = new Vector2(touch.deltaPosition.x, Screen.height - touch.deltaPosition.y);

            switch (touch.phase)
            {
            case TouchPhase.Began:
                return(PointerDownEvent.GetPooled(touch, modifiers));

            case TouchPhase.Moved:
                return(PointerMoveEvent.GetPooled(touch, modifiers));

            case TouchPhase.Stationary:
                return(PointerStationaryEvent.GetPooled(touch, modifiers));

            case TouchPhase.Ended:
                return(PointerUpEvent.GetPooled(touch, modifiers));

            case TouchPhase.Canceled:
                return(PointerCancelEvent.GetPooled(touch, modifiers));

            default:
                return(null);
            }
        }
        void OnPointerDown(PointerDownEvent e)
        {
            if (!e.isPrimary || e.button != 0)
            {
                return;
            }

            m_OriginalPointerPosition = this.ChangeCoordinatesTo(parent, e.localPosition);
            m_OriginalElementPosition = m_EdgeModel.EdgeControlPoints[m_ControlPointIndex].Position;
            m_OriginalTightness       = m_EdgeModel.EdgeControlPoints[m_ControlPointIndex].Tightness;

            if (e.modifiers == EventModifiers.None)
            {
                m_DraggingControlPoint = true;
            }
            else if (e.modifiers == EventModifiers.Alt)
            {
                m_DraggingTightness = true;
            }

            if (m_DraggingControlPoint || m_DraggingTightness)
            {
                this.CapturePointer(e.pointerId);
                e.StopPropagation();
            }
        }
Esempio n. 4
0
 void OnPointerDownEvent(PointerDownEvent e)
 {
     if (onClick != null)
     {
         onClick(Target != null);
     }
 }
Esempio n. 5
0
 void OnPointerDownEvent(PointerDownEvent e)
 {
     if (onClick != null)
     {
         onClick(e.ClickedObject.GetType());
     }
 }
Esempio n. 6
0
 protected override void handleTapUp(PointerDownEvent down = null, PointerUpEvent up = null)
 {
     if (onAnyTapUp != null)
     {
         onAnyTapUp();
     }
 }
Esempio n. 7
0
        void OnPointerDown(PointerDownEvent e)
        {
            if (m_Active)
            {
                e.StopImmediatePropagation();
                return;
            }

            if (CanStartManipulation(e))
            {
                var ve = (e.currentTarget as VisualElement);
                m_Header = ve.GetFirstAncestorOfType <MultiColumnCollectionHeader>();
                preview  = m_Column.collection.resizePreview;

                if (preview)
                {
                    if (m_PreviewElement == null)
                    {
                        m_PreviewElement = new MultiColumnHeaderColumnResizePreview();
                    }

                    VisualElement previewParent = m_Header.GetFirstAncestorOfType <ScrollView>()?.parent ?? m_Header.parent;

                    previewParent.hierarchy.Add(m_PreviewElement);
                }

                columnLayout = m_Header.columnLayout;
                m_Start      = ve.ChangeCoordinatesTo(m_Header, e.localPosition);
                BeginDragResize(m_Start.x);
                m_Active = true;
                target.CaptureMouse();
                e.StopPropagation();
            }
        }
Esempio n. 8
0
 void _handlePointerDown(PointerDownEvent evt)
 {
     if (widget.enabledCallback())
     {
         _recognizer.addPointer(evt);
     }
 }
Esempio n. 9
0
 private void OnPointerDown(PointerDownEvent evt)
 {
     tooltip.text = "PointerDown!";
     UpdateTooltipPosition(evt.localPosition);
     mainArea.AddToClassList("main-area--active");
     mainArea.CapturePointer(evt.pointerId);
 }
Esempio n. 10
0
 protected override bool isPointerAllowed(PointerDownEvent _event)
 {
     if (!CupertinoScrollbarUtils._hitTestInteractive(_customPaintKey, _event.position))
     {
         return(false);
     }
     return(base.isPointerAllowed(_event));
 }
 void _handlePointerDown(PointerDownEvent evt)
 {
     D.assert(this._recognizers != null);
     foreach (GestureRecognizer recognizer in this._recognizers.Values)
     {
         recognizer.addPointer(evt);
     }
 }
Esempio n. 12
0
 protected override bool isPointerAllowed(PointerDownEvent _event)
 {
     if (onAnyTapUp == null)
     {
         return(false);
     }
     return(base.isPointerAllowed(_event));
 }
 void OnPointerDownEvent(PointerDownEvent e)
 {
     if (e.target == this && e.isPrimary && e.button == 0)
     {
         m_GotMouseDown = true;
         m_MouseOffset  = e.localPosition;
     }
 }
Esempio n. 14
0
        static void ProductEntryClicked(PointerDownEvent evt)
        {
            if (GUI.skin == null)
            {
                return;
            }

            s_ProductDropDown.Show(new Rect(evt.position, Vector2.zero));
        }
Esempio n. 15
0
 private void OnPointerDownEvent(PointerDownEvent evt)
 {
     if (/*evt.target == this && */ evt.button == 0 && evt.isPrimary)
     {
         _dragState   = DragState.Ready;
         _mouseOffset = evt.localPosition;
         this.CaptureMouse();
     }
 }
Esempio n. 16
0
        void OnPointerDown(PointerDownEvent evt)
        {
            if (m_ActiveElement == null && evt.currentTarget == evt.target)
            {
                evt.target.CapturePointer(evt.pointerId);
                var ve = (VisualElement)evt.target;

                StartActiveElement(ve, evt.position);
            }
        }
Esempio n. 17
0
 void OnPointerDown(PointerDownEvent evt)
 {
     if (CanStartManipulation(evt))
     {
         m_Panning          = true;
         m_ActivatingButton = evt.button;
         target.CaptureMouse();
         evt.StopImmediatePropagation();
     }
 }
Esempio n. 18
0
    private void OnFingerDown(PointerDownEvent evt)
    {
        if (evt.pointerType == PointerType.touch && evt.currentTarget == evt.target)
        {
            var ve = evt.target as VisualElement;
            OnDown(ve);

            // Prevent compatibility mouse events from being fired for this pointer.
            evt.PreventDefault();
        }
    }
 void OnTouchDown(PointerDownEvent e)
 {
     if (e.pointerType == PointerType.touch)
     {
         (e.currentTarget as VisualElement).style.backgroundColor = GetRandomColor();
     }
     else
     {
         (e.currentTarget as VisualElement).style.backgroundColor = new StyleColor(Color.black);
     }
 }
Esempio n. 20
0
 void OnPointerDownEvent(PointerDownEvent evt)
 {
     if (evt.button == (int)MouseButton.LeftMouse)
     {
         if (visualInput.ContainsPoint(visualInput.WorldToLocal(evt.originalMousePosition)))
         {
             ShowMenu();
             evt.StopPropagation();
         }
     }
 }
        void ToggleConnectionStatus(PointerDownEvent e, LiveLinkConnection connection)
        {
            switch (connection.Status)
            {
            case LiveLinkConnectionStatus.Connected:
                DisconnectPlayer(e, connection);
                break;

            case LiveLinkConnectionStatus.SoftDisconnected:
                ReconnectPlayer(e, connection);
                break;
            }
        }
Esempio n. 22
0
        void _routePointer(PointerDownEvent pEvent)
        {
            if (widget.maxSimultaneousDrags != null &&
                _activeCount >= widget.maxSimultaneousDrags)
            {
                return;
            }

            if (pEvent is PointerDownEvent)
            {
                _recognizer.addPointer((PointerDownEvent)pEvent);
            }
        }
        private void OnPointerDown(PointerDownEvent evt)
        {
            //Not the left mouse button or this is an empty slotIn
            if (evt.button != 0 || ItemGuid.Equals(""))
            {
                return;
            }

            //Clear the image
            Icon.image = null;

            //Start the drag
            InventoryUIController.StartDrag(evt.position, this);
        }
Esempio n. 24
0
        private void OnPointerDownEvent(PointerDownEvent evt)
        {
            if (evt.button != (int)MouseButton.LeftMouse)
            {
                m_CanStartDrag = false;
                return;
            }

            if (CanStartDrag(evt.position))
            {
                m_CanStartDrag = true;
                m_Start        = evt.position;
            }
        }
Esempio n. 25
0
    private IEnumerator SetAsActive(ListItem item)
    {
        yield return(new WaitForEndOfFrame());

        PointerDownEvent pt = item.GetComponent <PointerDownEvent>();

        if (pt != null)
        {
            pt.onPointerDown.Invoke();
        }
        else
        {
            Debug.Log("cannot find pointer script!");
        }
    }
 private void UpdateValueOnPointerDown(PointerDownEvent evt)
 {
     if (CanStartDrag(evt.button, evt.localPosition))
     {
         if (evt.pointerId != PointerId.mousePointerId)
         {
             evt.PreventDefault();
             m_DragElement.CapturePointer(evt.pointerId);
             ProcessDownEvent(evt);
         }
         else
         {
             evt.StopImmediatePropagation();
         }
     }
 }
Esempio n. 27
0
        protected void OnPointerDown(PointerDownEvent e)
        {
            if (m_Active)
            {
                e.StopImmediatePropagation();
                return;
            }

            if (CanStartManipulation(e))
            {
                m_Start = e.localPosition;

                m_Active = true;
                target.CapturePointer(e.pointerId);
                e.StopPropagation();
            }
        }
 private void OnPointerDown(PointerDownEvent evt)
 {
     if (droppedObject != null)
     {
         DragAndDrop.PrepareStartDrag();
         DragAndDrop.objectReferences = new[] { droppedObject };
         if (assetPath != string.Empty)
         {
             DragAndDrop.paths = new[] { assetPath };
         }
         else
         {
             DragAndDrop.paths = new string[] {};
         }
         DragAndDrop.StartDrag(string.Empty);
     }
 }
Esempio n. 29
0
        private void OnPointerDown(PointerDownEvent evt)
        {
            if (evt.pointerType != PointerType.touch)
            {
                return;
            }

            if (evt.currentTarget == evt.target)
            {
                evt.target.CapturePointer(evt.pointerId);

                VisualElement ve = (VisualElement)evt.target;
                ve.AddToClassList("active");

                var fingerIndex = evt.pointerId - PointerId.touchPointerIdBase;
                m_StartPosition[fingerIndex]        = new Vector2(ve.resolvedStyle.left, ve.resolvedStyle.top);
                m_PointerStartPosition[fingerIndex] = evt.position;
            }
        }
Esempio n. 30
0
        public override void ExecuteDefaultActionAtTarget(EventBase evt)
        {
            base.ExecuteDefaultActionAtTarget(evt);

            if (keyboardOnScreen != null)
            {
                return;
            }

            var edition = textElement.edition;

            if (!edition.isReadOnly && evt.eventTypeId == PointerDownEvent.TypeId())
            {
                // CaptureMouse is preventing WebGL from processing pointerDown event in
                // TextInputFieldBase during the Javascript event handler, preventing the
                // keyboard from being displayed. Disable the capture behavior for WebGL.
                textElement.CaptureMouse();
                m_LastPointerDownTarget = evt.target as VisualElement;
            }
            else if (!edition.isReadOnly && evt.eventTypeId == PointerUpEvent.TypeId())
            {
                textElement.ReleaseMouse();
                if (m_LastPointerDownTarget == null || !m_LastPointerDownTarget.worldBound.Contains(((PointerUpEvent)evt).position))
                {
                    return;
                }

                m_LastPointerDownTarget = null;

                edition.UpdateText(editingUtilities.text);

                OpenTouchScreenKeyboard();

                if (keyboardOnScreen != null)
                {
                    PollTouchScreenKeyboard();
                }

                // Scroll offset might need to be updated
                edition.UpdateScrollOffset?.Invoke();
                evt.StopPropagation();
            }
        }