@geode/opengeodeweb-front 10.14.0-rc.7 → 10.14.0
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.
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
import ObjectTreeControls from "@ogw_front/components/Viewer/ObjectTree/Base/Controls.vue";
|
|
3
3
|
import ObjectTreeItemLabel from "@ogw_front/components/Viewer/ObjectTree/Base/ItemLabel.vue";
|
|
4
4
|
import { compareSelections } from "@ogw_front/utils/treeview";
|
|
5
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
5
6
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
7
|
+
import { useHoverhighlight } from "@ogw_front/composables/use_hover_highlight";
|
|
6
8
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
7
9
|
import { useTreeFilter } from "@ogw_front/composables/use_tree_filter";
|
|
8
10
|
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
9
11
|
|
|
10
12
|
const treeviewStore = useTreeviewStore();
|
|
13
|
+
const dataStore = useDataStore();
|
|
11
14
|
const dataStyleStore = useDataStyleStore();
|
|
12
15
|
const hybridViewerStore = useHybridViewerStore();
|
|
16
|
+
const { onHoverEnter, onHoverLeave } = useHoverhighlight();
|
|
13
17
|
|
|
14
18
|
const emit = defineEmits(["show-menu"]);
|
|
15
19
|
|
|
@@ -62,6 +66,21 @@ function isModel(item) {
|
|
|
62
66
|
actualItem.viewer_type === "model" || ["BRep", "Section"].includes(actualItem.geode_object_type)
|
|
63
67
|
);
|
|
64
68
|
}
|
|
69
|
+
|
|
70
|
+
async function handleHoverEnter(item) {
|
|
71
|
+
const actualItem = item.raw || item;
|
|
72
|
+
const is_model = isModel(item);
|
|
73
|
+
let block_ids = [];
|
|
74
|
+
if (is_model) {
|
|
75
|
+
block_ids = await dataStore.getAllModelComponentsViewerIds(actualItem.id);
|
|
76
|
+
}
|
|
77
|
+
onHoverEnter(actualItem.id, block_ids, is_model ? "model" : "mesh");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function handleHoverLeave(item) {
|
|
81
|
+
const actualItem = item.raw || item;
|
|
82
|
+
onHoverLeave(actualItem.id);
|
|
83
|
+
}
|
|
65
84
|
</script>
|
|
66
85
|
|
|
67
86
|
<template>
|
|
@@ -89,6 +108,8 @@ function isModel(item) {
|
|
|
89
108
|
<template #title="{ item }">
|
|
90
109
|
<ObjectTreeItemLabel
|
|
91
110
|
:item="item"
|
|
111
|
+
@mouseenter="handleHoverEnter(item)"
|
|
112
|
+
@mouseleave="handleHoverLeave(item)"
|
|
92
113
|
@contextmenu="emit('show-menu', { event: $event, itemId: item.id })"
|
|
93
114
|
/>
|
|
94
115
|
</template>
|
|
@@ -5,11 +5,13 @@ import ObjectTreeItemLabel from "@ogw_front/components/Viewer/ObjectTree/Base/It
|
|
|
5
5
|
import { compareSelections } from "@ogw_front/utils/treeview";
|
|
6
6
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
7
7
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
8
|
+
import { useHoverhighlight } from "@ogw_front/composables/use_hover_highlight";
|
|
8
9
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
9
10
|
import { useTreeFilter } from "@ogw_front/composables/use_tree_filter";
|
|
10
11
|
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
11
12
|
|
|
12
13
|
const { id: viewId } = defineProps({ id: { type: String, required: true } });
|
|
14
|
+
const { onHoverEnter, onHoverLeave } = useHoverhighlight();
|
|
13
15
|
const emit = defineEmits(["show-menu"]);
|
|
14
16
|
|
|
15
17
|
const dataStore = useDataStore();
|
|
@@ -63,6 +65,18 @@ function showContextMenu(event, item) {
|
|
|
63
65
|
modelComponentType: actualItem.category ? undefined : actualItem.id,
|
|
64
66
|
});
|
|
65
67
|
}
|
|
68
|
+
|
|
69
|
+
function handleHoverEnter(item) {
|
|
70
|
+
const actualItem = item.raw || item;
|
|
71
|
+
const block_ids = actualItem.category
|
|
72
|
+
? [actualItem.viewer_id]
|
|
73
|
+
: actualItem.children?.map((child) => child.viewer_id) || [];
|
|
74
|
+
onHoverEnter(viewId, block_ids);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function handleHoverLeave() {
|
|
78
|
+
onHoverLeave(viewId);
|
|
79
|
+
}
|
|
66
80
|
</script>
|
|
67
81
|
|
|
68
82
|
<template>
|
|
@@ -95,6 +109,8 @@ function showContextMenu(event, item) {
|
|
|
95
109
|
<ObjectTreeItemLabel
|
|
96
110
|
:item="item"
|
|
97
111
|
show-tooltip
|
|
112
|
+
@mouseenter="handleHoverEnter(item)"
|
|
113
|
+
@mouseleave="handleHoverLeave(item)"
|
|
98
114
|
@contextmenu="showContextMenu($event, item)"
|
|
99
115
|
/>
|
|
100
116
|
</template>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
2
|
+
import vtk_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
3
|
+
|
|
4
|
+
const HOVER_DELAY = 1000;
|
|
5
|
+
|
|
6
|
+
export function useHoverhighlight() {
|
|
7
|
+
const viewerStore = useViewerStore();
|
|
8
|
+
let timer = undefined;
|
|
9
|
+
let currentId = undefined;
|
|
10
|
+
let currentType = undefined;
|
|
11
|
+
|
|
12
|
+
function onHoverEnter(id, block_ids = [], type = "model") {
|
|
13
|
+
if (timer) {
|
|
14
|
+
clearTimeout(timer);
|
|
15
|
+
}
|
|
16
|
+
const schema = vtk_schemas.opengeodeweb_viewer[type].highlight;
|
|
17
|
+
timer = setTimeout(async () => {
|
|
18
|
+
currentId = id;
|
|
19
|
+
currentType = type;
|
|
20
|
+
const params = {
|
|
21
|
+
id,
|
|
22
|
+
visibility: true,
|
|
23
|
+
...(type === "model" && { block_ids }),
|
|
24
|
+
};
|
|
25
|
+
await viewerStore.request(schema, params);
|
|
26
|
+
}, HOVER_DELAY);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function onHoverLeave(id) {
|
|
30
|
+
if (timer) {
|
|
31
|
+
clearTimeout(timer);
|
|
32
|
+
timer = undefined;
|
|
33
|
+
}
|
|
34
|
+
if (currentId === id) {
|
|
35
|
+
const schema = vtk_schemas.opengeodeweb_viewer[currentType].highlight;
|
|
36
|
+
const params = {
|
|
37
|
+
id,
|
|
38
|
+
visibility: false,
|
|
39
|
+
...(currentType === "model" && { block_ids: [] }),
|
|
40
|
+
};
|
|
41
|
+
viewerStore.request(schema, params);
|
|
42
|
+
currentId = undefined;
|
|
43
|
+
currentType = undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return { onHoverEnter, onHoverLeave };
|
|
48
|
+
}
|
package/app/stores/data.js
CHANGED
|
@@ -63,6 +63,7 @@ export const useDataStore = defineStore("data", () => {
|
|
|
63
63
|
id: meshComponent.geode_id,
|
|
64
64
|
title: meshComponent.name,
|
|
65
65
|
category: meshComponent.type,
|
|
66
|
+
viewer_id: meshComponent.viewer_id,
|
|
66
67
|
is_active: meshComponent.is_active,
|
|
67
68
|
})),
|
|
68
69
|
}));
|
|
@@ -206,6 +207,11 @@ export const useDataStore = defineStore("data", () => {
|
|
|
206
207
|
return await getMeshComponentGeodeIds(modelId, "Block");
|
|
207
208
|
}
|
|
208
209
|
|
|
210
|
+
async function getAllModelComponentsViewerIds(modelId) {
|
|
211
|
+
const components = await database.model_components.where("id").equals(modelId).toArray();
|
|
212
|
+
return components.map((component) => Number.parseInt(component.viewer_id, 10));
|
|
213
|
+
}
|
|
214
|
+
|
|
209
215
|
async function getMeshComponentsViewerIds(modelId, meshComponentGeodeIds) {
|
|
210
216
|
const components = await database.model_components
|
|
211
217
|
.where("[id+geode_id]")
|
|
@@ -245,6 +251,7 @@ export const useDataStore = defineStore("data", () => {
|
|
|
245
251
|
getLinesGeodeIds,
|
|
246
252
|
getSurfacesGeodeIds,
|
|
247
253
|
getBlocksGeodeIds,
|
|
254
|
+
getAllModelComponentsViewerIds,
|
|
248
255
|
getMeshComponentGeodeIds,
|
|
249
256
|
getMeshComponentsViewerIds,
|
|
250
257
|
getComponentByViewerId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geode/opengeodeweb-front",
|
|
3
|
-
"version": "10.14.0
|
|
3
|
+
"version": "10.14.0",
|
|
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": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"build": ""
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@geode/opengeodeweb-back": "
|
|
38
|
-
"@geode/opengeodeweb-viewer": "
|
|
37
|
+
"@geode/opengeodeweb-back": "latest",
|
|
38
|
+
"@geode/opengeodeweb-viewer": "latest",
|
|
39
39
|
"@google-cloud/run": "3.2.0",
|
|
40
40
|
"@kitware/vtk.js": "33.3.0",
|
|
41
41
|
"@mdi/font": "7.4.47",
|