@geode/opengeodeweb-front 11.1.0 → 11.2.0-rc.2

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.
@@ -20,6 +20,8 @@ interface Props {
20
20
  active?: unknown[];
21
21
  scrollTop?: number;
22
22
  options?: Record<string, unknown>;
23
+ // Row tinted from outside the tree, e.g. while its model tree header is hovered
24
+ linked?: { id: unknown; color: string };
23
25
  }
24
26
 
25
27
  const {
@@ -29,6 +31,7 @@ const {
29
31
  active = [],
30
32
  scrollTop = 0,
31
33
  options = {},
34
+ linked = undefined,
32
35
  } = defineProps<Props>();
33
36
 
34
37
  const treeWrapper = ref<HTMLDivElement | undefined>(undefined);
@@ -217,8 +220,14 @@ const { handleKeyDown } = useTreeKeyboardNav(
217
220
  'leaf-row': item.isLeaf,
218
221
  'is-focused': focusedIndex === index,
219
222
  'is-active': item.isActive,
223
+ 'is-linked': linked !== undefined && item.raw[actualItemProps.value] === linked.id,
220
224
  },
221
225
  ]"
226
+ :style="
227
+ linked !== undefined && item.raw[actualItemProps.value] === linked.id
228
+ ? { '--row-link-color': linked.color }
229
+ : undefined
230
+ "
222
231
  class="pa-0"
223
232
  tabindex="-1"
224
233
  @mousedown.prevent
@@ -312,6 +321,11 @@ const { handleKeyDown } = useTreeKeyboardNav(
312
321
  box-shadow: inset 0 0 0 2px rgba(var(--v-theme-primary), 0.6);
313
322
  }
314
323
 
324
+ .tree-row-wrapper.is-linked {
325
+ background-color: color-mix(in srgb, var(--row-link-color) 22%, transparent) !important;
326
+ box-shadow: inset 0 0 0 2px var(--row-link-color);
327
+ }
328
+
315
329
  .tree-row-wrapper:hover:not(.is-focused):not(.is-active) {
316
330
  background-color: rgba(0, 0, 0, 0.04) !important;
317
331
  }
@@ -11,6 +11,8 @@ interface Props {
11
11
  scrollTop?: number;
12
12
  borderRadius?: string;
13
13
  borderLeft?: boolean;
14
+ // Ties the box to its row in the objects tree, highlighted while either is hovered
15
+ accent?: { color: string; highlighted: boolean };
14
16
  }
15
17
 
