diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 5273b88c..66d4647e 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -708,11 +708,11 @@ L.U.Map.include({ } L.DomEvent.on(zoom_to, 'click', function (e) { e.callback = L.bind(this.view, this); - this.bringToCenter(e); + this.zoomTo(e); }, feature); L.DomEvent.on(title, 'click', function (e) { e.callback = L.bind(this.view, this) - this.bringToCenter(e); + this.zoomTo(e); }, feature); L.DomEvent.on(edit, 'click', function () { this.edit(); diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index c872e689..a238c10f 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -113,7 +113,7 @@ L.U.FeatureMixin = { this.getAdvancedEditActions(advancedActions); this.map.ui.openPanel({data: {html: container}, className: 'dark'}); this.map.editedFeature = this; - if (!this.isOnScreen()) this.bringToCenter(e); + if (!this.isOnScreen()) this.zoomTo(e); }, getAdvancedEditActions: function (container) { @@ -254,28 +254,23 @@ L.U.FeatureMixin = { return value; }, - bringToCenter: function (e) { - e = e || {}; - var latlng = e.latlng || this.getCenter(); - this.map.setView(latlng, e.zoomTo || this.map.getZoom()); - if (e.callback) e.callback.call(this); - }, - zoomTo: function (e) { e = e || {}; var easing = e.easing !== undefined ? e.easing : this.map.options.easing; - if (easing) this.flyTo(); - else this.bringToCenter({zoomTo: this.getBestZoom(), callback: e.callback}); + if (easing) { + this.map.flyTo(this.getCenter(), this.getBestZoom()); + } + else { + var latlng = e.latlng || this.getCenter(); + this.map.setView(latlng, this.getBestZoom() || this.map.getZoom()); + } + if (e.callback) e.callback.call(this); }, getBestZoom: function () { return this.getOption('zoomTo'); }, - flyTo: function () { - this.map.flyTo(this.getCenter(), this.getBestZoom()); - }, - getNext: function () { return this.datalayer.getNextFeature(this); }, @@ -587,7 +582,7 @@ L.U.Marker = L.Marker.extend({ callback: function () { if (!this._latlng.isValid()) return this.map.ui.alert({content: L._('Invalid latitude or longitude'), level: 'error'}); this._redraw(); - this.bringToCenter(); + this.zoomTo({easing: false}); }, callbackContext: this }); @@ -595,12 +590,12 @@ L.U.Marker = L.Marker.extend({ fieldset.appendChild(builder.build()); }, - bringToCenter: function (e) { + zoomTo: function (e) { if (this.datalayer.isClustered() && !this._icon) { // callback is mandatory for zoomToShowLayer this.datalayer.layer.zoomToShowLayer(this, e.callback || function (){}); } else { - L.U.FeatureMixin.bringToCenter.call(this, e); + L.U.FeatureMixin.zoomTo.call(this, e); } }, @@ -711,9 +706,7 @@ L.U.PathMixin = { }, getBestZoom: function () { - if (this.options.zoomTo) return this.options.zoomTo; - var bounds = this.getBounds(); - return this.map.getBoundsZoom(bounds, true); + return this.getOption("zoomTo") || this.map.getBoundsZoom(this.getBounds(), true); }, endEdit: function () { diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index b5d466a7..605598e1 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -12,7 +12,6 @@ L.Map.mergeOptions({ default_fill: true, default_weight: 3, default_iconClass: 'Default', - default_zoomTo: 16, default_popupContentTemplate: '# {name}\n{description}', default_interactive: true, default_labelDirection: 'auto', @@ -45,7 +44,7 @@ L.Map.mergeOptions({ captionMenus: true, slideshow: {}, clickable: true, - easing: true, + easing: false, permissions: {}, permanentCreditBackground: true, }); @@ -262,8 +261,7 @@ L.U.Map.include({ // but the control breaks if we don't specify a class here, so a fake class // will do. icon: 'umap-fake-class', - iconLoading: 'umap-fake-class', - flyTo: true, + iconLoading: 'umap-fake-class' }); this._controls.fullscreen = new L.Control.Fullscreen({title: {'false': L._('View Fullscreen'), 'true': L._('Exit Fullscreen')}}); this._controls.search = new L.U.SearchControl(); @@ -1287,7 +1285,7 @@ L.U.Map.include({ 'options.smoothFactor', 'options.dashArray', 'options.zoomTo', - ['options.easing', {handler: 'Switch', label: L._('Advanced transition')}], + ['options.easing', {handler: 'Switch', label: L._('Animated transitions')}], 'options.labelKey', ['options.sortKey', {handler: 'BlurInput', helpEntries: 'sortKey', placeholder: L._('Default: name'), label: L._('Sort key'), inheritable: true}], ['options.filterKey', {handler: 'Input', helpEntries: 'filterKey', placeholder: L._('Default: name'), label: L._('Filter keys'), inheritable: true}], @@ -1416,7 +1414,7 @@ L.U.Map.include({ var slideshowFields = [ ['options.slideshow.active', {handler: 'Switch', label: L._('Activate slideshow mode')}], ['options.slideshow.delay', {handler: 'SlideshowDelay', helpText: L._('Delay between two transitions when in play mode')}], - ['options.slideshow.easing', {handler: 'Switch', label: L._('Smart transitions'), inheritable: true}], + ['options.slideshow.easing', {handler: 'Switch', label: L._('Animated transitions'), inheritable: true}], ['options.slideshow.autoplay', {handler: 'Switch', label: L._('Autostart when map is loaded')}] ]; var slideshowHandler = function () { diff --git a/umap/static/umap/js/umap.popup.js b/umap/static/umap/js/umap.popup.js index 40bfe6e8..aca9d533 100644 --- a/umap/static/umap/js/umap.popup.js +++ b/umap/static/umap/js/umap.popup.js @@ -118,13 +118,13 @@ L.U.PopupTemplate.Default = L.Class.extend({ if (prev) previousLi.title = L._('Go to «{feature}»', {feature: prev.properties.name || L._('previous')}); zoomLi.title = L._('Zoom to this feature'); L.DomEvent.on(nextLi, 'click', function () { - if (next) next.bringToCenter({zoomTo: next.getOption('zoomTo'), callback: next.view}); + if (next) next.zoomTo({callback: next.view}); }); L.DomEvent.on(previousLi, 'click', function () { - if (prev) prev.bringToCenter({zoomTo: prev.getOption('zoomTo'), callback: prev.view}); + if (prev) prev.zoomTo({callback: prev.view}); }); L.DomEvent.on(zoomLi, 'click', function () { - this.bringToCenter({zoomTo: this.getOption('zoomTo')}); + this.zoomTo(); }, this.feature); } },