diff --git a/assets/maps/contao-leaflet.js b/assets/maps/contao-leaflet.js
index 652a519..02e1dc1 100644
--- a/assets/maps/contao-leaflet.js
+++ b/assets/maps/contao-leaflet.js
@@ -1 +1 @@
-L.Contao=L.Class.extend({includes:L.Mixin.Events,attribution:' | netzmacht creative',maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,e){return e.map.attributionControl.setPrefix(e.map.attributionControl.options.prefix+this.attribution),this.maps[t]=e,this.fire("map:added",{id:t,map:e}),this},getMap:function(t){return"undefined"==typeof this.maps[t]?null:this.maps[t]},addIcon:function(t,e){return this.icons[t]=e,this.fire("icon:added",{id:t,icon:e}),this},loadIcons:function(t){for(var e=0;ei&&(n[n.length]=[e,t].join("=")),document.location.pathname+n.join("&")}}),L.contao=new L.Contao,L.Map.include({_dynamicBounds:null,calculateFeatureBounds:function(t,e){if(t){if(!this.options.adjustBounds&&!e)return;this._scanForBounds(t)}else this.eachLayer(this._scanForBounds,this);this._dynamicBounds&&this.fitBounds(this._dynamicBounds)},_scanForBounds:function(t){var e;t.feature&&t.feature.properties&&t.feature.properties.affectBounds?t.getBounds?(e=t.getBounds(),e.isValid()&&(this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e.getSouthWest(),e.getNorthEast()))):t.getLatLng&&(e=t.getLatLng(),this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e,e)):t.eachLayer&&t.eachLayer(this._scanForBounds,this)}});
\ No newline at end of file
+L.Contao=L.Class.extend({includes:L.Mixin.Events,attribution:' | netzmacht creative',maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,e){return e.map.attributionControl.setPrefix(e.map.attributionControl.options.prefix+this.attribution),this.maps[t]=e,this.fire("map:added",{id:t,map:e}),this},getMap:function(t){return"undefined"==typeof this.maps[t]?null:this.maps[t]},addIcon:function(t,e){return this.icons[t]=e,this.fire("icon:added",{id:t,icon:e}),this},loadIcons:function(t){for(var e=0;ei&&(n[n.length]=[e,t].join("=")),document.location.pathname+n.join("&")}}),L.contao=new L.Contao,L.Map.include({_dynamicBounds:null,calculateFeatureBounds:function(t,e){if(t){if(!this.options.adjustBounds&&!e)return;this._scanForBounds(t)}else this.eachLayer(this._scanForBounds,this);this._dynamicBounds&&this.fitBounds(this._dynamicBounds)},_scanForBounds:function(t){var e;!t.feature||t.feature.properties&&t.feature.properties.ignoreForBounds?t instanceof L.MarkerClusterGroup&&t.options.affectBounds?(e=t.getBounds(),e.isValid()&&(this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e.getSouthWest(),e.getNorthEast()))):(!t.options||t.options&&t.options.affectBounds)&&t.eachLayer&&t.eachLayer(this._scanForBounds,this):t.getBounds?(e=t.getBounds(),e.isValid()&&(this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e.getSouthWest(),e.getNorthEast()))):t.getLatLng&&(e=t.getLatLng(),this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e,e))}});
\ No newline at end of file
diff --git a/assets/maps/src/Contao.js b/assets/maps/src/Contao.js
index 3fc588f..9be2a49 100644
--- a/assets/maps/src/Contao.js
+++ b/assets/maps/src/Contao.js
@@ -163,6 +163,7 @@ L.Contao = L.Class.extend({
// constructor arguments given, use them.
if (feature.properties.arguments) {
marker = L[type].apply(L[type], feature.properties.arguments);
+
L.Util.setOptions(marker, feature.properties.options);
}
}
diff --git a/assets/maps/src/Map.calculateFeatureBounds.js b/assets/maps/src/Map.calculateFeatureBounds.js
index c9f7e36..7eb844e 100644
--- a/assets/maps/src/Map.calculateFeatureBounds.js
+++ b/assets/maps/src/Map.calculateFeatureBounds.js
@@ -1,3 +1,4 @@
+
/**
* Extend map so that it can calculate their bounds depending of the features with the property affectBounds.
*/
@@ -42,7 +43,7 @@ L.Map.include({
_scanForBounds: function(layer) {
var source;
- if (layer.feature && layer.feature.properties && layer.feature.properties.affectBounds) {
+ if (layer.feature && (!layer.feature.properties || !layer.feature.properties.ignoreForBounds)) {
if (layer.getBounds) {
source = layer.getBounds();
@@ -62,7 +63,17 @@ L.Map.include({
this._dynamicBounds = L.latLngBounds(source, source);
}
}
- } else if (layer.eachLayer) {
+ } else if (layer instanceof L.MarkerClusterGroup && layer.options.affectBounds) {
+ source = layer.getBounds();
+
+ if (source.isValid()) {
+ if (this._dynamicBounds) {
+ this._dynamicBounds.extend(source);
+ } else {
+ this._dynamicBounds = L.latLngBounds(source.getSouthWest(), source.getNorthEast());
+ }
+ }
+ } else if ((!layer.options || (layer.options && layer.options.affectBounds)) && layer.eachLayer) {
layer.eachLayer(this._scanForBounds, this);
}
}
diff --git a/module/dca/tl_leaflet_layer.php b/module/dca/tl_leaflet_layer.php
index f2f90a5..276bc7c 100644
--- a/module/dca/tl_leaflet_layer.php
+++ b/module/dca/tl_leaflet_layer.php
@@ -145,14 +145,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
),
'markers extends default' => array(
'+expert' => array('pointToLayer'),
- '+active' => array('deferred')
+ '+active' => array('deferred', 'affectBounds')
),
'group extends default' => array(
'+title' => array('groupType'),
+ '+active' => array('affectBounds')
),
'vectors extends default' => array(
'+expert' => array('onEachFeature', 'pointToLayer'),
- '+active' => array('deferred'),
+ '+active' => array('deferred', 'affectBounds'),
),
'reference extends default' => array(
'+title' => array('reference', 'standalone')
@@ -173,6 +174,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'iconCreateFunction',
'disableDefaultStyle'
),
+ '+active' => array(
+ 'affectBounds'
+ )
),
),
@@ -500,5 +504,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'eval' => array('tl_class' => 'w50', 'submitOnChange' => false, 'isBoolean' => true),
'sql' => "char(1) NOT NULL default ''"
),
+ 'affectBounds' => array
+ (
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['affectBounds'],
+ 'exclude' => true,
+ 'inputType' => 'checkbox',
+ 'default' => false,
+ 'eval' => array('tl_class' => 'w50'),
+ 'sql' => "char(1) NOT NULL default ''"
+ ),
)
);
diff --git a/module/dca/tl_leaflet_marker.php b/module/dca/tl_leaflet_marker.php
index fb56e53..1597576 100644
--- a/module/dca/tl_leaflet_marker.php
+++ b/module/dca/tl_leaflet_marker.php
@@ -116,7 +116,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'riseOffset',
'customIcon',
),
- 'active' => array('active', 'affectBounds')
+ 'active' => array('active', 'ignoreForBounds')
),
),
'metasubpalettes' => array(
@@ -286,9 +286,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'eval' => array('maxlength' => 5, 'rgxp' => 'digit', 'tl_class' => 'clr w50', 'nullIfEmpty' => true),
'sql' => "int(5) NULL"
),
- 'affectBounds' => array
+ 'ignoreForBounds' => array
(
- 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['affectBounds'],
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['ignoreForBounds'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => false,
diff --git a/module/dca/tl_leaflet_vector.php b/module/dca/tl_leaflet_vector.php
index 9f4ca07..0087082 100644
--- a/module/dca/tl_leaflet_vector.php
+++ b/module/dca/tl_leaflet_vector.php
@@ -119,7 +119,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'data' => array(),
'popup' => array(':hide','addPopup'),
'config' => array(':hide', 'style', 'className', 'clickable'),
- 'active' => array('active', 'affectBounds')
+ 'active' => array('active', 'ignoreForBounds')
),
'polyline extends default' => array(
@@ -348,9 +348,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
),
'sql' => "mediumblob NULL"
),
- 'affectBounds' => array
+ 'ignoreForBounds' => array
(
- 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['affectBounds'],
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['ignoreForBounds'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => false,
diff --git a/module/languages/en/tl_leaflet_layer.php b/module/languages/en/tl_leaflet_layer.php
index fe5cf52..e13db4c 100644
--- a/module/languages/en/tl_leaflet_layer.php
+++ b/module/languages/en/tl_leaflet_layer.php
@@ -76,6 +76,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['iconCreateFunction'][0] = 'Crea
$GLOBALS['TL_LANG']['tl_leaflet_layer']['iconCreateFunction'][1] = 'Function used to create the cluster icon.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['disableDefaultStyle'][0] = 'Disable default style';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['disableDefaultStyle'][1] = 'Do not load default marker cluster stylesheets.';
+$GLOBALS['TL_LANG']['tl_leaflet_layer']['affectBounds'][0] = 'Affect map bounds';
+$GLOBALS['TL_LANG']['tl_leaflet_layer']['affectBounds'][1] = 'If the map support it the marker will be used to affect the initial map bounds.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][0] = 'Layer group';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][1] = 'Basic layer group.
See http://leafletjs.com/reference.html#layergroup';
diff --git a/module/languages/en/tl_leaflet_marker.php b/module/languages/en/tl_leaflet_marker.php
index 7d78143..12d8e8d 100644
--- a/module/languages/en/tl_leaflet_marker.php
+++ b/module/languages/en/tl_leaflet_marker.php
@@ -20,33 +20,33 @@ $GLOBALS['TL_LANG']['tl_leaflet_marker']['toggle'][1] = 'Toggle marker ID %s act
$GLOBALS['TL_LANG']['tl_leaflet_marker']['icons'][0] = 'Manage icons';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['icons'][1] = 'Manage marker icons.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['title'][0] = 'Title';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['title'][1] = 'Title of the map.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['alias'][0] = 'Alias';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['alias'][1] = 'Alias of the map.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['coordinates'][0] = 'Coordinates';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['coordinates'][1] = 'Coordinates of the marker as comma separated value (Latitude, longitude [, altitude]).';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['tooltip'][0] = 'Tooltip';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['tooltip'][1] = 'Marker tooltip rendered as title attribute.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['alt'][0] = 'Alternative text';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['alt'][1] = 'Text for the alt attribute of the icon image (useful for accessibility).';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['addPopup'][0] = 'Add popup';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['addPopup'][1] = 'Add a popup for the marker';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['popupContent'][0] = 'Popup content';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['popupContent'][1] = 'Content of the popup. Insert tags are replaced.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['clickable'][0] = 'Clickable';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['clickable'][1] = 'If deactivated, the marker will not emit mouse events and will act as a part of the underlying map.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['draggable'][0] = 'Draggable';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['draggable'][1] = 'Whether the marker is draggable with mouse/touch or not.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['keyboard'][0] = 'Keyboard navigation';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['keyboard'][1] = 'Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['zIndexOffset'][0] = 'ZIndex offset';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['zIndexOffset'][1] = 'By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['customIcon'][0] = 'Custom icon';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['customIcon'][1] = 'Use a custom icon.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'][0] = 'Icon';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'][1] = 'Select a custom icon.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['active'][0] = 'Activate marker';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['active'][1] = 'Only activated markers are rendered on the map.';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['affectBounds'][0] = 'Affect map bounds';
-$GLOBALS['TL_LANG']['tl_leaflet_marker']['affectBounds'][1] = 'If the map support it the marker will be used to affect the initial map bounds.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['title'][0] = 'Title';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['title'][1] = 'Title of the map.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['alias'][0] = 'Alias';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['alias'][1] = 'Alias of the map.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['coordinates'][0] = 'Coordinates';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['coordinates'][1] = 'Coordinates of the marker as comma separated value (Latitude, longitude [, altitude]).';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['tooltip'][0] = 'Tooltip';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['tooltip'][1] = 'Marker tooltip rendered as title attribute.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['alt'][0] = 'Alternative text';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['alt'][1] = 'Text for the alt attribute of the icon image (useful for accessibility).';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['addPopup'][0] = 'Add popup';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['addPopup'][1] = 'Add a popup for the marker';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['popupContent'][0] = 'Popup content';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['popupContent'][1] = 'Content of the popup. Insert tags are replaced.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['clickable'][0] = 'Clickable';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['clickable'][1] = 'If deactivated, the marker will not emit mouse events and will act as a part of the underlying map.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['draggable'][0] = 'Draggable';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['draggable'][1] = 'Whether the marker is draggable with mouse/touch or not.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['keyboard'][0] = 'Keyboard navigation';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['keyboard'][1] = 'Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['zIndexOffset'][0] = 'ZIndex offset';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['zIndexOffset'][1] = 'By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['customIcon'][0] = 'Custom icon';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['customIcon'][1] = 'Use a custom icon.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'][0] = 'Icon';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'][1] = 'Select a custom icon.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['active'][0] = 'Activate marker';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['active'][1] = 'Only activated markers are rendered on the map.';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['ignoreForBounds'][0] = 'Ignore for bounds';
+$GLOBALS['TL_LANG']['tl_leaflet_marker']['ignoreForBounds'][1] = 'Do not include this item in the bounds calculation.';
diff --git a/module/languages/en/tl_leaflet_vector.php b/module/languages/en/tl_leaflet_vector.php
index 4c86141..a2269ec 100644
--- a/module/languages/en/tl_leaflet_vector.php
+++ b/module/languages/en/tl_leaflet_vector.php
@@ -6,52 +6,52 @@ $GLOBALS['TL_LANG']['tl_leaflet_vector']['config_legend'] = 'Configuration';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['data_legend'] = 'Vector data';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['popup_legend'] = 'Popup';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['new'][0] = 'Create vector';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['new'][1] = 'Create new vector';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['edit'][0] = 'Edit vector';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['edit'][1] = 'Edit vector ID %s';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['copy'][0] = 'Copy vector';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['copy'][1] = 'Copy vector ID %s';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'][0] = 'Delete vector';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'][1] = 'Delete vector ID %s';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['show'][0] = 'Show details';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['show'][1] = 'Show vector ID %s details';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['cut'][0] = 'Move vector';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['cut'][1] = 'Move vector ID %s';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'][0] = 'Toggle activation';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'][1] = 'Toggle vector ID %s activation';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['styles'][0] = 'Manage styles';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['styles'][1] = 'Manage vector styles';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['new'][0] = 'Create vector';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['new'][1] = 'Create new vector';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['edit'][0] = 'Edit vector';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['edit'][1] = 'Edit vector ID %s';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['copy'][0] = 'Copy vector';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['copy'][1] = 'Copy vector ID %s';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'][0] = 'Delete vector';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'][1] = 'Delete vector ID %s';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['show'][0] = 'Show details';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['show'][1] = 'Show vector ID %s details';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['cut'][0] = 'Move vector';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['cut'][1] = 'Move vector ID %s';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'][0] = 'Toggle activation';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'][1] = 'Toggle vector ID %s activation';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['styles'][0] = 'Manage styles';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['styles'][1] = 'Manage vector styles';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['title'][0] = 'Title';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['title'][1] = 'Title of the vector.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['alias'][0] = 'Alias';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['alias'][1] = 'Alias of the vector.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'][0] = 'Type';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'][1] = 'Choose the vector type.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'][0] = 'Type';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'][1] = 'Choose the vector type.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['data'][0] = 'Vector data';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['data'][1] = 'Define each coordinate of the vector on a line. Each line is a comma separated value (latitude, longitude [, altitude]).';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['multiData'][0] = 'Multi data';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['multiData'][1] = 'Define coordinates of each vector in a new textarea.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['addPopup'][0] = 'Add popup';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['addPopup'][1] = 'Add a popup to the vector.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['popupContent'][0] = 'Popup content';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['popupContent'][1] = 'Content of the popup. Insert tags are replaced.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['clickable'][0] = 'Clickable';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['clickable'][1] = 'If deactivated, the vector will not emit mouse events and will act as a part of the underlying map.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['active'][0] = 'Activate vector';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['active'][1] = 'Only activated vector are rendered on the map.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['className'][0] = 'Class name';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['className'][1] = 'Custom class name set on an element.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['coordinates'][0] = 'Coordinates';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['coordinates'][1] = 'Coordinates of the vector as comma separated value (Latitude, longitude [, altitude]).';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['radius'][0] = 'Radius';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['radius'][1] = 'Radius of the element. For a circle its defined in meters, for a circle marker in pixels.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['bounds'][0] = 'Bounds';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['bounds'][1] = 'Each field defines a corner of the bounds as comma separated value (Latitude, longitude [, altitude]).';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['style'][0] = 'Style';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['style'][1] = 'Choose a style. If none defined, the default style of leaflet is used.';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['affectBounds'][0] = 'Affect map bounds';
-$GLOBALS['TL_LANG']['tl_leaflet_vector']['affectBounds'][1] = 'If the map support it the vector will affect the initial map bounds.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['title'][0] = 'Title';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['title'][1] = 'Title of the vector.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['alias'][0] = 'Alias';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['alias'][1] = 'Alias of the vector.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'][0] = 'Type';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'][1] = 'Choose the vector type.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'][0] = 'Type';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'][1] = 'Choose the vector type.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['data'][0] = 'Vector data';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['data'][1] = 'Define each coordinate of the vector on a line. Each line is a comma separated value (latitude, longitude [, altitude]).';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['multiData'][0] = 'Multi data';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['multiData'][1] = 'Define coordinates of each vector in a new textarea.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['addPopup'][0] = 'Add popup';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['addPopup'][1] = 'Add a popup to the vector.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['popupContent'][0] = 'Popup content';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['popupContent'][1] = 'Content of the popup. Insert tags are replaced.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['clickable'][0] = 'Clickable';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['clickable'][1] = 'If deactivated, the vector will not emit mouse events and will act as a part of the underlying map.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['active'][0] = 'Activate vector';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['active'][1] = 'Only activated vector are rendered on the map.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['className'][0] = 'Class name';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['className'][1] = 'Custom class name set on an element.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['coordinates'][0] = 'Coordinates';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['coordinates'][1] = 'Coordinates of the vector as comma separated value (Latitude, longitude [, altitude]).';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['radius'][0] = 'Radius';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['radius'][1] = 'Radius of the element. For a circle its defined in meters, for a circle marker in pixels.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['bounds'][0] = 'Bounds';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['bounds'][1] = 'Each field defines a corner of the bounds as comma separated value (Latitude, longitude [, altitude]).';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['style'][0] = 'Style';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['style'][1] = 'Choose a style. If none defined, the default style of leaflet is used.';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['ignoreForBounds'][0] = 'Ignore for bounds';
+$GLOBALS['TL_LANG']['tl_leaflet_vector']['ignoreForBounds'][1] = 'Do not include this item in the bounds calculation.';
diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkerClusterLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkerClusterLayerMapper.php
index 480a529..660a027 100644
--- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkerClusterLayerMapper.php
+++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkerClusterLayerMapper.php
@@ -87,6 +87,8 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
$GLOBALS['TL_CSS'][] = 'assets/leaflet/libs/leaflet-markercluster/MarkerCluster.Default.css||static';
}
+ $definition->setOption('affectBounds', (bool) $model->affectBounds);
+
$collection = LayerModel::findBy(
array('pid=?', 'active=1'),
array($model->id),
diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php
index 0929dd2..19632cf 100644
--- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php
+++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php
@@ -66,9 +66,10 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
) {
if ($model->deferred) {
- if ($model->pointToLayer) {
+ if ($model->pointToLayer || $model->affectBounds) {
$layer = new GeoJson($this->getElementId($model, $elementId));
$layer->setPointToLayer(new Expression($model->pointToLayer));
+ $layer->setOption('affectBounds', (bool) $model->affectBounds);
return array($this->getElementId($model, $elementId), RequestUrl::create($model->id), array(), $layer);
}
@@ -89,6 +90,8 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
LatLngBounds $bounds = null,
Definition $parent = null
) {
+ $definition->setOption('affectBounds', (bool) $model->affectBounds);
+
if ($definition instanceof GeoJson) {
$collection = $this->loadMarkerModels($model);
@@ -98,7 +101,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
if ($marker instanceof Marker) {
$feature = $marker->toGeoJsonFeature();
- $feature->setProperty('affectBounds', ($item->affectBounds));
+ $feature->setProperty('ignoreForBounds', ($item->ignoreForBounds));
$definition->addData($feature, true);
}
diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php
index e431647..0be6844 100644
--- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php
+++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php
@@ -80,6 +80,10 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
$options['onEachFeature'] = new Expression($model->onEachFeature);
}
+ if ($model->affectBounds) {
+ $options['affectBounds'] = (bool) $model->affectBounds;
+ }
+
if (!empty($options)) {
$layer = new GeoJson($this->getElementId($model, $elementId));
$layer->setOptions($options);
@@ -105,6 +109,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
) {
if ($definition instanceof GeoJson) {
$collection = $this->loadVectorModels($model);
+ $definition->setOption('affectBounds', (bool) $model->affectBounds);
if ($collection) {
foreach ($collection as $item) {
@@ -114,7 +119,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
$feature = $vector->toGeoJsonFeature();
if ($feature instanceof Feature) {
- $feature->setProperty('affectBounds', (bool) $item->affectBounds);
+ $feature->setProperty('ignoreForBounds', (bool) $item->ignoreForBounds);
}
$definition->addData($feature, true);
@@ -150,7 +155,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
if ($vector instanceof GeoJsonFeature) {
if ($vector instanceof Feature) {
- $vector->setProperty('affectBounds', (bool) $item->affectBounds);
+ $vector->setProperty('ignoreForBounds', (bool) $item->ignoreForBounds);
}
$feature->addFeature($vector);