litegraph.js icon indicating copy to clipboard operation
litegraph.js copied to clipboard

Callback called twice on Button Widget click

Open adam-matic opened this issue 5 years ago • 2 comments

I made a 'toolbox' node, and a button widget inside it that creates a new node. Every time I click on the button, two nodes are created, one on "mouse up", one on "mouse down". This seems to be happening in the demos too, as the button is highlighted twice, on up and down mouse events. Is this a bug, or is there a special callback to define? Thanks

adam-matic avatar Mar 27 '20 21:03 adam-matic

You need update this mouse event if (event.type === "mousemove") { to if (event.type === "mousedown") {

AlexandrTomin avatar Apr 22 '20 11:04 AlexandrTomin

Just ran into this as well, why is that not the default? I can't imagine much of anyone wanting the current default double callback behavior

SonicZentropy avatar Sep 28 '20 12:09 SonicZentropy