Skip to content

Commit 0dc7973

Browse files
authored
Merge pull request #219 from Geode-solutions/feat/toggle_visibility-in_hybrid_viewer
feat(HybridViewer): toggle object visibility
2 parents 3d2b7cc + 847884c commit 0dc7973

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

internal_stores/mesh/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default function useMeshStyle() {
1010
const edgesStyleStore = useMeshEdgesStyle()
1111
const polygonsStyleStore = useMeshPolygonsStyle()
1212
const polyhedraStyleStore = useMeshPolyhedraStyle()
13+
const hybridViewerStore = useHybridViewerStore()
1314

1415
function setMeshVisibility(id, visibility) {
1516
viewer_call(
@@ -20,6 +21,7 @@ export default function useMeshStyle() {
2021
{
2122
response_function: () => {
2223
dataStyleStore.styles[id].visibility = visibility
24+
hybridViewerStore.setVisibility(id, visibility)
2325
console.log("setMeshVisibility", dataStyleStore.styles[id].visibility)
2426
},
2527
},

internal_stores/model/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default function useModelStyle() {
1616
const blocksStyleStore = useBlocksStyle()
1717
const modelEdgesStore = useModelEdgesStyle()
1818
const modelPointsStore = useModelPointsStyle()
19+
const hybridViewerStore = useHybridViewerStore()
1920

2021
/** Getters **/
2122
function modelVisibility(id) {
@@ -70,6 +71,7 @@ export default function useModelStyle() {
7071
{
7172
response_function: () => {
7273
dataStyleStore.styles[id].visibility = visibility
74+
hybridViewerStore.setVisibility(id, visibility)
7375
console.log("setModelVisibility", visibility)
7476
},
7577
},

stores/hybrid_viewer.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
6666
db[id] = { actor, polydata, mapper }
6767
}
6868

69+
async function setVisibility(id, visibility) {
70+
db[id].actor.setVisibility(visibility)
71+
const renderWindow = genericRenderWindow.value.getRenderWindow()
72+
renderWindow.render()
73+
}
6974
async function setZScaling(z_scale) {
7075
zScale.value = z_scale
7176
const renderer = genericRenderWindow.value.getRenderer()
@@ -183,6 +188,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
183188
db,
184189
genericRenderWindow,
185190
addItem,
191+
setVisibility,
186192
setZScaling,
187193
syncRemoteCamera,
188194
initHybridViewer,

0 commit comments

Comments
 (0)