Browse Source

Code cleanup

master
GabrielTrettel 3 years ago
parent
commit
60dae34816
  1. 29
      src/app/components/map/LeafLetMap.js
  2. 4
      src/app/components/map/OpenStreetMap.js

29
src/app/components/map/LeafLetMap.js

@ -59,36 +59,7 @@ function handleEvent(event) {
return code_to_function[payload.code](payload); return code_to_function[payload.code](payload);
} }
function buildIcon(icon) {
return `\`
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.dot {
height: 25px;
width: 25px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
}
</style>
</head>
<body>
<div style="text-align:center">
<span class="dot"></span>
</div>
</body>
</html>
\``;
}
async function insertMarker(mapRef, ID, coordinate, icon) { async function insertMarker(mapRef, ID, coordinate, icon) {
var iconSvg = icon;
mapRef.injectJavaScript(` mapRef.injectJavaScript(`
var customIcon = L.divIcon({ var customIcon = L.divIcon({
className: 'marker-class', className: 'marker-class',

4
src/app/components/map/OpenStreetMap.js

@ -48,7 +48,7 @@ export default function OpenStreetMap({
markersList && markersList &&
mapRef && mapRef &&
notEmpy(markersList) && notEmpy(markersList) &&
markersList.forEach((val, key) => {
markersList.forEach((val, _) => {
insertMarker(mapRef, val.ID, val.coordinate, val.image); insertMarker(mapRef, val.ID, val.coordinate, val.image);
}); });
@ -56,7 +56,7 @@ export default function OpenStreetMap({
markersList && markersList &&
mapRef && mapRef &&
notEmpy(markersList) && notEmpy(markersList) &&
markersList.forEach((val, key) => {
markersList.forEach((val, _) => {
insertMarker(mapRef, val.ID, val.coordinate, val.image); insertMarker(mapRef, val.ID, val.coordinate, val.image);
}); });
}, [markersList]) }, [markersList])

Loading…
Cancel
Save