@geode/opengeodeweb-front 10.32.0 → 10.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { computed, ref, watch } from "vue";
2
1
  import { useElementBounding, useThrottleFn } from "@vueuse/core";
3
2
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
3
+ import { useTreeviewStore } from "@ogw_front/stores/treeview";
4
4
 
5
5
  const LUMINANCE_THRESHOLD = 0.65;
6
6
  const ADAPTIVE_EXPONENT = 0.3;
@@ -22,8 +22,10 @@ function getValue(val) {
22
22
  return val ?? 0;
23
23
  }
24
24
 
25
+ // oxlint-disable max-lines-per-function
25
26
  export function useAdaptiveStyles(target, options = {}) {
26
27
  const hybridViewerStore = useHybridViewerStore();
28
+ const treeviewStore = useTreeviewStore();
27
29
 
28
30
  const isCoordinates =
29
31
  target &&
@@ -65,19 +67,35 @@ export function useAdaptiveStyles(target, options = {}) {
65
67
 
66
68
  const brightness = ref(LUMINANCE_THRESHOLD);
67
69
 
68
- const updateBrightness = useThrottleFn(() => {
70
+ function calculateBrightness() {
69
71
  brightness.value = hybridViewerStore.getAverageBrightness({
70
72
  x: x.value,
71
73
  y: y.value,
72
74
  width: width.value,
73
75
  height: height.value,
74
76
  });
75
- }, ADAPTIVE_REFRESH_RATE);
77
+ }
78
+
79
+ const updateBrightness = useThrottleFn(calculateBrightness, ADAPTIVE_REFRESH_RATE);
76
80
 
77
81
  watch([x, y, width, height, () => hybridViewerStore.latestImage], updateBrightness, {
78
82
  immediate: true,
79
83
  });
80
84
 
85
+ async function forceRefresh() {
86
+ await nextTick();
87
+ bounding.update?.();
88
+ calculateBrightness();
89
+ }
90
+
91
+ if (getCurrentInstance()) {
92
+ onMounted(() => {
93
+ forceRefresh();
94
+ });
95
+ }
96
+
97
+ watch(() => treeviewStore.opened_views, forceRefresh, { deep: true });
98
+
81
99
  const adaptiveStyles = computed(() => {
82
100
  const normalized = Math.min(1, brightness.value / LUMINANCE_THRESHOLD);
83
101
  const darkFactor = (1 - normalized) ** ADAPTIVE_EXPONENT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.32.0",
3
+ "version": "10.32.1",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {