You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey everyone! Some users of our platform requested collapsing blocks on double click. We've implemented it but it seems to be bugged.
Is it possible for you to implement this feature natively?
Our double click handler for blocks as a reference:
function setDblClickOnBlock (block, isChild) {
if (!block) return
let clickedCount = 0
block.getSvgRoot().addEventListener('pointerdown', (e) => {
clickedCount += 1
// HACK: imitation of double-click
if (clickedCount >= 2) {
if (isChild) {
e.stopPropagation()
}
block.setCollapsed(!block.isCollapsed())
}
setTimeout(() => {
clickedCount = 0
}, 300)
})
}
The text was updated successfully, but these errors were encountered:
If you want to make it work correctly you'll probably need to modify the BlockDragger (core/block_dragger.js), but because there are so many click targets on a block (icons & fields) it'll be difficult to get it right. Feel free to ask questions on the forum if you run into problems.
That being said, we don't plan to support this in the main library. We think this would be a confusing UX for most Blockly users and recommend adding an icon for collapsing/uncollapsing blocks for apps that need to collapse blocks frequently. Double click might be the right UX for your users, though.
Hey everyone! Some users of our platform requested collapsing blocks on double click. We've implemented it but it seems to be bugged.
Is it possible for you to implement this feature natively?
Our double click handler for blocks as a reference:
The text was updated successfully, but these errors were encountered: