Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 26 additions & 76 deletions app/components/Viewer/TreeComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,90 +13,40 @@

const emit = defineEmits(["show-menu"])

const items = dataStore.formatedMeshComponents(props.id)
const mesh_components_selection = ref(
dataStyleStore.visibleMeshComponents(props.id),
const items = ref([])
const mesh_components_selection = dataStyleStore.visibleMeshComponents(
props.id,
)

watchEffect(async () => {
items.value = await dataStore.formatedMeshComponents(props.id)
})

watch(
mesh_components_selection,
(current, previous) => {
if (!previous) previous = []
else {
const { added, removed } = compareSelections(current, previous)
async (current, previous) => {
if (!previous) return

const { added, removed } = compareSelections(current, previous)

const [added_corners, added_lines, added_surfaces, added_blocks] =
sortMeshComponents(added)
const [
removed_corners,
removed_lines,
removed_surfaces,
removed_blocks,
] = sortMeshComponents(removed)
if (added_corners.length > 0) {
dataStyleStore.setModelCornersVisibility(
props.id,
added_corners,
true,
)
}
if (added_lines.length > 0) {
dataStyleStore.setModelLinesVisibility(props.id, added_lines, true)
}
if (added_surfaces.length > 0) {
dataStyleStore.setModelSurfacesVisibility(
props.id,
added_surfaces,
true,
)
}
if (added_blocks.length > 0) {
dataStyleStore.setModelBlocksVisibility(props.id, added_blocks, true)
}
if (removed_corners.length > 0) {
dataStyleStore.setModelCornersVisibility(
props.id,
removed_corners,
false,
)
}
if (removed_lines.length > 0) {
dataStyleStore.setModelLinesVisibility(props.id, removed_lines, false)
}
if (removed_surfaces.length > 0) {
dataStyleStore.setModelSurfacesVisibility(
props.id,
removed_surfaces,
false,
)
}
if (removed_blocks.length > 0) {
dataStyleStore.setModelBlocksVisibility(
props.id,
removed_blocks,
false,
)
}
hybridViewerStore.remoteRender()
if (added.length > 0) {
await dataStyleStore.setModelMeshComponentsVisibility(
props.id,
added,
true,
)
}
if (removed.length > 0) {
await dataStyleStore.setModelMeshComponentsVisibility(
props.id,
removed,
false,
)
}
hybridViewerStore.remoteRender()
},
{ immediate: true, deep: true },
{ deep: true },
)

function sortMeshComponents(items) {
var corner_ids = [],
line_ids = [],
surface_ids = [],
block_ids = []
for (const item of items) {
const item_type = dataStore.meshComponentType(props.id, item)
if (item_type === "corner") corner_ids.push(item)
else if (item_type === "line") line_ids.push(item)
else if (item_type === "surface") surface_ids.push(item)
else if (item_type === "block") block_ids.push(item)
}
return [corner_ids, line_ids, surface_ids, block_ids]
}
</script>

<template>
Expand Down
4 changes: 2 additions & 2 deletions internal/stores/model/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function useModelStyle() {
)
}

async function setModelMeshComponentVisibility(
async function setModelMeshComponentsVisibility(
id,
component_geode_ids,
visibility,
Expand Down Expand Up @@ -188,7 +188,7 @@ export default function useModelStyle() {
modelMeshComponentVisibility,
setModelVisibility,
setModelColor,
setModelMeshComponentVisibility,
setModelMeshComponentsVisibility,
applyModelStyle,
setModelMeshComponentsDefaultStyle,
...useModelBlocksStyle(),
Expand Down
1 change: 0 additions & 1 deletion tests/integration/microservices/back/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
# pip-compile --output-file=tests/integration/microservices/back/requirements.txt tests/integration/microservices/back/requirements.in
#

opengeodeweb-back==6.*,>=6.1.0rc3
1 change: 0 additions & 1 deletion tests/integration/microservices/viewer/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
# pip-compile --output-file=tests/integration/microservices/viewer/requirements.txt tests/integration/microservices/viewer/requirements.in
#

opengeodeweb-viewer==1.*,>=1.15.1rc2
Loading