Skip to content

Commit

Permalink
Disable handlers before enabling
Browse files Browse the repository at this point in the history
… in order to prevent duplicate event listeners from being bound

fixes #2069
  • Loading branch information
Lucas Wojciechowski committed Feb 8, 2016
1 parent 00ac673 commit 11efb1b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions js/ui/handler/box_zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function BoxZoom(map) {

BoxZoom.prototype = {
enable: function () {
this.disable();
this._el.addEventListener('mousedown', this._onMouseDown, false);
},

Expand Down
1 change: 1 addition & 0 deletions js/ui/handler/dblclick_zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function DoubleClickZoom(map) {

DoubleClickZoom.prototype = {
enable: function () {
this.disable();
this._map.on('dblclick', this._onDblClick);
},

Expand Down
1 change: 1 addition & 0 deletions js/ui/handler/drag_pan.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function DragPan(map) {

DragPan.prototype = {
enable: function () {
this.disable();
this._el.addEventListener('mousedown', this._onDown);
this._el.addEventListener('touchstart', this._onDown);
},
Expand Down
1 change: 1 addition & 0 deletions js/ui/handler/drag_rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function DragRotate(map) {

DragRotate.prototype = {
enable: function () {
this.disable();
this._el.addEventListener('mousedown', this._onDown);
},

Expand Down
1 change: 1 addition & 0 deletions js/ui/handler/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function Keyboard(map) {

Keyboard.prototype = {
enable: function () {
this.disable();
this._el.addEventListener('keydown', this._onKeyDown, false);
},

Expand Down
2 changes: 1 addition & 1 deletion js/ui/handler/scroll_zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function ScrollZoom(map) {

ScrollZoom.prototype = {
enable: function () {
this.disable();
this._el.addEventListener('wheel', this._onWheel, false);
this._el.addEventListener('mousewheel', this._onWheel, false);
},
Expand Down Expand Up @@ -144,4 +145,3 @@ ScrollZoom.prototype = {
* @instance
* @property {EventData} data Original event data, if fired interactively
*/

1 change: 1 addition & 0 deletions js/ui/handler/touch_zoom_rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function TouchZoomRotate(map) {

TouchZoomRotate.prototype = {
enable: function () {
this.disable();
this._el.addEventListener('touchstart', this._onStart, false);
},

Expand Down

0 comments on commit 11efb1b

Please sign in to comment.