Skip to content

Commit 6ea57db

Browse files
Wire overlay_transparency slider to layer rendering
The transparency percentage was collected but never applied. Now converts to opacity for both individual GeoRasterLayers and the overlap hatch layer, and watches for changes to trigger redraws. Fixes meshtastic#52. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 669e5c4 commit 6ea57db

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/components/Display.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,20 @@
111111
</template>
112112

113113
<script setup lang="ts">
114+
import { watch } from "vue";
114115
import { useStore } from "../store.ts";
115116
const store = useStore();
116117
const { display } = store.splatParams;
117118
118119
function onOverlapModeChange() {
119120
store.updateOverlapLayer();
120121
}
122+
123+
watch(
124+
() => display.overlay_transparency,
125+
() => {
126+
store.redrawSites();
127+
store.updateOverlapLayer();
128+
},
129+
);
121130
</script>

src/store.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,10 @@ const useStore = defineStore("store", {
491491
// Add GeoRasterLayers back to the map
492492
this.localSites.forEach((site: Site) => {
493493
if (!site.visible) return;
494+
const userOpacity = 1 - this.splatParams.display.overlay_transparency / 100;
494495
const rasterLayer = new GeoRasterLayer({
495496
georaster: site.raster,
496-
opacity: overlapActive ? 0 : 0.7,
497+
opacity: overlapActive ? 0 : userOpacity,
497498
noDataValue: 255,
498499
resolution: 256,
499500
});
@@ -528,12 +529,13 @@ const useStore = defineStore("store", {
528529
}));
529530

530531
// Create the overlap layer
532+
const overlapOpacity = 1 - this.splatParams.display.overlay_transparency / 100;
531533
this.overlapLayer = createOverlapHatchLayer({
532534
towers,
533535
mode: this.splatParams.display.overlapMode,
534536
minDbm: this.splatParams.display.min_dbm,
535537
maxDbm: this.splatParams.display.max_dbm,
536-
opacity: 1,
538+
opacity: overlapOpacity,
537539
});
538540

539541
this.overlapLayer.addTo(this.map);

0 commit comments

Comments
 (0)