public void PointerMove(MouseInputEvent mouseEvent) { if (IsTapping() && !WithinAnchorDeadzone(mouseEvent)) { Reset(); } }
public void PointerUp(MouseInputEvent mouseEvent) { TrackPointerUp(); if (IsTapping()) { ++m_tapUpCount; if (m_tapDownCount > m_tapUpCount) { Reset(); return; } if (m_tapDownCount >= 2) { if (WithinAnchorDeadzone(mouseEvent)) { DispatchDoubleTap(); } else { // Two taps have occurred in the time window, but too far apart on screen, should be two single taps. DispatchSingleTap(); m_tapAnchorX = mouseEvent.x; m_tapAnchorY = mouseEvent.y; DispatchSingleTap(); } } } }
public void PointerMove(MouseInputEvent mouseEvent) { if (!m_panButtonDown) { return; } Vector2 newPos = new Vector2(mouseEvent.x, mouseEvent.y); if (m_current == newPos) { return; } float anchorDeltaSqMag = (m_anchor - newPos).sqrMagnitude; bool exceededStartPanThreshold = (anchorDeltaSqMag > 4.0f); //m_panStartThresholdPixels); if (!m_panning && exceededStartPanThreshold) { m_panning = true; var pan = PopulatePanData(); m_handler.Event_TouchPan_Start(pan); } if (m_panning) { m_current = newPos; var pan = PopulatePanData(); m_handler.Event_TouchPan(pan); } }
public void PointerUp(MouseInputEvent mouseEvent) { m_rotating = false; var data = MakeRotateData(0.0f, 0.0f, 0); m_handler.Event_TouchRotate_End(data); }
public void PointerMove(MouseInputEvent mouseEvent) { // mouseEvent.z values provided via Unity seem to be multiples of +/- 1.0, not necessarily raised very frame // no units mentioned here: https://docs.unity3d.com/ScriptReference/Input-mouseScrollDelta.html float zoomDelta = -mouseEvent.z * m_sensitivity; m_zoomAccumulator += zoomDelta; }
public void PointerUp(MouseInputEvent mouseEvent) { if (!m_tilting) { return; } EndTiltGesture(); }
public void PointerDown(MouseInputEvent mouseEvent) { m_tilting = true; m_previousMousePositionY = mouseEvent.y; var data = MakeTiltData(0.0f); m_handler.Event_TiltStart(data); }
public void PointerDown(MouseInputEvent mouseEvent) { m_rotating = true; m_anchor.x = mouseEvent.x; m_anchor.y = mouseEvent.y; m_totalRotation = 0.0f; var data = MakeRotateData(0.0f, 0.0f, 2); m_handler.Event_TouchRotate_Start(data); }
public void PointerMove(MouseInputEvent mouseEvent) { if (!m_tilting) { return; } var data = MakeTiltData(m_previousMousePositionY - mouseEvent.y, Screen.height); m_previousMousePositionY = mouseEvent.y; m_handler.Event_Tilt(data); }
public void PointerDown(MouseInputEvent mouseEvent) { TrackPointerDown(); if (m_tapDownCount == 0) { m_tapAnchorX = mouseEvent.x; m_tapAnchorY = mouseEvent.y; } ++m_tapDownCount; m_tapUnixTime = MillisecondsSinceEpoch(); }
public void PointerMove(MouseInputEvent mouseEvent) { if (!m_rotating) { return; } const float INPUT_SCALE = 1 / 500.0f; var data = MakeRotateData(INPUT_SCALE * (m_anchor.x - mouseEvent.x), 0.0f, 2); m_totalRotation += data.rotation; m_handler.Event_TouchRotate(data); }
public void PointerDown(MouseInputEvent mouseEvent) { if (mouseEvent.Action != MouseInputAction.MousePrimaryDown) { return; } m_panButtonDown = true; if (!m_panning) { m_current.Set(mouseEvent.x, mouseEvent.y); m_anchor = m_current; } }
private bool WithinAnchorDeadzone(MouseInputEvent mouseEvent) { Debug.Assert(IsTapping()); Vector2 tapLocation = new Vector2(m_tapAnchorX, m_tapAnchorY); Vector2 currentLocation = new Vector2(mouseEvent.x, mouseEvent.y); if ((tapLocation - currentLocation).sqrMagnitude < TapDeadZonePixelsSq) { return(true); } else { return(false); } }
public void HandleInput(MouseInputEvent inputEvent) { switch (inputEvent.Action) { case MouseInputAction.MousePrimaryDown: m_pan.PointerDown(inputEvent); m_touch.PointerDown(inputEvent); m_tap.PointerDown(inputEvent); break; case MouseInputAction.MousePrimaryUp: m_pan.PointerUp(inputEvent); m_touch.PointerUp(inputEvent); m_tap.PointerUp(inputEvent); break; case MouseInputAction.MouseMove: m_pan.PointerMove(inputEvent); m_rotate.PointerMove(inputEvent); m_tilt.PointerMove(inputEvent); m_touch.PointerMove(inputEvent); break; case MouseInputAction.MouseSecondaryDown: m_rotate.PointerDown(inputEvent); break; case MouseInputAction.MouseSecondaryUp: m_rotate.PointerUp(inputEvent); break; case MouseInputAction.MouseMiddleDown: m_tilt.PointerDown(inputEvent); break; case MouseInputAction.MouseMiddleUp: m_tilt.PointerUp(inputEvent); break; case MouseInputAction.MouseWheel: m_zoom.PointerMove(inputEvent); break; } }
public void PointerUp(MouseInputEvent mouseEvent) { if (mouseEvent.Action != MouseInputAction.MousePrimaryUp) { return; } m_panButtonDown = false; if (m_panning) { m_current.x = mouseEvent.x; m_current.y = mouseEvent.y; m_panning = false; var pan = PopulatePanData(); m_handler.Event_TouchPan_End(pan); } }
public void PointerMove(MouseInputEvent mouseEvent) { float zoomDelta = -mouseEvent.z * m_sensitivity; m_zoomAccumulator += zoomDelta; }
private bool UpdatePinching(bool pinching, MouseInputEvent touchEvent, out float pinchScale, int numTouches, bool pointerUp) { pinchScale = 0.0f; return false; }
private bool UpdateRotation(MouseInputEvent touchEvent, int numTouches, bool pointerUp) { return(false); }
public void HandleInput(MouseInputEvent inputEvent) { switch (inputEvent.Action) { case MouseInputAction.MousePrimaryDown: if (EventSystem.current.IsPointerOverGameObject()) { break; } m_pan.PointerDown(inputEvent); m_touch.PointerDown(inputEvent); m_tap.PointerDown(inputEvent); break; case MouseInputAction.MousePrimaryUp: if (EventSystem.current.IsPointerOverGameObject()) { break; } m_pan.PointerUp(inputEvent); m_touch.PointerUp(inputEvent); m_tap.PointerUp(inputEvent); break; case MouseInputAction.MouseMove: if (EventSystem.current.IsPointerOverGameObject()) { break; } m_pan.PointerMove(inputEvent); m_rotate.PointerMove(inputEvent); m_tilt.PointerMove(inputEvent); m_touch.PointerMove(inputEvent); break; case MouseInputAction.MouseSecondaryDown: if (EventSystem.current.IsPointerOverGameObject()) { break; } m_rotate.PointerDown(inputEvent); break; case MouseInputAction.MouseSecondaryUp: if (EventSystem.current.IsPointerOverGameObject()) { break; } m_rotate.PointerUp(inputEvent); break; case MouseInputAction.MouseMiddleDown: if (EventSystem.current.IsPointerOverGameObject()) { break; } m_tilt.PointerDown(inputEvent); break; case MouseInputAction.MouseMiddleUp: if (EventSystem.current.IsPointerOverGameObject()) { break; } m_tilt.PointerUp(inputEvent); break; case MouseInputAction.MouseWheel: if (EventSystem.current.IsPointerOverGameObject()) { break; } m_zoom.PointerMove(inputEvent); break; } }