|
44 | 44 | hybridViewerStore.remoteRender() |
45 | 45 | }, |
46 | 46 | }) |
47 | | - const vertex_attribute = computed({ |
48 | | - get: () => dataStyleStore.meshEdgesVertexAttribute(id.value), |
| 47 | + const vertex_attribute_name = computed({ |
| 48 | + get: () => dataStyleStore.meshEdgesVertexAttributeName(id.value), |
| 49 | + set: () => { |
| 50 | + // Name is set via attribute-selected event to pass defaultMin/defaultMax |
| 51 | + }, |
| 52 | + }) |
| 53 | + const vertex_attribute_range = computed({ |
| 54 | + get: () => dataStyleStore.meshEdgesVertexAttributeRange(id.value), |
49 | 55 | set: (newValue) => { |
50 | | - dataStyleStore.setMeshEdgesVertexAttribute(id.value, newValue) |
| 56 | + dataStyleStore.setMeshEdgesVertexAttributeRange( |
| 57 | + id.value, |
| 58 | + newValue[0], |
| 59 | + newValue[1], |
| 60 | + ) |
| 61 | + // Re-apply colormap with new range |
| 62 | + const colorMap = dataStyleStore.meshEdgesVertexAttributeColorMap(id.value) |
| 63 | + if (colorMap) { |
| 64 | + dataStyleStore.setMeshEdgesVertexAttributeColorMap( |
| 65 | + id.value, |
| 66 | + colorMap, |
| 67 | + newValue[0], |
| 68 | + newValue[1], |
| 69 | + ) |
| 70 | + } |
51 | 71 | hybridViewerStore.remoteRender() |
52 | 72 | }, |
53 | 73 | }) |
54 | | - const edge_attribute = computed({ |
55 | | - get: () => dataStyleStore.meshEdgesEdgeAttribute(id.value), |
| 74 | + const vertex_attribute_color_map = computed({ |
| 75 | + get: () => dataStyleStore.meshEdgesVertexAttributeColorMap(id.value), |
56 | 76 | set: (newValue) => { |
57 | | - dataStyleStore.setMeshEdgesEdgeAttribute(id.value, newValue) |
| 77 | + const range = dataStyleStore.meshEdgesVertexAttributeRange(id.value) |
| 78 | + dataStyleStore.setMeshEdgesVertexAttributeColorMap( |
| 79 | + id.value, |
| 80 | + newValue, |
| 81 | + range[0], |
| 82 | + range[1], |
| 83 | + ) |
58 | 84 | hybridViewerStore.remoteRender() |
59 | 85 | }, |
60 | 86 | }) |
| 87 | + const edge_attribute_name = computed({ |
| 88 | + get: () => dataStyleStore.meshEdgesEdgeAttributeName(id.value), |
| 89 | + set: () => { |
| 90 | + // Name is set via attribute-selected event to pass defaultMin/defaultMax |
| 91 | + }, |
| 92 | + }) |
| 93 | + const edge_attribute_range = computed({ |
| 94 | + get: () => dataStyleStore.meshEdgesEdgeAttributeRange(id.value), |
| 95 | + set: (newValue) => { |
| 96 | + dataStyleStore.setMeshEdgesEdgeAttributeRange( |
| 97 | + id.value, |
| 98 | + newValue[0], |
| 99 | + newValue[1], |
| 100 | + ) |
| 101 | + // Re-apply colormap with new range |
| 102 | + const colorMap = dataStyleStore.meshEdgesEdgeAttributeColorMap(id.value) |
| 103 | + if (colorMap) { |
| 104 | + dataStyleStore.setMeshEdgesEdgeAttributeColorMap( |
| 105 | + id.value, |
| 106 | + colorMap, |
| 107 | + newValue[0], |
| 108 | + newValue[1], |
| 109 | + ) |
| 110 | + } |
| 111 | + hybridViewerStore.remoteRender() |
| 112 | + }, |
| 113 | + }) |
| 114 | + const edge_attribute_color_map = computed({ |
| 115 | + get: () => dataStyleStore.meshEdgesEdgeAttributeColorMap(id.value), |
| 116 | + set: (newValue) => { |
| 117 | + const range = dataStyleStore.meshEdgesEdgeAttributeRange(id.value) |
| 118 | + dataStyleStore.setMeshEdgesEdgeAttributeColorMap( |
| 119 | + id.value, |
| 120 | + newValue, |
| 121 | + range[0], |
| 122 | + range[1], |
| 123 | + ) |
| 124 | + hybridViewerStore.remoteRender() |
| 125 | + }, |
| 126 | + }) |
| 127 | +
|
| 128 | + // Event handlers for attribute selection with default min/max |
| 129 | + function onVertexAttributeSelected(data) { |
| 130 | + dataStyleStore.setMeshEdgesVertexAttributeName( |
| 131 | + id.value, |
| 132 | + data.name, |
| 133 | + data.defaultMin, |
| 134 | + data.defaultMax, |
| 135 | + ) |
| 136 | + hybridViewerStore.remoteRender() |
| 137 | + } |
| 138 | + function onEdgeAttributeSelected(data) { |
| 139 | + dataStyleStore.setMeshEdgesEdgeAttributeName( |
| 140 | + id.value, |
| 141 | + data.name, |
| 142 | + data.defaultMin, |
| 143 | + data.defaultMax, |
| 144 | + ) |
| 145 | + hybridViewerStore.remoteRender() |
| 146 | + } |
61 | 147 | </script> |
62 | 148 | <template> |
63 | 149 | <ViewerContextMenuItem |
|
91 | 177 | :id="id" |
92 | 178 | v-model:coloring_style_key="coloring_style_key" |
93 | 179 | v-model:color="color" |
94 | | - v-model:vertex_attribute="vertex_attribute" |
95 | | - v-model:edge_attribute="edge_attribute" |
96 | | - mesh-type="edges" |
| 180 | + v-model:vertex_attribute_name="vertex_attribute_name" |
| 181 | + v-model:vertex_attribute_range="vertex_attribute_range" |
| 182 | + v-model:vertex_attribute_color_map="vertex_attribute_color_map" |
| 183 | + v-model:edge_attribute_name="edge_attribute_name" |
| 184 | + v-model:edge_attribute_range="edge_attribute_range" |
| 185 | + v-model:edge_attribute_color_map="edge_attribute_color_map" |
| 186 | + @vertex-attribute-selected="onVertexAttributeSelected" |
| 187 | + @edge-attribute-selected="onEdgeAttributeSelected" |
97 | 188 | /> |
98 | 189 | </v-col> |
99 | 190 | </v-row> |
|
0 commit comments