diff --git a/package-lock.json b/package-lock.json index 6e883d9..4d32c32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "@sjvair/monitor-map", - "version": "1.8.8", + "version": "1.8.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@sjvair/monitor-map", - "version": "1.8.8", + "version": "1.8.9", "devDependencies": { "@types/d3": "^7.4.3", "@types/leaflet": "^1.9.8", "@types/leaflet.markercluster": "^1.5.4", - "@types/node": "20.11.19", + "@types/node": "20.11.20", "@vitejs/plugin-vue": "^5.0.4", "@vuepic/vue-datepicker": "^8.1.1", "axios": "^1.6.7", @@ -23,7 +23,7 @@ "leaflet-svg-shape-markers": "^1.4.0", "leaflet.markercluster": "^1.5.3", "sass": "^1.71.1", - "terser": "^5.27.2", + "terser": "^5.28.1", "typescript": "^5.3.3", "uplot": "^1.6.30", "vite": "^5.1.4", @@ -930,9 +930,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", + "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -2957,9 +2957,9 @@ } }, "node_modules/terser": { - "version": "5.27.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.2.tgz", - "integrity": "sha512-sHXmLSkImesJ4p5apTeT63DsV4Obe1s37qT8qvwHRmVxKTBH7Rv9Wr26VcAMmLbmk9UliiwK8z+657NyJHHy/w==", + "version": "5.28.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.28.1.tgz", + "integrity": "sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -4755,9 +4755,9 @@ } }, "@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", + "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", "dev": true, "requires": { "undici-types": "~5.26.4" @@ -6241,9 +6241,9 @@ "dev": true }, "terser": { - "version": "5.27.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.2.tgz", - "integrity": "sha512-sHXmLSkImesJ4p5apTeT63DsV4Obe1s37qT8qvwHRmVxKTBH7Rv9Wr26VcAMmLbmk9UliiwK8z+657NyJHHy/w==", + "version": "5.28.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.28.1.tgz", + "integrity": "sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA==", "dev": true, "requires": { "@jridgewell/source-map": "^0.3.3", diff --git a/package.json b/package.json index a4bcfd3..882c9d1 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "files": [ "dist" ], - "version": "1.8.9", + "version": "1.8.10", "type": "module", "scripts": { "dev": "vite", @@ -17,7 +17,7 @@ "@types/d3": "^7.4.3", "@types/leaflet": "^1.9.8", "@types/leaflet.markercluster": "^1.5.4", - "@types/node": "20.11.19", + "@types/node": "20.11.20", "@vitejs/plugin-vue": "^5.0.4", "@vuepic/vue-datepicker": "^8.1.1", "axios": "^1.6.7", @@ -29,7 +29,7 @@ "leaflet-svg-shape-markers": "^1.4.0", "leaflet.markercluster": "^1.5.3", "sass": "^1.71.1", - "terser": "^5.27.2", + "terser": "^5.28.1", "typescript": "^5.3.3", "uplot": "^1.6.30", "vite": "^5.1.4", diff --git a/src/Calibrators/service.ts b/src/Calibrators/service.ts index 68e89f7..42bd2e0 100644 --- a/src/Calibrators/service.ts +++ b/src/Calibrators/service.ts @@ -30,7 +30,7 @@ export function getCalibratorByRefId(id: string): Calibrator | undefined { return calibrators.value.find(c => c.reference_id === id); } -export function isCalibrator(monitor: Monitor | string): boolean { +export function isCalibratorObject(monitor: Monitor | string): boolean { return (typeof monitor === "string") ? calibrators.value.some(c => c.id === monitor) : calibrators.value.some(c => c.id === monitor.data.id); diff --git a/src/DisplayOptions/MonitorMarkers.ts b/src/DisplayOptions/MonitorMarkers.ts index 1fa5df1..acf17a5 100644 --- a/src/DisplayOptions/MonitorMarkers.ts +++ b/src/DisplayOptions/MonitorMarkers.ts @@ -1,7 +1,7 @@ import { ref, watch } from "vue"; import { useRouter } from "vue-router"; import { useInteractiveMap } from "../Map"; -import { isCalibrator, getCalibratorById, getCalibratorByRefId, monitorIsCalibrator, useCalibratorsService } from "../Calibrators"; +import { isCalibratorObject, getCalibratorById, getCalibratorByRefId, monitorIsCalibrator, useCalibratorsService } from "../Calibrators"; import L from "../modules/Leaflet"; import { asyncInitializer, darken, dateUtil, readableColor, toHex } from "../modules"; import { MonitorDisplayField, MonitorDataField, useMonitorsService, getMonitor } from "../Monitors"; @@ -117,10 +117,11 @@ export const useMonitorMarkers = asyncInitializer(async (r displayRefs, () => { monitorMarkersMap.forEach((marker, id) => { - const monitor = isCalibrator(id) + const monitor = isCalibratorObject(id) ? getCalibratorById(id)! : monitors.value[id]; + if (isVisible(monitor)) { monitorMarkersGroup.addLayer(marker); @@ -232,9 +233,11 @@ function isVisible(monitor: Monitor | Calibrator): boolean { : monitorMarkersVisibility.AirNow.model.value; case "AQview": - return monitorMarkersVisibility.AQview.model.value; + return (monitorIsCalibrator(monitor)) + ? monitorMarkersVisibility.Calibrators.model.value || monitorMarkersVisibility.AQview.model.value + : monitorMarkersVisibility.AQview.model.value; } - } else if ("id" in monitor && isCalibrator(monitor.id)) { + } else if ("id" in monitor && isCalibratorObject(monitor.id)) { const ref = getMonitor(monitor.reference_id); if(!monitorMarkersVisibility.displayInactive.model.value && !ref.data.is_active){