Skip to content

Commit

Permalink
Clock prompt dialog input on canvas click (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-byrne authored Aug 21, 2024
1 parent 86d9391 commit f351b1d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/litegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -11432,6 +11432,15 @@ LGraphNode.prototype.executeAction = function(action)

setTimeout(function() {
input.focus();
function handleOutsideClick(e) {
if (e.target === canvas) {
dialog.close();
canvas.parentNode.removeEventListener("click", handleOutsideClick);
canvas.parentNode.removeEventListener("touchend", handleOutsideClick);
}
}
canvas.parentNode.addEventListener("click", handleOutsideClick);
canvas.parentNode.addEventListener("touchend", handleOutsideClick);
}, 10);

return dialog;
Expand Down

5 comments on commit f351b1d

@horizontalyu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a new bug with this code. Clicking input on the node will bring up a dialog, but releasing the mouse will automatically close the dialog.

@christian-byrne
Copy link
Author

@christian-byrne christian-byrne commented on f351b1d Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a new bug with this code. Clicking input on the node will bring up a dialog, but releasing the mouse will automatically close the dialog.

on touch device? Should maybe use mouseup event, or increase the timeout.

@christian-byrne
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a new bug with this code. Clicking input on the node will bring up a dialog, but releasing the mouse will automatically close the dialog.

Since I can't reproduce it, it's hard to test a fix. Can you try increasing the timeout here to something like 256 and see if it fixes it?

}, 10);

Otherwise you can tell me the device and browser app and I can try to reproduce that way.

@horizontalyu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a new bug with this code. Clicking input on the node will bring up a dialog, but releasing the mouse will automatically close the dialog.

on touch device? Should maybe use mouseup event, or increase the timeout.

I'm using google browser for windows, increase the timeout is ok, thanks

@christian-byrne
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for bringing it up. It seems to only happen on STRING inputs. I just pushed a fix for it: #86

Please sign in to comment.