@@ -304,6 +304,12 @@ class Stage extends React.Component {
304
304
}
305
305
this . setState ( { mouseDownTimeoutId : null } ) ;
306
306
}
307
+ /**
308
+ * Initialize the position of the "dragged sprite" canvas
309
+ * @param {DrawableExtraction } drawableData The data returned from renderer.extractDrawableScreenSpace
310
+ * @param {number } x The x position of the initial drag event
311
+ * @param {number } y The y position of the initial drag event
312
+ */
307
313
drawDragCanvas ( drawableData , x , y ) {
308
314
const {
309
315
imageData,
@@ -349,9 +355,6 @@ class Stage extends React.Component {
349
355
// Dragging always brings the target to the front
350
356
target . goToFront ( ) ;
351
357
352
- // Extract the drawable art
353
- const drawableData = this . renderer . extractDrawableScreenSpace ( drawableId ) ;
354
-
355
358
const [ scratchMouseX , scratchMouseY ] = this . getScratchCoords ( x , y ) ;
356
359
const offsetX = target . x - scratchMouseX ;
357
360
const offsetY = - ( target . y + scratchMouseY ) ;
@@ -363,6 +366,8 @@ class Stage extends React.Component {
363
366
dragOffset : [ offsetX , offsetY ]
364
367
} ) ;
365
368
if ( this . props . useEditorDragStyle ) {
369
+ // Extract the drawable art
370
+ const drawableData = this . renderer . extractDrawableScreenSpace ( drawableId ) ;
366
371
this . drawDragCanvas ( drawableData , x , y ) ;
367
372
this . positionDragCanvas ( x , y ) ;
368
373
this . props . vm . postSpriteInfo ( { visible : false } ) ;
0 commit comments