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 )); }
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()); } }
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 )); }
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 )); }
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 )); }
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)); }
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 )); }
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 )); } }
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 )); }