-
Notifications
You must be signed in to change notification settings - Fork 303
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 (controls): add an offset after mouse movement #611
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks
@@ -904,8 +904,13 @@ function GlobeControls(view, target, radius, options = {}) { | |||
|
|||
event.preventDefault(); | |||
|
|||
const staticPos = window.getComputedStyle(event.target.parentElement).position !== 'static'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you factorize this part that appears several times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it depends on the event
, and this variable is available in the function scope only. As GlobeControls
is a sort of singleton (correct me if I'm wrong), we can't compute the value at the init of the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, you could pass the event as a parameter.
In short, it isn't important.
@elias75015 can you test if the bug is fixed? |
When moving the globe using GlobeControls, there was some kind of offset, the globe not staying right under the cursor. This is visible if the container of the canvas is not occupying the full page, the container has a CSS position property different of the default 'static' and there are elements right before it on the page, like the geoportal case. The solution to avoid this, is to detect the position of the container and add an offset according to this position, using the getBoundingClientRect method of the container.
cec996c
to
bf71599
Compare
The following bugs have been corrected :
|
When moving the globe using
GlobeControls
, there was some kind of offset, the globe not staying right under the cursor. This is visible if the container of the canvas is not occupying the full page, the container has a CSS position property different of the defaultstatic
and there are elements right before it on the page, like the geoportal case.The solution to avoid this, is to detect the position of the container and add an offset according to this position, using the
getBoundingClientRect
method of the container.@elias75015 could you test this fix ?
Note: as I tweaked the
GlobeControls
, I can confirm that we need to resolve issue #545, as there were some other bugs as well.