Browse Source

Option 'preferredZoom'

master
parent
commit
713a2b5fdf
  1. 1
      README.md
  2. 4
      src/CategoryOverpass.js

1
README.md

@ -111,6 +111,7 @@ The following values are possible for categories (the only mandatory value is qu
* popupDescription: like description, but an alternative if the description in popups should be different from the list.
* markerSign: a HTML string which will be shown within the marker and in the list. (default: '')
* priority: a numeric value by which the elements in the list will be sorted (lower values first)
* preferredZoom: At which max. zoom level will the map zoom when showing details
* const: an object variable which is available as prefix in twig functions.
All values in the "feature" section may use the [TwigJS language](doc/TwigJS.md) for evaluation.

4
src/CategoryOverpass.js

@ -25,6 +25,7 @@ var defaultValues = {
},
markerSymbol: "{{ markerPointer({})|raw }}",
listMarkerSymbol: "{{ markerCircle({})|raw }}",
preferredZoom: 16
},
queryOptions: {
split: 64
@ -298,8 +299,9 @@ CategoryOverpass.prototype.show = function (id, options, callback) {
this.layer.show(id, options, function (err, data) {
if (!err) {
if (options.showDetails && !options.hasLocation) {
var preferredZoom = data.data.preferredZoom || 16
var maxZoom = this.map.getZoom()
maxZoom = maxZoom > 16 ? maxZoom : 16
maxZoom = maxZoom > preferredZoom ? maxZoom : preferredZoom
this.map.flyToBounds(data.object.bounds.toLeaflet(), {
maxZoom: maxZoom
})

Loading…
Cancel
Save