mirror of https://github.com/4xmen/xshop.git
optimized ui/ux of menus and customer
parent
9332f1e9d2
commit
e9402cac80
@ -1,33 +1,37 @@
|
|||||||
import L from 'leaflet';
|
import L from 'leaflet';
|
||||||
|
|
||||||
var map,marker ;
|
var map, marker;
|
||||||
window.addEventListener('load',function () {
|
window.addEventListener('load', function () {
|
||||||
|
try {
|
||||||
|
|
||||||
// delete L.icon.default.prototype._getIconUrl ;
|
// delete L.icon.default.prototype._getIconUrl ;
|
||||||
if (!import.meta.env.DEV){
|
if (!import.meta.env.DEV) {
|
||||||
L.Icon.Default.mergeOptions({
|
L.Icon.Default.mergeOptions({
|
||||||
iconRetinaUrl: "/assets/vendor/leaflet/marker-icon-2x.png",
|
iconRetinaUrl: "/assets/vendor/leaflet/marker-icon-2x.png",
|
||||||
iconUrl: "/assets/vendor/leaflet/marker-icon.png",
|
iconUrl: "/assets/vendor/leaflet/marker-icon.png",
|
||||||
shadowUrl: "/assets/vendor/leaflet/marker-shadow.png"
|
shadowUrl: "/assets/vendor/leaflet/marker-shadow.png"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (document.querySelectorAll('#mapContainer').length != 0) {
|
if (document.querySelectorAll('#mapContainer').length != 0) {
|
||||||
const lat = parseFloat(document.querySelector('#maplat').value);
|
const lat = parseFloat(document.querySelector('#maplat').value);
|
||||||
const lng = parseFloat(document.querySelector('#maplng').value);
|
const lng = parseFloat(document.querySelector('#maplng').value);
|
||||||
const zoom = parseInt(document.querySelector('#mapzoom').value);
|
const zoom = parseInt(document.querySelector('#mapzoom').value);
|
||||||
map = L.map(document.querySelector('#mapContainer')).setView([lat, lng], zoom);
|
map = L.map(document.querySelector('#mapContainer')).setView([lat, lng], zoom);
|
||||||
|
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
attribution: '© openstreetmap',
|
attribution: '© openstreetmap',
|
||||||
attributionControl: false,
|
attributionControl: false,
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
map.attributionControl.setPrefix('xShop');
|
map.attributionControl.setPrefix('xShop');
|
||||||
|
|
||||||
if (this.marker) {
|
if (this.marker) {
|
||||||
map.removeLayer(marker);
|
map.removeLayer(marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
marker = L.marker({lat: lat, lng: lng}).addTo(map);
|
marker = L.marker({lat: lat, lng: lng}).addTo(map);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue