@geode/opengeodeweb-front 10.44.0-rc.10 → 10.44.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { getPlaneCssColor } from "@ogw_front/utils/clipping_planes";
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
|
-
plane: { origin?: number[]; normal: number[] };
|
|
5
|
+
plane: { origin?: number[]; normal: number[]; opacity: number };
|
|
6
6
|
index: number;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -49,6 +49,23 @@ const emit = defineEmits<Emits>();
|
|
|
49
49
|
</v-col>
|
|
50
50
|
</v-row>
|
|
51
51
|
|
|
52
|
+
<v-row align="center" no-gutters class="mb-1">
|
|
53
|
+
<v-col cols="auto" class="text-caption text-medium-emphasis">Opacity</v-col>
|
|
54
|
+
<v-col class="px-2">
|
|
55
|
+
<v-slider
|
|
56
|
+
v-model="plane.opacity"
|
|
57
|
+
data-testid="planeOpacitySlider"
|
|
58
|
+
:min="0"
|
|
59
|
+
:max="1"
|
|
60
|
+
:step="0.05"
|
|
61
|
+
:color="getPlaneCssColor(index)"
|
|
62
|
+
track-color="grey-lighten-2"
|
|
63
|
+
density="compact"
|
|
64
|
+
hide-details
|
|
65
|
+
/>
|
|
66
|
+
</v-col>
|
|
67
|
+
</v-row>
|
|
68
|
+
|
|
52
69
|
<v-row no-gutters class="mb-1">
|
|
53
70
|
<v-col class="text-caption text-medium-emphasis">Origin [X, Y, Z]</v-col>
|
|
54
71
|
</v-row>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DEBOUNCE_DELAY,
|
|
4
|
+
DEFAULT_NORMALS,
|
|
5
|
+
DEFAULT_PLANE_OPACITY,
|
|
6
|
+
getPlaneRgbaColor,
|
|
7
|
+
} from "@ogw_front/utils/clipping_planes";
|
|
3
8
|
import type { ClippingPlane } from "@ogw_front/composables/clipping_planes_widget_entries";
|
|
4
9
|
import ClippingPlaneCard from "@ogw_front/components/ClippingPlaneCard.vue";
|
|
5
10
|
import SliceCard from "@ogw_front/components/SliceCard.vue";
|
|
@@ -26,7 +31,10 @@ function newItemId(): number {
|
|
|
26
31
|
lastItemId += 1;
|
|
27
32
|
return lastItemId;
|
|
28
33
|
}
|
|
29
|
-
|
|
34
|
+
function createPlane(origin: ClippingPlane["origin"], normal: number[]): ClippingPlane {
|
|
35
|
+
return { id: newItemId(), origin, normal, opacity: DEFAULT_PLANE_OPACITY };
|
|
36
|
+
}
|
|
37
|
+
const planes = ref<ClippingPlane[]>([createPlane(undefined, [1, 0, 0])]);
|
|
30
38
|
const allItems = dataStore.refRegisteredItems();
|
|
31
39
|
const targetIds = computed<string[]>(() => {
|
|
32
40
|
if (targetAllVisible.value) {
|
|
@@ -84,9 +92,10 @@ async function applyClippingPlanes(): Promise<void> {
|
|
|
84
92
|
}
|
|
85
93
|
const center = getSceneCenter();
|
|
86
94
|
const untargetedIds = getUntargetedIds();
|
|
87
|
-
const planesData = planes.value.map((plane) => ({
|
|
95
|
+
const planesData = planes.value.map((plane, index) => ({
|
|
88
96
|
origin: (plane.origin || center).map(Number),
|
|
89
97
|
normal: plane.normal.map(Number),
|
|
98
|
+
color: getPlaneRgbaColor(index, plane.opacity),
|
|
90
99
|
}));
|
|
91
100
|
if (targetIds.value.length > 0) {
|
|
92
101
|
await hybridViewerStore.setClippingPlanes(
|
|
@@ -112,7 +121,7 @@ function addPlane(): void {
|
|
|
112
121
|
// Satisfy noUncheckedIndexedAccess and are never hit at runtime.
|
|
113
122
|
const normal = DEFAULT_NORMALS[planes.value.length % DEFAULT_NORMALS.length] ??
|
|
114
123
|
DEFAULT_NORMALS[0] ?? [1, 0, 0];
|
|
115
|
-
planes.value.push(
|
|
124
|
+
planes.value.push(createPlane([...getSceneCenter()], normal));
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
function removePlane(index: number): void {
|
|
@@ -127,7 +136,7 @@ function flipNormal(plane: { normal: number[] }): void {
|
|
|
127
136
|
|
|
128
137
|
async function resetClippingPlanes(): Promise<void> {
|
|
129
138
|
setFromWidget(true);
|
|
130
|
-
planes.value = [
|
|
139
|
+
planes.value = [createPlane(undefined, [1, 0, 0])];
|
|
131
140
|
resetSlices();
|
|
132
141
|
updateWidgetPlacement({ isReset: true });
|
|
133
142
|
setFromWidget(false);
|
|
@@ -2,6 +2,7 @@ const AXIS_SCALE = 0.45;
|
|
|
2
2
|
const SIZE_RATIO = 0.1;
|
|
3
3
|
const DEBOUNCE_DELAY = 200;
|
|
4
4
|
const CHANGE_THRESHOLD = 1e-4;
|
|
5
|
+
const DEFAULT_PLANE_OPACITY = 0.1;
|
|
5
6
|
// oxlint-disable no-magic-numbers
|
|
6
7
|
const COLOR_BLUE = [0.12, 0.53, 0.9];
|
|
7
8
|
const COLOR_GREEN = [0.26, 0.63, 0.28];
|
|
@@ -16,8 +17,22 @@ const NORMAL_Z = [0, 0, 1];
|
|
|
16
17
|
const DEFAULT_NORMALS = [NORMAL_X, NORMAL_Y, NORMAL_Z];
|
|
17
18
|
const RGB_MAX_VALUE = 255;
|
|
18
19
|
|
|
20
|
+
function getPlaneColor(index: number): readonly number[] {
|
|
21
|
+
return PLANE_COLORS[index % PLANE_COLORS.length] ?? COLOR_BLUE;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getPlaneRgbaColor(
|
|
25
|
+
index: number,
|
|
26
|
+
alpha: number,
|
|
27
|
+
): { red: number; green: number; blue: number; alpha: number } {
|
|
28
|
+
const [red = 0, green = 0, blue = 0] = getPlaneColor(index).map((channel) =>
|
|
29
|
+
Math.round(channel * RGB_MAX_VALUE),
|
|
30
|
+
);
|
|
31
|
+
return { red, green, blue, alpha };
|
|
32
|
+
}
|
|
33
|
+
|
|
19
34
|
function getPlaneCssColor(index: number): string {
|
|
20
|
-
const rgb =
|
|
35
|
+
const rgb = getPlaneColor(index);
|
|
21
36
|
return `rgb(${rgb.map((channel) => Math.round(channel * RGB_MAX_VALUE)).join(",")})`;
|
|
22
37
|
}
|
|
23
38
|
|
|
@@ -80,8 +95,11 @@ export {
|
|
|
80
95
|
SIZE_RATIO,
|
|
81
96
|
DEBOUNCE_DELAY,
|
|
82
97
|
CHANGE_THRESHOLD,
|
|
98
|
+
DEFAULT_PLANE_OPACITY,
|
|
83
99
|
PLANE_COLORS,
|
|
84
100
|
DEFAULT_NORMALS,
|
|
101
|
+
getPlaneColor,
|
|
102
|
+
getPlaneRgbaColor,
|
|
85
103
|
getPlaneCssColor,
|
|
86
104
|
hasPlaneChanged,
|
|
87
105
|
getPlaneStyle,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geode/opengeodeweb-front",
|
|
3
|
-
"version": "10.44.0-rc.
|
|
3
|
+
"version": "10.44.0-rc.11",
|
|
4
4
|
"description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
|
|
5
5
|
"homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
|
|
6
6
|
"bugs": {
|