16
18
  const {
@@ -21,12 +23,17 @@ const {
21
23
  scrollTop = 0,
22
24
  borderRadius = "16px",
23
25
  borderLeft = true,
26
+ accent = undefined,
24
27
  } = defineProps<Props>();
25
28
 
29
+ const slots = useSlots();
30
+
26
31
  interface Emits {
27
32
  close: [];
28
33
  dragstart: [event: DragEvent];
29
34
  "update:scrollTop": [value: number];
35
+ "header-enter": [];
36
+ "header-leave": [];
30
37
  }
31
38
 
32
39
  const emit = defineEmits<Emits>();
@@ -97,13 +104,21 @@ watch(
97
104
  ref="treeview-box"
98
105
  variant="outlined"
99
106
  class="tree-box d-flex flex-column"
100
- :style="[adaptiveStyles, { borderRadius, borderLeft: borderLeft ? undefined : 'none' }]"
107
+ :class="{ 'is-highlighted': accent?.highlighted }"
108
+ :style="[
109
+ adaptiveStyles,
110
+ { borderRadius, borderLeft: borderLeft ? undefined : 'none' },
111
+ accent ? { '--tree-box-accent': accent.color } : {},
112
+ ]"
101
113
  >
114
+ <div v-if="accent" data-testid="treeBoxAccent" class="tree-box-accent" />
102
115
  <v-card-title
103
116
  class="tree-box-header d-flex align-center"
104
117
  :class="{ 'cursor-grab': closable }"
105
118
  :draggable="closable"
106
119
  @dragstart="emit('dragstart', $event)"
120
+ @mouseenter="emit('header-enter')"
121
+ @mouseleave="emit('header-leave')"
107
122
  >
108
123
  <v-img
109
124
  v-if="icon"
@@ -116,20 +131,27 @@ watch(
116
131
  />
117
132
  <v-icon v-else-if="mdiIcon" size="24" class="mr-2">{{ mdiIcon }}</v-icon>
118
133
  <v-icon v-else-if="closable" size="24" class="mr-2">mdi-drag-variant</v-icon>
119
- <span
120
- class="text-subtitle-2 font-weight-bold d-inline-flex align-center"
121
- style="
122
- height: 24px;
123
- line-height: 1;
124
- overflow: hidden;
125
- text-overflow: ellipsis;
126
- white-space: nowrap;
127
- flex-shrink: 1;
128
- min-width: 0;
129
- "
130
- >
131
- {{ title }}
132
- </span>
134
+ <v-tooltip :disabled="!slots.tooltip" location="bottom start" open-delay="400">
135
+ <template #activator="{ props: tooltipProps }">
136
+ <span
137
+ v-bind="tooltipProps"
138
+ data-testid="treeBoxTitle"
139
+ class="text-subtitle-2 font-weight-bold d-inline-flex align-center"
140
+ style="
141
+ height: 24px;
142
+ line-height: 1;
143
+ overflow: hidden;
144
+ text-overflow: ellipsis;
145
+ white-space: nowrap;
146
+ flex-shrink: 1;
147
+ min-width: 0;
148
+ "
149
+ >
150
+ {{ title }}
151
+ </span>
152
+ </template>
153
+ <slot name="tooltip" />
154
+ </v-tooltip>
133
155
  <v-spacer />
134
156
  <v-btn
135
157
  v-if="closable"
@@ -188,6 +210,28 @@ watch(
188
210
  z-index: 1;
189
211
  }
190
212
 
213
+ .tree-box-accent {
214
+ position: absolute;
215
+ z-index: 2;
216
+ left: 0;
217
+ top: 0;
218
+ bottom: 0;
219
+ width: 4px;
220
+ background-color: var(--tree-box-accent);
221
+ pointer-events: none;
222
+ }
223
+
224
+ .tree-box.is-highlighted {
225
+ border-color: var(--tree-box-accent) !important;
226
+ box-shadow:
227
+ inset 0 0 0 2px var(--tree-box-accent),
228
+ 0 4px 15px rgba(0, 0, 0, 0.05);
229
+ }
230
+
231
+ .tree-box.is-highlighted .tree-box-header {
232
+ background-color: color-mix(in srgb, var(--tree-box-accent) 18%, transparent);
233
+ }
234
+
191
235
  .tree-box-header {
192
236
  height: 32px !important;
193
237
  padding: 0 10px !important;
@@ -5,6 +5,7 @@ import type { TreeMenuPayload } from "@ogw_front/utils/treeview";
5
5
  import ViewerObjectTreeBox from "@ogw_front/components/Viewer/ObjectTree/Box.vue";
6
6
  import { geode_objects } from "@ogw_front/assets/geode_objects";
7
7
  import { useAdaptiveStyles } from "@ogw_front/composables/use_adaptive_styles";
8
+ import { useModelHeaderHover } from "@ogw_front/composables/model_header_hover";
8
9
  import { useTreeviewStore } from "@ogw_front/stores/treeview";
9
10
 
10
11
  const WIDTH_MIN = 100;
@@ -23,6 +24,7 @@ interface Props {
23
24
  const { containerWidth } = defineProps<Props>();
24
25
 
25
26
  const treeviewStore = useTreeviewStore();
27
+ const { onModelHeaderEnter, onModelHeaderLeave } = useModelHeaderHover();
26
28
 
27
29
  interface Emits {
28
30
  "show-menu": [payload: TreeMenuPayload];
@@ -87,6 +89,16 @@ watch([maxWidth, (): number => additionalViews.value.length], ([newMax]): void =
87
89
  }
88
90
  });
89
91
 
92
+ function modelGeodeId(modelId: string): string | undefined {
93
+ for (const group of treeviewStore.items) {
94
+ const child = group.children.find((item) => item.id === modelId);
95
+ if (child) {
96
+ return child.geode_id;
97
+ }
98
+ }
99
+ return undefined;
100
+ }
101
+
90
102
  function onDragStart(index: number): void {
91
103
  draggedIndex.value = index;
92
104
  }
@@ -278,10 +290,28 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
278
290
  closable
279
291
  :border-radius="`0 ${index === 0 ? '16px' : '0'} ${index === additionalViews.length - 1 ? '16px' : '0'} 0`"
280
292
  :border-left="false"
293
+ :accent="
294
+ view.color
295
+ ? { color: view.color, highlighted: treeviewStore.hoveredModelId === view.id }
296
+ : undefined
297
+ "
281
298
  @close="treeviewStore.closeView(view.id)"
282
299
  @dragstart="onDragStart(index + 1)"
283
300
  @update:scroll-top="treeviewStore.setScrollTop(view.id, $event)"
301
+ @header-enter="onModelHeaderEnter(view.id)"
302
+ @header-leave="onModelHeaderLeave(view.id)"
284
303
  >
304
+ <template #tooltip>
305
+ <div data-testid="modelTreeTooltip" class="d-flex flex-column ga-1 text-caption">
306
+ <span><strong class="mr-1">Name:</strong>{{ view.title }}</span>
307
+ <span v-if="view.geode_object_type">
308
+ <strong class="mr-1">Type:</strong>{{ view.geode_object_type }}
309
+ </span>
310
+ <span v-if="modelGeodeId(view.id)">
311
+ <strong class="mr-1">ID:</strong>{{ modelGeodeId(view.id) }}
312
+ </span>
313
+ </div>
314
+ </template>
285
315
  <ModelTree
286
316
  data-testid="modelComponentsObjectTree"
287
317
  :id="view.id"
@@ -139,6 +139,24 @@ function showMenu(event: MouseEvent, item: TreeGroupItem): void {
139
139
  });
140
140
  }
141
141
 
142
+ // Color of the opened model tree of a data, the link between the row and that tree
143
+ function modelTreeColor(id: string): string | undefined {
144
+ return treeviewStore.opened_views.find((view) => view.id === id)?.color;
145
+ }
146
+
147
+ // The row of the model whose tree header is hovered
148
+ const linkedRow = computed<{ id: string; color: string } | undefined>(() => {
149
+ const id = treeviewStore.hoveredModelId;
150
+ if (id === undefined) {
151
+ return undefined;
152
+ }
153
+ const color = modelTreeColor(id);
154
+ if (color === undefined) {
155
+ return undefined;
156
+ }
157
+ return { id, color };
158
+ });
159
+
142
160
  function isModel(item: TreeGroupItem): boolean {
143
161
  const actualItem = item.raw || item;
144
162
  return (
@@ -161,6 +179,9 @@ function handleHoverEnter({
161
179
  }
162
180
 
163
181
  const is_model = isModel(item);
182
+ if (is_model) {
183
+ treeviewStore.setHoveredModel(actualItem.id);
184
+ }
164
185
 
165
186
  onHoverEnter(
166
187
  actualItem.id,
@@ -180,6 +201,9 @@ function handleHoverLeave({ item }: { item: TreeGroupItem }): void {
180
201
  if (!actualItem.viewer_type) {
181
202
  return;
182
203
  }
204
+ if (treeviewStore.hoveredModelId === actualItem.id) {
205
+ treeviewStore.setHoveredModel(undefined);
206
+ }
183
207
  onHoverLeave(actualItem.id);
184
208
  }
185
209
 
@@ -222,6 +246,7 @@ function expandAll(): void {
222
246
  customFilter,
223
247
  }"
224
248
  :scroll-top="mainView?.scrollTop || 0"
249
+ :linked="linkedRow"
225
250
  class="transparent-treeview virtual-tree-height"
226
251
  @update:selected="(val) => onUpdateSelection(val as string[])"
227
252
  @update:scroll-top="treeviewStore.setScrollTop(mainView?.id ?? '', $event)"
@@ -259,8 +284,13 @@ function expandAll(): void {
259
284
  size="medium"
260
285
  style="height: 23px; width: 23px"
261
286
  class="ml-2"
262
- variant="text"
263
- v-tooltip="'Model\'s mesh components'"
287
+ :variant="modelTreeColor(item.id as string) ? 'tonal' : 'text'"
288
+ :color="modelTreeColor(item.id as string)"
289
+ v-tooltip="
290
+ modelTreeColor(item.id as string)
291
+ ? 'Close model\'s mesh components'
292
+ : 'Model\'s mesh components'
293
+ "
264
294
  @click.stop="
265
295
  treeviewStore.displayAdditionalTree(
266
296
  item.id as string,
@@ -11,13 +11,26 @@ type HighlightType = "mesh" | "model";
11
11
  type HighlightSchema = (typeof vtk_schemas)["opengeodeweb_viewer"][HighlightType]["highlight"];
12
12
  type BlockIdsProvider = readonly number[] | (() => readonly number[] | Promise<readonly number[]>);
13
13
 
14
- export function useHoverhighlight(): {
14
+ // Every live instance, so a highlight can be released from outside the component that started it
15
+ const instances = new Set<(dataId: DataId) => void>();
16
+
17
+ // Releases the hover and the viewer highlight of a data, whichever component started them:
18
+ // The element under the cursor may be removed, and browsers send no mouseleave for it
19
+ function releaseHoverHighlight(dataId: DataId): void {
20
+ for (const release of instances) {
21
+ release(dataId);
22
+ }
23
+ }
24
+
25
+ function useHoverhighlight(): {
15
26
  onHoverEnter: typeof onHoverEnter;
16
27
  onHoverLeave: typeof onHoverLeave;
17
28
  } {
18
29
  const viewerStore = useViewerStore();
19
30
  const dataStore = useDataStore();
20
31
  let timer: ReturnType<typeof setTimeout> | undefined = undefined;
32
+ // Item whose highlight is waiting for the delay
33
+ let pendingId: DataId | undefined = undefined;
21
34
  // Item hovered last, whose highlight may still be pending
22
35
  let currentId: DataId | undefined = undefined;
23
36
  // Item the viewer was asked to highlight, the only one to unhighlight
@@ -33,6 +46,7 @@ export function useHoverhighlight(): {
33
46
  clearTimeout(timer);
34
47
  timer = undefined;
35
48
  }
49
+ pendingId = dataId;
36
50
  const schema = vtk_schemas.opengeodeweb_viewer[type].highlight;
37
51
 
38
52
  async function highlightAction(): Promise<void> {
@@ -79,10 +93,12 @@ export function useHoverhighlight(): {
79
93
  }
80
94
 
81
95
  if (immediate) {
96
+ pendingId = undefined;
82
97
  // oxlint-disable-next-line typescript/no-floating-promises -- runHighlightAction catches its own errors internally.
83
98
  runHighlightAction();
84
99
  } else {
85
100
  timer = setTimeout(() => {
101
+ pendingId = undefined;
86
102
  // oxlint-disable-next-line typescript/no-floating-promises -- runHighlightAction catches its own errors internally.
87
103
  runHighlightAction();
88
104
  }, HOVER_DELAY);
@@ -110,6 +126,9 @@ export function useHoverhighlight(): {
110
126
  clearTimeout(timer);
111
127
  timer = undefined;
112
128
  }
129
+ if (pendingId === dataId) {
130
+ pendingId = undefined;
131
+ }
113
132
  if (currentId === dataId) {
114
133
  currentId = undefined;
115
134
  }
@@ -127,5 +146,26 @@ export function useHoverhighlight(): {
127
146
  }
128
147
  }
129
148
 
149
+ function release(dataId: DataId): void {
150
+ if (pendingId === dataId || currentId === dataId || highlighted?.dataId === dataId) {
151
+ onHoverLeave(dataId);
152
+ }
153
+ }
154
+
155
+ // A component unmounted while hovered gets no mouseleave either
156
+ if (getCurrentScope()) {
157
+ instances.add(release);
158
+ onScopeDispose(() => {
159
+ instances.delete(release);
160
+ for (const dataId of new Set([pendingId, currentId, highlighted?.dataId])) {
161
+ if (dataId !== undefined) {
162
+ onHoverLeave(dataId);
163
+ }
164
+ }
165
+ });
166
+ }
167
+
130
168
  return { onHoverEnter, onHoverLeave };
131
169
  }
170
+
171
+ export { releaseHoverHighlight, useHoverhighlight };
@@ -0,0 +1,46 @@
1
+ import { releaseHoverHighlight, useHoverhighlight } from "@ogw_front/composables/hover_highlight";
2
+ import { useDataStore } from "@ogw_front/stores/data";
3
+ import { useTreeviewStore } from "@ogw_front/stores/treeview";
4
+
5
+ // Hovering a model tree header shows its model in the viewer and its row in the objects tree
6
+ export function useModelHeaderHover(): {
7
+ onModelHeaderEnter: (modelId: string) => void;
8
+ onModelHeaderLeave: (modelId: string) => void;
9
+ } {
10
+ const treeviewStore = useTreeviewStore();
11
+ const dataStore = useDataStore();
12
+ const { onHoverEnter, onHoverLeave } = useHoverhighlight();
13
+
14
+ function onModelHeaderEnter(modelId: string): void {
15
+ treeviewStore.setHoveredModel(modelId);
16
+ onHoverEnter(
17
+ modelId,
18
+ async () => {
19
+ const viewerIds = await dataStore.getAllModelComponentsViewerIds(modelId);
20
+ return viewerIds;
21
+ },
22
+ "model",
23
+ );
24
+ }
25
+
26
+ function onModelHeaderLeave(modelId: string): void {
27
+ if (treeviewStore.hoveredModelId === modelId) {
28
+ treeviewStore.setHoveredModel(undefined);
29
+ }
30
+ onHoverLeave(modelId);
31
+ }
32
+
33
+ // A view closed under the cursor never gets its mouseleave: release what its hover started
34
+ watch(
35
+ () => treeviewStore.opened_views.map((view) => view.id),
36
+ (newIds, oldIds) => {
37
+ for (const viewId of oldIds) {
38
+ if (!newIds.includes(viewId)) {
39
+ releaseHoverHighlight(viewId);
40
+ }
41
+ }
42
+ },
43
+ );
44
+
45
+ return { onModelHeaderEnter, onModelHeaderLeave };
46
+ }
@@ -16,6 +16,7 @@ import type {
16
16
  import type { TreeGroup, TreeNode } from "@ogw_front/types/tree";
17
17
  import { ref, watch } from "vue";
18
18
  import { getTable } from "@ogw_internal/database/database";
19
+ import { nextModelTreeColor } from "@ogw_front/utils/treeview";
19
20
 
20
21
  const PANEL_WIDTH = 300;
21
22
 
@@ -25,6 +26,8 @@ interface OpenedView extends Partial<GeodeObjectTyped> {
25
26
  title: string;
26
27
  scrollTop: number;
27
28
  opened: string[];
29
+ // Ties a model tree to its row in the objects tree
30
+ color?: string;
28
31
  }
29
32
 
30
33
  interface TreeviewChild extends TreeNode, GeodeIdentified, GeodeObjectTyped, ViewerTyped {}
@@ -68,6 +71,18 @@ interface ReadonlyTreeviewSnapshot {
68
71
  selection?: readonly (string | { id: string })[];
69
72
  }
70
73
 
74
+ // Model trees saved before they had a color get one, distinct from the others
75
+ function withModelTreeColors(views: OpenedView[]): OpenedView[] {
76
+ const used: (string | undefined)[] = views.map((view) => view.color);
77
+ for (const view of views) {
78
+ if (view.type === "component" && view.color === undefined) {
79
+ view.color = nextModelTreeColor(used);
80
+ used.push(view.color);
81
+ }
82
+ }
83
+ return views;
84
+ }
85
+
71
86
  function snapshotSelectionIds(snapshot: ReadonlyTreeviewSnapshot | undefined): string[] {
72
87
  if (snapshot?.selectionIds) {
73
88
  return [...snapshot.selectionIds];
@@ -88,6 +103,8 @@ export const useTreeviewStore = defineStore("treeview", () => {
88
103
  const isImporting = ref(false);
89
104
  const pendingSelectionIds = ref<string[]>([]);
90
105
  const rowHeights = ref<number[]>([]);
106
+ // Model hovered in the objects tree or on its model tree header: not saved
107
+ const hoveredModelId = ref<string | undefined>(undefined);
91
108
 
92
109
  const treeview_config_db = getTable<TreeviewConfigRecord>("treeview_config");
93
110
 
@@ -95,7 +112,7 @@ export const useTreeviewStore = defineStore("treeview", () => {
95
112
  try {
96
113
  const config = await treeview_config_db.get("main");
97
114
  if (config?.opened_views) {
98
- opened_views.value = config.opened_views;
115
+ opened_views.value = withModelTreeColors(config.opened_views);
99
116
  }
100
117
  if (config?.panelWidth !== undefined && config.panelWidth !== 0) {
101
118
  panelWidth.value = config.panelWidth;
@@ -143,7 +160,15 @@ export const useTreeviewStore = defineStore("treeview", () => {
143
160
  { deep: true },
144
161
  );
145
162
 
163
+ // No mouseleave is sent for an element removed under the cursor: clear the hover here
164
+ function clearHoveredModel(id: string): void {
165
+ if (hoveredModelId.value === id) {
166
+ hoveredModelId.value = undefined;
167
+ }
168
+ }
169
+
146
170
  function closeView(id: string): void {
171
+ clearHoveredModel(id);
147
172
  opened_views.value = opened_views.value.filter((view: ReadonlyOpenedView) => view.id !== id);
148
173
  }
149
174
 
@@ -199,6 +224,7 @@ export const useTreeviewStore = defineStore("treeview", () => {
199
224
  }
200
225
 
201
226
  function removeItem(dataId: DataId): void {
227
+ clearHoveredModel(dataId);
202
228
  for (let index = 0; index < items.value.length; index += 1) {
203
229
  const group = items.value[index];
204
230
  if (!group) {
@@ -234,9 +260,14 @@ export const useTreeviewStore = defineStore("treeview", () => {
234
260
  geode_object_type: geodeObjectType,
235
261
  scrollTop: 0,
236
262
  opened: [],
263
+ color: nextModelTreeColor(opened_views.value.map((view) => view.color)),
237
264
  });
238
265
  }
239
266
 
267
+ function setHoveredModel(id: string | undefined): void {
268
+ hoveredModelId.value = id;
269
+ }
270
+
240
271
  function moveView(from_index: number, to_index: number): void {
241
272
  if (from_index !== 0 && to_index !== 0) {
242
273
  const [element] = opened_views.value.splice(from_index, 1);
@@ -248,8 +279,10 @@ export const useTreeviewStore = defineStore("treeview", () => {
248
279
 
249
280
  function importStores(snapshot: ReadonlyTreeviewSnapshot | undefined): void {
250
281
  if (snapshot?.opened_views) {
251
- // oxlint-disable-next-line no-unsafe-type-assertion -- narrowing the readonly parameter view back to the mutable working type; these objects aren't actually frozen at runtime.
252
- opened_views.value = [...snapshot.opened_views] as OpenedView[];
282
+ // Copies: the snapshot keeps its views as they were saved
283
+ opened_views.value = withModelTreeColors(
284
+ snapshot.opened_views.map((view) => ({ ...view, opened: [...view.opened] })),
285
+ );
253
286
  } else {
254
287
  opened_views.value = defaultOpenedViews();
255
288
  }
@@ -356,6 +389,8 @@ export const useTreeviewStore = defineStore("treeview", () => {
356
389
  additionalPanelWidth,
357
390
  isImporting,
358
391
  rowHeights,
392
+ hoveredModelId,
393
+ setHoveredModel,
359
394
  addItem,
360
395
  removeItem,
361
396
  renameItem,
@@ -12,6 +12,7 @@ import {
12
12
  fetchViewerVersion,
13
13
  launchViewerMicroservice,
14
14
  pickWorldPosition,
15
+ showRenderingWarnings,
15
16
  } from "./viewer_helpers/actions.js";
16
17
  import {
17
18
  getWebsocketApiPort,
@@ -60,6 +61,8 @@ export const useViewerStore = defineStore(
60
61
  const request_counter = ref(0);
61
62
  const status = ref(Status.NOT_CONNECTED);
62
63
  const version = ref("0.0.0");
64
+ // The viewer warnings are shown once, not again on each reconnection
65
+ const rendering_warnings_shown = ref(false);
63
66
  const protocol = computed(() => getWebsocketApiProtocol());
64
67
  const port = computed(() => getWebsocketApiPort(default_local_port.value));
65
68
  const base_url = computed(() => {
@@ -137,6 +140,10 @@ export const useViewerStore = defineStore(
137
140
  status.value = Status.NOT_CONNECTED;
138
141
  throw error;
139
142
  }
143
+ if (!rendering_warnings_shown.value) {
144
+ rendering_warnings_shown.value = true;
145
+ void showRenderingWarnings(request);
146
+ }
140
147
  });
141
148
  }
142
149
  async function launch(args: Readonly<{ projectFolderPath: string }>): Promise<unknown> {
@@ -1,9 +1,11 @@
1
1
  import type { MicroserviceVersionSchema } from "@ogw_shared/utils/types.js";
2
2
  import type { Vector3 } from "@kitware/vtk.js/types";
3
3
  import type { ViewerRequest } from "./request.js";
4
+ import { consola } from "consola";
4
5
  import opengeodeweb_front_schemas from "@geode/opengeodeweb-front/opengeodeweb_front_typed_schemas.js";
5
6
  import opengeodeweb_viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
6
7
  import { useAppStore } from "@ogw_front/stores/app";
8
+ import { useFeedbackStore } from "@ogw_front/stores/feedback";
7
9
 
8
10
  async function pickWorldPosition(request: ViewerRequest, x: number, y: number): Promise<Vector3> {
9
11
  const schema = opengeodeweb_viewer_schemas.opengeodeweb_viewer.viewer.get_point_position;
@@ -65,4 +67,19 @@ async function fetchViewerVersion(
65
67
  return result;
66
68
  }
67
69
 
68
- export { fetchViewerVersion, launchViewerMicroservice, pickWorldPosition };
70
+ // Shows the viewer's warnings about its rendering setup, e.g. software rendering fallback.
71
+ // Informational only: a failure is logged, never thrown, so it cannot break the connection.
72
+ async function showRenderingWarnings(request: ViewerRequest): Promise<void> {
73
+ const schema = opengeodeweb_viewer_schemas.opengeodeweb_viewer.rendering_warnings;
74
+ try {
75
+ const { warnings } = await request({ schema });
76
+ const feedbackStore = useFeedbackStore();
77
+ for (const warning of warnings) {
78
+ feedbackStore.add_warning(warning);
79
+ }
80
+ } catch (error) {
81
+ consola.warn("[viewer] Rendering warnings unavailable:", String(error));
82
+ }
83
+ }
84
+
85
+ export { fetchViewerVersion, launchViewerMicroservice, pickWorldPosition, showRenderingWarnings };
@@ -43,7 +43,25 @@ type TreeMenuPayload =
43
43
  | ModelComponentMenuPayload
44
44
  | BasemapMenuPayload;
45
45
 
46
- export { compareSelections };
46
+ // Colors that tie each opened model tree to its row in the objects tree
47
+ const MODEL_TREE_COLORS = [
48
+ "#1E88E5",
49
+ "#E53935",
50
+ "#43A047",
51
+ "#FB8C00",
52
+ "#8E24AA",
53
+ "#00ACC1",
54
+ "#D81B60",
55
+ "#6D4C41",
56
+ ] as const;
57
+
58
+ // The first color no opened tree uses, cycling once they are all taken
59
+ function nextModelTreeColor(usedColors: readonly (string | undefined)[]): string {
60
+ const free = MODEL_TREE_COLORS.find((color) => !usedColors.includes(color));
61
+ return free ?? MODEL_TREE_COLORS[usedColors.length % MODEL_TREE_COLORS.length] ?? "";
62
+ }
63
+
64
+ export { MODEL_TREE_COLORS, compareSelections, nextModelTreeColor };
47
65
  export type {
48
66
  DataMenuPayload,
49
67
  GeodeObjectTypeMenuPayload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "11.1.0",
3
+ "version": "11.2.0-rc.2",
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": {
@@ -75,9 +75,9 @@
75
75
  "prepublishOnly": "npm run build"
76
76
  },
77
77
  "dependencies": {
78
- "@geode/cloud-api": "latest",
79
- "@geode/opengeodeweb-back": "latest",
80
- "@geode/opengeodeweb-viewer": "latest",
78
+ "@geode/cloud-api": "next",
79
+ "@geode/opengeodeweb-back": "next",
80
+ "@geode/opengeodeweb-viewer": "next",
81
81
  "@kitware/vtk.js": "33.3.0",
82
82
  "@mdi/font": "7.4.47",
83
83
  "@msgpack/msgpack": "2.8.0",