Skip to content
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

use offsetX & offsetY instead of x & y to get relative positions #445

Merged
merged 2 commits into from
Mar 22, 2017

Conversation

gnavvy
Copy link
Contributor

@gnavvy gnavvy commented Mar 22, 2017

fixes #248 and #444
tested (ad-hoc) in the svg-interoperability example with a scolled offset.
will add a dedicated example consist of multiple non-full screen widgets later.

@@ -119,7 +119,7 @@ export default class DeckGL extends React.Component {

// Route events to layers
_onClick(event) {
const {x, y} = event;
const {event: {offsetX: x = 0, offsetY: y = 0} = {}} = event;
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • Since we are changing this to fix an issue should we add a line of comment why we are using offsetX and offsetY?
  • About the default values: Is this just a sanity check or is there are reason for the defaults? I.e. when is offsetX and offsetY undefined? Do we want to send a 0,0 event in those cases? Or drop the event? Or pass along the undefined so that app can check? Maybe add another comment line about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a sanity check.

I agree it makes more sense to drop the event if either event.event is falsy (luma.gl addEvent fails, shouldn't be) or offsetX offsetY are falsy (browser fails, again shouldn't be according to the spec); it's also heavy and requires changes on existing apps if we surface the error message via the picked object.

will just drop the event if sanity check fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mouse event positions incorrect when page scrolled
3 participants