private void Update() { if (!_toID) //if second state still not selected . set second position to mousePos { control[4].position = MousePosition.GetMousePosition(); SetMiddleInBetween(); } else { Vector3 offcet = (control[2].position - control[0].position).normalized + (control[2].position - control[4].position).normalized; _inputFieldInit.SetPosition(control[2].position + (offcet.normalized * 0.5f)); } RenderCurve(); helpersLine.SetPosition(0, control[1].position); helpersLine.SetPosition(1, control[3].position); }
private static void OnClick(object sender, RoutedEventArgs e) { if (sender is Button btn) { Window window = Window.GetWindow(btn); if (window != null) { Point pointOfLogo = btn.PointToScreen(new Point(0d, 0d)); MousePosition mousePosition = new MousePosition(); // not the best programming here, but if in center screen adjust to top of logo if (pointOfLogo.X > 600) { pointOfLogo.X -= 145; } if (pointOfLogo.Y > 300) { pointOfLogo.Y -= 50; } SystemCommands.ShowSystemMenu(window, mousePosition.GetMousePosition(window, pointOfLogo.X, pointOfLogo.Y)); } } }
private Vector3 _offset; //offset from where we click to objects center private void OnMouseDown() { _offset = transform.position - MousePosition.GetMousePosition(); }
private void OnMouseDrag() { transform.position = MousePosition.GetMousePosition() + _offset; stateName.position = MousePosition.GetCamera().WorldToScreenPoint(transform.position); }
private void OnMouseDown() { _offset = transform.position - MousePosition.GetMousePosition(); _center = other.position + (transform.position - other.position) / 2; }
private void OnMouseDrag() { transform.position = MousePosition.GetMousePosition() + _offset; other.position = _center + (_center - transform.position); }
private void OnMouseDrag() { transform.position = MousePosition.GetMousePosition() + _offset; }