40 Commits

Author SHA1 Message Date
Qiaochu Hu
7d4c8b6bd4
fix: resolve state management issues and memory leaks (#152)
This commit fixes several issues in the core state management:

1. Fix deleteNodesAction recursive call issue
   - Previously, the function recursively called get().deleteNodes()
     inside the set() callback, which could cause state inconsistencies.
   - Now collects all descendant IDs first in a separate pass, then
     deletes them all in a single batch operation.

2. Fix memory leak in use-scene temporal tracking
   - Module-level variables (prevPastLength, prevFutureLength,
     prevNodesSnapshot) persisted across store re-creations.
   - Now cleared in unloadScene() to release stale node references.
   - Added clearTemporalTracking() helper function.

3. Remove unused variable in wall-system
   - Removed debug variable 'useFrameNb' that was declared but never used.

4. Fix requestAnimationFrame in updateNodesAction
   - Previously used RAF without cleanup, causing multiple queued
     callbacks when updates happened rapidly.
   - Now uses a single tracked RAF with cancellation support.

Co-authored-by: hobostay <hobostay@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 00:30:16 -04:00
Anton
f06f2fa1b1
feat: 2D editing — floorplan panel, measurements, command palette (v0.3.0)
* sync: port 2D editing features from monorepo (v0.3.0)

## New Features

### Floorplan Panel (7.5K LOC)
- Full 2D editing interface with wall drawing, measurement, and unit display
- Interactive floorplan view with pan/zoom, grid snapping
- Wall thickness visualization, door/window placement
- Zone and slab polygon editing
- Guide image overlay support
- Metric/imperial unit toggle

### Command Palette Overhaul
- Complete rewrite with new command registry system
- Keyboard shortcuts UI with ShortcutToken component
- Editor-specific commands (floorplan, measurements, camera focus)
- Improved search and action organization

### Wall Measurements
- Real-time wall length labels in 3D view
- Metric/imperial conversion
- Wall measurement UI component

### Enhanced Tools
- Wall drafting utilities (grid snapping, validation)
- Node action menu for quick operations
- Improved polygon editing for zones/slabs/sites
- Roof segment panel for granular roof control

## Package Changes

### @pascal-app/core@0.3.0
- New wall-footprint.ts: 2D wall footprint calculation
- Wall mitering exports for floorplan view
- camera-controls:focus event
- Space detection undo pause/resume
- Mark sibling nodes dirty on deletion (miter recalc)

### @pascal-app/viewer@0.3.0
- ErrorBoundary component for robust item rendering
- Broken item fallback UI
- Wall renderer: mark dirty on mount
- Ground occluder: only lowest level punches through
- Unit state (metric/imperial) in viewer store

### @pascal-app/editor@0.1.0
- 48 file changes (16 new, 32 modified)
- New stores: useCommandRegistry, usePaletteViewRegistry
- Tree node drag-and-drop system
- Level selection utilities
- Enhanced scene graph operations

## Apps/Editor
- GeistPixelSquare font for pixel-perfect UI
- Blueprint icon asset
- Updated layout and globals for font support

## Security
- Zero AI imports or internal package refs
- All monorepo-specific code excluded
- Clean audit: no API keys or secrets

## Testing
- Security audit passed ✅
- All AI/internal code excluded ✅
- Version bumps applied ✅

79 files modified, 16 files added
~2600 insertions, ~1400 deletions

* fix: lint cleanup — suppress intentional dep warnings, fix missing dep, remove stale ignores

- Add biome-ignore for 3 intentional useEffect reset patterns (levelId, selectedGuide, selectedId)
- Fix actual missing dependency: currentBuildingId in handleSiteEditShortcutSelect callback
- Remove 3 stale biome-ignore comments in r3f.d.ts (rule not active)

Build and lint pass clean.

* fix: type errors — polygon area guards, selection cast, readonly keywords, door guard

- ceiling-panel, slab-panel, ceiling-tree-node, slab-tree-node, zone-tree-node:
  guard polygon[i]/polygon[j] array access before arithmetic (TS2532)
- scene.ts: introduce toViewerSelection() helper to cast persisted string IDs
  to branded template literal types expected by useViewer.setSelection (TS2345)
- door-panel: guard early return when node is undefined in setSegmentHeightRatio (TS18048)
- editor-commands: remove 'as const' from inline command object, keywords is mutable string[] (TS2322)

All type checks pass. Build and lint clean.

---------

Co-authored-by: Anton Pascal <anton-pascal@users.noreply.github.com>
2026-03-24 19:48:11 +00:00
Aymeric Rabot
1d28e4208f
sync: update core and viewer from monorepo (#143)
Major changes:
- Roof system rewrite with roof-segment support
- Scene store refactor
- Spatial grid improvements
- Item light system
- Post-processing and selection manager updates
- Perf monitor component

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 23:18:30 -04:00
wass08
f2501be2bf remove community 2026-03-13 09:07:46 +01:00
wass08
849baa0a0e default value 2026-03-06 13:08:24 +01:00
wass08
bc57afb8fa collections + unify color picker 2026-03-06 13:08:23 +01:00
wass08
54051b11fa item system controls 2026-03-06 13:08:21 +01:00
wass08
927ecba054 schema and interactive store 2026-03-06 13:06:33 +01:00
Wassim SAMAD
2182fe535d
Merge pull request #116 from pascalorg/fix/community-feedback-pass-3
Fix/community feedback pass 3
2026-02-24 16:17:44 +09:00
Aymeric Rabot
db05c86120
Add scene graph viewer and persist migration (#115)
Render an interactive Scene Graph in the Settings panel using @visual-json/react. Introduces SceneNode/SceneGraphNode types and buildSceneGraphValue to build a tree (handles missing nodes and cycles), and adds handlers to block drag/drop/context/delete mutations inside the viewer. Adds @visual-json/react to apps/editor package.json and updates the dev script to forbid .env.local and source the root .env instead. Also adds a persistence migration in use-scene to preserve existing nodes and rootNodeIds when the persist version changes.
2026-02-24 00:40:18 -05:00
wass08
20f5f7ab4a fix wall elevation with slab holes 2026-02-24 10:27:51 +09:00
wass08
3791739b5b mark nodes as dirty after deletion 2026-02-24 08:19:49 +09:00
wass08
d15f601107 item scale 2026-02-23 10:59:42 +09:00
wass08
4dd85993cb fix issue undo history number input 2026-02-10 11:00:11 +09:00
wass08
39f9f595d8 scene starting with site and not with building anymore 2026-02-05 14:42:46 +09:00
wass08
73dfac795a fix placement 2026-02-02 11:39:38 +09:00
wass08
f98ead4585 camera for zones and levels 2026-02-02 10:24:57 +09:00
wass08
ff4e2fc2fe fix entire rebuild on updates 2026-02-02 09:40:11 +09:00
Aymeric Rabot
6c99851006 Refactor asset types and improve UI primitives
Replaces usage of the Asset type with AssetInput across editor components and hooks for consistency with core types. Adds default dimensions fallback for asset placement logic. Refactors UI primitives (button, sidebar, opacity control) to support forwarding refs and asChild prop, and updates imports for primitives. Updates Radix UI dependencies in package.json and bun.lock.
2026-01-30 22:01:25 -05:00
wass08
498da300db export / load json 2026-01-30 07:48:52 +09:00
wass08
d4ff59e9c5 fix undo dirty nodes 2026-01-27 19:22:39 +09:00
wass08
fb3cd3e34e zones as nodes 2026-01-26 07:34:53 +09:00
wass08
aaadec8add fix default spatial grid 2026-01-23 11:31:14 +09:00
wass08
3240266476 transient nodes 2026-01-23 11:13:11 +09:00
wass08
cc9d9916b7 data persist 2026-01-23 09:56:06 +09:00
wass08
3ab5077ea0 draft zone 2026-01-22 09:32:28 +09:00
wass08
5de0818633 biome 2026-01-21 10:03:29 +09:00
wass08
eb564a9819 tmp catalog 2026-01-21 08:56:10 +09:00
wass08
dabaefc57a different level edition + fix 2026-01-20 08:26:47 +09:00
wass08
f3456aed42 can place on wall 2026-01-19 09:32:46 +09:00
wass08
a217d0d3a6 drafting wall attach system 2026-01-19 07:59:06 +09:00
wass08
162c70552c item catalog draft 2026-01-17 15:40:04 +09:00
wass08
87029005f6 draft item tool 2026-01-17 11:36:24 +09:00
wass08
3908432225 cleaner add + undo/redo state 2026-01-17 10:08:19 +09:00
wass08
536c2e94cc draft wall builder 2026-01-16 13:58:01 +09:00
wass08
1b954d3416 events handlers 2026-01-16 11:42:10 +09:00
wass08
60cb60fdaa code organization 2026-01-16 09:46:19 +09:00
wass08
0c07c482a5 registry / systems / renderer 2026-01-15 10:43:32 +09:00
wass08
aa8ee9c034 project organization 2026-01-14 11:14:31 +09:00
wass08
25c14b54f2 structuring store 2026-01-14 10:36:29 +09:00