Skip to content

Commit 2417c37

Browse files
committed
Hide images when contours are shown
1 parent c178188 commit 2417c37

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

client/src/components/SpectrogramViewer.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export default defineComponent({
3636
scaledVals,
3737
configuration,
3838
scaledWidth,
39-
scaledHeight
39+
scaledHeight,
40+
viewContours,
4041
} = useState();
4142
4243
const containerRef: Ref<HTMLElement | undefined> = ref();
@@ -227,6 +228,16 @@ export default defineComponent({
227228
228229
onUnmounted(() => geoJS.destroyGeoViewer());
229230
231+
watch(viewContours, () => {
232+
// If the user has chosen to look at the contours, hide
233+
// the images.
234+
if (viewContours.value) {
235+
geoJS.clearQuadFeatures(true);
236+
} else if (props.images.length) {
237+
geoJS.drawImages(props.images, scaledWidth.value, scaledHeight.value, false);
238+
}
239+
});
240+
230241
return {
231242
containerRef,
232243
geoViewerRef: geoJS.getGeoViewer(),

client/src/components/geoJS/geoJSUtils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@ const useGeoJS = () => {
3333
}
3434
};
3535

36-
const clearQuadFeatures = () => {
36+
const clearQuadFeatures = (redraw?: boolean) => {
3737
quadFeatures.forEach((feature) => {
3838
if (quadFeatureLayer) {
3939
quadFeatureLayer.removeFeature(feature);
4040
}
4141
});
4242
quadFeatures.splice(0, quadFeatures.length);
43+
if (redraw) {
44+
quadFeatureLayer.draw();
45+
}
4346
};
4447

4548
const initializeViewer = (
@@ -222,6 +225,7 @@ const useGeoJS = () => {
222225
resetMapDimensions,
223226
resetZoom,
224227
destroyGeoViewer,
228+
clearQuadFeatures,
225229
};
226230
};
227231

0 commit comments

Comments
 (0)