Add fullscreen control.

This commit is contained in:
David Molineus
2015-01-20 17:36:19 +01:00
parent 0c1df3b6d9
commit 8ddfdc753b
5 changed files with 129 additions and 52 deletions

View File

@@ -99,6 +99,7 @@ $GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\ScaleCo
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\LayersControlMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\AttributionControlMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\LoadingControlMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\FullscreenControlMapper';
// Vector mappers.
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Vector\PolylineMapper';
@@ -216,7 +217,7 @@ $GLOBALS['LEAFLET_LAYERS'] = array
*
* Supported leaflet control types. Register your type for the database driven definition here.
*/
$GLOBALS['LEAFLET_CONTROLS'] = array('zoom', 'layers', 'scale', 'attribution', 'loading');
$GLOBALS['LEAFLET_CONTROLS'] = array('zoom', 'layers', 'scale', 'attribution', 'loading', 'fullscreen');
/*

View File

@@ -119,7 +119,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
),
'loading extends default' => array(
'config' => array('separate', 'zoomControl', 'spinjs')
)
),
'fullscreen extends default' => array(
'config' => array('buttonTitle', 'separate', 'simulateFullScreen')
),
),
'metasubpalettes' => array(
@@ -399,5 +402,21 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
),
'sql' => "mediumtext NULL"
),
'simulateFullScreen' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['simulateFullScreen'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50 m12'),
'sql' => "char(1) NOT NULL default ''"
),
'buttonTitle' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['buttonTitle'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
),
);

View File

@@ -10,6 +10,8 @@ $GLOBALS['TL_LANG']['leaflet_control']['scale'][0] = 'Scale control';
$GLOBALS['TL_LANG']['leaflet_control']['scale'][1] = 'A simple scale control that shows the scale of the current center of the screen. For more details read the <a href="http://leafletjs.com/reference.html#control-scale" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_control']['loading'][0] = 'Loading indicator';
$GLOBALS['TL_LANG']['leaflet_control']['loading'][1] = 'Leaflet.loading is a simple loading indicator implemented as control. For more details read the <a href="https://github.com/ebrelsford/Leaflet.loading" target="_blank">Plugin documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_control']['fullscreen'][0] = 'Fullscreen control';
$GLOBALS['TL_LANG']['leaflet_control']['fullscreen'][1] = 'Add a fullscreen toggle button. For more details read the <a href="https://github.com/brunob/leaflet.fullscreen" target="_blank">Plugin documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_layer']['provider'][0] = 'Leaflet provider';
$GLOBALS['TL_LANG']['leaflet_layer']['provider'][1] = 'Leaflet tile provider. For more details read the <a href="https://github.com/leaflet-extras/leaflet-providers" target="_blank">plugin documentation</a>.';

View File

@@ -69,6 +69,12 @@ $GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl'][0] = 'Zoom control';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl'][1] = 'Assign loading control to a specific zoom control. If it\'s not used on the map/activated the default one is used.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['layerMode'][0] = 'Mode';
$GLOBALS['TL_LANG']['tl_leaflet_control']['layerMode'][1] = 'Add layer as baselayer or overlay.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['layerMode'][0] = 'Mode';
$GLOBALS['TL_LANG']['tl_leaflet_control']['layerMode'][1] = 'Add layer as baselayer or overlay.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['buttonTitle'][0] = 'Button title';
$GLOBALS['TL_LANG']['tl_leaflet_control']['buttonTitle'][1] = 'Title attribute of the control button.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['simulateFullScreen'][0] = 'Always simulate fullscreen';
$GLOBALS['TL_LANG']['tl_leaflet_control']['simulateFullScreen'][1] = 'Simulate fullscreen no matter if the browser supports the Fullscreen API.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['bottomleft'][0] = 'Bottom left';
$GLOBALS['TL_LANG']['tl_leaflet_control']['bottomleft'][1] = 'Bottom left of the map.';

View File

@@ -0,0 +1,49 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Mapper\Control;
use Netzmacht\LeafletPHP\Definition;
/**
* Class FullscreenControlMapper.
*
* @package Netzmacht\Contao\Leaflet\Mapper\Control
*/
class FullscreenControlMapper extends AbstractControlMapper
{
/**
* Class of the definition being created.
*
* @var string
*/
protected static $definitionClass = 'Netzmacht\LeafletPHP\Plugins\FullScreen\FullScreenControl';
/**
* Layer type.
*
* @var string
*/
protected static $type = 'fullscreen';
/**
* {@inheritdoc}
*/
protected function initialize()
{
parent::initialize();
$this
->addOption('forceSeparateButton', 'separate')
->addConditionalOption('title', 'title', 'buttonTitle')
->addOption('forcePseudoFullScreen', 'simulateFullScreen');
}
}