Remove unused boxzoom related parts.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com> Change-Id: I6ce90e4ec020f2c96ad72b54ea5c5d2182c91bc1
This commit is contained in:
parent
fee024f739
commit
04a049922a
3 changed files with 1 additions and 104 deletions
|
@ -292,7 +292,6 @@ COOL_JS_LST =\
|
|||
src/map/handler/Map.DoubleClickZoom.js \
|
||||
src/dom/DomEvent.Pointer.js \
|
||||
src/map/handler/Map.TouchGesture.js \
|
||||
src/map/handler/Map.BoxZoom.js \
|
||||
src/map/handler/Map.Keyboard.js \
|
||||
src/map/handler/Map.Welcome.js \
|
||||
src/map/handler/Map.Feedback.js \
|
||||
|
|
|
@ -152,7 +152,6 @@ L.Map = L.Evented.extend({
|
|||
this.addHandler('touchGesture', L.Map.TouchGesture);
|
||||
} else {
|
||||
this.addHandler('mouse', L.Map.Mouse);
|
||||
this.addHandler('boxZoom', L.Map.BoxZoom);
|
||||
this.addHandler('scrollHandler', L.Map.Scroll);
|
||||
this.addHandler('doubleClickZoom', L.Map.DoubleClickZoom);
|
||||
}
|
||||
|
@ -1701,7 +1700,7 @@ L.Map = L.Evented.extend({
|
|||
|
||||
_draggableMoved: function (obj) {
|
||||
obj = obj.options.draggable ? obj : this;
|
||||
return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved());
|
||||
return obj.dragging && obj.dragging.moved();
|
||||
},
|
||||
|
||||
_clearHandlers: function () {
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
/* -*- js-indent-level: 8 -*- */
|
||||
/*
|
||||
* L.Handler.ShiftDragZoom is used to add shift-drag zoom interaction to the map
|
||||
* (zoom to a selected bounding box), enabled by default.
|
||||
*/
|
||||
|
||||
L.Map.mergeOptions({
|
||||
boxZoom: true
|
||||
});
|
||||
|
||||
L.Map.BoxZoom = L.Handler.extend({
|
||||
initialize: function (map) {
|
||||
this._map = map;
|
||||
this._container = map._container;
|
||||
this._pane = map._panes.overlayPane;
|
||||
},
|
||||
|
||||
addHooks: function () {
|
||||
L.DomEvent.on(this._container, 'mousedown', this._onMouseDown, this);
|
||||
},
|
||||
|
||||
removeHooks: function () {
|
||||
L.DomEvent.off(this._container, 'mousedown', this._onMouseDown, this);
|
||||
},
|
||||
|
||||
moved: function () {
|
||||
return this._moved;
|
||||
},
|
||||
|
||||
_onMouseDown: function (e) {
|
||||
if (this._map._docLayer._hasActiveSelection)
|
||||
return false;
|
||||
if (!e.shiftKey || ((e.which !== 1) && (e.button !== 0))) { return false; }
|
||||
|
||||
this._moved = false;
|
||||
|
||||
L.DomUtil.disableTextSelection();
|
||||
L.DomUtil.disableImageDrag();
|
||||
|
||||
this._startPoint = this._map.mouseEventToContainerPoint(e);
|
||||
|
||||
L.DomEvent.on(document, {
|
||||
contextmenu: L.DomEvent.stop,
|
||||
mousemove: this._onMouseMove,
|
||||
mouseup: this._onMouseUp,
|
||||
keydown: this._onKeyDown
|
||||
}, this);
|
||||
},
|
||||
|
||||
_onMouseMove: function (e) {
|
||||
if (!this._moved) {
|
||||
this._moved = true;
|
||||
|
||||
this._box = L.DomUtil.create('div', 'leaflet-zoom-box', this._container);
|
||||
L.DomUtil.addClass(this._container, 'leaflet-crosshair');
|
||||
|
||||
this._map.fire('boxzoomstart');
|
||||
}
|
||||
|
||||
this._point = this._map.mouseEventToContainerPoint(e);
|
||||
|
||||
var bounds = new L.Bounds(this._point, this._startPoint),
|
||||
size = bounds.getSize();
|
||||
|
||||
L.DomUtil.setPosition(this._box, bounds.min);
|
||||
|
||||
this._box.style.width = size.x + 'px';
|
||||
this._box.style.height = size.y + 'px';
|
||||
},
|
||||
|
||||
_finish: function () {
|
||||
if (this._moved) {
|
||||
L.DomUtil.remove(this._box);
|
||||
L.DomUtil.removeClass(this._container, 'leaflet-crosshair');
|
||||
}
|
||||
|
||||
L.DomUtil.enableTextSelection();
|
||||
L.DomUtil.enableImageDrag();
|
||||
|
||||
L.DomEvent.off(document, {
|
||||
contextmenu: L.DomEvent.stop,
|
||||
mousemove: this._onMouseMove,
|
||||
mouseup: this._onMouseUp,
|
||||
keydown: this._onKeyDown
|
||||
}, this);
|
||||
},
|
||||
|
||||
_onMouseUp: function (e) {
|
||||
if ((e.which !== 1) && (e.button !== 0)) { return; }
|
||||
|
||||
this._finish();
|
||||
|
||||
if (!this._moved) { return; }
|
||||
},
|
||||
|
||||
_onKeyDown: function (e) {
|
||||
if (e.keyCode === 27) {
|
||||
this._finish();
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue