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

Make sure that ol.MapBrowserEvent#getPixel() always returns a valid value #1138

Merged
merged 1 commit into from
Oct 18, 2013

Conversation

fredj
Copy link
Member

@fredj fredj commented Oct 17, 2013

Because of a bug in closure-library [1], ol.MapBrowserEvent#getPixel() crash when the event type is touchend or touchcancel. This PR adds a workaround by computing the pixel_ attribute in the constructor.

[1] https://code.google.com/p/closure-library/issues/detail?id=588

this.focus_ = mapBrowserEvent.getCoordinate();
}

this.focus_ = mapBrowserEvent.getCoordinate();
Copy link
Member

Choose a reason for hiding this comment

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

What about MOUSEOUT?

@fredj
Copy link
Member Author

fredj commented Oct 17, 2013

This is all wrong :-)

event.clientX, event.clientY is not the same as goog.style.getRelativePosition(event)

@fredj
Copy link
Member Author

fredj commented Oct 17, 2013

In case of a touchmove, if multiple touch have moved (event.changedTouches.length > 1) the first item is returned.
There should be a way to specify the touch identifier.

@elemoine
Copy link
Member

This SO answer says that event.changedTouches is also > 1 if multiple touches hit the screen (touchstart) at the same time.

@elemoine
Copy link
Member

LGTM

fredj added a commit that referenced this pull request Oct 18, 2013
Make sure that ol.MapBrowserEvent#getPixel() always returns a valid value
@fredj fredj merged commit 19f6645 into openlayers:master Oct 18, 2013
@fredj fredj deleted the touch_pixel branch October 18, 2013 04:45
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.

None yet

2 participants