@geode/opengeodeweb-front 12.2.0-rc.2 → 12.2.0-rc.4
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.
- package/.build/tests/browser/helpers/image.js +25 -0
- package/.build/tests/browser/helpers/object_trees/common.js +3 -1
- package/.build/tests/browser/helpers/object_trees/model_tree_bar.js +41 -0
- package/.build/tests/browser/helpers/wait_for_action_settled.js +2 -2
- package/.build/tests/browser/suites/image/raster_image.js +33 -0
- package/.build/tests/browser/suites/index.js +4 -0
- package/.build/tests/browser/suites/model/collections.js +1 -1
- package/.build/tests/browser/suites/object_tree/controls.js +2 -1
- package/.build/tests/browser/suites/object_tree/model_tree_bar.js +81 -0
- package/app/components/Viewer/Image/ImageOptions.vue +67 -0
- package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +12 -1
- package/app/components/Viewer/ObjectTree/Base/Controls.vue +26 -2
- package/app/components/Viewer/ObjectTree/Box.vue +30 -5
- package/app/components/Viewer/ObjectTree/Layout.vue +183 -54
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +3 -2
- package/app/composables/hover_highlight.ts +6 -5
- package/app/composables/model_tree_drag.ts +56 -0
- package/app/composables/use_adaptive_styles.ts +15 -8
- package/app/composables/use_overlapping_picker.ts +6 -1
- package/app/composables/virtual_tree.ts +7 -1
- package/app/stores/data_style.ts +12 -1
- package/app/stores/menu_helpers/image.ts +11 -0
- package/app/stores/menu_helpers/menus_data.ts +2 -0
- package/app/stores/treeview.ts +29 -1
- package/app/types/identifiers.ts +8 -0
- package/app/utils/default_styles/images.ts +16 -0
- package/app/utils/default_styles/index.ts +3 -2
- package/app/utils/threshold_sources.ts +5 -1
- package/internal/stores/data_style/image/index.ts +107 -0
- package/internal/stores/hybrid_viewer/brightness.ts +36 -19
- package/package.json +1 -1
- package/tests/browser/helpers/image.ts +33 -0
- package/tests/browser/helpers/object_trees/common.ts +4 -0
- package/tests/browser/helpers/object_trees/model_tree_bar.ts +78 -0
- package/tests/browser/helpers/wait_for_action_settled.ts +2 -3
- package/tests/browser/suites/image/raster_image.ts +40 -0
- package/tests/browser/suites/model/collections.ts +2 -1
- package/tests/browser/suites/object_tree/controls.ts +3 -0
- package/tests/browser/suites/object_tree/model_tree_bar.ts +125 -0
|
@@ -6,6 +6,7 @@ import ViewerObjectTreeBox from "@ogw_front/components/Viewer/ObjectTree/Box.vue
|
|
|
6
6
|
import { geodeObjectImage } from "@ogw_front/assets/geode_objects";
|
|
7
7
|
import { useAdaptiveStyles } from "@ogw_front/composables/use_adaptive_styles";
|
|
8
8
|
import { useModelHeaderHover } from "@ogw_front/composables/model_header_hover";
|
|
9
|
+
import { useModelTreeDrag } from "@ogw_front/composables/model_tree_drag";
|
|
9
10
|
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
10
11
|
|
|
11
12
|
const WIDTH_MIN = 100;
|
|
@@ -27,6 +28,8 @@ const { containerWidth } = defineProps<Props>();
|
|
|
27
28
|
|
|
28
29
|
const treeviewStore = useTreeviewStore();
|
|
29
30
|
const { onModelHeaderEnter, onModelHeaderLeave } = useModelHeaderHover();
|
|
31
|
+
const { draggedId, dropTargetId, onDragStart, onDragOver, onDragEnd, onDrop, dropSide } =
|
|
32
|
+
useModelTreeDrag();
|
|
30
33
|
|
|
31
34
|
interface Emits {
|
|
32
35
|
"show-menu": [payload: TreeMenuPayload];
|
|
@@ -43,9 +46,14 @@ const mainView = computed(() => treeviewStore.opened_views.find((view) => view.i
|
|
|
43
46
|
const additionalViews = computed(() =>
|
|
44
47
|
treeviewStore.opened_views.filter((view) => view.id !== "main"),
|
|
45
48
|
);
|
|
49
|
+
// The model trees not collapsed in the activity bar
|
|
50
|
+
const shownViews = computed(() => additionalViews.value.filter((view) => view.collapsed !== true));
|
|
51
|
+
// From two model trees, one button collapses them all, or shows them all again once all are collapsed
|
|
52
|
+
const MIN_MODEL_TREES_FOR_ALL = 2;
|
|
53
|
+
const showAllToggle = computed(() => additionalViews.value.length >= MIN_MODEL_TREES_FOR_ALL);
|
|
46
54
|
|
|
47
55
|
const totalWidth = computed<string>(() => {
|
|
48
|
-
const hasAdditional =
|
|
56
|
+
const hasAdditional = shownViews.value.length > 0;
|
|
49
57
|
const hasMain = Boolean(mainView.value);
|
|
50
58
|
const gap = hasAdditional && hasMain ? GAP_WIDTH : 0;
|
|
51
59
|
const firstColWidth = hasMain ? treeviewStore.panelWidth : 0;
|
|
@@ -57,10 +65,9 @@ const rowHeights = computed<number[]>({
|
|
|
57
65
|
get: () => treeviewStore.rowHeights,
|
|
58
66
|
set: (val) => treeviewStore.setRowHeights(val),
|
|
59
67
|
});
|
|
60
|
-
const draggedIndex = ref<number | undefined>(undefined);
|
|
61
68
|
|
|
62
69
|
watch(
|
|
63
|
-
() =>
|
|
70
|
+
() => shownViews.value.length,
|
|
64
71
|
(newLength) => {
|
|
65
72
|
if (newLength > 0 && rowHeights.value.length !== newLength) {
|
|
66
73
|
treeviewStore.setRowHeights(Array.from({ length: newLength }, () => PERCENT_100 / newLength));
|
|
@@ -69,8 +76,8 @@ watch(
|
|
|
69
76
|
{ immediate: true },
|
|
70
77
|
);
|
|
71
78
|
|
|
72
|
-
watch([maxWidth, (): number =>
|
|
73
|
-
const hasAdditional =
|
|
79
|
+
watch([maxWidth, (): number => shownViews.value.length], ([newMax]): void => {
|
|
80
|
+
const hasAdditional = shownViews.value.length > 0;
|
|
74
81
|
const gap = hasAdditional ? GAP_WIDTH : 0;
|
|
75
82
|
const total =
|
|
76
83
|
treeviewStore.panelWidth + (hasAdditional ? treeviewStore.additionalPanelWidth : 0) + gap;
|
|
@@ -101,28 +108,19 @@ function modelGeodeId(modelId: string): string | undefined {
|
|
|
101
108
|
return undefined;
|
|
102
109
|
}
|
|
103
110
|
|
|
104
|
-
function onDragStart(index: number): void {
|
|
105
|
-
draggedIndex.value = index;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function onDragOver(event: DragEvent): void {
|
|
109
|
-
event.preventDefault();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function onDrop(targetIndex: number): void {
|
|
113
|
-
if (draggedIndex.value !== undefined && draggedIndex.value !== targetIndex) {
|
|
114
|
-
treeviewStore.moveView(draggedIndex.value, targetIndex);
|
|
115
|
-
}
|
|
116
|
-
draggedIndex.value = undefined;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
111
|
function onResizeStart(event: MouseEvent): void {
|
|
120
112
|
const startWidth = treeviewStore.panelWidth;
|
|
121
113
|
const startX = event.clientX;
|
|
114
|
+
// Both listeners go at once, also from the resize itself once a panel is closed or collapsed
|
|
115
|
+
const listeners = new AbortController();
|
|
116
|
+
function stopResize(): void {
|
|
117
|
+
listeners.abort();
|
|
118
|
+
document.body.style.userSelect = "";
|
|
119
|
+
}
|
|
122
120
|
function resize(move_event: MouseEvent): void {
|
|
123
121
|
const deltaX = move_event.clientX - startX;
|
|
124
122
|
let newWidth = startWidth + deltaX;
|
|
125
|
-
const hasAdditional =
|
|
123
|
+
const hasAdditional = shownViews.value.length > 0;
|
|
126
124
|
const gap = hasAdditional ? GAP_WIDTH : 0;
|
|
127
125
|
const currentTotalWidth =
|
|
128
126
|
newWidth + (hasAdditional ? treeviewStore.additionalPanelWidth : 0) + gap;
|
|
@@ -132,46 +130,45 @@ function onResizeStart(event: MouseEvent): void {
|
|
|
132
130
|
|
|
133
131
|
if (newWidth < AUTO_CLOSE_THRESHOLD) {
|
|
134
132
|
treeviewStore.closeView("main");
|
|
133
|
+
stopResize();
|
|
135
134
|
return;
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
treeviewStore.setPanelWidth(Math.max(WIDTH_MIN, newWidth));
|
|
139
138
|
document.body.style.userSelect = "none";
|
|
140
139
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
document.removeEventListener("mouseup", stopResize);
|
|
144
|
-
document.body.style.userSelect = "";
|
|
145
|
-
}
|
|
146
|
-
document.addEventListener("mousemove", resize);
|
|
147
|
-
document.addEventListener("mouseup", stopResize);
|
|
140
|
+
document.addEventListener("mousemove", resize, { signal: listeners.signal });
|
|
141
|
+
document.addEventListener("mouseup", stopResize, { signal: listeners.signal });
|
|
148
142
|
}
|
|
149
143
|
|
|
150
144
|
function onAdditionalResizeStart(event: MouseEvent): void {
|
|
151
145
|
const startWidth = treeviewStore.additionalPanelWidth;
|
|
152
146
|
const startX = event.clientX;
|
|
147
|
+
// Both listeners go at once, also from the resize itself once a panel is closed or collapsed
|
|
148
|
+
const listeners = new AbortController();
|
|
149
|
+
function stopResize(): void {
|
|
150
|
+
listeners.abort();
|
|
151
|
+
document.body.style.userSelect = "";
|
|
152
|
+
}
|
|
153
153
|
function resize(move_event: MouseEvent): void {
|
|
154
154
|
const deltaX = move_event.clientX - startX;
|
|
155
155
|
const newWidth = startWidth + deltaX;
|
|
156
156
|
const currentTotalWidth = treeviewStore.panelWidth + newWidth + GAP_WIDTH;
|
|
157
|
+
// Only the last shown tree collapses: the drag ends there, the next moves would collapse the others
|
|
157
158
|
if (newWidth < AUTO_CLOSE_THRESHOLD) {
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
treeviewStore.
|
|
159
|
+
const lastShownView = shownViews.value.at(-1);
|
|
160
|
+
if (lastShownView) {
|
|
161
|
+
treeviewStore.setCollapsed(lastShownView.id, true);
|
|
161
162
|
}
|
|
163
|
+
stopResize();
|
|
162
164
|
return;
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
treeviewStore.setAdditionalPanelWidth(Math.max(WIDTH_MIN, newWidth));
|
|
166
168
|
document.body.style.userSelect = "none";
|
|
167
169
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
document.removeEventListener("mouseup", stopResize);
|
|
171
|
-
document.body.style.userSelect = "";
|
|
172
|
-
}
|
|
173
|
-
document.addEventListener("mousemove", resize);
|
|
174
|
-
document.addEventListener("mouseup", stopResize);
|
|
170
|
+
document.addEventListener("mousemove", resize, { signal: listeners.signal });
|
|
171
|
+
document.addEventListener("mouseup", stopResize, { signal: listeners.signal });
|
|
175
172
|
}
|
|
176
173
|
|
|
177
174
|
function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
@@ -226,7 +223,7 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
|
226
223
|
<div
|
|
227
224
|
ref="activity-bar"
|
|
228
225
|
class="activity-bar d-flex flex-column align-center py-2"
|
|
229
|
-
:class="{ 'is-closed':
|
|
226
|
+
:class="{ 'is-closed': !mainView && shownViews.length === 0 }"
|
|
230
227
|
:style="activityBarAdaptiveStyles"
|
|
231
228
|
>
|
|
232
229
|
<v-btn
|
|
@@ -238,6 +235,53 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
|
238
235
|
v-tooltip="'Toggle Objects'"
|
|
239
236
|
@click="treeviewStore.toggleView('main')"
|
|
240
237
|
/>
|
|
238
|
+
<template v-if="additionalViews.length > 0">
|
|
239
|
+
<div class="activity-bar-separator" />
|
|
240
|
+
<v-btn
|
|
241
|
+
v-if="showAllToggle"
|
|
242
|
+
data-testid="toggleAllModelTreesButton"
|
|
243
|
+
:icon="shownViews.length > 0 ? 'ph-caret-double-left' : 'ph-caret-double-right'"
|
|
244
|
+
variant="text"
|
|
245
|
+
density="comfortable"
|
|
246
|
+
class="model-tree-toggle-all"
|
|
247
|
+
v-tooltip="shownViews.length > 0 ? 'Collapse all model trees' : 'Show all model trees'"
|
|
248
|
+
@click="treeviewStore.setAllCollapsed(shownViews.length > 0)"
|
|
249
|
+
/>
|
|
250
|
+
<div
|
|
251
|
+
v-for="view in additionalViews"
|
|
252
|
+
:key="view.id"
|
|
253
|
+
data-testid="modelTreeToggle"
|
|
254
|
+
class="model-tree-toggle"
|
|
255
|
+
:class="[{ 'is-collapsed': view.collapsed === true }, dropSide(view.id)]"
|
|
256
|
+
:style="view.color ? { '--model-tree-color': view.color } : undefined"
|
|
257
|
+
draggable="true"
|
|
258
|
+
@dragstart="onDragStart(view.id)"
|
|
259
|
+
@dragenter.prevent="dropTargetId = view.id"
|
|
260
|
+
@dragover="onDragOver"
|
|
261
|
+
@drop="onDrop(view.id)"
|
|
262
|
+
@dragend="onDragEnd"
|
|
263
|
+
>
|
|
264
|
+
<v-btn
|
|
265
|
+
data-testid="toggleModelTreeButton"
|
|
266
|
+
icon
|
|
267
|
+
variant="text"
|
|
268
|
+
density="comfortable"
|
|
269
|
+
v-tooltip="view.collapsed === true ? `Show ${view.title}` : `Collapse ${view.title}`"
|
|
270
|
+
@click="treeviewStore.toggleCollapsed(view.id)"
|
|
271
|
+
@mouseenter="onModelHeaderEnter(view.id)"
|
|
272
|
+
@mouseleave="onModelHeaderLeave(view.id)"
|
|
273
|
+
>
|
|
274
|
+
<v-img
|
|
275
|
+
v-if="view.geode_object_type"
|
|
276
|
+
:src="geodeObjectImage(view.geode_object_type)"
|
|
277
|
+
width="22"
|
|
278
|
+
height="22"
|
|
279
|
+
class="model-tree-toggle-icon"
|
|
280
|
+
/>
|
|
281
|
+
<v-icon v-else size="22">ph-cube</v-icon>
|
|
282
|
+
</v-btn>
|
|
283
|
+
</div>
|
|
284
|
+
</template>
|
|
241
285
|
</div>
|
|
242
286
|
|
|
243
287
|
<div class="treeview-container d-flex" :style="{ width: totalWidth }">
|
|
@@ -253,7 +297,7 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
|
253
297
|
font-icon="ph-tree-structure"
|
|
254
298
|
:scroll-top="mainView?.scrollTop || 0"
|
|
255
299
|
closable
|
|
256
|
-
:border-radius="
|
|
300
|
+
:border-radius="shownViews.length > 0 ? '0' : `0 ${PANEL_RADIUS} ${PANEL_RADIUS} 0`"
|
|
257
301
|
:border-left="false"
|
|
258
302
|
@close="treeviewStore.closeView('main')"
|
|
259
303
|
@update:scroll-top="mainView && treeviewStore.setScrollTop(mainView.id, $event)"
|
|
@@ -263,34 +307,34 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
|
263
307
|
</div>
|
|
264
308
|
|
|
265
309
|
<div
|
|
266
|
-
v-if="mainView &&
|
|
310
|
+
v-if="mainView && shownViews.length > 0"
|
|
267
311
|
class="column-separator"
|
|
268
312
|
@mousedown="onResizeStart"
|
|
269
313
|
/>
|
|
270
314
|
|
|
271
315
|
<div
|
|
272
|
-
v-if="
|
|
316
|
+
v-if="shownViews.length > 0"
|
|
273
317
|
class="column additional-column"
|
|
274
318
|
:style="{
|
|
275
319
|
width: `${treeviewStore.additionalPanelWidth}px`,
|
|
276
320
|
}"
|
|
277
321
|
>
|
|
278
|
-
<template v-for="(view, index) in
|
|
322
|
+
<template v-for="(view, index) in shownViews" :key="view.id">
|
|
279
323
|
<div
|
|
280
324
|
class="view-wrapper"
|
|
281
325
|
:class="{
|
|
282
|
-
'drag-over':
|
|
326
|
+
'drag-over': draggedId !== undefined && draggedId !== view.id,
|
|
283
327
|
}"
|
|
284
328
|
:style="{ flex: `0 0 ${rowHeights[index]}%` }"
|
|
285
329
|
@dragover="onDragOver"
|
|
286
|
-
@drop="onDrop(
|
|
330
|
+
@drop="onDrop(view.id)"
|
|
287
331
|
>
|
|
288
332
|
<ViewerObjectTreeBox
|
|
289
333
|
:title="view.title"
|
|
290
334
|
:icon="view.geode_object_type ? geodeObjectImage(view.geode_object_type) : undefined"
|
|
291
335
|
:scroll-top="view.scrollTop"
|
|
292
336
|
closable
|
|
293
|
-
:border-radius="`0 ${index === 0 ? PANEL_RADIUS : '0'} ${index ===
|
|
337
|
+
:border-radius="`0 ${index === 0 ? PANEL_RADIUS : '0'} ${index === shownViews.length - 1 ? PANEL_RADIUS : '0'} 0`"
|
|
294
338
|
:border-left="false"
|
|
295
339
|
:accent="
|
|
296
340
|
view.color
|
|
@@ -298,7 +342,8 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
|
298
342
|
: undefined
|
|
299
343
|
"
|
|
300
344
|
@close="treeviewStore.closeView(view.id)"
|
|
301
|
-
@dragstart="onDragStart(
|
|
345
|
+
@dragstart="onDragStart(view.id)"
|
|
346
|
+
@dragend="onDragEnd"
|
|
302
347
|
@update:scroll-top="treeviewStore.setScrollTop(view.id, $event)"
|
|
303
348
|
@header-enter="onModelHeaderEnter(view.id)"
|
|
304
349
|
@header-leave="onModelHeaderLeave(view.id)"
|
|
@@ -322,17 +367,17 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
|
322
367
|
</ViewerObjectTreeBox>
|
|
323
368
|
</div>
|
|
324
369
|
<div
|
|
325
|
-
v-if="index <
|
|
370
|
+
v-if="index < shownViews.length - 1"
|
|
326
371
|
class="v-split-resizer"
|
|
327
372
|
@mousedown="onVerticalResizeStart($event, index)"
|
|
328
373
|
/>
|
|
329
374
|
</template>
|
|
330
375
|
</div>
|
|
331
376
|
<div
|
|
332
|
-
v-if="
|
|
377
|
+
v-if="mainView || shownViews.length > 0"
|
|
333
378
|
class="total-resizer"
|
|
334
379
|
@mousedown="
|
|
335
|
-
|
|
380
|
+
shownViews.length > 0
|
|
336
381
|
? onAdditionalResizeStart($event)
|
|
337
382
|
: mainView
|
|
338
383
|
? onResizeStart($event)
|
|
@@ -378,10 +423,21 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
|
378
423
|
content: "";
|
|
379
424
|
position: absolute;
|
|
380
425
|
inset: 0;
|
|
381
|
-
/* Adaptive glass: apps can tint it (an "r, g, b" triplet)
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
426
|
+
/* Adaptive glass: apps can tint it (an "r, g, b" triplet), change its blending and set a minimum opacity, per
|
|
427
|
+
theme (the radial menu's one) */
|
|
428
|
+
background: rgba(
|
|
429
|
+
var(--ogw-viewer-glass-tint, 255, 255, 255),
|
|
430
|
+
max(var(--adaptive-opacity), var(--ogw-viewer-glass-min-opacity, 0))
|
|
431
|
+
);
|
|
432
|
+
/* Apps can replace the adaptive blur and dimming of the backdrop, "none" keeps it sharp */
|
|
433
|
+
backdrop-filter: var(
|
|
434
|
+
--ogw-viewer-glass-backdrop,
|
|
435
|
+
blur(var(--adaptive-blur)) brightness(var(--adaptive-brightness))
|
|
436
|
+
);
|
|
437
|
+
-webkit-backdrop-filter: var(
|
|
438
|
+
--ogw-viewer-glass-backdrop,
|
|
439
|
+
blur(var(--adaptive-blur)) brightness(var(--adaptive-brightness))
|
|
440
|
+
);
|
|
385
441
|
mix-blend-mode: var(--ogw-viewer-glass-blend, lighten);
|
|
386
442
|
z-index: 0;
|
|
387
443
|
pointer-events: none;
|
|
@@ -396,6 +452,79 @@ function onVerticalResizeStart(event: MouseEvent, index: number): void {
|
|
|
396
452
|
z-index: 1;
|
|
397
453
|
}
|
|
398
454
|
|
|
455
|
+
.activity-bar-separator {
|
|
456
|
+
width: 24px;
|
|
457
|
+
height: 1px;
|
|
458
|
+
margin-bottom: 6px;
|
|
459
|
+
flex-shrink: 0;
|
|
460
|
+
background-color: rgba(var(--v-border-color), var(--v-border-opacity));
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.model-tree-toggle-all {
|
|
464
|
+
margin-bottom: 2px;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/* A model tree button: the model type icon, marked with the color of its tree, faded while collapsed */
|
|
468
|
+
.model-tree-toggle {
|
|
469
|
+
display: flex;
|
|
470
|
+
justify-content: center;
|
|
471
|
+
width: 100%;
|
|
472
|
+
margin-bottom: 2px;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.model-tree-toggle::before {
|
|
476
|
+
content: "";
|
|
477
|
+
position: absolute;
|
|
478
|
+
left: 0;
|
|
479
|
+
top: 10px;
|
|
480
|
+
bottom: 10px;
|
|
481
|
+
width: 3px;
|
|
482
|
+
border-radius: 0 2px 2px 0;
|
|
483
|
+
background-color: var(--model-tree-color, transparent);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.model-tree-toggle .v-btn {
|
|
487
|
+
background-color: rgba(var(--v-theme-on-surface), 0.08);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* Where a dragged model button lands */
|
|
491
|
+
.model-tree-toggle.drop-before::after,
|
|
492
|
+
.model-tree-toggle.drop-after::after {
|
|
493
|
+
content: "";
|
|
494
|
+
position: absolute;
|
|
495
|
+
left: 8px;
|
|
496
|
+
right: 8px;
|
|
497
|
+
height: 2px;
|
|
498
|
+
border-radius: 1px;
|
|
499
|
+
background-color: rgb(var(--v-theme-primary));
|
|
500
|
+
pointer-events: none;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.model-tree-toggle.drop-before::after {
|
|
504
|
+
top: -2px;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.model-tree-toggle.drop-after::after {
|
|
508
|
+
bottom: -2px;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.model-tree-toggle.is-collapsed::before {
|
|
512
|
+
opacity: 0.5;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.model-tree-toggle.is-collapsed .v-btn {
|
|
516
|
+
background-color: transparent;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.model-tree-toggle.is-collapsed :deep(.v-btn__content) {
|
|
520
|
+
opacity: 0.55;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.model-tree-toggle-icon {
|
|
524
|
+
flex: 0 0 auto;
|
|
525
|
+
filter: var(--ogw-mono-icon-filter, brightness(0));
|
|
526
|
+
}
|
|
527
|
+
|
|
399
528
|
.treeview-container {
|
|
400
529
|
height: 100%;
|
|
401
530
|
width: max-content;
|
|
@@ -185,7 +185,8 @@ function handleHoverEnter({
|
|
|
185
185
|
}): void {
|
|
186
186
|
const actualItem = item.raw || item;
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
// Images are not pickable: the viewer has nothing to highlight
|
|
189
|
+
if (!actualItem.viewer_object_type || actualItem.viewer_object_type === "image") {
|
|
189
190
|
return;
|
|
190
191
|
}
|
|
191
192
|
|
|
@@ -209,7 +210,7 @@ function handleHoverEnter({
|
|
|
209
210
|
|
|
210
211
|
function handleHoverLeave({ item }: { item: TreeGroupItem }): void {
|
|
211
212
|
const actualItem = item.raw || item;
|
|
212
|
-
if (!actualItem.viewer_object_type) {
|
|
213
|
+
if (!actualItem.viewer_object_type || actualItem.viewer_object_type === "image") {
|
|
213
214
|
return;
|
|
214
215
|
}
|
|
215
216
|
if (treeviewStore.hoveredModelId === actualItem.id) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
|
|
2
|
+
import type { HighlightableObjectType } from "@ogw_front/types/identifiers";
|
|
2
3
|
import type { ParamsOf } from "@ogw_shared/utils/types";
|
|
3
4
|
import type { ViewerId } from "@geode/opengeodeweb-viewer/schema_types";
|
|
4
|
-
import type { ViewerObjectType } from "@geode/opengeodeweb-microservice/data_types";
|
|
5
5
|
import { consola } from "consola";
|
|
6
6
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
7
7
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
@@ -9,7 +9,8 @@ import vtk_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_sc
|
|
|
9
9
|
|
|
10
10
|
const HOVER_DELAY = 200;
|
|
11
11
|
|
|
12
|
-
type HighlightSchema =
|
|
12
|
+
type HighlightSchema =
|
|
13
|
+
(typeof vtk_schemas)["opengeodeweb_viewer"][HighlightableObjectType]["highlight"];
|
|
13
14
|
type BlockIdsProvider =
|
|
14
15
|
| readonly ViewerId[]
|
|
15
16
|
| (() => readonly ViewerId[] | Promise<readonly ViewerId[]>);
|
|
@@ -37,12 +38,12 @@ function useHoverhighlight(): {
|
|
|
37
38
|
// Item hovered last, whose highlight may still be pending
|
|
38
39
|
let currentId: DataId | undefined = undefined;
|
|
39
40
|
// Item the viewer was asked to highlight, the only one to unhighlight
|
|
40
|
-
let highlighted: { dataId: DataId; type:
|
|
41
|
+
let highlighted: { dataId: DataId; type: HighlightableObjectType } | undefined = undefined;
|
|
41
42
|
|
|
42
43
|
function onHoverEnter(
|
|
43
44
|
dataId: DataId,
|
|
44
45
|
block_ids_provider: BlockIdsProvider = [],
|
|
45
|
-
type:
|
|
46
|
+
type: HighlightableObjectType = "model",
|
|
46
47
|
immediate = false,
|
|
47
48
|
): void {
|
|
48
49
|
if (timer) {
|
|
@@ -109,7 +110,7 @@ function useHoverhighlight(): {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
async function unhighlightAction(
|
|
112
|
-
type:
|
|
113
|
+
type: HighlightableObjectType,
|
|
113
114
|
dataId: DataId,
|
|
114
115
|
request: {
|
|
115
116
|
schema: HighlightSchema;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
2
|
+
|
|
3
|
+
// A drop target has to accept the drag over it
|
|
4
|
+
function onDragOver(event: DragEvent): void {
|
|
5
|
+
event.preventDefault();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Model trees are reordered by dragging their panel header or their button in the activity bar
|
|
9
|
+
export function useModelTreeDrag(): {
|
|
10
|
+
draggedId: Ref<string | undefined>;
|
|
11
|
+
dropTargetId: Ref<string | undefined>;
|
|
12
|
+
onDragStart: (id: string) => void;
|
|
13
|
+
onDragOver: (event: DragEvent) => void;
|
|
14
|
+
onDragEnd: () => void;
|
|
15
|
+
onDrop: (targetId: string) => void;
|
|
16
|
+
dropSide: (targetId: string) => string | undefined;
|
|
17
|
+
} {
|
|
18
|
+
const treeviewStore = useTreeviewStore();
|
|
19
|
+
const draggedId = ref<string | undefined>(undefined);
|
|
20
|
+
// Model button hovered while dragging another one: the line shows where the dragged one lands
|
|
21
|
+
const dropTargetId = ref<string | undefined>(undefined);
|
|
22
|
+
|
|
23
|
+
function viewIndex(id: string): number {
|
|
24
|
+
return treeviewStore.opened_views.findIndex((view) => view.id === id);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function onDragStart(id: string): void {
|
|
28
|
+
draggedId.value = id;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function onDragEnd(): void {
|
|
32
|
+
draggedId.value = undefined;
|
|
33
|
+
dropTargetId.value = undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function onDrop(targetId: string): void {
|
|
37
|
+
if (draggedId.value !== undefined && draggedId.value !== targetId) {
|
|
38
|
+
treeviewStore.moveView(viewIndex(draggedId.value), viewIndex(targetId));
|
|
39
|
+
}
|
|
40
|
+
onDragEnd();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The dragged tree takes the place of the target: before it when moving up, after it when moving down
|
|
44
|
+
function dropSide(targetId: string): string | undefined {
|
|
45
|
+
if (
|
|
46
|
+
draggedId.value === undefined ||
|
|
47
|
+
dropTargetId.value !== targetId ||
|
|
48
|
+
draggedId.value === targetId
|
|
49
|
+
) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return viewIndex(draggedId.value) > viewIndex(targetId) ? "drop-before" : "drop-after";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return { draggedId, dropTargetId, onDragStart, onDragOver, onDragEnd, onDrop, dropSide };
|
|
56
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BrightnessRange } from "@ogw_internal/stores/hybrid_viewer/brightness";
|
|
1
2
|
import type { MaybeComputedElementRef } from "@vueuse/core";
|
|
2
3
|
import { consola } from "consola";
|
|
3
4
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
@@ -62,9 +63,10 @@ function getValue(val: unknown): number {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
// How much the glass has to cover its backdrop to keep the text readable: dark text (light theme)
|
|
65
|
-
// Needs it over
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
// Needs it over the darkest pixel of the backdrop, light text (dark theme) over the brightest one. Same curve
|
|
67
|
+
// Both ways.
|
|
68
|
+
function contrastFactor(range: BrightnessRange, isDark: boolean): number {
|
|
69
|
+
const backdrop = isDark ? 1 - range.brightest : range.darkest;
|
|
68
70
|
const normalized = Math.min(1, backdrop / LUMINANCE_THRESHOLD);
|
|
69
71
|
return (1 - normalized) ** ADAPTIVE_EXPONENT;
|
|
70
72
|
}
|
|
@@ -76,7 +78,7 @@ interface GlassStyles {
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
function useGlassStyles(
|
|
79
|
-
brightness: Ref<
|
|
81
|
+
brightness: Ref<BrightnessRange>,
|
|
80
82
|
options: AdaptiveStylesOptions,
|
|
81
83
|
): ComputedRef<GlassStyles> {
|
|
82
84
|
const theme = useTheme();
|
|
@@ -99,12 +101,12 @@ function useGlassStyles(
|
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
// oxlint-disable max-lines-per-function
|
|
102
|
-
|
|
104
|
+
function useAdaptiveStyles(
|
|
103
105
|
target: AdaptiveStylesTarget,
|
|
104
106
|
options: AdaptiveStylesOptions = {},
|
|
105
107
|
): {
|
|
106
108
|
adaptiveStyles: ComputedRef<GlassStyles>;
|
|
107
|
-
brightness: Ref<
|
|
109
|
+
brightness: Ref<BrightnessRange>;
|
|
108
110
|
} {
|
|
109
111
|
const hybridViewerStore = useHybridViewerStore();
|
|
110
112
|
const treeviewStore = useTreeviewStore();
|
|
@@ -154,10 +156,13 @@ export function useAdaptiveStyles(
|
|
|
154
156
|
const width = computed(() => unwrapped.value.width);
|
|
155
157
|
const height = computed(() => unwrapped.value.height);
|
|
156
158
|
|
|
157
|
-
const brightness = ref(
|
|
159
|
+
const brightness = ref<BrightnessRange>({
|
|
160
|
+
darkest: LUMINANCE_THRESHOLD,
|
|
161
|
+
brightest: LUMINANCE_THRESHOLD,
|
|
162
|
+
});
|
|
158
163
|
|
|
159
164
|
function calculateBrightness(): void {
|
|
160
|
-
brightness.value = hybridViewerStore.
|
|
165
|
+
brightness.value = hybridViewerStore.getBrightnessRange({
|
|
161
166
|
x: x.value,
|
|
162
167
|
y: y.value,
|
|
163
168
|
width: width.value,
|
|
@@ -207,3 +212,5 @@ export function useAdaptiveStyles(
|
|
|
207
212
|
brightness,
|
|
208
213
|
};
|
|
209
214
|
}
|
|
215
|
+
|
|
216
|
+
export { contrastFactor, useAdaptiveStyles };
|
|
@@ -112,7 +112,12 @@ export function useOverlappingPicker(): UseOverlappingPickerReturn {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
async function getViewableIds(): Promise<string[]> {
|
|
115
|
-
|
|
115
|
+
// Images are not pickable
|
|
116
|
+
const activeIds = new Set(
|
|
117
|
+
dataItems.value
|
|
118
|
+
.filter((i: DataItem) => i.viewer_object_type !== "image")
|
|
119
|
+
.map((i: DataItem) => i.data_id),
|
|
120
|
+
);
|
|
116
121
|
const visibleStyleIds = Object.keys(dataStyleStore.styles).filter(
|
|
117
122
|
(styleId) => activeIds.has(styleId) && dataStyleStore.objectVisibility(styleId) === true,
|
|
118
123
|
);
|
|
@@ -140,14 +140,20 @@ function useVirtualTree(
|
|
|
140
140
|
};
|
|
141
141
|
const displayItems = computed(() => flattenTree(flattenContext, props.value.items ?? []));
|
|
142
142
|
|
|
143
|
+
// A search opens every group to show its matches: clearing it reopens the groups opened before
|
|
144
|
+
let openedBeforeSearch: unknown[] | undefined = undefined;
|
|
143
145
|
watch(
|
|
144
146
|
() => props.value.search,
|
|
145
147
|
(newSearch, oldSearch) => {
|
|
146
148
|
const hasNewSearch = newSearch !== undefined && newSearch !== "";
|
|
147
149
|
const hadOldSearch = oldSearch !== undefined && oldSearch !== "";
|
|
148
150
|
if (hasNewSearch && !hadOldSearch) {
|
|
151
|
+
openedBeforeSearch = [...(props.value.opened ?? [])];
|
|
149
152
|
const allIds = collectNonLeafIds(props.value.items ?? []);
|
|
150
|
-
emit("update:opened", [...new Set([...
|
|
153
|
+
emit("update:opened", [...new Set([...openedBeforeSearch, ...allIds])]);
|
|
154
|
+
} else if (!hasNewSearch && hadOldSearch && openedBeforeSearch !== undefined) {
|
|
155
|
+
emit("update:opened", openedBeforeSearch);
|
|
156
|
+
openedBeforeSearch = undefined;
|
|
151
157
|
}
|
|
152
158
|
},
|
|
153
159
|
);
|
package/app/stores/data_style.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { getDefaultStyle } from "@ogw_front/utils/default_styles";
|
|
|
14
14
|
import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
|
|
15
15
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
16
16
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
17
|
+
import { useImageStyle } from "@ogw_internal/stores/data_style/image/index";
|
|
17
18
|
import { useMeshStyle } from "@ogw_internal/stores/data_style/mesh/index";
|
|
18
19
|
import { useModelStyle } from "@ogw_internal/stores/data_style/model/index";
|
|
19
20
|
import { useSceneStyle } from "@ogw_internal/stores/data_style/scene";
|
|
@@ -44,6 +45,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
44
45
|
// oxlint-disable-next-line max-lines-per-function
|
|
45
46
|
export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
46
47
|
const dataStyleState = useDataStyleState();
|
|
48
|
+
const imageStyleStore = useImageStyle();
|
|
47
49
|
const meshStyleStore = useMeshStyle();
|
|
48
50
|
const modelStyleStore = useModelStyle();
|
|
49
51
|
const sceneStyleStore = useSceneStyle();
|
|
@@ -76,6 +78,9 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
76
78
|
|
|
77
79
|
const { viewer_object_type } = item;
|
|
78
80
|
|
|
81
|
+
if (viewer_object_type === "image") {
|
|
82
|
+
return imageStyleStore.setImageVisibility(dataId, visibility);
|
|
83
|
+
}
|
|
79
84
|
if (viewer_object_type === "mesh") {
|
|
80
85
|
return meshStyleStore.setMeshVisibility(dataId, visibility);
|
|
81
86
|
}
|
|
@@ -93,6 +98,9 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
93
98
|
|
|
94
99
|
const { viewer_object_type } = item;
|
|
95
100
|
|
|
101
|
+
if (viewer_object_type === "image") {
|
|
102
|
+
return imageStyleStore.applyImageStyle(dataId);
|
|
103
|
+
}
|
|
96
104
|
if (viewer_object_type === "mesh") {
|
|
97
105
|
return meshStyleStore.applyMeshStyle(dataId);
|
|
98
106
|
}
|
|
@@ -158,7 +166,9 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
158
166
|
return;
|
|
159
167
|
}
|
|
160
168
|
const viewerObjectType = meta.viewer_object_type;
|
|
161
|
-
if (viewerObjectType === "
|
|
169
|
+
if (viewerObjectType === "image") {
|
|
170
|
+
await imageStyleStore.applyImageStyle(dataId);
|
|
171
|
+
} else if (viewerObjectType === "mesh") {
|
|
162
172
|
await meshStyleStore.applyMeshStyle(dataId);
|
|
163
173
|
} else if (viewerObjectType === "model") {
|
|
164
174
|
await modelStyleStore.applyModelStyle(dataId);
|
|
@@ -177,6 +187,7 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
177
187
|
applyAllStylesFromState,
|
|
178
188
|
...dataStyleState,
|
|
179
189
|
...attributeTimeStepStyle,
|
|
190
|
+
...imageStyleStore,
|
|
180
191
|
...meshStyleStore,
|
|
181
192
|
...modelStyleStore,
|
|
182
193
|
...sceneStyleStore,
|