aboutsummaryrefslogtreecommitdiffstats
path: root/extlib/leaflet/src/handler/ShiftDragZoom.js
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2015-02-14 13:34:41 -0600
committerChristopher Allan Webber <cwebber@dustycloud.org>2015-02-17 15:48:28 -0600
commit9252fc84840220106e696cc2116e7804c9529c5a (patch)
treec1bafe27ad0cac8e4b49bd476ad2e3947fe4fca9 /extlib/leaflet/src/handler/ShiftDragZoom.js
parent572106e23037997db9a4e131029b0a4f7cb969b5 (diff)
downloadmediagoblin-9252fc84840220106e696cc2116e7804c9529c5a.tar.lz
mediagoblin-9252fc84840220106e696cc2116e7804c9529c5a.tar.xz
mediagoblin-9252fc84840220106e696cc2116e7804c9529c5a.zip
Remove extlib deps moved into bower
Diffstat (limited to 'extlib/leaflet/src/handler/ShiftDragZoom.js')
-rw-r--r--extlib/leaflet/src/handler/ShiftDragZoom.js79
1 files changed, 0 insertions, 79 deletions
diff --git a/extlib/leaflet/src/handler/ShiftDragZoom.js b/extlib/leaflet/src/handler/ShiftDragZoom.js
deleted file mode 100644
index ba216109..00000000
--- a/extlib/leaflet/src/handler/ShiftDragZoom.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * L.Handler.ShiftDragZoom is used internally by L.Map to add shift-drag zoom (zoom to a selected bounding box).
- */
-
-L.Handler.ShiftDragZoom = L.Handler.extend({
- initialize: function(map) {
- this._map = map;
- this._container = map._container;
- this._pane = map._panes.overlayPane;
- },
-
- enable: function() {
- if (this._enabled) { return; }
-
- L.DomEvent.addListener(this._container, 'mousedown', this._onMouseDown, this);
-
- this._enabled = true;
- },
-
- disable: function() {
- if (!this._enabled) { return; }
-
- L.DomEvent.removeListener(this._container, 'mousedown', this._onMouseDown);
-
- this._enabled = false;
- },
-
- _onMouseDown: function(e) {
- if (!e.shiftKey || ((e.which != 1) && (e.button != 1))) { return false; }
-
- L.DomUtil.disableTextSelection();
-
- this._startLayerPoint = this._map.mouseEventToLayerPoint(e);
-
- this._box = L.DomUtil.create('div', 'leaflet-zoom-box', this._pane);
- L.DomUtil.setPosition(this._box, this._startLayerPoint);
-
- //TODO move cursor to styles
- this._container.style.cursor = 'crosshair';
-
- L.DomEvent.addListener(document, 'mousemove', this._onMouseMove, this);
- L.DomEvent.addListener(document, 'mouseup', this._onMouseUp, this);
-
- L.DomEvent.preventDefault(e);
- },
-
- _onMouseMove: function(e) {
- var layerPoint = this._map.mouseEventToLayerPoint(e),
- dx = layerPoint.x - this._startLayerPoint.x,
- dy = layerPoint.y - this._startLayerPoint.y;
-
- var newX = Math.min(layerPoint.x, this._startLayerPoint.x),
- newY = Math.min(layerPoint.y, this._startLayerPoint.y),
- newPos = new L.Point(newX, newY);
-
- L.DomUtil.setPosition(this._box, newPos);
-
- this._box.style.width = (Math.abs(dx) - 4) + 'px';
- this._box.style.height = (Math.abs(dy) - 4) + 'px';
- },
-
- _onMouseUp: function(e) {
- this._pane.removeChild(this._box);
- this._container.style.cursor = '';
-
- L.DomUtil.enableTextSelection();
-
- L.DomEvent.removeListener(document, 'mousemove', this._onMouseMove);
- L.DomEvent.removeListener(document, 'mouseup', this._onMouseUp);
-
- var layerPoint = this._map.mouseEventToLayerPoint(e);
-
- var bounds = new L.LatLngBounds(
- this._map.layerPointToLatLng(this._startLayerPoint),
- this._map.layerPointToLatLng(layerPoint));
-
- this._map.fitBounds(bounds);
- }
-}); \ No newline at end of file