Skip to content

Commit

Permalink
Merge branch 'duskohu-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Olicek committed Jan 18, 2016
2 parents 875358f + d830b45 commit 93eba8e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
3 changes: 2 additions & 1 deletion client-side/googleMapAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ GoogleMap.prototype = {
this.options.key = properties.key;
this.options.bound = properties.bound;
this.options.cluster = properties.cluster;
this.options.clusterOptions = properties.clusterOptions;
this.options.waypoints = properties.waypoint;
this.basePath = this.element.dataset.basepath;
this.URL = this.element.dataset.markersfallback;
Expand Down Expand Up @@ -198,7 +199,7 @@ GoogleMap.prototype = {
if (base.options.cluster)
{
if (typeof MarkerClusterer != 'undefined') {
new MarkerClusterer(base.map, base.markersCluster);
new MarkerClusterer(base.map, base.markersCluster, base.options.clusterOptions);
} else
{
throw 'MarkerClusterer is not loaded! Please use markerclusterer.js from client-side folder';
Expand Down
14 changes: 12 additions & 2 deletions src/MapAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class MapAPI extends Control
/** @var boolean */
private $markerClusterer;

/** @var array */
private $clusterOptions;

/** @var boolean */
private $scrollable = FALSE;

Expand All @@ -70,8 +73,13 @@ class MapAPI extends Control
* @var array
*/
private $direction = ['travelmode' => 'DRIVING'];




public function __construct()
{
parent::__construct();
}

/**
* @internal
* @param array $config
Expand Down Expand Up @@ -316,6 +324,7 @@ public function addMarkers(Markers $markers)
$this->markers = $markers->getMarkers();
$this->bound = $markers->getBound();
$this->markerClusterer = $markers->getMarkerClusterer();
$this->clusterOptions = $markers->getClusterOptions();
return $this;
}

Expand Down Expand Up @@ -355,6 +364,7 @@ public function render()
'key' => $this->key,
'bound' => $this->bound,
'cluster' => $this->markerClusterer,
'clusterOptions' => $this->clusterOptions,
'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL
);
$this->template->map = \Nette\Utils\Json::encode($map);
Expand Down
22 changes: 21 additions & 1 deletion src/Markers.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class Markers extends \Nette\Object
/** @var Boolean */
private $markerClusterer = FALSE;

private $clusterOptions = array();


/**
* @internal
Expand Down Expand Up @@ -140,8 +142,26 @@ public function getMarkerClusterer()
{
return $this->markerClusterer;
}



/**
* @param array $options
* @return \Oli\GoogleAPI\Markers
*/
public function setClusterOptions($options = array())
{
$this->clusterOptions = $options;
return $this;
}


/**
* @return array
*/
public function getClusterOptions()
{
return $this->clusterOptions;
}

/**
* @param Boolean $bound Show all of markers
Expand Down

0 comments on commit 93eba8e

Please sign in to comment.