public void PollInput(Event e, CanvasTransform t, Rect inputRect) { if (lastCreatedNodeToPosition != null) { lastCreatedNodeToPosition.Center = BonsaiInput.MousePosition(t); lastCreatedNodeToPosition = null; } if (e.type == EventType.MouseDrag) { if (MotionAction != null) { MotionAction(t); OnCanvasChanged(); } } if (BonsaiInput.IsPanAction(e)) { Pan(e.delta); OnCanvasChanged(); } if (BonsaiInput.IsZoomAction(e)) { Zoom(e.delta.y); OnCanvasChanged(); } Input.HandleMouseEvents(e, t, Canvas.Nodes, inputRect); }
private void StartSingleDrag(BonsaiInputEvent startEvent) { BonsaiNode node = startEvent.node; Vector2 offset = EditorSingleDrag.StartDrag(node, startEvent.canvasMousePostion); MotionAction = (CanvasTransform t) => EditorSingleDrag.Drag(node, BonsaiInput.MousePosition(t), offset); }
private void StartMultiDrag(BonsaiInputEvent startEvent) { var nodes = EditorMultiDrag.StartDrag(NodeSelection.SelectedNodes, startEvent.canvasMousePostion); MotionAction = (CanvasTransform t) => EditorMultiDrag.Drag(BonsaiInput.MousePosition(t), nodes); }