Skip to content

Commit

Permalink
Use processedFile over origFile on local marker icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Bigga committed Apr 4, 2021
1 parent dad33de commit 81d634d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
18 changes: 11 additions & 7 deletions Classes/Controller/PluginController.php
Expand Up @@ -474,17 +474,18 @@ function getMap()
continue;
}
$item['tx_odsosm_marker'] = $icons[$item['tx_odsosm_marker']];
$item['tx_odsosm_marker']['icon'] = $file->getPublicUrl();
$item['tx_odsosm_marker']['icon'] = $file;
$item['tx_odsosm_marker']['type'] = 'image';
$item['tx_odsosm_marker']['size_x'] = '60';
$item['tx_odsosm_marker']['size_y'] = '60';
} elseif ($icon) {
if ($this->config['icon.'][$table] == 'IMAGE') {
// dummy rendering is necessary to have image information in $GLOBALS['TSFE']->lastImageInfo
$imageDummy = $local_cObj->cObjGetSingle($this->config['icon.'][$table], $this->config['icon.'][$table . '.']);
// rendering is necessary to have image information in $GLOBALS['TSFE']->lastImageInfo
$imageDummy = $local_cObj->cObjGetSingle(
$this->config['icon.'][$table],
$this->config['icon.'][$table . '.']
);
$info = $GLOBALS['TSFE']->lastImageInfo;
$item['tx_odsosm_marker'] = array(
'icon' => $info['origFile'],
'icon' => $info['processedFile'],
'type' => 'image',
'size_x' => $info[0],
'size_y' => $info[1],
Expand All @@ -493,7 +494,10 @@ function getMap()
);
} elseif ($this->config['icon.'][$table] == 'TEXT') {
$conf = $this->config['icon.'][$table . '.'];
$html = $local_cObj->cObjGetSingle($this->config['icon.'][$table], $this->config['icon.'][$table . '.']);
$html = $local_cObj->cObjGetSingle(
$this->config['icon.'][$table],
$this->config['icon.'][$table . '.']
);
$item['tx_odsosm_marker'] = array(
'icon' => $html,
'type' => 'html',
Expand Down
7 changes: 3 additions & 4 deletions Classes/Provider/Leaflet.php
Expand Up @@ -153,10 +153,10 @@ protected function getMarker($item, $table)
{
$jsMarker = '';
$jsElementVar = $table . '_' . $item['uid'];
$fileRepository = GeneralUtility::makeInstance(FileRepository::class);

switch ($table) {
case 'tx_odsosm_track':
$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
$fileObjects = $fileRepository->findByRelation('tx_odsosm_track', 'file', $item['uid']);
if ($fileObjects) {
$file = $fileObjects[0];
Expand Down Expand Up @@ -209,7 +209,6 @@ protected function getMarker($item, $table)
$jsMarker .= 'var myStyle = {};';
}

$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
$fileObjects = $fileRepository->findByRelation('tx_odsosm_vector', 'file', $item['uid']);
if ($fileObjects) {
$file = $fileObjects[0];
Expand Down Expand Up @@ -250,7 +249,7 @@ protected function getMarker($item, $table)
$iconOptions['html'] = $marker['icon'];
$markerOptions['icon'] = 'icon: new L.divIcon(' . json_encode($iconOptions) . ')';
} else {
$icon = $GLOBALS['TSFE']->absRefPrefix . $marker['icon'];
$icon = $GLOBALS['TSFE']->absRefPrefix . $marker['icon']->getPublicUrl();
$iconOptions['iconUrl'] = $icon;
$markerOptions['icon'] = 'icon: new L.Icon(' . json_encode($iconOptions) . ')';
}
Expand All @@ -260,7 +259,7 @@ protected function getMarker($item, $table)
$jsMarker .= 'var ' . $jsElementVar . ' = new L.Marker([' . $item['latitude'] . ', ' . $item['longitude'] . '], {' . implode(',', $markerOptions) . "});\n";
// Add group to layer switch
if ($item['group_title']) {
$this->layers[1][($marker['type'] == 'html' ? $marker['icon'] : '<img src="' . $icon . '" />') . ' ' . $item['group_title']] = $item['group_uid'];
$this->layers[1][($marker['type'] == 'html' ? $marker['icon'] : '<img class="marker-icon" style="max-width: 60px;" src="' . $icon . '" />') . ' ' . $item['group_title']] = $item['group_uid'];
$this->layers[2][$item['group_uid']][] = $jsElementVar;
} else {
$this->layers[2][$this->config['id'] . '_g'][] = $jsElementVar;
Expand Down
4 changes: 2 additions & 2 deletions Documentation/Administrators/Index.rst
Expand Up @@ -7,7 +7,7 @@ In the extension configuration

+----------------------------+------------------------------------------------+-------------+
| Option | Description | Default |
+----------------------------+------------------------------------------------+-------------+
+============================+================================================+=============+
| Autocomplete longitude | You can enable to search the coordinates on | 1: If no |
| and latitude | geonames.org when saving an fe_users or | coordinates |
| | tt_address element. | are set |
Expand Down Expand Up @@ -44,7 +44,7 @@ Reference

+-----------------+-----------+-------------------------------------+---------+
| Property | Data type | Description | Default |
+-----------------+-----------+-------------------------------------+---------+
+=================+===========+=====================================+=========+
| cluster | boolean | Cluster marker at lower map zoom. | 0 |
+-----------------+-----------+-------------------------------------+---------+
| cluster_radius | integer | Cluster marker in given radius. | 80 |
Expand Down

0 comments on commit 81d634d

Please sign in to comment.