@@ -36,6 +36,7 @@ import { DebouncedFunc, debounce } from 'lodash';
36
36
import { DragAwareMouseListener } from '../../../base/drag-aware-mouse-listener' ;
37
37
import { CursorCSS , cursorFeedbackAction } from '../../../base/feedback/css-feedback' ;
38
38
import { FeedbackCommand } from '../../../base/feedback/feedback-command' ;
39
+ import { OptionalAction } from '../../../base/model/glsp-model-source' ;
39
40
import { forEachElement } from '../../../utils/gmodel-util' ;
40
41
import { SResizeHandle , addResizeHandles , isResizable , removeResizeHandles } from '../../change-bounds/model' ;
41
42
import { createMovementRestrictionFeedback , removeMovementRestrictionFeedback } from '../../change-bounds/movement-restrictor' ;
@@ -125,7 +126,7 @@ export namespace MoveInitializedEventAction {
125
126
}
126
127
127
128
export function create ( ) : MoveInitializedEventAction {
128
- return { kind : KIND } ;
129
+ return OptionalAction . mark ( { kind : KIND } ) ;
129
130
}
130
131
}
131
132
@@ -141,7 +142,7 @@ export namespace MoveFinishedEventAction {
141
142
}
142
143
143
144
export function create ( ) : MoveFinishedEventAction {
144
- return { kind : KIND } ;
145
+ return OptionalAction . mark ( { kind : KIND } ) ;
145
146
}
146
147
}
147
148
@@ -157,6 +158,7 @@ export class FeedbackMoveMouseListener extends DragAwareMouseListener implements
157
158
protected positionUpdater ;
158
159
protected elementId2startPos = new Map < string , Point > ( ) ;
159
160
protected pendingMoveInitialized ?: DebouncedFunc < ( ) => void > ;
161
+ protected moveInitialized = false ;
160
162
161
163
constructor ( protected tool : ChangeBoundsTool ) {
162
164
super ( ) ;
@@ -178,10 +180,12 @@ export class FeedbackMoveMouseListener extends DragAwareMouseListener implements
178
180
}
179
181
180
182
protected scheduleMoveInitialized ( ) : void {
183
+ this . moveInitialized = false ;
181
184
this . pendingMoveInitialized ?. cancel ( ) ;
182
185
this . pendingMoveInitialized = debounce ( ( ) => {
183
186
this . tool . registerFeedback ( [ MoveInitializedEventAction . create ( ) ] , this ) ;
184
187
this . pendingMoveInitialized = undefined ;
188
+ this . moveInitialized = true ;
185
189
} , 750 ) ;
186
190
this . pendingMoveInitialized ( ) ;
187
191
}
@@ -329,11 +333,12 @@ export class FeedbackMoveMouseListener extends DragAwareMouseListener implements
329
333
const moveAction = MoveAction . create ( elementMoves , { animate : false , finished : true } ) ;
330
334
this . tool . deregisterFeedback ( this , [ moveAction ] ) ;
331
335
}
332
- } else if ( resetFeedback ) {
336
+ } else if ( resetFeedback && this . moveInitialized ) {
333
337
this . tool . deregisterFeedback ( this , [ MoveFinishedEventAction . create ( ) ] ) ;
334
338
}
335
339
this . positionUpdater . resetPosition ( ) ;
336
340
this . _isMouseDrag = false ;
341
+ this . moveInitialized = false ;
337
342
this . rootElement = undefined ;
338
343
this . elementId2startPos . clear ( ) ;
339
344
}
0 commit comments