void UpdateCameraPanning() { if (SF_GUI.ReleasedCameraMove()) { panCamera = false; } bool insideNodeView = MouseInsideNodeView(true); bool dragging = (Event.current.type == EventType.MouseDrag && panCamera); bool connecting = SF_NodeConnector.IsConnecting(); bool rotatingPreview = editor.preview.isDraggingLMB; bool placingNode = editor.nodeBrowser.IsPlacing(); bool draggingSeparators = editor.DraggingAnySeparator(); if (connecting) { // Pan camera when cursor nears edges while making a connection Vector2 mousePosInNodeViewScreenSpace = ZoomSpaceToScreenSpace(Event.current.mousePosition) - Vector2.right * editor.separatorLeft.rect.xMax; float areaWidth; if (SF_Settings.showNodeSidebar) { areaWidth = editor.separatorRight.rect.xMin - editor.separatorLeft.rect.xMax; } else { areaWidth = Screen.width - editor.separatorLeft.rect.xMax; } float areaHeight = editor.nodeView.rect.height; float dragPanMargin = 32f; float panSpeed = 0.2f; float leftMag = Mathf.Clamp(-mousePosInNodeViewScreenSpace.x + dragPanMargin, 0f, dragPanMargin); float rightMag = Mathf.Clamp(mousePosInNodeViewScreenSpace.x - areaWidth + dragPanMargin, 0f, dragPanMargin); float topMag = Mathf.Clamp(-mousePosInNodeViewScreenSpace.y + dragPanMargin, 0f, dragPanMargin); float bottomMag = Mathf.Clamp(mousePosInNodeViewScreenSpace.y - areaHeight + dragPanMargin, 0f, dragPanMargin); cameraPos += new Vector2(rightMag - leftMag, bottomMag - topMag) * panSpeed; } bool doingSomethingElse = connecting || rotatingPreview || placingNode || draggingSeparators; bool dragInside = dragging && insideNodeView; if (dragInside && !doingSomethingElse) { //if( !SF_GUI.MultiSelectModifierHeld() ) // selection.DeselectAll(); //Debug.Log("Delta: " + Event.current.delta); cameraPos -= Event.current.delta; SnapCamera(); BoundsAdjustCamera(); editor.Defocus(); //Debug.Log( "USING" ); Event.current.Use(); } if (SF_GUI.PressedCameraMove()) { panCamera = true; } }