Implement boundsMode fit.

This commit is contained in:
David Molineus
2015-01-27 00:02:17 +01:00
parent 37b10c14fe
commit e2eceab60e
20 changed files with 388 additions and 72 deletions

View File

@@ -171,6 +171,10 @@ $GLOBALS['LEAFLET_LAYERS'] = array
'children' => false,
'icon' => 'system/modules/leaflet/assets/img/markers.png',
'markers' => true,
'boundsMode' => array(
'extend' => true,
'fit' => 'deferred'
),
'label' => function ($row, $label) {
$count = \Netzmacht\Contao\Leaflet\Model\MarkerModel::countBy('pid', $row['id']);
$label .= sprintf(
@@ -187,6 +191,9 @@ $GLOBALS['LEAFLET_LAYERS'] = array
'children' => false,
'icon' => 'system/modules/leaflet/assets/img/vectors.png',
'vectors' => true,
'boundsMode' => array(
'extend' => true,
),
'label' => function ($row, $label) {
$count = \Netzmacht\Contao\Leaflet\Model\VectorModel::countBy('pid', $row['id']);
$label .= sprintf(
@@ -307,3 +314,10 @@ $GLOBALS['LEAFLET_FEATURE_MODEL_PROPERTIES']['tl_leaflet_marker'][] = 'alias';
$GLOBALS['LEAFLET_FEATURE_MODEL_PROPERTIES']['tl_leaflet_vector'][] = 'id';
$GLOBALS['LEAFLET_FEATURE_MODEL_PROPERTIES']['tl_leaflet_vector'][] = 'title';
$GLOBALS['LEAFLET_FEATURE_MODEL_PROPERTIES']['tl_leaflet_vector'][] = 'alias';
/*
* Filters can be passed to a data request to get only specific data from a layer.
*/
$GLOBALS['LEAFLET_FILTERS']['bbox'] = 'Netzmacht\Contao\Leaflet\Filter\BboxFilter';
$GLOBALS['LEAFLET_FILTERS']['distance'] = 'Netzmacht\Contao\Leaflet\Filter\DistanceFilter';

View File

@@ -148,15 +148,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
),
'markers extends default' => array(
'+expert' => array('pointToLayer'),
'+active' => array('deferred', 'affectBounds')
'+config' => array('deferred', 'boundsMode')
),
'group extends default' => array(
'+title' => array('groupType'),
'+active' => array('affectBounds')
'+active' => array('boundsMode')
),
'vectors extends default' => array(
'+expert' => array('onEachFeature', 'pointToLayer'),
'+active' => array('deferred', 'affectBounds'),
'+config' => array('deferred', 'boundsMode'),
),
'reference extends default' => array(
'+title' => array('reference', 'standalone')
@@ -335,7 +335,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'exclude' => true,
'inputType' => 'checkbox',
'default' => true,
'eval' => array('tl_class' => 'w50', 'submitOnChange' => false, 'isBoolean' => true),
'eval' => array('tl_class' => 'w50 m12', 'submitOnChange' => true, 'isBoolean' => true),
'sql' => "char(1) NOT NULL default '1'"
),
'groupType' => array
@@ -530,14 +530,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
'boundsMode' => 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 ''"
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['boundsMode'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getBoundsModes'),
'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true),
'sql' => "varchar(6) NOT NULL default ''"
),
'tileUrl' => array
(

View File

@@ -94,7 +94,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'metapalettes' => array(
'default' => array(
'title' => array('title', 'alias'),
'zoom' => array('center', 'zoom', 'adjustZoomExtra', 'adjustBounds'),
'zoom' => array('center', 'zoom', 'adjustZoomExtra', 'adjustBounds', 'dynamicLoad'),
'locate' => array('locate'),
'layers' => array('layers'),
'interaction' => array(
@@ -419,6 +419,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'eval' => array('tl_class' => 'clr w50', 'multiple' => true, 'helpwizard' => true),
'sql' => "varchar(255) NOT NULL default ''"
),
'dynamicLoad' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['dynamicLoad'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => true,
'eval' => array('tl_class' => 'w50', 'submitOnChange' => false),
'sql' => "char(1) NOT NULL default ''"
),
'locate' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['locate'],

View File

@@ -176,18 +176,44 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate'),
array('Netzmacht\Contao\Leaflet\Dca\Marker', 'saveCoordinates')
),
'wizard' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getGeocoder')
),
'eval' => array(
'maxlength' => 255,
'tl_class' => 'long clr',
'nullIfEmpty' => true,
'maxlength' => 255,
'tl_class' => 'long clr',
'nullIfEmpty' => true,
'doNotSaveEmpty' => true,
),
'sql' => "varchar(255) NULL"
),
'latitude' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['latitude'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "float NULL"
),
'longitude' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['longitude'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "float NULL"
),
'altitude' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['altitude'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "float NULL"
),
'active' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['active'],

View File

@@ -76,8 +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']['boundsMode'][0] = 'Bounds relation';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['boundsMode'][1] = 'Choose a mode how the layer data should affect the map bounds.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['minZoom'][0] = 'Minimum zoom';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['minZoom'][1] = 'Minimum zoom number.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['maxZoom'][0] = 'Maximum zoom';