]> git.openstreetmap.org Git - rails.git/commitdiff
Remove pan and zoom controls
authorTom MacWright <tom@macwright.org>
Mon, 10 Jun 2013 16:46:00 +0000 (09:46 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 18 Jul 2013 17:31:19 +0000 (10:31 -0700)
Vendorfile
app/assets/javascripts/application.js
app/assets/javascripts/map.js.erb
app/assets/stylesheets/leaflet-all.css.scss
vendor/assets/leaflet/leaflet.pan.js [deleted file]
vendor/assets/leaflet/leaflet.zoom.js [deleted file]

index 3eee989d3adcf45a784e25046629d9d00d807d85..c2622b16cfac1803bfad3377092d03b8718a72c5 100644 (file)
@@ -16,14 +16,6 @@ folder 'vendor/assets' do
       folder 'img', 'src/img'
     end
 
-    from 'git://github.com/kartena/Leaflet.Pancontrol.git' do
-      file 'leaflet.pan.js', 'src/L.Control.Pan.js'
-    end
-
-    from 'git://github.com/kartena/Leaflet.zoomslider.git' do
-      file 'leaflet.zoom.js', 'src/L.Control.Zoomslider.js'
-    end
-
     from 'git://github.com/jfirebaugh/leaflet-osm.git' do
       file 'leaflet.osm.js', 'leaflet-osm.js'
     end
@@ -32,7 +24,7 @@ folder 'vendor/assets' do
   folder 'jquery' do
     from 'git://github.com/jevin/Autogrow-Textarea.git' do
       file 'jquery.autogrowtextarea.js', 'jquery.autogrowtextarea.js'
-    end  
+    end
   end
 
   folder 'ohauth' do
@@ -42,7 +34,7 @@ folder 'vendor/assets' do
   end
 
   folder 'iD' do
-    from 'git://github.com/systemed/iD', :branch => '1-0-stable' do
+    from 'git://github.com/systemed/iD', :branch => 'release' do
       folder 'iD/img', 'dist/img'
       folder 'iD/locales', 'dist/locales'
       file 'iD.css.erb', 'dist/iD.css' do |path|
index f8a8c4520699c160b108a1dc447fe3a1ca4a12c1..b9d09bd82e1921643c94a92c0802434080cd46dd 100644 (file)
@@ -6,8 +6,6 @@
 //= require leaflet
 //= require leaflet.osm
 //= require leaflet.locationfilter
-//= require leaflet.pan
-//= require leaflet.zoom
 //= require i18n/translations
 //= require oauth
 //= require osm
index 90aefa94580a5fd466c4eb5316d5111c896f9978..2354593ff9ed368d34d125e06c2ef76557ec6236 100644 (file)
@@ -59,10 +59,6 @@ function createMap(divName, options) {
     map.attributionControl.setPrefix('');
   }
 
-  if (options.panZoomControl) {
-    new L.Control.Pan().addTo(map);
-    new L.Control.Zoomslider({stepHeight: 7}).addTo(map);
-  }
 
   var layersControl = L.control.layers();
 
index 16001e5a59c80c5ef081e0ebd2759dbfd28185d1..a32e24dd1488950540cd1762fec973e650514298 100644 (file)
@@ -1,8 +1,6 @@
 /*
  *= require leaflet
  *= require leaflet.locationfilter
- *= require leaflet.pan
- *= require leaflet.zoom
  */
 
 /* Override to serve images through the asset pipeline. */
diff --git a/vendor/assets/leaflet/leaflet.pan.js b/vendor/assets/leaflet/leaflet.pan.js
deleted file mode 100644 (file)
index 5fa3a91..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-L.Control.Pan = L.Control.extend({
-       options: {
-               position: 'topleft',
-               panOffset: 500
-       },
-
-       onAdd: function (map) {
-               var className = 'leaflet-control-pan',
-                       container = L.DomUtil.create('div', className),
-                       off = this.options.panOffset;
-
-               this._panButton('Up'   , className + '-up'   
-                                               , container, map, new L.Point(    0 , -off));
-               this._panButton('Left' , className + '-left' 
-                                               , container, map, new L.Point( -off ,  0));
-               this._panButton('Right', className + '-right'
-                                               , container, map, new L.Point(  off ,  0));
-               this._panButton('Down' , className + '-down'
-                                               , container, map, new L.Point(    0 ,  off));
-               
-               return container;
-       },
-
-       _panButton: function (title, className, container, map, offset, text) {
-               var wrapper = L.DomUtil.create('div', className + "-wrap", container);
-               var link = L.DomUtil.create('a', className, wrapper);
-               link.href = '#';
-               link.title = title;
-               L.DomEvent
-                       .on(link, 'click', L.DomEvent.stopPropagation)
-                       .on(link, 'click', L.DomEvent.preventDefault)
-                       .on(link, 'click', function(){ map.panBy(offset); }, map)
-                       .on(link, 'dblclick', L.DomEvent.stopPropagation)
-
-               return link;
-       }
-});
-
-L.Map.mergeOptions({
-    panControl: true
-});
-
-L.Map.addInitHook(function () {
-    if (this.options.panControl) {
-               this.panControl = new L.Control.Pan();
-               this.addControl(this.panControl);
-       }
-});
-
-L.control.pan = function (options) {
-    return new L.Control.Pan(options);
-};
diff --git a/vendor/assets/leaflet/leaflet.zoom.js b/vendor/assets/leaflet/leaflet.zoom.js
deleted file mode 100644 (file)
index 0d105f9..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-L.Control.Zoomslider = (function () {
-
-       var Knob = L.Draggable.extend({
-               initialize: function (element, stepHeight, knobHeight) {
-                       L.Draggable.prototype.initialize.call(this, element, element);
-                       this._element = element;
-
-                       this._stepHeight = stepHeight;
-                       this._knobHeight = knobHeight;
-
-                       this.on('predrag', function () {
-                               this._newPos.x = 0;
-                               this._newPos.y = this._adjust(this._newPos.y);
-                       }, this);
-               },
-
-               _adjust: function (y) {
-                       var value = Math.round(this._toValue(y));
-                       value = Math.max(0, Math.min(this._maxValue, value));
-                       return this._toY(value);
-               },
-
-               // y = k*v + m
-               _toY: function (value) {
-                       return this._k * value + this._m;
-               },
-               // v = (y - m) / k
-               _toValue: function (y) {
-                       return (y - this._m) / this._k;
-               },
-
-               setSteps: function (steps) {
-                       var sliderHeight = steps * this._stepHeight;
-                       this._maxValue = steps - 1;
-
-                       // conversion parameters
-                       // the conversion is just a common linear function.
-                       this._k = -this._stepHeight;
-                       this._m = sliderHeight - (this._stepHeight + this._knobHeight) / 2;
-               },
-
-               setPosition: function (y) {
-                       L.DomUtil.setPosition(this._element,
-                                                                 L.point(0, this._adjust(y)));
-               },
-
-               setValue: function (v) {
-                       this.setPosition(this._toY(v));
-               },
-
-               getValue: function () {
-                       return this._toValue(L.DomUtil.getPosition(this._element).y);
-               }
-       });
-
-       var Zoomslider = L.Control.extend({
-               options: {
-                       position: 'topleft',
-                       // Height of zoom-slider.png in px
-                       stepHeight: 9,
-                       // Height of the knob div in px
-                       knobHeight: 5,
-                       styleNS: 'leaflet-control-zoomslider'
-               },
-
-               onAdd: function (map) {
-                       var container = L.DomUtil.create('div', this.options.styleNS + ' leaflet-bar');
-
-                       L.DomEvent.disableClickPropagation(container);
-
-                       this._map = map;
-
-                       this._zoomInButton = this._createZoomButton(
-                               'in', 'top', container, this._zoomIn);
-
-                       this._sliderElem = L.DomUtil.create(
-                               'div',
-                               this.options.styleNS + "-slider leaflet-bar-part",
-                               container);
-
-                       this._zoomOutButton = this._createZoomButton(
-                               'out', 'bottom', container, this._zoomOut);
-
-                       map .on('zoomlevelschange', this._refresh, this)
-                               .on("zoomend", this._updateKnob, this)
-                               .on("zoomend", this._updateDisabled, this)
-                               .whenReady(this._createSlider, this)
-                               .whenReady(this._createKnob, this)
-                               .whenReady(this._refresh, this);
-
-                       return container;
-               },
-
-               onRemove: function (map) {
-                       map .off("zoomend", this._updateKnob)
-                               .off("zoomend", this._updateDisabled)
-                               .off('zoomlevelschange', this._refresh);
-               },
-
-               _refresh: function () {
-                       var zoomLevels = this._zoomLevels();
-                       if (zoomLevels < Infinity  && this._knob  && this._sliderBody) {
-                               this._setSteps(zoomLevels);
-                               this._updateKnob();
-                               this._updateDisabled();
-                       }
-               },
-               _zoomLevels: function () {
-                       return this._map.getMaxZoom() - this._map.getMinZoom() + 1;
-               },
-
-               _createSlider: function () {
-                       this._sliderBody = L.DomUtil.create('div',
-                                                                                               this.options.styleNS + '-slider-body',
-                                                                                               this._sliderElem);
-                       L.DomEvent.on(this._sliderBody, 'click', this._onSliderClick, this);
-               },
-
-               _createKnob: function () {
-                       var knobElem = L.DomUtil.create('div', this.options.styleNS + '-slider-knob',
-                                                                                       this._sliderBody);
-                       L.DomEvent.disableClickPropagation(knobElem);
-
-                       this._knob = new Knob(knobElem,
-                                                                 this.options.stepHeight,
-                                                                 this.options.knobHeight)
-                               .on('dragend', this._updateZoom, this);
-                       this._knob.enable();
-               },
-
-               _onSliderClick: function (e) {
-                       var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e);
-                       var y = L.DomEvent.getMousePosition(first).y
-                                       - L.DomUtil.getViewportOffset(this._sliderBody).y; // Cache this?
-                       this._knob.setPosition(y);
-                       this._updateZoom();
-               },
-
-               _zoomIn: function (e) {
-                       this._map.zoomIn(e.shiftKey ? 3 : 1);
-               },
-               _zoomOut: function (e) {
-                       this._map.zoomOut(e.shiftKey ? 3 : 1);
-               },
-
-               _createZoomButton: function (zoomDir, end, container, fn) {
-                       var barPart = 'leaflet-bar-part',
-                               classDef = this.options.styleNS + '-' + zoomDir
-                                       + ' ' + barPart
-                                       + ' ' + barPart + '-' + end,
-                               title = 'Zoom ' + zoomDir,
-                               link = L.DomUtil.create('a', classDef, container);
-                       link.href = '#';
-                       link.title = title;
-
-                       L.DomEvent
-                               .on(link, 'click', L.DomEvent.preventDefault)
-                               .on(link, 'click', fn, this);
-
-                       return link;
-               },
-               _toZoomLevel: function (value) {
-                       return value + this._map.getMinZoom();
-               },
-               _toValue: function (zoomLevel) {
-                       return zoomLevel - this._map.getMinZoom();
-               },
-               _setSteps: function (zoomLevels) {
-                       this._sliderBody.style.height 
-                               = (this.options.stepHeight * zoomLevels) + "px";
-                       this._knob.setSteps(zoomLevels);
-               },
-               _updateZoom: function () {
-                       this._map.setZoom(this._toZoomLevel(this._knob.getValue()));
-               },
-               _updateKnob: function () {
-                       if (this._knob) {
-                               this._knob.setValue(this._toValue(this._map.getZoom()));
-                       }
-               },
-               _updateDisabled: function () {
-                       var map = this._map,
-                               className = this.options.styleNS + '-disabled';
-
-                       L.DomUtil.removeClass(this._zoomInButton, className);
-                       L.DomUtil.removeClass(this._zoomOutButton, className);
-
-                       if (map.getZoom() === map.getMinZoom()) {
-                               L.DomUtil.addClass(this._zoomOutButton, className);
-                       }
-                       if (map.getZoom() === map.getMaxZoom()) {
-                               L.DomUtil.addClass(this._zoomInButton, className);
-                       }
-               }
-       });
-       return Zoomslider;
-})();
-
-L.Map.mergeOptions({
-    zoomControl: false,
-    zoomsliderControl: true
-});
-
-L.Map.addInitHook(function () {
-    if (this.options.zoomsliderControl) {
-               this.zoomsliderControl = new L.Control.Zoomslider();
-               this.addControl(this.zoomsliderControl);
-       }
-});
-
-L.control.zoomslider = function (options) {
-    return new L.Control.Zoomslider(options);
-};