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

Set mouse position as part of wheel events. #1027

Merged
merged 1 commit into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Improvements
- Points with small radii or thin strokes are rendered better (#1021)

### Bug Fixes
- Mouse wheel events didn't recompute gcs coordinates, so a wheel event without a previous move event coult list the wrong location (#1027)

## Version 0.19.6

### Features
Expand Down
8 changes: 8 additions & 0 deletions src/mapInteractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,9 @@ var mapInteractor = function (args) {
* @param {jQuery.Event} evt JQuery event with the mouse position.
*/
this._getMousePosition = function (evt) {
if (evt.pageX === undefined || evt.pageY === undefined) {
return;
}
var offset = $node.offset(), dt, t;

t = (new Date()).valueOf();
Expand Down Expand Up @@ -849,6 +852,9 @@ var mapInteractor = function (args) {
* @param {jQuery.Event} evt The event that trigger the mouse action.
*/
this._getMouseButton = function (evt) {
if (evt.buttons === undefined && evt.which === undefined) {
return;
}
for (var prop in m_mouse.buttons) {
if (m_mouse.buttons.hasOwnProperty(prop)) {
m_mouse.buttons[prop] = false;
Expand Down Expand Up @@ -1725,6 +1731,8 @@ var mapInteractor = function (args) {
}

// perform the map navigation event
m_this._getMousePosition(evt);
m_this._getMouseButton(evt);
m_this._getMouseModifiers(evt);

actionRecord = actionMatch({wheel: true}, m_mouse.modifiers,
Expand Down