Skip to content

Commit 2573b1b

Browse files
committed
Document drawDragCanvas
1 parent e66e528 commit 2573b1b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/containers/stage.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,12 @@ class Stage extends React.Component {
304304
}
305305
this.setState({mouseDownTimeoutId: null});
306306
}
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+
*/
307313
drawDragCanvas (drawableData, x, y) {
308314
const {
309315
imageData,
@@ -349,9 +355,6 @@ class Stage extends React.Component {
349355
// Dragging always brings the target to the front
350356
target.goToFront();
351357

352-
// Extract the drawable art
353-
const drawableData = this.renderer.extractDrawableScreenSpace(drawableId);
354-
355358
const [scratchMouseX, scratchMouseY] = this.getScratchCoords(x, y);
356359
const offsetX = target.x - scratchMouseX;
357360
const offsetY = -(target.y + scratchMouseY);
@@ -363,6 +366,8 @@ class Stage extends React.Component {
363366
dragOffset: [offsetX, offsetY]
364367
});
365368
if (this.props.useEditorDragStyle) {
369+
// Extract the drawable art
370+
const drawableData = this.renderer.extractDrawableScreenSpace(drawableId);
366371
this.drawDragCanvas(drawableData, x, y);
367372
this.positionDragCanvas(x, y);
368373
this.props.vm.postSpriteInfo({visible: false});

0 commit comments

Comments
 (0)