예제 #1
0
                               104)] // Priority over hundred to make it call after the GUI, and before Node dragging (110) and window panning (105)
        private static void HandleGroupDraggingStart(NodeEditorInputInfo inputInfo)
        {
            if (GUIUtility.hotControl > 0)
            {
                return; // GUI has control
            }
            NodeEditorState state = inputInfo.editorState;

            if (inputInfo.inputEvent.button == 0 && state.focusedNode == null && state.dragNode == false)
            {
                // Do not interfere with other dragging stuff
                NodeGroup focusedGroup = GroupAtPositionInput(state, NodeEditor.ScreenToCanvasSpace(inputInfo.inputPos));
                if (focusedGroup != null)
                {
                    // Start dragging the focused group
                    UpdateGroupOrder();
                    Vector2 canvasInputPos = NodeEditor.ScreenToCanvasSpace(inputInfo.inputPos);
                    if (CheckBorderSelection(state, focusedGroup.bodyRect, canvasInputPos, out NodeGroup.resizeDir))
                    {
                        // Resizing
                        state.activeGroup = focusedGroup;
                        // Get start drag position
                        Vector2 startSizePos = Vector2.zero;
                        if ((NodeGroup.resizeDir & BorderSelection.Left) != 0)
                        {
                            startSizePos.x = focusedGroup.rect.xMin;
                        }
                        else if ((NodeGroup.resizeDir & BorderSelection.Right) != 0)
                        {
                            startSizePos.x = focusedGroup.rect.xMax;
                        }
                        if ((NodeGroup.resizeDir & BorderSelection.Top) != 0)
                        {
                            startSizePos.y = focusedGroup.rect.yMin;
                        }
                        else if ((NodeGroup.resizeDir & BorderSelection.Bottom) != 0)
                        {
                            startSizePos.y = focusedGroup.rect.yMax;
                        }
                        // Start the resize drag
                        state.StartDrag("group", inputInfo.inputPos, startSizePos);
                        state.resizeGroup = true;
                        inputInfo.inputEvent.Use();
                    }
                    else if (focusedGroup.headerRect.Contains(canvasInputPos))
                    {
                        // Dragging
                        state.activeGroup = focusedGroup;
                        state.StartDrag("group", inputInfo.inputPos, state.activeGroup.rect.position);
                        state.activeGroup.UpdatePins();
                        inputInfo.inputEvent.Use();
                    }
                }
            }
        }
예제 #2
0
        [EventHandlerAttribute(EventType.MouseDown, 30)] // Priority over hundred to make it call after the GUI
        private static void HandleNodeDraggingStart(NodeEditorInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.editorState;

            if (inputInfo.inputEvent.button == 0 && state.focusedNode != null)
            {
                // Clicked inside the selected Node, so start dragging it
                state.dragNode = true;
                state.StartDrag("node", inputInfo.inputPos, state.focusedNode.rect.position);
            }
        }
예제 #3
0
        [EventHandlerAttribute(EventType.MouseDown, 105)]          // Priority over hundred to make it call after the GUI
        private static void HandleWindowPanningStart(NodeEditorInputInfo inputInfo)
        {
            if (GUIUtility.hotControl > 0)
            {
                return;                 // GUI has control
            }
            NodeEditorState state = inputInfo.editorState;

            if ((inputInfo.inputEvent.button == 0 || inputInfo.inputEvent.button == 2) && state.focusedNode == null)
            {             // Left- or Middle clicked on the empty canvas -> Start panning
                state.panWindow = true;
                state.StartDrag("window", inputInfo.inputPos, state.panOffset);
            }
        }
예제 #4
0
        [EventHandlerAttribute(EventType.MouseDown, 110)]          // Priority over hundred to make it call after the GUI
        private static void HandleNodeDraggingStart(NodeEditorInputInfo inputInfo)
        {
            if (GUIUtility.hotControl > 0)
            {
                return;                 // GUI has control
            }
            NodeEditorState state = inputInfo.editorState;

            if (inputInfo.inputEvent.button == 0 && state.focusedNode != null && state.focusedNode == state.selectedNode && state.focusedConnectionKnob == null)
            {             // Clicked inside the selected Node, so start dragging it
                state.dragNode = true;
                state.StartDrag("node", inputInfo.inputPos, state.focusedNode.rect.position);
            }
        }