0

当用户停止拖动块时,我想触发一个功能。但它似乎只支持块创建/删除/移动和更改事件检测,有没有办法做到这一点?

4

1 回答 1

0

我很确定Blockly.Events.BLOCK_MOVE仅在移动块后调用。

您还可以检测是否(https://developers.google.com/blockly/guides/configure/web/events#blocklyeventsblock_drag),如果鼠标按下,则等待鼠标升起。

这是一些示例代码:

JS

mouseState="up"
onBlockDrag(){ //youll need to setup the onblockdrag event
mouseState="down"
while (mouseState = "down"){
//do nothing while mouse down
}
//after mouse down
// your code
}

HTML

<div id="blocklyDiv" ng-mouseup="mouseState='up'"></div>
于 2021-02-20T18:47:18.717 回答