Skip to content

Commit 8efb435

Browse files
authored
Revert "Only call Renderer.pick() on draggable targets in Stage.onStartDrag"
1 parent bd92b1e commit 8efb435

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src/containers/stage.jsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -342,29 +342,16 @@ class Stage extends React.Component {
342342
}
343343
onStartDrag (x, y) {
344344
if (this.state.dragId) return;
345-
346-
// Targets with no attached drawable cannot be dragged.
347-
let draggableTargets = this.props.vm.runtime.targets.filter(
348-
target => Number.isFinite(target.drawableID)
349-
);
350-
351-
// Because pick queries can be expensive, only perform them for drawables that are currently draggable.
352-
// If we're in the editor, we can drag all targets. Otherwise, filter.
353-
if (!this.props.useEditorDragStyle) {
354-
draggableTargets = draggableTargets.filter(
355-
target => target.draggable
356-
);
357-
}
358-
if (draggableTargets.length === 0) return;
359-
360-
const draggableIDs = draggableTargets.map(target => target.drawableID);
361-
const drawableId = this.renderer.pick(x, y, 1, 1, draggableIDs);
345+
const drawableId = this.renderer.pick(x, y);
362346
if (drawableId === null) return;
363347
const targetId = this.props.vm.getTargetIdForDrawableId(drawableId);
364348
if (targetId === null) return;
365349

366350
const target = this.props.vm.runtime.getTargetById(targetId);
367351

352+
// Do not start drag unless in editor drag mode or target is draggable
353+
if (!(this.props.useEditorDragStyle || target.draggable)) return;
354+
368355
// Dragging always brings the target to the front
369356
target.goToFront();
370357

0 commit comments

Comments
 (0)