Skip to content

Commit

Permalink
fix sensor without icon
Browse files Browse the repository at this point in the history
  • Loading branch information
vol4tim committed May 13, 2024
1 parent ebc64e2 commit 8131b13
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/utils/map/marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function createMarkerUser(coord, data) {
function createMarker(point, colors) {
const coord = [point.geo.lat, point.geo.lng];
let marker;
if (sensors[point.sensor_id]) {
if (sensors[point.sensor_id] && sensors[point.sensor_id].icon) {
marker = createMarkerBrand(coord, point, colors);
} else if (point.data.windang) {
marker = createMarkerArrow(coord, point, colors);
Expand Down Expand Up @@ -321,18 +321,16 @@ export async function addPoint(point) {
await addMarker(point);

/* + Broadcasting about new sensor */
const bc = new BroadcastChannel('sensors')
bc.postMessage(point)
bc.close()
const bc = new BroadcastChannel("sensors");
bc.postMessage(point);
bc.close();
/* - Broadcasting about new sensor */

} else if (point.model === 3) {
await addMarker(point);
await addPointPath(point);
} else if (point.model === 4) {
await addMarkerUser(point);
}

} catch (error) {
console.log(error);
}
Expand Down Expand Up @@ -472,9 +470,9 @@ export function clear() {
markersLayer.clearLayers();

/* + Broadcasting about removing all sensors */
const bc = new BroadcastChannel('sensorsremoved')
bc.postMessage(true)
bc.close()
const bc = new BroadcastChannel("sensorsremoved");
bc.postMessage(true);
bc.close();
/* - Broadcasting about removing all sensors */
}
if (pathsLayer) {
Expand Down

0 comments on commit 8131b13

Please sign in to comment.