feat(web): add dynamic area layouts and camera views
Area headers now expose a real ⋮ menu with split, join, swap, duplicate, maximize/focus, close and reset; the first operation measures the CSS grid into normalized rects and switches that workspace to an OPFS-persisted custom layout while reusing the existing React content per slot. ViewportNavigation gains Numpad0 camera view with last-view restore, framing-only navigation when unlocked, Camera to View lock that writes the camera object (rotation-mode-aware native setObjectTransform), and Ctrl+Alt+Numpad0 camera-to-view. Camera lock persists per area. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,8 @@ export interface ViewportCameraState extends ViewportOrbitState {
|
||||
position: [number, number, number];
|
||||
}
|
||||
|
||||
export type ViewportView = 'USER' | 'FRONT' | 'BACK' | 'RIGHT' | 'LEFT' | 'TOP' | 'BOTTOM';
|
||||
export type ViewportNavigationCommand = ViewportView | 'PROJECTION' | 'FRAME_ALL' | 'FRAME_SELECTED' | 'ZOOM_IN' | 'ZOOM_OUT';
|
||||
export type ViewportView = 'USER' | 'CAMERA' | 'FRONT' | 'BACK' | 'RIGHT' | 'LEFT' | 'TOP' | 'BOTTOM';
|
||||
export type ViewportNavigationCommand = ViewportView | 'PROJECTION' | 'FRAME_ALL' | 'FRAME_SELECTED' | 'ZOOM_IN' | 'ZOOM_OUT' | 'TOGGLE_CAMERA_VIEW' | 'CAMERA_TO_VIEW' | 'CAMERA_LOCK';
|
||||
export interface ViewportNavigationCamera {
|
||||
position: [number,number,number];
|
||||
quaternion: [number,number,number,number];
|
||||
@@ -30,6 +30,35 @@ export interface BlenderViewportCamera {
|
||||
orientation: [number,number,number,number];
|
||||
projection: 'PERSPECTIVE'|'ORTHOGRAPHIC';
|
||||
fov:number; near:number; far:number; zoom:number; orthoHeight:number;
|
||||
shiftX?:number; shiftY?:number; objectId?:string; lensMm?:number; sensorWidthMm?:number; sensorHeightMm?:number; camzoom?:number;
|
||||
}
|
||||
|
||||
export interface BlenderSceneCameraFrame extends BlenderViewportCamera {
|
||||
objectId: string;
|
||||
lensMm: number;
|
||||
sensorWidthMm: number;
|
||||
sensorHeightMm: number;
|
||||
sensorFit: number;
|
||||
shift: [number, number];
|
||||
orthoScale: number;
|
||||
camzoom: number;
|
||||
}
|
||||
|
||||
export function cameraZoomFac(camzoom: number): number {
|
||||
const clamped = Math.max(-30, Math.min(600, camzoom));
|
||||
return ((Math.SQRT2 + clamped / 50) ** 2) / 4;
|
||||
}
|
||||
|
||||
export function eulerFromQuaternion(q: readonly [number, number, number, number]): [number, number, number] {
|
||||
const [x, y, z, w] = q;
|
||||
const sinr = 2 * (w * x + y * z);
|
||||
const cosr = 1 - 2 * (x * x + y * y);
|
||||
const roll = Math.atan2(sinr, cosr);
|
||||
const sinp = 2 * (w * y - z * x);
|
||||
const pitch = Math.abs(sinp) >= 1 ? Math.sign(sinp) * Math.PI / 2 : Math.asin(sinp);
|
||||
const siny = 2 * (w * z + x * y);
|
||||
const cosy = 1 - 2 * (y * y + z * z);
|
||||
return [roll, pitch, Math.atan2(siny, cosy)];
|
||||
}
|
||||
|
||||
export const VIEWPORT_DEFAULT_ORBIT: Readonly<ViewportOrbitState> = Object.freeze({
|
||||
|
||||
Reference in New Issue
Block a user