@@ -39,6 +39,9 @@ class CoreGraph {
3939 }
4040 // if (cy) this.cy = cy;
4141 this . cy = cytoscape ( { ...cyOptions , container : element } ) ;
42+ this . cy . on ( 'position' , 'node' , ( ) => {
43+ this . cy . edges ( ) . updateStyle ( ) ;
44+ } ) ;
4245 this . id = id ;
4346 this . projectName = projectName ;
4447 this . authorName = authorName ;
@@ -81,50 +84,48 @@ class CoreGraph {
8184 this . cy . nodeEditing ( {
8285 resizeToContentCueEnabled : ( ) => false ,
8386 setWidth : ( node , width ) => {
84- // HARD ENFORCEMENT: Snap width every frame during resize
85- const snappedWidth = this . snapDimensionToGrid ( width ) ;
86- node . data ( 'style' , { ...node . data ( 'style' ) , width : snappedWidth } ) ;
87+ // Allow free resizing during drag - snapping will happen on resizeend
88+ node . data ( 'style' , { ...node . data ( 'style' ) , width } ) ;
8789
8890 // Adjust position to maintain edge alignment based on resize handle
8991 const resizeType = node . scratch ( 'resizeType' ) ;
9092 if ( resizeType && ( resizeType . includes ( 'left' ) || resizeType . includes ( 'right' ) ) ) {
9193 const currentPos = node . position ( ) ;
9294 const initialPos = node . scratch ( 'resizeInitialPos' ) ;
9395 const initialWidth = node . scratch ( 'width' ) ;
94- const widthDelta = snappedWidth - initialWidth ;
96+ const widthDelta = width - initialWidth ;
9597
9698 let newX = currentPos . x ;
9799 if ( resizeType . includes ( 'left' ) ) {
98100 newX = initialPos . x - widthDelta / 2 ;
99101 } else if ( resizeType . includes ( 'right' ) ) {
100102 newX = initialPos . x + widthDelta / 2 ;
101103 }
102- node . position ( { x : this . snapToGrid ( newX ) , y : currentPos . y } ) ;
104+ node . position ( { x : newX , y : currentPos . y } ) ;
103105 }
104- return snappedWidth ;
106+ return width ;
105107 } ,
106108 setHeight : ( node , height ) => {
107- // HARD ENFORCEMENT: Snap height every frame during resize
108- const snappedHeight = this . snapDimensionToGrid ( height ) ;
109- node . data ( 'style' , { ...node . data ( 'style' ) , height : snappedHeight } ) ;
109+ // Allow free resizing during drag - snapping will happen on resizeend
110+ node . data ( 'style' , { ...node . data ( 'style' ) , height } ) ;
110111
111112 // Adjust position to maintain edge alignment based on resize handle
112113 const resizeType = node . scratch ( 'resizeType' ) ;
113114 if ( resizeType && ( resizeType . includes ( 'top' ) || resizeType . includes ( 'bottom' ) ) ) {
114115 const currentPos = node . position ( ) ;
115116 const initialPos = node . scratch ( 'resizeInitialPos' ) ;
116117 const initialHeight = node . scratch ( 'height' ) ;
117- const heightDelta = snappedHeight - initialHeight ;
118+ const heightDelta = height - initialHeight ;
118119
119120 let newY = currentPos . y ;
120121 if ( resizeType . includes ( 'top' ) ) {
121122 newY = initialPos . y - heightDelta / 2 ;
122123 } else if ( resizeType . includes ( 'bottom' ) ) {
123124 newY = initialPos . y + heightDelta / 2 ;
124125 }
125- node . position ( { x : currentPos . x , y : this . snapToGrid ( newY ) } ) ;
126+ node . position ( { x : currentPos . x , y : newY } ) ;
126127 }
127- return snappedHeight ;
128+ return height ;
128129 } ,
129130 isNoResizeMode ( node ) { return node . data ( 'type' ) !== 'ordin' ; } ,
130131 isNoControlsMode ( node ) { return node . data ( 'type' ) !== 'ordin' ; } ,
0 commit comments