Skip to content

Commit a0ecf24

Browse files
fix tests
1 parent a37cdc3 commit a0ecf24

File tree

12 files changed

+219
-415
lines changed

12 files changed

+219
-415
lines changed

composables/viewer_call.js

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,43 @@ export function viewer_call(
2020
const client = viewer_store.client
2121

2222
return new Promise((resolve, reject) => {
23-
if (client) {
24-
viewer_store.start_request()
25-
client
26-
.getConnection()
27-
.getSession()
28-
.call(schema.$id, [params])
29-
.then(
30-
(value) => {
31-
if (response_function) {
32-
response_function(value)
33-
}
34-
resolve()
35-
},
36-
(reason) => {
37-
if (request_error_function) {
38-
request_error_function(reason)
39-
}
40-
reject()
41-
},
42-
)
43-
.catch((error) => {
44-
feedback_store.add_error(
45-
error.code,
46-
schema.route,
47-
error.message,
48-
error.message,
49-
)
50-
if (response_error_function) {
51-
response_error_function(error)
23+
if (!client) {
24+
reject()
25+
}
26+
viewer_store.start_request()
27+
client
28+
.getConnection()
29+
.getSession()
30+
.call(schema.$id, [params])
31+
.then(
32+
(value) => {
33+
if (response_function) {
34+
response_function(value)
35+
}
36+
resolve()
37+
},
38+
(reason) => {
39+
if (request_error_function) {
40+
request_error_function(reason)
5241
}
5342
reject()
54-
})
55-
.finally(() => {
56-
viewer_store.stop_request()
57-
})
58-
}
43+
},
44+
)
45+
.catch((error) => {
46+
feedback_store.add_error(
47+
error.code,
48+
schema.route,
49+
error.message,
50+
error.message,
51+
)
52+
if (response_error_function) {
53+
response_error_function(error)
54+
}
55+
reject()
56+
})
57+
.finally(() => {
58+
viewer_store.stop_request()
59+
})
5960
})
6061
}
6162

internal_stores/mesh/edges.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ export function useMeshEdgesStyle() {
8181
)
8282
}
8383

84-
function applyEdgesStyle(id, style) {
85-
setEdgesVisibility(id, style.visibility)
86-
setEdgesActiveColoring(id, style.coloring.active)
87-
// setEdgesWidth(id, style.width);
84+
async function applyEdgesStyle(id, style) {
85+
return Promise.all([
86+
setEdgesVisibility(id, style.visibility),
87+
setEdgesActiveColoring(id, style.coloring.active),
88+
// setEdgesWidth(id, style.width);
89+
])
8890
}
8991

9092
return {

internal_stores/mesh/index.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,29 @@ export default function useMeshStyle() {
2222
response_function: () => {
2323
hybridViewerStore.setVisibility(id, visibility)
2424
dataStyleStore.styles[id].visibility = visibility
25-
console.log("setMeshVisibility", dataStyleStore.styles[id].visibility)
2625
},
2726
},
2827
)
2928
}
3029

31-
function applyMeshDefaultStyle(id) {
32-
const id_style = dataStyleStore.styles[id]
33-
for (const [key, value] of Object.entries(id_style)) {
34-
if (key == "visibility") setMeshVisibility(id, value)
35-
else if (key == "points") pointsStyleStore.applyPointsStyle(id, value)
36-
else if (key == "edges") edgesStyleStore.applyEdgesStyle(id, value)
37-
else if (key == "polygons")
38-
polygonsStyleStore.applyPolygonsStyle(id, value)
39-
else if (key == "polyhedra")
40-
polyhedraStyleStore.applyPolyhedraStyle(id, value)
41-
}
30+
async function applyMeshDefaultStyle(id) {
31+
return new Promise(async (resolve) => {
32+
const id_style = dataStyleStore.styles[id]
33+
for (const [key, value] of Object.entries(id_style)) {
34+
if (key == "visibility") {
35+
await setMeshVisibility(id, value)
36+
} else if (key == "points") {
37+
await pointsStyleStore.applyPointsStyle(id, value)
38+
} else if (key == "edges") {
39+
await edgesStyleStore.applyEdgesStyle(id, value)
40+
} else if (key == "polygons") {
41+
await polygonsStyleStore.applyPolygonsStyle(id, value)
42+
} else if (key == "polyhedra") {
43+
await polyhedraStyleStore.applyPolyhedraStyle(id, value)
44+
}
45+
}
46+
resolve()
47+
})
4248
}
4349

4450
return {

internal_stores/mesh/points.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ export function useMeshPointsStyle() {
108108
}
109109

110110
function applyPointsStyle(id, style) {
111-
setPointsVisibility(id, style.visibility)
112-
setPointsActiveColoring(id, style.coloring.active)
113-
setPointsSize(id, style.size)
111+
return Promise.all([
112+
setPointsVisibility(id, style.visibility),
113+
setPointsActiveColoring(id, style.coloring.active),
114+
setPointsSize(id, style.size),
115+
])
114116
}
115117

116118
return {

internal_stores/mesh/polygons.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ export function useMeshPolygonsStyle() {
137137
}
138138

139139
function applyPolygonsStyle(id, style) {
140-
setPolygonsVisibility(id, style.visibility)
141-
setPolygonsActiveColoring(id, style.coloring.active)
140+
return Promise.all([
141+
setPolygonsVisibility(id, style.visibility),
142+
setPolygonsActiveColoring(id, style.coloring.active),
143+
])
142144
}
143145

144146
return {

internal_stores/mesh/polyhedra.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ export function useMeshPolyhedraStyle() {
115115
}
116116

117117
function applyPolyhedraStyle(id, style) {
118-
setPolyhedraVisibility(id, style.visibility)
119-
setPolyhedraActiveColoring(id, style.coloring.active)
118+
return Promise.all([
119+
setPolyhedraVisibility(id, style.visibility),
120+
setPolyhedraActiveColoring(id, style.coloring.active),
121+
])
120122
}
121123

122124
return {

0 commit comments

Comments
 (0)