-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ScreenSpaceEventHandler when Cesium does not take up the entire browser window #2417
Conversation
@bagnell can you review please? |
I found a related bug in |
Additional discussion: https://groups.google.com/forum/#!topic/cesium-dev/Emt-CrGYulY |
The related bug I mentioned above is separate from the issue mentioned on the forum, and is now fixed in this pull request. |
I know very little about the mouse handling code, but isn't @shunter any thoughts here? |
Any update? We'll want to merge this this week so it makes 1.6. |
This looks good to me. Just waiting on a response to @mramato's comment. |
Size, yes, but we're not calling
Not really. The top of the call stack is an input event, so we can't pass it down from there. The best we could do is compute and cache the rectangle if it's undefined, and then reset it to undefined each frame. I started trying to do this but it's ugly and likely to lead to bugs. In particular, I just committed a change to reduce the number of calls to By the way, this pull request brings Cesium's input handling from "horribly broken" to "working but possibly not quite as optimal as it could be" so merge it already! 6 days, sheesh. :) |
Agreed we should merge this before the release.
With one important caveat: When you're moving the mouse, dozens of Anyway, I did a little performance testing of this vs master, and I couldn't spot the difference. So @bagnell I think you should merge. |
As @emackey stated, profiling doesn't show any performance issues (I tried IE, Firefox, and Chrome). |
…inates Fix ScreenSpaceEventHandler when Cesium does not take up the entire browser window
…entHandler to listen on the document for pointer up and move events.
…entHandler to listen on the document for pointer up and move events.
A bug was introduced in #2408 that breaks mouse events completely when the Cesium canvas is not in the upper-left of the browser window.
The problem is that
clientX
andclientY
are relative to the client area of the overall browser window, not the DOM element, even for listeners attached to a specific element.https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.clientX