Browse Source

fixed map centering

main
Marco Colia 2 years ago
parent
commit
2b62c5532d
  1. 2
      js/dist/forum.js
  2. 2
      js/dist/forum.js.map
  3. 7
      js/src/forum/index.js

2
js/dist/forum.js vendored

File diff suppressed because one or more lines are too long

2
js/dist/forum.js.map vendored

File diff suppressed because one or more lines are too long

7
js/src/forum/index.js

@ -46,6 +46,7 @@ app.initializers.add('justoverclock/users-map-location', () => {
}); });
let map2 = L.map('map2').setView([this.latitude, this.longitude], 13); let map2 = L.map('map2').setView([this.latitude, this.longitude], 13);
let marker = L.marker([this.latitude, this.longitude], { icon: markerIcon }).addTo(map2)/*.bindPopup('A pretty CSS3 popup.<br> Easily customizable.').openPopup();*/
let layerUserCard = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { let layerUserCard = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: attribution:
'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>, Developed by <a href="https://flarum.it/">Marco Colia</a>', 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>, Developed by <a href="https://flarum.it/">Marco Colia</a>',
@ -56,6 +57,10 @@ app.initializers.add('justoverclock/users-map-location', () => {
zoomOffset: -1, zoomOffset: -1,
accessToken: publicToken, accessToken: publicToken,
}).addTo(map2); }).addTo(map2);
setTimeout(() => {
map2.invalidateSize()
},800)
}); });
}); });
extend(SettingsPage.prototype, 'oncreate', function () { extend(SettingsPage.prototype, 'oncreate', function () {
@ -86,7 +91,7 @@ app.initializers.add('justoverclock/users-map-location', () => {
}); });
let map = L.map('map').setView([this.latitude, this.longitude], 13); let map = L.map('map').setView([this.latitude, this.longitude], 13);
let marker = L.marker([this.latitude, this.longitude], { icon: markerIcon }).addTo(map); let marker = L.marker([this.latitude, this.longitude], { icon: markerIcon }).addTo(map)
let layer = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { let layer = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: attribution:
'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' + 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +

Loading…
Cancel
Save