Skip to content

Commit

Permalink
Set mouse position as part of wheel events.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Sep 14, 2019
1 parent 5e8ba34 commit 07932d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit 07932d6

Please sign in to comment.