public void Draw() { GUI.Box(rect, "", EditorStyles.textField); if (rect.Contains(Event.current.mousePosition) || dragging) { GUIHelper.AssignCursor(rect, MouseCursor.ResizeHorizontal); } if (Event.current.isMouse) { if (GUIHelper.ReleasedRawLMB()) { StopDrag(); } if (dragging) { UpdateDrag(); } if (GUIHelper.PressedLMB(rect)) { StartDrag(); } } }
protected void UpdateNodeMove() { if (GUIHelper.ReleasedLMB() && _movingNode) { _movingNode = false; Event.current.Use(); } var isHover = isHovering(); bool isDragging = _movingNode && (Event.current.type == EventType.MouseDrag); if (isDragging) { SetPos(_rect.x + Event.current.delta.x, _rect.y + Event.current.delta.y); Event.current.Use(); } if (GUIHelper.PressedLMB() && isHover) { _movingNode = true; _window.nodeArea.selectingNode = this; Event.current.Use(); } }
private bool isPressed() { return(isHovering() && GUIHelper.PressedLMB()); }