public override void OnTouch(Input input, TouchMoveEventArgs eventArgs) { if (input.NumTouches == 1) { // Only move in y axis Camera.Pan(0, eventArgs.DY, 0.05f, false, 0, min); } }
private void HandleTouchMove(TouchMoveEventArgs args) { MoveTouch(new TouchState { ID = args.TouchID, ScreenPosition = new IntVector2(args.X, args.Y), Pressure = args.Pressure }); }
void HandleTouchMove3(TouchMoveEventArgs args) { if (pickedNode != null) { var graphics = Graphics; ConstraintMouse2D constraintMouse = pickedNode.GetComponent <ConstraintMouse2D>(); Vector3 pos = camera.ScreenToWorldPoint(new Vector3((float)args.X / graphics.Width, (float)args.Y / graphics.Height, 0.0f)); constraintMouse.Target = new Vector2(pos.X, pos.Y); } }
private void HorizontalMove(TouchMoveEventArgs e) { if (ContinuousMovement) { var movement = (new Vector2(e.X, e.Y) - activeTouches[e.TouchID]) * Sensitivity; movement.Y = -movement.Y; cameraMover.SetStaticHorizontalMovement(movement); } else { var movement = new Vector2(e.DX, -e.DY) * Sensitivity; cameraMover.AddDecayingHorizontalMovement(movement); } }
protected override void TouchMove(TouchMoveEventArgs e) { try { switch (movementType) { case CameraMovementType.Horizontal: HorizontalMove(e); break; case CameraMovementType.Vertical: break; case CameraMovementType.FreeFloat: break; default: throw new InvalidOperationException("Unsupported CameraMovementType in TouchController"); } } catch (KeyNotFoundException) { Urho.IO.Log.Write(LogLevel.Warning, "TouchID was not valid in TouchMove"); } }
void OnTouched(TouchMoveEventArgs eventArgs) { // Handle GridView scrolling if (Input.NumTouches == 1) { DragGrid(new Vector3(0, -eventArgs.DY * cameraMovementSpeed, 0)); //gridViewNode.Position += new Vector3(0 /*eventArgs.DX * cameraMovementSpeed*/, -eventArgs.DY * cameraMovementSpeed, 0); //System.Console.WriteLine("x: " + gridViewNode.Position.X + " y: " + gridViewNode.Position.Y); } // Handle panning and pinching else if (Input.NumTouches >= 2) { // Get Touchstates TouchState fingerOne = Input.GetTouch(0); TouchState fingerTwo = Input.GetTouch(1); // Pinching if (isPinching(ref fingerOne.Delta.X, ref fingerTwo.Delta.X, ref fingerOne.Delta.Y, ref fingerTwo.Delta.Y)) { // Get delta distance between both touches double oldDistance = GetDistance2D(fingerOne.LastPosition.X, fingerTwo.LastPosition.X, fingerOne.LastPosition.Y, fingerTwo.LastPosition.Y); double newDistance = GetDistance2D(fingerOne.Position.X, fingerTwo.Position.X, fingerOne.Position.Y, fingerTwo.Position.Y); double deltaDistance = oldDistance - newDistance; // Precision control if (Math.Abs(deltaDistance) > pinchPrecision) { float scale = (float)(newDistance / oldDistance); pinchZoom = (newDistance > oldDistance) ? scale : -scale; // Update camera offset cameraPositionOffset.Z += pinchZoom * zoomFactor; } } } }
protected override void TouchMove(TouchMoveEventArgs e) { }
/// <summary> /// Called every time a touch is moved /// </summary> /// <param name="eventArgs"></param> void OnTouched(TouchMoveEventArgs eventArgs) { currentScreenLayout.OnTouch(Input, eventArgs); }
public TouchMoveEventArguments(TouchMoveEventArgs args) : base(args) { DX = args.DX; DY = args.DY; Pressure = args.Pressure; }
public abstract void OnTouch(Input input, TouchMoveEventArgs eventArgs);
void Input_TouchMove(TouchMoveEventArgs e) { debugHud.AdditionalText = $"Touch: {e.X};{e.Y}"; }
private void OnTouchMove(TouchMoveEventArgs args) { _touchMove?.Invoke(this, new TouchMoveEventArguments(args)); }
protected TouchEventArguments(TouchMoveEventArgs args) { TouchID = args.TouchID; X = args.X; Y = args.Y; }
private void Input_TouchMove(TouchMoveEventArgs obj) { }
void HandleTouchMove3(TouchMoveEventArgs args) { if (pickedNode != null) { var graphics = Graphics; ConstraintMouse2D constraintMouse = pickedNode.GetComponent<ConstraintMouse2D>(); Vector3 pos = camera.ScreenToWorldPoint(new Vector3((float)args.X / graphics.Width, (float)args.Y / graphics.Height, 0.0f)); constraintMouse.Target=new Vector2(pos.X, pos.Y); } }
protected abstract void TouchMove(TouchMoveEventArgs e);
public override void OnTouch(Input input, TouchMoveEventArgs eventArgs) { if (input.NumTouches == 1) { if (Camera.Zoom == 1) { // Don't scroll carousel if there is only one camera in the system if (ItemCount == 1) { return; } if (Math.Abs(eventArgs.DX) > swipeThreshold && swipeSelectionThrottle < Time.SystemTime) { swipeSelectionThrottle = Time.SystemTime + 500; SelectNeighbour(eventArgs.DX > swipeThreshold); return; } // We want to scroll Offset += eventArgs.DX * scrollSpeed; double deltaTime = Time.SystemTime - touchThrottleTime; if (eventArgs.DX > 0) { swipingDirection = SwipingDirection.RIGHT; } else if (eventArgs.DX < 0) { swipingDirection = SwipingDirection.LEFT; } // Check if we are panning or just scrolling the carousel // based on current zoom if (deltaTime > 200) { // If the offset is greater than half the screen distance then the neighbouring camera is closer // to the center and thus is selected. if (Math.Abs(Offset) > Math.Abs(halfScreenDistance)) { SelectNeighbour(Offset > halfScreenDistance); } touchThrottleTime = Time.SystemTime; } } else { // We want to Pan Camera.Pan(eventArgs.DX, eventArgs.DY, 0.005f, true, CameraManager.CurrentCamera.Screen.Height / 2, -CameraManager.CurrentCamera.Screen.Height / 2, CameraManager.CurrentCamera.Screen.Width / 2, -CameraManager.CurrentCamera.Screen.Width / 2); } } else if (input.NumTouches >= 2) { // Get Touchstates TouchState fingerOne = input.GetTouch(0); TouchState fingerTwo = input.GetTouch(1); Camera.Zoom += Gestures.GetZoomAmountFromPinch(fingerOne, fingerTwo) * 0.2f; if (Camera.Zoom < 1) { Camera.Zoom = 1; // Reset panning instantly instead of waiting for next finger touch Camera.Pan(eventArgs.DX, eventArgs.DY); } } }