static void canvas_EvMotion(object sender, MotionEventArgs e) { mousex = e.X; mousey = canvas.PhysicalSize.Height - e.Y - 1; canvas.Redraw(); }
/// <summary> /// Event to listen to get the SDOF motion. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public void HandleMotion(object sender, MotionEventArgs args) { if (AxisValueChanged != null) { AxisValueChanged(this, new AxisValueChangedArgs { Axis = _TX.AxisDesc, Value = args.TX }); AxisValueChanged(this, new AxisValueChangedArgs { Axis = _TY.AxisDesc, Value = args.TY }); AxisValueChanged(this, new AxisValueChangedArgs { Axis = _TZ.AxisDesc, Value = args.TZ }); AxisValueChanged(this, new AxisValueChangedArgs { Axis = _RX.AxisDesc, Value = args.RX }); AxisValueChanged(this, new AxisValueChangedArgs { Axis = _RY.AxisDesc, Value = args.RY }); AxisValueChanged(this, new AxisValueChangedArgs { Axis = _RZ.AxisDesc, Value = args.RZ }); } if (ButtonValueChanged != null) { //ButtonValueChanged(this, new ButtonValueChangedArgs { Button = Button1.ButtonDesc, Pressed }); //ButtonValueChanged(this, new ButtonValueChangedArgs { Button = Button2.ButtonDesc, Pressed }); } }
private void OnSpaceMouseMotion(object sender, MotionEventArgs e) { var move = new Vector3(e.Tx, e.Ty, -e.Tz) / 300; Camera.Move(move); Camera.Rotation -= new Vector2(e.Ry, e.Rx) / 300; }
private void Update() { // if there are no touch to be processed, just ignore the following instructions if (Input.touchCount <= 0) { return; } // loop through each touch and process it according to its phase foreach (Touch touch in Input.touches) { if (touch.phase == TouchPhase.Began) { // If this touch is on UI elements or PhysicsRaycaster targets, mark as invalid if (EventSystem.current.IsPointerOverGameObject(touch.fingerId)) { SetTouchState(touch.fingerId, TouchState.Invalid); } else // if not, we can mark it as a valid touch { SetTouchState(touch.fingerId, TouchState.Valid); } } else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled) { if (IsTouchInDictionaryInvalid(touch.fingerId)) { continue; } bool isTouchMoved = (touchStateDictionary[touch.fingerId] == TouchState.Moved); // this touch leaves screen, so set it to invalid // need to do this after assigning isTouchMoved, otherwise it'll be corrupted touchStateDictionary[touch.fingerId] = TouchState.Invalid; if (OnTouchEnded != null) { EndedTouchEventArgs eventArgs = new EndedTouchEventArgs(isTouchMoved, touch.position); OnTouchEnded.Invoke(this, eventArgs); } } else if (touch.phase == TouchPhase.Moved) { // if this touch is invalid, don't reset it to moved if (IsTouchInDictionaryInvalid(touch.fingerId)) { continue; } touchStateDictionary[touch.fingerId] = TouchState.Moved; if (OnTouchMoving != null) { MotionEventArgs eventArgs = new MotionEventArgs(touch.deltaPosition); OnTouchMoving.Invoke(this, eventArgs); } } } }
private void Connex_Motion(object sender, MotionEventArgs e) { vYaw = e.RY / 2048f; vPitch = -e.RX / 2048f; vRoll = -e.RZ / 2048f; vPush = e.TY / 2048f; if (Logic.Instance.settings.SpaceNavigatorInvertPitch) { vPitch = -vPitch; } }
private void OnTouchMoving(Object sender, MotionEventArgs eventArgs) { float horizontalRotation = horizontalRotatingSpeed * eventArgs.motion.x; transform.Rotate(0, horizontalRotation, 0, Space.World); float verticalRotation = verticalRotatingSpeed * -eventArgs.motion.y; m_currentVerticalRotation += verticalRotation; Vector3 t_newEuler = transform.localEulerAngles; t_newEuler.x = AngleMath.ClampAngle(m_currentVerticalRotation, minVerticalRotation, maxVerticalRotation); transform.localEulerAngles = t_newEuler; }
protected void HandleMotionEvent(object o, MotionEventArgs args) { float x1; float y1; Clutter.EventHelper.GetCoords(args.Event, out x1, out y1); float tx; float ty; GetTransformedPosition(out tx, out ty); if (x1 <= tx + Width && x1 >= tx && (args.Event.ModifierState.value__ & ModifierType.Button1Mask.value__) != 0 && (button.State & 2) != 0) { float deltaX = (x1 - mouseX); SetValueSilently(posval + (deltaX / (width - height))); } mouseX = x1; args.RetVal = true; }
private void ProcessQueue() { if (messages.Count > 0) { byte[] ms = messages.Peek(); NetworkMessage message = NetworkMessage.Deserialize(ms); if (message is MotionNetworkMessage) { MotionNetworkMessage motionMessage = message as MotionNetworkMessage; var e = new MotionEventArgs(); e.motionType = motionMessage.MotionType; e.distance = motionMessage.Distance; MovementEvent(this, e); } messages.Dequeue(); } }
void OnDrawAreaMotion(object sender, MotionEventArgs e) { Drawing drw = CurrentDrawing; if (drw != null) { var size = drawarea.PhysicalSize; drawarea.Focused = true; //need focus for accepting wheel events var newcursorpixel = new Point2i(e.X, size.Height - e.Y - 1); double dx = newcursorpixel.X - cursorpixel.X; double dy = newcursorpixel.Y - cursorpixel.Y; cursorpixel = newcursorpixel; if (e.Status.HasFlag(KeyStatus.MiddleButton)) { drw.ViewTransform = drw.ViewTransform * Transform2d.Translate(dx, dy); drawarea.Redraw(); return; } RedrawOverlay(); } else { trackingpos = null; } // w.Caption = viewtransform.ToString(); // pt.ToString() + " " + e.Status.ToString(); //Caption = e.X.ToString(); SetCoordText(); }
protected void HandleMotionEvent(object o, MotionEventArgs args) { float x1; float y1; Clutter.EventHelper.GetCoords (args.Event, out x1, out y1); float tx; float ty; GetTransformedPosition (out tx, out ty); if (x1 <= tx+Width && x1 >= tx && (args.Event.ModifierState.value__ & ModifierType.Button1Mask.value__)!=0 && (button.State & 2)!=0) { float deltaX = (x1 - mouseX); SetValueSilently (posval + (deltaX / (width - height))); } mouseX = x1; args.RetVal = true; }
private void Move(object sender, MotionEventArgs e) { motionController.Move(e.motionType, e.distance); }