mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-14 11:39:59 -05:00
Merge pull request #1718 from paulkaplan/block-id-on-drag-end
Include the original blockId of the top block being dragged.
This commit is contained in:
commit
bb6aa7644b
3 changed files with 6 additions and 5 deletions
|
@ -340,7 +340,7 @@ class Blocks {
|
|||
// Drag blocks onto another sprite
|
||||
if (e.isOutside) {
|
||||
const newBlocks = adapter(e);
|
||||
optRuntime.emitBlockEndDrag(newBlocks);
|
||||
optRuntime.emitBlockEndDrag(newBlocks, e.blockId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1857,9 +1857,10 @@ class Runtime extends EventEmitter {
|
|||
/**
|
||||
* Emit event to indicate that the block drag has ended with the blocks outside the blocks workspace
|
||||
* @param {Array.<object>} blocks The set of blocks dragged to the GUI
|
||||
* @param {string} topBlockId The original id of the top block being dragged
|
||||
*/
|
||||
emitBlockEndDrag (blocks) {
|
||||
this.emit(Runtime.BLOCK_DRAG_END, blocks);
|
||||
emitBlockEndDrag (blocks, topBlockId) {
|
||||
this.emit(Runtime.BLOCK_DRAG_END, blocks, topBlockId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,8 +96,8 @@ class VirtualMachine extends EventEmitter {
|
|||
this.runtime.on(Runtime.BLOCK_DRAG_UPDATE, areBlocksOverGui => {
|
||||
this.emit(Runtime.BLOCK_DRAG_UPDATE, areBlocksOverGui);
|
||||
});
|
||||
this.runtime.on(Runtime.BLOCK_DRAG_END, blocks => {
|
||||
this.emit(Runtime.BLOCK_DRAG_END, blocks);
|
||||
this.runtime.on(Runtime.BLOCK_DRAG_END, (blocks, topBlockId) => {
|
||||
this.emit(Runtime.BLOCK_DRAG_END, blocks, topBlockId);
|
||||
});
|
||||
this.runtime.on(Runtime.EXTENSION_ADDED, blocksInfo => {
|
||||
this.emit(Runtime.EXTENSION_ADDED, blocksInfo);
|
||||
|
|
Loading…
Reference in a new issue