foci act centers on selected spot on-edit

0c49bca · gmorell · 2022-09-16 04:03

5 files +7 -1

Files changed

modified apps/room_sanctum/assets/js/app.js
+7 −1
@@ -44,7 +44,13 @@ Hooks.MapPush = {
44 44 Hooks.mkMap = {
45 45 mounted() {
46 46 const markers = {}
47 − var map = L.map('map', {keyboard: true}).setView([42.3736, -71.1097], 13);
47 + latlng = document.getElementById('map').getAttribute('data-latlng')
48 + if (latlng != null) {
49 + coords = JSON.parse(latlng)
50 + } else {
51 + coords = [42.3736, -71.1097]
52 + }
53 + var map = L.map('map', {keyboard: true}).setView(coords, 13);
48 54
49 55 const view = this;
50 56 var marker = L.centerMarker(map).on("newposition", function() {

Parents: 447d834