@@ -443,7 +443,8 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
443443 __itemMoving : function ( itemId , xDiff , yDiff ) {
444444 this . getSelectedNodeUIs ( ) . forEach ( selectedNodeUI => {
445445 if ( itemId !== selectedNodeUI . getNodeId ( ) ) {
446- selectedNodeUI . setPosition ( {
446+ // do not touch the position, just move the node, this will happen in __itemStoppedMoving
447+ selectedNodeUI . moveNodeTo ( {
447448 x : selectedNodeUI . initPos . x + xDiff ,
448449 y : selectedNodeUI . initPos . y + yDiff
449450 } ) ;
@@ -464,10 +465,24 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
464465 this . getSelectedNodeUIs ( ) . forEach ( selectedNodeUI => delete selectedNodeUI [ "initPos" ] ) ;
465466 this . getSelectedAnnotations ( ) . forEach ( selectedAnnotation => delete selectedAnnotation [ "initPos" ] ) ;
466467
467- if ( nodeUI && osparc . Preferences . getInstance ( ) . isSnapNodeToGrid ( ) ) {
468- this . getSelectedNodeUIs ( ) . forEach ( selectedNodeUI => selectedNodeUI . snapToGrid ( ) ) ;
469- // make sure nodeUI is moved, then update edges
470- setTimeout ( ( ) => this . __updateNodeUIPos ( nodeUI ) , 10 ) ;
468+ // the moving item could be an annotation, so we need to check if it is a nodeUI
469+ if ( nodeUI ) {
470+ this . getSelectedNodeUIs ( ) . forEach ( selectedNodeUI => {
471+ if ( nodeUI !== selectedNodeUI ) {
472+ // now set the position
473+ const layoutProps = selectedNodeUI . getLayoutProperties ( ) ;
474+ selectedNodeUI . setPosition ( {
475+ x : layoutProps . left ,
476+ y : layoutProps . top ,
477+ } ) ;
478+ }
479+ } ) ;
480+
481+ if ( osparc . Preferences . getInstance ( ) . isSnapNodeToGrid ( ) ) {
482+ this . getSelectedNodeUIs ( ) . forEach ( selectedNodeUI => selectedNodeUI . snapToGrid ( ) ) ;
483+ // make sure nodeUI is moved, then update edges
484+ setTimeout ( ( ) => this . __updateNodeUIPos ( nodeUI ) , 10 ) ;
485+ }
471486 }
472487
473488 this . __updateWorkbenchBounds ( ) ;
0 commit comments