mirror of
https://github.com/a2nt/webpack-bootstrap-ui-kit.git
synced 2024-10-22 11:05:45 +02:00
IMPR: Maps API improvement
This commit is contained in:
parent
548b1a508e
commit
4d61ad171e
@ -38,6 +38,10 @@ const MapAPI = (($) => {
|
|||||||
|
|
||||||
config['font-family'] = $BODY.css('font-family');
|
config['font-family'] = $BODY.css('font-family');
|
||||||
|
|
||||||
|
if (!config['icon']) {
|
||||||
|
config['icon'] = '<i class="fas fa-map-marker-alt"></i>';
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`${NAME}: init ${Drv.getName()}...`);
|
console.log(`${NAME}: init ${Drv.getName()}...`);
|
||||||
Drv.init($el, config);
|
Drv.init($el, config);
|
||||||
ui.drv = Drv;
|
ui.drv = Drv;
|
||||||
@ -51,17 +55,28 @@ const MapAPI = (($) => {
|
|||||||
} else if (config['address']) {
|
} else if (config['address']) {
|
||||||
console.log(config['address']);
|
console.log(config['address']);
|
||||||
console.log(`${NAME}: setting up address marker`);
|
console.log(`${NAME}: setting up address marker`);
|
||||||
Drv.geocode(config['address'], (result) => {
|
Drv.geocode(config['address'], (results) => {
|
||||||
console.log(result);
|
console.log(results);
|
||||||
|
|
||||||
|
const lat = results[0].geometry.location.lat();
|
||||||
|
const lng = results[0].geometry.location.lng();
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`${NAME}: setting up single lat/lng marker lat: ${lat} lng: ${lng}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
Drv.addMarker([lng, lat], config);
|
||||||
|
ui.map.setCenter({ lat: lat, lng: lng });
|
||||||
});
|
});
|
||||||
} else if (config['lat'] && config['lng']) {
|
} else if (config['lat'] && config['lng']) {
|
||||||
console.log(`${NAME}: setting up single lat/lng marker`);
|
const lat = config['lat'];
|
||||||
|
const lng = config['lng'];
|
||||||
|
|
||||||
if (!config['icon']) {
|
console.log(
|
||||||
config['icon'] = '<i class="fas fa-map-marker-alt"></i>';
|
`${NAME}: setting up single lat/lng marker lat: ${lat} lng: ${lng}`,
|
||||||
}
|
);
|
||||||
|
|
||||||
Drv.addMarker([config['lng'], config['lat']], config);
|
Drv.addMarker([lng, lat], config);
|
||||||
}
|
}
|
||||||
|
|
||||||
$el.data(DATA_KEY, ui);
|
$el.data(DATA_KEY, ui);
|
||||||
|
Loading…
Reference in New Issue
Block a user