Skip to content

Commit 7aaf3f5

Browse files
return viewer_call in dataStyle store
1 parent 84a4e22 commit 7aaf3f5

File tree

10 files changed

+50
-51
lines changed

10 files changed

+50
-51
lines changed

internal_stores/mesh/edges.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function useMeshEdgesStyle() {
2121

2222
/** Actions **/
2323
function setEdgesVisibility(id, visibility) {
24-
viewer_call(
24+
return viewer_call(
2525
{
2626
schema: mesh_edges_schemas.visibility,
2727
params: { id, visibility },
@@ -37,31 +37,30 @@ export function useMeshEdgesStyle() {
3737
},
3838
)
3939
}
40-
function setEdgesActiveColoring(id, type) {
41-
if (type == "color")
42-
setEdgesColor(id, dataStyleStore.styles[id].edges.coloring.color)
43-
else if (type == "vertex") {
44-
const vertex = dataStyleStore.styles[id].edges.coloring.vertex
45-
if (vertex !== null) setEdgesVertexAttribute(id, vertex)
46-
} else if (type == "edges") {
47-
const edges = dataStyleStore.styles[id].edges.coloring.edges
48-
if (edges !== null) setEdgesEdgeAttribute(id, edges)
40+
async function setEdgesActiveColoring(id, type) {
41+
const coloring = dataStyleStore.styles[id].edges.coloring
42+
if (type == "color") {
43+
setEdgesColor(id, coloring.color)
44+
// else if (type == "vertex") {
45+
// const vertex = coloring.vertex
46+
// if (vertex !== null) setEdgesVertexAttribute(id, vertex)
47+
// } else if (type == "edges") {
48+
// const edges = coloring.edges
49+
// if (edges !== null) setEdgesEdgeAttribute(id, edges)
4950
} else throw new Error("Unknown edges coloring type: " + type)
50-
dataStyleStore.styles[id].edges.coloring.active = type
51-
console.log(
52-
"setEdgesActiveColoring",
53-
dataStyleStore.styles[id].edges.coloring.active,
54-
)
51+
coloring.active = type
52+
console.log("setEdgesActiveColoring", coloring.active)
5553
}
5654

5755
function setEdgesColor(id, color) {
58-
viewer_call(
56+
return viewer_call(
5957
{
6058
schema: mesh_edges_schemas.color,
6159
params: { id, color },
6260
},
6361
{
6462
response_function: () => {
63+
console.log("response_function", id, color)
6564
dataStyleStore.styles[id].edges.coloring.color = color
6665
console.log(
6766
"setEdgesColor",
@@ -71,16 +70,16 @@ export function useMeshEdgesStyle() {
7170
},
7271
)
7372
}
74-
function setEdgesSize(id, size) {
75-
viewer_call(
73+
function setEdgesWidth(id, width) {
74+
return viewer_call(
7675
{
77-
schema: mesh_edges_schemas.size,
78-
params: { id, size },
76+
schema: mesh_edges_schemas.width,
77+
params: { id, width },
7978
},
8079
{
8180
response_function: () => {
82-
dataStyleStore.styles[id].edges.size = size
83-
console.log("setEdgesSize", dataStyleStore.styles[id].edges.size)
81+
dataStyleStore.styles[id].edges.width = width
82+
console.log("setEdgesWidth", dataStyleStore.styles[id].edges.width)
8483
},
8584
},
8685
)
@@ -89,7 +88,7 @@ export function useMeshEdgesStyle() {
8988
function applyEdgesStyle(id, style) {
9089
setEdgesVisibility(id, style.visibility)
9190
setEdgesActiveColoring(id, style.coloring.active)
92-
// setEdgesSize(id, style.size);
91+
// setEdgesWidth(id, style.size);
9392
}
9493

9594
return {
@@ -100,7 +99,7 @@ export function useMeshEdgesStyle() {
10099
setEdgesVisibility,
101100
setEdgesActiveColoring,
102101
setEdgesColor,
103-
setEdgesSize,
102+
setEdgesWidth,
104103
applyEdgesStyle,
105104
}
106105
}

internal_stores/mesh/points.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function useMeshPointsStyle() {
2424

2525
/** Actions **/
2626
function setPointsVisibility(id, visibility) {
27-
viewer_call(
27+
return viewer_call(
2828
{
2929
schema: mesh_points_schemas.visibility,
3030
params: { id, visibility },
@@ -42,7 +42,7 @@ export function useMeshPointsStyle() {
4242
}
4343

4444
function setPointsColor(id, color) {
45-
viewer_call(
45+
return viewer_call(
4646
{
4747
schema: viewer_schemas.opengeodeweb_viewer.mesh.points.color,
4848
params: { id, color },
@@ -59,7 +59,7 @@ export function useMeshPointsStyle() {
5959
)
6060
}
6161
function setPointsVertexAttribute(id, vertex_attribute) {
62-
viewer_call(
62+
return viewer_call(
6363
{
6464
schema: viewer_schemas.opengeodeweb_viewer.mesh.points.vertex_attribute,
6565
params: { id, ...vertex_attribute },
@@ -76,7 +76,7 @@ export function useMeshPointsStyle() {
7676
)
7777
}
7878
function setPointsSize(id, size) {
79-
viewer_call(
79+
return viewer_call(
8080
{
8181
schema: viewer_schemas.opengeodeweb_viewer.mesh.points.size,
8282
params: { id, size },

internal_stores/mesh/polygons.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function useMeshPolygonsStyle() {
2727

2828
/** Actions **/
2929
function setPolygonsVisibility(id, visibility) {
30-
viewer_call(
30+
return viewer_call(
3131
{
3232
schema: mesh_polygons_schemas.visibility,
3333
params: { id, visibility },
@@ -67,7 +67,7 @@ export function useMeshPolygonsStyle() {
6767
)
6868
}
6969
function setPolygonsColor(id, color) {
70-
viewer_call(
70+
return viewer_call(
7171
{
7272
schema: mesh_polygons_schemas.color,
7373
params: { id, color },
@@ -84,7 +84,7 @@ export function useMeshPolygonsStyle() {
8484
)
8585
}
8686
function setPolygonsTextures(id, textures) {
87-
viewer_call(
87+
return viewer_call(
8888
{
8989
schema: viewer_schemas.opengeodeweb_viewer.mesh.apply_textures,
9090
params: { id, textures },
@@ -101,7 +101,7 @@ export function useMeshPolygonsStyle() {
101101
)
102102
}
103103
function setPolygonsVertexAttribute(id, vertex_attribute) {
104-
viewer_call(
104+
return viewer_call(
105105
{
106106
schema: mesh_polygons_schemas.vertex_attribute,
107107
params: { id, ...vertex_attribute },
@@ -118,7 +118,7 @@ export function useMeshPolygonsStyle() {
118118
)
119119
}
120120
function setPolygonsPolygonAttribute(id, polygon_attribute) {
121-
viewer_call(
121+
return viewer_call(
122122
{
123123
schema: mesh_polygons_schemas.polygon_attribute,
124124
params: { id, ...polygon_attribute },

internal_stores/mesh/polyhedra.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function useMeshPolyhedraStyle() {
2727

2828
/** Actions **/
2929
function setPolyhedraVisibility(id, visibility) {
30-
viewer_call(
30+
return viewer_call(
3131
{
3232
schema: mesh_polyhedra_schemas.visibility,
3333
params: { id, visibility },
@@ -60,7 +60,7 @@ export function useMeshPolyhedraStyle() {
6060
)
6161
}
6262
function setPolyhedraColor(id, color) {
63-
viewer_call(
63+
return viewer_call(
6464
{
6565
schema: mesh_polyhedra_schemas.color,
6666
params: { id, color },
@@ -78,7 +78,7 @@ export function useMeshPolyhedraStyle() {
7878
}
7979

8080
function setPolyhedraVertexAttribute(id, vertex_attribute) {
81-
viewer_call(
81+
return viewer_call(
8282
{
8383
schema: mesh_polyhedra_schemas.vertex_attribute,
8484
params: { id, ...vertex_attribute },
@@ -96,7 +96,7 @@ export function useMeshPolyhedraStyle() {
9696
}
9797

9898
function setPolyhedraPolyhedronAttribute(id, polyhedron_attribute) {
99-
viewer_call(
99+
return viewer_call(
100100
{
101101
schema: mesh_polyhedra_schemas.polyhedron_attribute,
102102
params: { id, ...polyhedron_attribute },

internal_stores/model/blocks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function useBlocksStyle() {
1515
/** Actions **/
1616
function setBlockVisibility(id, block_ids, visibility) {
1717
const block_flat_indexes = dataBaseStore.getFlatIndexes(id, block_ids)
18-
viewer_call(
18+
return viewer_call(
1919
{
2020
schema: blocks_schemas.visibility,
2121
params: { id, block_ids: block_flat_indexes, visibility },

internal_stores/model/corners.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function useCornersStyle() {
1414
/** Actions **/
1515
function setCornerVisibility(id, corner_ids, visibility) {
1616
const corner_flat_indexes = dataBaseStore.getFlatIndexes(id, corner_ids)
17-
viewer_call(
17+
return viewer_call(
1818
{
1919
schema: corners_schemas.visibility,
2020
params: { id, block_ids: corner_flat_indexes, visibility },

internal_stores/model/edges.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ export function useModelEdgesStyle() {
99
}
1010

1111
function setModelEdgesVisibility(id, visibility) {
12-
if (!dataStyleStore.styles[id]) {
13-
dataStyleStore.styles[id] = {}
14-
}
15-
if (!dataStyleStore.styles[id].edges) {
16-
dataStyleStore.styles[id].edges = {}
17-
}
12+
// if (!dataStyleStore.styles[id]) {
13+
// dataStyleStore.styles[id] = {}
14+
// }
15+
// if (!dataStyleStore.styles[id].edges) {
16+
// dataStyleStore.styles[id].edges = {}
17+
// }
1818

19-
viewer_call(
19+
return viewer_call(
2020
{
2121
schema: model_edges_schemas.visibility,
2222
params: { id, visibility },

internal_stores/model/lines.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function useLinesStyle() {
1818
/** Actions **/
1919
function setLineVisibility(id, line_ids, visibility) {
2020
const line_flat_indexes = dataBaseStore.getFlatIndexes(id, line_ids)
21-
viewer_call(
21+
return viewer_call(
2222
{
2323
schema: lines_schemas.visibility,
2424
params: { id, block_ids: line_flat_indexes, visibility },
@@ -38,7 +38,7 @@ export function useLinesStyle() {
3838

3939
function setLineColor(id, line_ids, color) {
4040
const line_flat_indexes = dataBaseStore.getFlatIndexes(id, line_ids)
41-
viewer_call(
41+
return viewer_call(
4242
{
4343
schema: lines_schemas.color,
4444
params: { id, block_ids: line_flat_indexes, color },

internal_stores/model/points.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function useModelPointsStyle() {
1212
}
1313

1414
function setModelPointsVisibility(id, visibility) {
15-
viewer_call(
15+
return viewer_call(
1616
{
1717
schema: model_points_schemas.visibility,
1818
params: { id, visibility },
@@ -27,7 +27,7 @@ export function useModelPointsStyle() {
2727
}
2828

2929
function setModelPointsSize(id, size) {
30-
viewer_call(
30+
return viewer_call(
3131
{
3232
schema: model_points_schemas.size,
3333
params: { id, size },

internal_stores/model/surfaces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function useSurfacesStyle() {
1414
/** Actions **/
1515
function setSurfaceVisibility(id, surface_ids, visibility) {
1616
const surface_flat_indexes = dataBaseStore.getFlatIndexes(id, surface_ids)
17-
viewer_call(
17+
return viewer_call(
1818
{
1919
schema: surfaces_schemas.visibility,
2020
params: { id, block_ids: surface_flat_indexes, visibility },

0 commit comments

Comments
 (0)