コード例 #1
0
        public void OnDrag(PointerEventData eventData)
        {
            var position = this.getPointPosition(eventData);

            this._windowAdapter.postPointerEvent(new PointerData(
                                                     timeStamp: Timer.timespanSinceStartup,
                                                     change: PointerChange.move,
                                                     kind: InputUtils.getPointerDeviceKind(eventData),
                                                     device: InputUtils.getPointerDeviceKey(eventData),
                                                     physicalX: position.x,
                                                     physicalY: position.y
                                                     ));
        }
コード例 #2
0
ファイル: UIWidgetsPanel.cs プロジェクト: moto2002/UIWidgets
 void handleMouseScroll()
 {
     if (Input.mouseScrollDelta.y != 0 || Input.mouseScrollDelta.x != 0)
     {
         var scaleFactor = this.canvas.scaleFactor;
         var pos         = this.getPointPosition(Input.mousePosition);
         this._windowAdapter.onScroll(Input.mouseScrollDelta.x * scaleFactor,
                                      Input.mouseScrollDelta.y * scaleFactor,
                                      pos.x,
                                      pos.y,
                                      InputUtils.getScrollButtonKey());
     }
 }
コード例 #3
0
        public void OnPointerExit(PointerEventData eventData)
        {
            this._mouseEntered = false;
            var position = this.getPointPosition(eventData);

            this._windowAdapter.postPointerEvent(new PointerData(
                                                     timeStamp: Timer.timespanSinceStartup,
                                                     change: PointerChange.hover,
                                                     kind: InputUtils.getPointerDeviceKind(),
                                                     device: InputUtils.getPointerDeviceKey(eventData),
                                                     physicalX: position.x,
                                                     physicalY: position.y
                                                     ));
        }
コード例 #4
0
        public void OnPointerDown(PointerEventData eventData)
        {
            EventSystem.current.SetSelectedGameObject(this.gameObject, eventData);
            var position = this.getPointPosition(eventData);

            this._windowAdapter.postPointerEvent(new PointerData(
                                                     timeStamp: Timer.timespanSinceStartup,
                                                     change: PointerChange.down,
                                                     kind: InputUtils.getPointerDeviceKind(),
                                                     device: InputUtils.getPointerDeviceKey(eventData),
                                                     physicalX: position.x,
                                                     physicalY: position.y
                                                     ));
        }
コード例 #5
0
        public void OnPointerExit(PointerEventData eventData) {
            var pointerKey = InputUtils.getPointerDeviceKey(eventData);
            this._enteredPointers.Remove(pointerKey);

            var position = this.getPointPosition(eventData);
            this._windowAdapter.postPointerEvent(new PointerData(
                timeStamp: Timer.timespanSinceStartup,
                change: PointerChange.hover,
                kind: InputUtils.getPointerDeviceKind(eventData),
                device: pointerKey,
                physicalX: position.x,
                physicalY: position.y
            ));
        }
コード例 #6
0
ファイル: UIWidgetsPanel.cs プロジェクト: zz5756712/UIWidgets
        int getMouseButtonDown()
        {
            //default mouse button key = left mouse button
            var defaultKey = 0;

            for (int key = 0; key < mouseButtonNum; key++)
            {
                if (Input.GetMouseButton(key))
                {
                    defaultKey = key;
                    break;
                }
            }
            return(InputUtils.getMouseButtonKey(defaultKey));
        }
コード例 #7
0
        public void OnPointerUp(PointerEventData eventData)
        {
            var position = this.getPointPosition(eventData);

            if (position == null)
            {
                return;
            }
            this._windowAdapter.postPointerEvent(new PointerData(
                                                     timeStamp: Timer.timespanSinceStartup,
                                                     change: PointerChange.up,
                                                     kind: InputUtils.getPointerDeviceKind(eventData),
                                                     device: InputUtils.getPointerDeviceKey(eventData),
                                                     physicalX: position.Value.x,
                                                     physicalY: position.Value.y
                                                     ));
        }
コード例 #8
0
        void handleTouchMove()
        {
            for (var touchIndex = 0; touchIndex < Input.touchCount; touchIndex++)
            {
                var touchEvent = Input.GetTouch(touchIndex);
                if (touchEvent.phase != TouchPhase.Moved)
                {
                    continue;
                }

                var pos = this.getPointPosition(touchEvent.position);
                this._windowAdapter.postPointerEvent(new PointerData(
                                                         timeStamp: Timer.timespanSinceStartup,
                                                         change: PointerChange.hover,
                                                         kind: PointerDeviceKind.touch,
                                                         device: InputUtils.getTouchFingerKey(touchEvent.fingerId),
                                                         physicalX: pos.x,
                                                         physicalY: pos.y
                                                         ));
            }
        }
コード例 #9
0
        public void OnPointerEnter(PointerEventData eventData)
        {
            var position = this.getPointPosition(eventData);

            if (position == null)
            {
                return;
            }
            var pointerKey = InputUtils.getPointerDeviceKey(eventData);

            this._enteredPointers.Add(pointerKey);

            this._lastMouseMove = eventData.position;
            this._windowAdapter.postPointerEvent(new PointerData(
                                                     timeStamp: Timer.timespanSinceStartup,
                                                     change: PointerChange.hover,
                                                     kind: InputUtils.getPointerDeviceKind(eventData),
                                                     device: pointerKey,
                                                     physicalX: position.Value.x,
                                                     physicalY: position.Value.y
                                                     ));
        }