diff options
| -rw-r--r-- | app/Services/LeafletJsService.php | 1 | ||||
| -rw-r--r-- | resources/js/webtrees.js | 21 | ||||
| -rw-r--r-- | resources/views/icons/reset.phtml | 1 |
3 files changed, 12 insertions, 11 deletions
diff --git a/app/Services/LeafletJsService.php b/app/Services/LeafletJsService.php index 097aa45571..293c289367 100644 --- a/app/Services/LeafletJsService.php +++ b/app/Services/LeafletJsService.php @@ -81,6 +81,7 @@ class LeafletJsService 'icons' => [ 'collapse' => view('icons/collapse'), 'expand' => view('icons/expand'), + 'reset' => view('icons/reset'), ], 'mapProviders' => $map_providers, ]; diff --git a/resources/js/webtrees.js b/resources/js/webtrees.js index b7f2309bca..22f3debdba 100644 --- a/resources/js/webtrees.js +++ b/resources/js/webtrees.js @@ -685,18 +685,17 @@ options: { position: 'topleft', }, - onAdd: function (map) { - let container = L.DomUtil.create('div', 'leaflet-bar leaflet-control leaflet-control-custom'); + onAdd: (map) => { + const container = L.DomUtil.create('div', 'leaflet-bar leaflet-control leaflet-control-custom'); + const anchor = L.DomUtil.create('a', 'leaflet-control-reset', container); + + anchor.setAttribute('aria-label', config.i18n.reset); + anchor.setAttribute('title', config.i18n.reset); + anchor.setAttribute('aria-disabled', 'false'); + anchor.setAttribute('role', 'button'); + anchor.innerHTML = config.icons.reset; + container.onclick = resetCallback; - let reset = config.i18n.reset; - let anchor = L.DomUtil.create('a', 'leaflet-control-reset', container); - anchor.setAttribute('aria-label', reset); - anchor.href = '#'; - anchor.title = reset; - anchor.role = 'button'; - L.DomEvent.addListener(anchor, 'click', L.DomEvent.preventDefault); - let image = L.DomUtil.create('i', 'fas fa-redo', anchor); - image.alt = reset; return container; }, diff --git a/resources/views/icons/reset.phtml b/resources/views/icons/reset.phtml new file mode 100644 index 0000000000..bc6731109f --- /dev/null +++ b/resources/views/icons/reset.phtml @@ -0,0 +1 @@ +<span class="wt-icon-reset"><i class="fas fa-redo fa-fw" aria-hidden="true"></i></span><?php |
