@team-geospan/struct3d 1.0.6 → 1.0.7
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.
- package/MR_TEMPLATE.md +81 -0
- package/lib/defaults.js +1 -0
- package/lib/draw.js +7 -3
- package/package.json +1 -1
package/MR_TEMPLATE.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Merge Request: Add Color Theme Support to 3D Viewer
|
|
2
|
+
|
|
3
|
+
### Type of Change
|
|
4
|
+
|
|
5
|
+
Indicate the type of change this MR introduces:
|
|
6
|
+
|
|
7
|
+
- [x] New Feature
|
|
8
|
+
- [ ] Bug Fix
|
|
9
|
+
- [ ] Documentation Update
|
|
10
|
+
- [ ] Refactoring
|
|
11
|
+
- [ ] Hotfix
|
|
12
|
+
- [ ] Security Patch
|
|
13
|
+
- [ ] UI/UX Improvement
|
|
14
|
+
|
|
15
|
+
### Description
|
|
16
|
+
|
|
17
|
+
* **Summary**: Added color theme support to the StructureThreeD component, allowing users to toggle between different visual themes (default and gray) with dynamic sky and ground color changes.
|
|
18
|
+
|
|
19
|
+
* **JIRA Ticket**: N/A
|
|
20
|
+
|
|
21
|
+
**Details**: Explain the changes in more detail, including:
|
|
22
|
+
|
|
23
|
+
* **Why these changes were necessary**: The 3D viewer needed visual theme options to improve user experience and provide different viewing modes for various use cases.
|
|
24
|
+
|
|
25
|
+
* **The approach taken to implement them**:
|
|
26
|
+
- Added a `COLOR_THEMES` object with predefined theme configurations
|
|
27
|
+
- Extended the `StructureThreeD` component to accept a `colorTheme` prop
|
|
28
|
+
- Updated the `createReferences` function to accept a `groundColor` parameter
|
|
29
|
+
- Implemented dynamic color application based on the selected theme
|
|
30
|
+
|
|
31
|
+
* **Links to any related issues or tickets**: N/A
|
|
32
|
+
|
|
33
|
+
### Testing
|
|
34
|
+
|
|
35
|
+
* **Environment**: Local development environment with eitri 3D viewer integration
|
|
36
|
+
* **Steps**:
|
|
37
|
+
1. Load a 3D model in the StructureThreeD component
|
|
38
|
+
2. Toggle between "default" and "gray" themes using the theme selector
|
|
39
|
+
3. Verify sky color changes from blue to gray
|
|
40
|
+
4. Verify ground color changes from green to gray
|
|
41
|
+
5. Confirm no visual regressions in model rendering
|
|
42
|
+
* **Automated Tests**: No new automated tests added (existing functionality preserved)
|
|
43
|
+
|
|
44
|
+
### Impact
|
|
45
|
+
|
|
46
|
+
* **Performance**: Minimal impact - only adds theme selection logic and color calculations during render
|
|
47
|
+
* **Dependencies**: No new dependencies added
|
|
48
|
+
* **Risks**:
|
|
49
|
+
- None - this is a purely additive change with no breaking changes
|
|
50
|
+
|
|
51
|
+
### Rollback Plan
|
|
52
|
+
|
|
53
|
+
* **Steps to rollback**:
|
|
54
|
+
1. Remove `colorTheme` prop from `StructureThreeD` component
|
|
55
|
+
2. Remove `COLOR_THEMES` object and related theme logic
|
|
56
|
+
3. Revert `createReferences` function signature to original: `createReferences(scene)`
|
|
57
|
+
4. Revert ground color to hardcoded `0xf8f9fa`
|
|
58
|
+
* **Preconditions**: None - this is a safe rollback
|
|
59
|
+
* **Impacts**: Any projects using the new theme functionality will lose theme support
|
|
60
|
+
|
|
61
|
+
### Checklist
|
|
62
|
+
|
|
63
|
+
Ensure the following before requesting a review:
|
|
64
|
+
|
|
65
|
+
- [x] Code comments have been added, particularly for complex logic or significant changes.
|
|
66
|
+
- [ ] Documentation has been updated to reflect the changes.
|
|
67
|
+
- [ ] Unit and integration tests have been added or updated.
|
|
68
|
+
- [x] All tests are passing.
|
|
69
|
+
- [x] No new warnings are generated by the linter.
|
|
70
|
+
- [x] The GitLab pipeline passes without errors.
|
|
71
|
+
- [ ] A teammate has been assigned as a reviewer, and any high-priority MRs have been shared with #development for quicker review.
|
|
72
|
+
|
|
73
|
+
### CHANGELOG
|
|
74
|
+
|
|
75
|
+
If this MR contains changes that should be highlighted in the changelog or release notes, please provide a draft here.
|
|
76
|
+
|
|
77
|
+
* 1.0.5
|
|
78
|
+
* Add color theme support to 3D viewer
|
|
79
|
+
* Add `colorTheme` prop to `StructureThreeD` component
|
|
80
|
+
* Add `COLOR_THEMES` object with default and gray themes
|
|
81
|
+
* Update `createReferences` function to accept `groundColor` parameter
|
package/lib/defaults.js
CHANGED
package/lib/draw.js
CHANGED
|
@@ -77,6 +77,10 @@ export function createLines(
|
|
|
77
77
|
const { edges, points } = structure;
|
|
78
78
|
return Object.keys(edges).map((edgeId) => {
|
|
79
79
|
const edge = edges[edgeId];
|
|
80
|
+
const effectiveKind = edge.properties?.attachments?.includes("gutter")
|
|
81
|
+
? "gutter"
|
|
82
|
+
: edge.kind;
|
|
83
|
+
|
|
80
84
|
// offset and swap coordinates
|
|
81
85
|
const linePoints = edge.points.map((pointId) => {
|
|
82
86
|
const pt = points[pointId].coordinates;
|
|
@@ -87,15 +91,15 @@ export function createLines(
|
|
|
87
91
|
geometry.setPositions(linePoints.flatMap((p) => p));
|
|
88
92
|
|
|
89
93
|
const material = new LineMaterial({
|
|
90
|
-
color: edgeColors[
|
|
91
|
-
linewidth:
|
|
94
|
+
color: edgeColors[effectiveKind] || "#000000",
|
|
95
|
+
linewidth: effectiveKind ? 3 : 1,
|
|
92
96
|
});
|
|
93
97
|
material.resolution.set(width, height);
|
|
94
98
|
|
|
95
99
|
const line = new Line2(geometry, material);
|
|
96
100
|
line.userData = {
|
|
97
101
|
...edge.properties,
|
|
98
|
-
kind:
|
|
102
|
+
kind: effectiveKind,
|
|
99
103
|
id: `${stIdx}-${edgeId}`,
|
|
100
104
|
layer: "edges",
|
|
101
105
|
};
|