web; runtime; add browser_window_mouse(down|up|move)#101
web; runtime; add browser_window_mouse(down|up|move)#101jeremyfa wants to merge 1 commit intosnowkit:masterfrom
Conversation
These options allow to handle mouse events (down, move, up) in the entire browser window instead of just the canvas. It makes it possible to track a started mouse event outside the canvas and finish it inside it and vice versa.
|
Interesting! I don't know if I like it being 3 different config values for essentially the same thing.. Also I would mention that the typical approach I would use is the reverse, you can submit any events you want to the runtime, at any point. Listen on window (application specific) -> tell snow via |
|
I made them separate options because, for instance in my case, I don't need to catch I see that we can send events via With this PR it is just about setting an option (or two, three) to The This option may also be helpful for any luxe game, embedded in a bigger page, that relies on |
|
Right, I think there are multiple "problems" mentioned that's why I am thinking about it. Mouse up happening outside the canvas is supposed to happen regardless, but it would be weird if it happened and you didn't initiate that click inside the canvas, i.e "random mouseup from all over the web page" isn't useful as "there was a click inside the canvas, that left the canvas, but should still fire mouseup". I'll take a closer look when I can but I want to consider it a bit more closely, and I already know that I don't think the 3 config options are ideal here :) |
|
Making it a single option would be ok. Thanks for the feedback! |
These options allow to handle mouse events (down, move, up) in the entire browser window instead of just the canvas. It makes it possible to track a started mouse event outside the canvas and finish it inside it and vice versa.
I needed this because I embed a luxe view inside a bigger html page and need to keep track of what the mouse is doing outside the canvas. Before that, when starting a
mousedownevent in the canvas (to drag/select/move something) and releasing the mouse buttonmouseupoutside the canvas, the app would still think my mouse is pressed when it isn't. These options make it possible to handle it nicely.These options are disabled by default. If enabled, I didn't foresee any regression regarding computing event positions as
snowis not using MouseEvent values that depend on which element it was captured from anyway. Only window level values, then translating to canvas positions.