@@ -102,6 +102,7 @@ function Node({
102102 onNodeSelected = ( ) => { } ,
103103 onNodeUpdate = ( ) => Promise . resolve ( ) ,
104104} : INodeProps ) {
105+ const draggingEdge = useRef ( false ) ;
105106 const [ hovered , setHovered ] = useState ( false ) ;
106107 const nodeRef = useRef ( ) ;
107108 const oldSibling = useRef ( ) ;
@@ -161,6 +162,9 @@ function Node({
161162
162163 const { sourceEvent } = event ;
163164
165+ const shiftKey = sourceEvent . shiftKey || draggingEdge . current ;
166+
167+ draggingEdge . current = false ;
164168 position . current . pointerOffset = null ;
165169
166170 if ( oldSibling . current ?. parentElement ) {
@@ -170,8 +174,6 @@ function Node({
170174 ) ;
171175 }
172176
173- const shiftKey = sourceEvent . shiftKey ;
174-
175177 const nodeUpdate = onNodeUpdate (
176178 position . current ,
177179 data [ nodeKey ] ,
@@ -206,6 +208,7 @@ function Node({
206208 }
207209
208210 if ( shiftKey ) {
211+ draggingEdge . current = true ;
209212 // draw edge
210213 // undo the target offset subtraction done by Edge
211214 const off = calculateOffset (
@@ -220,7 +223,7 @@ function Node({
220223 newState . x += off . xOff ;
221224 newState . y += off . yOff ;
222225 // now tell the graph that we're actually drawing an edge
223- } else if ( layoutEngine ) {
226+ } else if ( ! draggingEdge . current && layoutEngine ) {
224227 // move node using the layout engine
225228 Object . assign ( newState , layoutEngine . getPositionForNode ( newState ) ) ;
226229 }
@@ -231,7 +234,7 @@ function Node({
231234 pointerOffset : newState . pointerOffset ,
232235 } ;
233236
234- onNodeMove ( newState , data [ nodeKey ] , shiftKey ) ;
237+ onNodeMove ( newState , data [ nodeKey ] , shiftKey || draggingEdge . current ) ;
235238 } ,
236239 [
237240 centerNodeOnMove ,
0 commit comments