Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Polish viewport frame and add local display controls

Yuechen Lid33c6cfe124f
diff --git a/aetheris.client/src/App.css b/aetheris.client/src/App.css
index 8cd7a520..a4942fac 100644
--- a/aetheris.client/src/App.css
+++ b/aetheris.client/src/App.css
@@ -201,15 +201,87 @@
min-height: calc(100vh - 140px);
padding: var(--layout-space-2);
display: flex;
+}
+
+.viewport-frame-outline {
+ flex: 1;
+ min-height: 0;
+ border: 1px solid #c7bfb1;
+ padding: 1px;
+ background: #c7bfb1;
+}
+
+.viewport-frame {
+ display: flex;
flex-direction: column;
+ height: 100%;
+ min-height: 0;
+ background: #2f2a27;
+}
+
+.viewport-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
gap: var(--layout-space-2);
+ padding: 9px 11px;
+ border-bottom: 1px solid #453f3a;
+ background: #2f2a27;
}
+.viewport-header__title {
+ color: #d9d0c3;
+}
-.viewport-canvas-frame {
+.viewport-segmented {
+ display: inline-flex;
+ border: 1px solid #746a5f;
+ background: #3a342f;
+}
+
+.viewport-segmented__button {
+ min-height: 26px;
+ border: 0;
+ border-right: 1px solid #746a5f;
+ border-radius: 0;
+ padding: 0 10px;
+ background: transparent;
+ color: #cfc4b4;
+ font-size: 0.68rem;
+ line-height: 1;
+ letter-spacing: 0.09em;
+ text-transform: uppercase;
+ font-weight: var(--ui-weight-title);
+}
+
+.viewport-segmented__button:last-child {
+ border-right: 0;
+}
+
+.viewport-segmented__button.is-active {
+ background: #cbc1b2;
+ color: #332d29;
+}
+
+.viewport-segmented__button:hover {
+ background: #4a433d;
+}
+
+.viewport-segmented__button.is-active:hover {
+ background: #cbc1b2;
+}
+
+.viewport-canvas-outline {
flex: 1;
min-height: 0;
- border-radius: calc(var(--layout-radius) - 2px);
+ border: 1px solid #c7bfb1;
+ padding: 1px;
+ background: #c7bfb1;
+}
+
+.viewport-canvas-frame {
+ height: 100%;
+ min-height: 0;
overflow: hidden;
background: linear-gradient(180deg, #f2f4f7 0%, #dde2e8 100%);
}
diff --git a/aetheris.client/src/App.tsx b/aetheris.client/src/App.tsx
index 2321bd8c..acba8b0d 100644
--- a/aetheris.client/src/App.tsx
+++ b/aetheris.client/src/App.tsx
@@ -70,6 +70,8 @@ function App() {
const [isImporting, setIsImporting] = useState(false);
const [isRefreshing, setIsRefreshing] = useState(false);
const [isResetting, setIsResetting] = useState(false);
+ const [isGridVisible, setIsGridVisible] = useState(true);
+ const [isCoordVisible, setIsCoordVisible] = useState(true);
const maxStepFileSizeBytes = 5 * 1024 * 1024;
@@ -548,13 +550,39 @@ function App() {
<main className="main-layout">
<section className="viewport-column">
<div className="viewport-shell">
- <h2 className="section-title">Viewport</h2>
- <ViewerViewport
- sceneData={sceneData}
- highlightedFaceId={highlightedFaceId}
- highlightedEdgeId={highlightedEdgeId}
- onPickRay={(origin, direction) => void handlePickRay(origin, direction)}
- />
+ <div className="viewport-frame-outline">
+ <div className="viewport-frame">
+ <div className="viewport-header">
+ <h2 className="section-title viewport-header__title">Viewport</h2>
+ <div className="viewport-segmented" role="group" aria-label="Viewport display controls">
+ <button
+ type="button"
+ className={isGridVisible ? 'viewport-segmented__button is-active' : 'viewport-segmented__button'}
+ onClick={() => setIsGridVisible((value) => !value)}
+ aria-pressed={isGridVisible}>
+ GRID
+ </button>
+ <button
+ type="button"
+ className={isCoordVisible ? 'viewport-segmented__button is-active' : 'viewport-segmented__button'}
+ onClick={() => setIsCoordVisible((value) => !value)}
+ aria-pressed={isCoordVisible}>
+ COORD
+ </button>
+ </div>
+ </div>
+ <div className="viewport-canvas-outline">
+ <ViewerViewport
+ sceneData={sceneData}
+ highlightedFaceId={highlightedFaceId}
+ highlightedEdgeId={highlightedEdgeId}
+ showGrid={isGridVisible}
+ showAxisGuide={isCoordVisible}
+ onPickRay={(origin, direction) => void handlePickRay(origin, direction)}
+ />
+ </div>
+ </div>
+ </div>
</div>
</section>
diff --git a/aetheris.client/src/__tests__/App.test.tsx b/aetheris.client/src/__tests__/App.test.tsx
index 8a14d25c..9b07c7ea 100644
--- a/aetheris.client/src/__tests__/App.test.tsx
+++ b/aetheris.client/src/__tests__/App.test.tsx
@@ -77,6 +77,8 @@ describe('App STEP file upload flow', () => {
expect(screen.getByRole('tab', { name: /STEP 242 Viewer/i }).getAttribute('aria-selected')).toBe('true');
expect(screen.getByText('Viewport')).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'GRID' }).getAttribute('aria-pressed')).toBe('true');
+ expect(screen.getByRole('button', { name: 'COORD' }).getAttribute('aria-pressed')).toBe('true');
expect(screen.queryByText('Create Box')).toBeNull();
fireEvent.click(screen.getByRole('tab', { name: /Modeling Demo/i }));
diff --git a/aetheris.client/src/viewer/ViewerViewport.tsx b/aetheris.client/src/viewer/ViewerViewport.tsx
index 7815e819..f4858ede 100644
--- a/aetheris.client/src/viewer/ViewerViewport.tsx
+++ b/aetheris.client/src/viewer/ViewerViewport.tsx
@@ -453,6 +453,8 @@ interface ViewerViewportProps {
sceneData: RenderSceneData | null;
highlightedFaceId?: number | null;
highlightedEdgeId?: number | null;
+ showGrid?: boolean;
+ showAxisGuide?: boolean;
onPickRay?: (origin: { x: number; y: number; z: number }, direction: { x: number; y: number; z: number }) => void;
}
@@ -580,7 +582,14 @@ function PickRayCapture({ onPickRay }: { onPickRay?: ViewerViewportProps['onPick
return null;
}
-export function ViewerViewport({ sceneData, highlightedFaceId = null, highlightedEdgeId = null, onPickRay }: ViewerViewportProps) {
+export function ViewerViewport({
+ sceneData,
+ highlightedFaceId = null,
+ highlightedEdgeId = null,
+ showGrid = true,
+ showAxisGuide = true,
+ onPickRay,
+}: ViewerViewportProps) {
const hasInteractionEdgeHighlight = highlightedEdgeId !== null;
return (
@@ -589,8 +598,8 @@ export function ViewerViewport({ sceneData, highlightedFaceId = null, highlighte
{/*Negative near value is indeed correct in order to show negative value on grid. Documentation is wrong.*/}
<ambientLight intensity={VIEWPORT_THEME.ambientIntensity} />
<directionalLight position={[-5, 9, 6]} intensity={VIEWPORT_THEME.directionalIntensity} />
- <DraftingGrid />
- <AxisGuide />
+ {showGrid ? <DraftingGrid /> : null}
+ {showAxisGuide ? <AxisGuide /> : null}
{sceneData?.faces.map((face) => (
<FaceMesh
key={`face-${face.faceId}`}