Skip to content

#000.#446

Closed
ruok-dev wants to merge 21 commits into
pascalorg:mainfrom
ruok-dev:main
Closed

#000.#446
ruok-dev wants to merge 21 commits into
pascalorg:mainfrom
ruok-dev:main

Conversation

@ruok-dev

@ruok-dev ruok-dev commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

.

ruok-dev added 14 commits June 16, 2026 13:53
… files

Summary

Fixed an issue where floors became impossible to drag or delete after importing JSON configuration files created in versions prior to 0.9.1.

Root Cause

The migration process was executing elevator parent migration before all level nodes had their children fully normalized. As a result, imported scenes could end up with inconsistent parent-child relationships, causing floor management operations such as dragging and deletion to fail.

Changes Made
Refactored migrateNodes() into a two-pass migration process.
Added normalization for level nodes:
Ensures level values are valid finite numbers.
Removes references to missing child nodes.
Preserves only valid children during migration.
Moved elevator migration logic to a dedicated second pass:
Elevator parent migration now runs only after all level.children relationships have been stabilized.
Prevents invalid hierarchy reconstruction when importing legacy JSON files.
Result

Imported layouts from versions prior to 0.9.1 now correctly preserve floor hierarchy, allowing floors to be dragged, reordered, and deleted as expected.
O default π/2 significa que CCW 90° a partir de +X aponta para +Z — portanto +Z é Norte. Isso é o inverso do que o two-bedroom.ts declarava ("positive z points south"). A limpeza do template abaixo corrige esse comentário para refletir a nova convenção canônica.
Updated coordinate system description for clarity.
This file implements a Zustand store for managing the north bearing state, allowing external React components to access the current bearing without using the Zustand viewer store.
Comment thread packages/viewer/src/components/viewer/index.tsx
* Default (π/2) means world +Z points north, world +X points east —
* consistent with the two-bedroom template and standard north-up site plans.
*/
northDirection: z.number().default(NORTH_DIRECTION_DEFAULT),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default northDirection contradicts −Z north

High Severity

The northDirection property's default π/2 value has conflicting interpretations for "True North." Despite being defined as radians CCW from world +X, the documentation, templates, and surveyor conversion inconsistently describe π/2 as pointing to +Z north, +Z south, or -Z north.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0c5c16b. Configure here.

Comment thread apps/editor/components/viewer-toolbar.tsx Outdated
Comment thread apps/editor/components/north-compass-bridge.ts Outdated
Comment thread packages/viewer/src/store/use-viewer.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit af1beac. Configure here.

return typeof dir === 'number' ? dir : NORTH_DIRECTION_DEFAULT
}
}
return NORTH_DIRECTION_DEFAULT

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Site north from wrong node

Medium Severity

useNorthDirection returns the first site from Object.values(nodes), while other editor code resolves the canonical site via rootNodeIds[0]. If more than one site exists or iteration order differs from the root, the compass can use the wrong northDirection.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit af1beac. Configure here.

@ruok-dev ruok-dev closed this Jun 26, 2026
@ruok-dev ruok-dev changed the title feat(core,editor,mcp): add canonical northDirection to Site + compass widget (#362) . Jun 26, 2026
@ruok-dev ruok-dev changed the title . #000. Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant