mirror of
https://github.com/google/blockly.git
synced 2026-05-01 01:20:13 +02:00
feat: Add a sound effect when dropping top-level items on the workspace (#9784)
This commit is contained in:
@@ -786,6 +786,10 @@ export class BlockDragStrategy implements IDragStrategy {
|
||||
this.applyConnections(this.connectionCandidate);
|
||||
this.disposeStep();
|
||||
} else {
|
||||
// play a sound if the block didn't connect to anything and isn't being deleted
|
||||
if (disposition !== DragDisposition.DELETE) {
|
||||
this.workspace.getAudioManager().play('drop');
|
||||
}
|
||||
this.block.queueRender().then(() => this.disposeStep());
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ export class CommentDragStrategy implements IDragStrategy {
|
||||
this.workspace
|
||||
.getLayerManager()
|
||||
?.moveOffDragLayer(this.comment, layers.BLOCK);
|
||||
this.workspace.getAudioManager().play('drop');
|
||||
this.comment.setDragging(false);
|
||||
|
||||
this.comment.snapToGrid();
|
||||
|
||||
@@ -333,4 +333,5 @@ function loadSounds(pathToMedia: string, workspace: WorkspaceSvg) {
|
||||
audioMgr.load([`${pathToMedia}click.mp3`], 'click');
|
||||
audioMgr.load([`${pathToMedia}disconnect.mp3`], 'disconnect');
|
||||
audioMgr.load([`${pathToMedia}delete.mp3`], 'delete');
|
||||
audioMgr.load([`${pathToMedia}drop.mp3`], 'drop');
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user