diff --git a/assets/maps/contao-leaflet.js b/assets/maps/contao-leaflet.js
index a9bf4c5..fd25c46 100644
--- a/assets/maps/contao-leaflet.js
+++ b/assets/maps/contao-leaflet.js
@@ -1 +1 @@
-L.Contao=L.Class.extend({includes:L.Mixin.Events,statics:{ATTRIBUTION:' | netzmacht'},maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images/",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,e){return 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;enetzmacht'},maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images/",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,o){return this.maps[t]=o,this.fire("map:added",{id:t,map:o}),this},getMap:function(t){return"undefined"==typeof this.maps[t]?null:this.maps[t]},addIcon:function(t,o){return this.icons[t]=o,this.fire("icon:added",{id:t,icon:o}),this},loadIcons:function(t){for(var o=0;o array(
'default' => array(
'title' => array('title', 'alias'),
- 'zoom' => array('center', 'zoom', 'adjustZoomExtra', 'adjustBounds', 'dynamicLoad'),
+ 'zoom' => array('center', 'zoom', 'adjustZoomExtra', 'adjustBounds', 'dynamicLoad', 'boundsPadding'),
'locate' => array('locate'),
'layers' => array('layers'),
'interaction' => array(
@@ -479,9 +479,22 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'exclude' => true,
'inputType' => 'checkbox',
'default' => false,
- 'eval' => array('tl_class' => 'w50', 'submitOnChange' => false),
+ 'eval' => array('tl_class' => 'clr w50', 'submitOnChange' => false),
'sql' => "char(1) NOT NULL default ''"
),
+ 'boundsPadding' => array
+ (
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['boundsPadding'],
+ 'exclude' => true,
+ 'inputType' => 'text',
+ 'eval' => array(
+ 'maxlength' => 32,
+ 'tl_class' => 'w50',
+ 'includeBlankOption' => true,
+ 'nullIfEmpty' => true
+ ),
+ 'sql' => "varchar(32) NULL"
+ ),
'locate' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['locate'],
diff --git a/module/languages/en/tl_leaflet_map.php b/module/languages/en/tl_leaflet_map.php
index 716736c..d5f5721 100644
--- a/module/languages/en/tl_leaflet_map.php
+++ b/module/languages/en/tl_leaflet_map.php
@@ -87,6 +87,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_map']['locateMaximumAge'][0] = 'Locate maximu
$GLOBALS['TL_LANG']['tl_leaflet_map']['locateMaximumAge'][1] = 'Maximum age of detected location in milliseconds. Use cached value if time has not passed.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['dynamicLoad'][0] = 'Load data dynamically in bounds';
$GLOBALS['TL_LANG']['tl_leaflet_map']['dynamicLoad'][1] = 'If enabled the map requests data from the layers for the current bounds only and make a new request if bounds has changed.';
+$GLOBALS['TL_LANG']['tl_leaflet_map']['boundsPadding'][0] = 'Bounds padding';
+$GLOBALS['TL_LANG']['tl_leaflet_map']['boundsPadding'][1] = 'Padding being used then applying bounds. Use comma separated values. If 2 values are given the padding option is set. If 4 values are given paddingTopLeft and paddingBottomRight is set.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['cache'][0] = 'Enable cache';
$GLOBALS['TL_LANG']['tl_leaflet_map']['cache'][1] = 'If enabled the generated map javascript is cached.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['cacheLifeTime'][0] = 'Cache lifetime';
diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php
index 20feb7e..1fa132e 100644
--- a/src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php
+++ b/src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php
@@ -180,6 +180,17 @@ class MapMapper extends AbstractMapper
$map->setOption('adjustBounds', true);
}
+ if ($model->boundsPadding) {
+ $value = array_map('intval', explode(',', $model->boundsPadding, 4));
+
+ if (count($value) === 4) {
+ $map->setOption('boundsPaddingTopLeft', [$value[0], $value[1]]);
+ $map->setOption('boundsPaddingBottomRight', [$value[2], $value[3]]);
+ } elseif (count($value) === 2) {
+ $map->setOption('boundsPadding', $value);
+ }
+ }
+
if (in_array('load', $adjustBounds)) {
$map->calculateFeatureBounds();
}