From de5a225a95125db1a66d6dfbaa3a790db9719c18 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 13 Jun 2013 15:19:03 -0700 Subject: [PATCH] Use custom zoom control everywhere --- app/assets/javascripts/application.js | 1 + app/assets/javascripts/browse.js | 2 +- app/assets/javascripts/changeset.js | 2 +- app/assets/javascripts/diary_entry.js | 2 +- app/assets/javascripts/index.js | 3 +-- .../{leaflet.customzoom.js => leaflet.zoom.js} | 16 ++++++---------- app/assets/javascripts/user.js | 2 +- config/locales/en.yml | 3 +++ 8 files changed, 15 insertions(+), 16 deletions(-) rename app/assets/javascripts/{leaflet.customzoom.js => leaflet.zoom.js} (79%) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f5022683b..0ee6dc880 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -5,6 +5,7 @@ //= require augment //= require leaflet //= require leaflet.osm +//= require leaflet.zoom //= require leaflet.extend //= require leaflet.locationfilter //= require i18n/translations diff --git a/app/assets/javascripts/browse.js b/app/assets/javascripts/browse.js index c39e8382c..2d9c4b46f 100644 --- a/app/assets/javascripts/browse.js +++ b/app/assets/javascripts/browse.js @@ -5,7 +5,7 @@ $(document).ready(function () { zoomControl: false }).addLayer(new L.OSM.Mapnik()); - L.control.zoom({position: 'topright'}) + L.OSM.zoom() .addTo(map); $("#small_map").on("resized", function () { diff --git a/app/assets/javascripts/changeset.js b/app/assets/javascripts/changeset.js index 7f21ae744..26c2351fa 100644 --- a/app/assets/javascripts/changeset.js +++ b/app/assets/javascripts/changeset.js @@ -6,7 +6,7 @@ $(document).ready(function () { zoomControl: false }).addLayer(new L.OSM.Mapnik()); - L.control.zoom({position: 'topright'}) + L.OSM.zoom() .addTo(map); $("#changeset_list_map").on("resized", function () { diff --git a/app/assets/javascripts/diary_entry.js b/app/assets/javascripts/diary_entry.js index e17f59ad2..7c420b671 100644 --- a/app/assets/javascripts/diary_entry.js +++ b/app/assets/javascripts/diary_entry.js @@ -27,7 +27,7 @@ $(document).ready(function () { zoomControl: false }).addLayer(new L.OSM.Mapnik()); - L.control.zoom({position: 'topright'}) + L.OSM.zoom() .addTo(map); $("#map").on("resized", function () { diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 7988541a6..6ea276230 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -1,6 +1,5 @@ //= require_self //= require leaflet.sidebar -//= require leaflet.customzoom //= require leaflet.locate //= require leaflet.layers //= require leaflet.key @@ -56,7 +55,7 @@ $(document).ready(function () { map.invalidateSize(); }); - L.control.customZoom({position: 'topright'}) + L.OSM.zoom({position: 'topright'}) .addTo(map); L.control.locate({position: 'topright'}) diff --git a/app/assets/javascripts/leaflet.customzoom.js b/app/assets/javascripts/leaflet.zoom.js similarity index 79% rename from app/assets/javascripts/leaflet.customzoom.js rename to app/assets/javascripts/leaflet.zoom.js index 091a97199..80b4ab1bc 100644 --- a/app/assets/javascripts/leaflet.customzoom.js +++ b/app/assets/javascripts/leaflet.zoom.js @@ -1,10 +1,6 @@ -/* - * L.Control.CustomZoom is used for the default zoom buttons on the map. - */ - -L.Control.CustomZoom = L.Control.extend({ +L.OSM.Zoom = L.Control.extend({ options: { - position: 'topleft' + position: 'topright' }, onAdd: function (map) { @@ -14,9 +10,9 @@ L.Control.CustomZoom = L.Control.extend({ this._map = map; this._zoomInButton = this._createButton( - '', 'Zoom in', zoomName + 'in', container, this._zoomIn, this); + '', I18n.t('javascripts.map.zoom.in'), zoomName + 'in', container, this._zoomIn, this); this._zoomOutButton = this._createButton( - '', 'Zoom out', zoomName + 'out', container, this._zoomOut, this); + '', I18n.t('javascripts.map.zoom.out'), zoomName + 'out', container, this._zoomOut, this); map.on('zoomend zoomlevelschange', this._updateDisabled, this); @@ -71,6 +67,6 @@ L.Control.CustomZoom = L.Control.extend({ } }); -L.control.customZoom = function (options) { - return new L.Control.CustomZoom(options); +L.OSM.zoom = function (options) { + return new L.OSM.Zoom(options); }; diff --git a/app/assets/javascripts/user.js b/app/assets/javascripts/user.js index 4e6467712..b5520aa36 100644 --- a/app/assets/javascripts/user.js +++ b/app/assets/javascripts/user.js @@ -4,7 +4,7 @@ $(document).ready(function () { zoomControl: false }).addLayer(new L.OSM.Mapnik()); - L.control.zoom({position: 'topright'}) + L.OSM.zoom() .addTo(map); $("#map").on("resized", function () { diff --git a/config/locales/en.yml b/config/locales/en.yml index 8be56bd3d..ad7dc3a51 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2046,6 +2046,9 @@ en: title: "Map Key" tooltip: "Key for the map" map: + zoom: + in: Zoom In + out: Zoom Out base: standard: Standard cycle_map: Cycle Map -- 2.39.5