mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
ifcviewer-web: navigation parity — view all, XYZ views, ortho, zoom-to-selected
The camera math already lived in the shared ViewportCore; the desktop just bound keys to it. The web build had no keyboard handler and no camera UI, so none of it was reachable. Wire it up (Tier 1 + 2 of nav parity; fly mode is a separate follow-up). Shared core: - setStandardView(StandardView) — named Front/Back/Left/Right/Top/Bottom wrapper over setStandardView(yaw,pitch), so the axis→angle mapping lives in one place. - frameSelection() — lifts the desktop's "union selected AABBs → frameAabb(1.30)" focus logic out of ViewportWindow into the core. Desktop's focusOnSelectedObject and the X/Y/Z hotkeys now call these (DRY, behaviour unchanged). Web: - main_web gains a keydown handler matching the desktop bindings — Home=view all, F=zoom to selected, P=ortho toggle, X/Y/Z (+Shift=negative)=standard views — plus exported entry points (view_all_c / frame_selection_c / toggle_projection_c / projection_is_ortho_c / standard_view_c) for the toolbar. - shell.html adds a bottom nav toolbar (Fit / Focus / Persp-Ortho / the six views) with the hotkeys in tooltips; the ortho button reflects state. Verified: Z key and Front button both move the camera, ortho toggles render + label, zero GPU errors; 111/111 unit + 6/6 web smoke pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -185,6 +185,19 @@ public:
|
||||
float dist, float yaw_deg, float pitch_deg);
|
||||
void setStandardView(float yaw_deg, float pitch_deg);
|
||||
|
||||
// Named axis-aligned views. Front/Back/Left/Right pin yaw at 0/180/270/90
|
||||
// (pitch 0); Top/Bottom pin pitch at ±90° and keep the current yaw. Wraps
|
||||
// setStandardView(yaw,pitch) so the mapping lives in one place (shared by
|
||||
// the desktop hotkeys and the web toolbar/keys).
|
||||
enum class StandardView { Front, Back, Left, Right, Top, Bottom };
|
||||
void setStandardView(StandardView view);
|
||||
|
||||
// Frame the current selection: union the selected objects' world AABBs and
|
||||
// fit the camera to them (same 1.30 padding as the desktop "F" hotkey).
|
||||
// No-op with an empty selection or no resolvable AABBs; returns whether it
|
||||
// framed anything. Uses the shared selection + computeObjectAabb/frameAabb.
|
||||
bool frameSelection();
|
||||
|
||||
// ---- Incremental orbit navigation ---------------------------------------
|
||||
//
|
||||
// Pixel-delta camera moves, shared by every host (Qt desktop + web).
|
||||
|
||||
Reference in New Issue
Block a user