huge Laravel 10 upgrade

This commit is contained in:
HolgerHatGarKeineNode
2023-02-19 20:13:20 +01:00
parent 5c74f77beb
commit 12847f95f6
440 changed files with 46336 additions and 682 deletions

View File

@@ -0,0 +1,66 @@
import {fadeElementIn, isDefined, logError, openUrl} from '../utils/helper';
import {dispatchEventMarkerClicked} from "../utils/dispatchEvent";
const name = 'mapkit';
export default {
name,
createMap(element, mapData) {
if (!isDefined(window.mapkit)) {
logError('mapkit is undefined');
return;
}
const {lat, lng, zoom, service} = mapData;
window.mapkit.init({
authorizationCallback(done) {
done(service.key);
},
});
window.mapkit.addEventListener('configuration-change', event => {
if (event.status === 'Initialized') {
fadeElementIn(element);
}
});
const map = new window.mapkit.Map(element, {
mapType: service.type || window.mapkit.Map.MapTypes.Standard,
});
const delta = Math.exp(Math.log(360) - (zoom * Math.LN2)); // TODO: zoom to delta not working
map.region = new window.mapkit.CoordinateRegion(
new window.mapkit.Coordinate(lat, lng),
new window.mapkit.CoordinateSpan(delta, delta),
);
return map;
},
createMarker(element, map, markerData) {
const {title, lat, lng, url, popup, icon} = markerData;
const coordinate = new window.mapkit.Coordinate(lat, lng);
const markerAnnotationOptions = {title};
if (icon) {
markerAnnotationOptions.glyphImage = {
1: icon,
};
}
const marker = new window.mapkit.MarkerAnnotation(coordinate, markerAnnotationOptions);
marker.addEventListener('select', event => {
dispatchEventMarkerClicked(name, element, map, marker);
if (popup) {
// TODO
} else if (url) {
openUrl(url);
}
});
map.showItems([marker]); // TODO: map auto resize bugging if multiple markers
return marker;
},
};