Commit Graph

8 Commits

Author SHA1 Message Date
Leopoldadmin a4371ca3ce fix: layer panel collapsible tree + element actions (visibility toggle, delete) + RenderEngine skips invisible elements 2026-06-27 23:59:12 +02:00
Leopoldadmin affa6be151 feat: layer panel with element tree - shows layers + elements as children with count badges, sub-layers supported 2026-06-27 14:27:34 +02:00
Leopoldadmin 4303076ce4 feat: click-drag drawing, layer tree, settings modal, UI improvements
- interaction: click-drag drawing for 2-point tools (line, rect, circle, dimension, leader)
- interaction: preview rendering during drag with setPreviewElement
- interaction: handleDrawDown only sets phase=drawing on first point
- CanvasArea: sync activeLayerId to LayerManager
- CanvasArea: callback refresh useEffect prevents stale closures
- App.tsx: functional setElements updates for handleElementCreated/Deleted/Modified
- LayerPanel: tree structure with sub-layers (onReorder, onAddSubLayer)
- TreeView: drag-and-drop reordering support
- RightSidebar: onReorder, onAddSubLayer, onUpdateElement props
- PropertiesPanel: onUpdateElement prop
- SettingsModal: personal/password/language/theme/users/plugins/AI tabs
- styles.css: extensive UI styling additions
- types: updated RightSidebarProps, CanvasAreaProps, LayerPanelProps
2026-06-27 14:12:37 +02:00
Leopoldadmin 39422a4348 fix: layer IDs globally unique - use timestamp-based IDs instead of hardcoded layer-0/1/2/3/4
Root cause: layers.id is TEXT PRIMARY KEY (global unique across all drawings).
Hardcoded IDs layer-0..layer-4 collided when multiple projects tried to create
the same layer IDs. Second project got UNIQUE constraint failed on POST /layers.
Without layers, elements had dangling layer_id refs causing FOREIGN KEY errors.

Fix: makeInitialLayers() generates unique IDs: layer-{timestamp}-{index}.
activeLayerId initialized from first layer, not hardcoded.
activeLayerName uses activeLayerId variable, not hardcoded layer-0.
On project load with existing layers, activeLayerId set from first DB layer.
2026-06-26 20:53:41 +02:00
Leopoldadmin 7ad0e11873 fix: element creation fails with empty layer_id (FOREIGN KEY constraint)
Three fixes:
1. interaction/index.ts: Add layerId to created element in confirmDraw()
2. CanvasArea.tsx: Sync layers to LayerManager via layerManagerRef
3. App.tsx: Fallback to activeLayerId in handleElementCreated if layerId missing

Root cause: LayerManager.activeLayerId was empty because layers were never
synced from React state to the interaction layer LayerManager. New elements
got layer_id="" which failed SQLite FOREIGN KEY constraint.

Also includes Yjs sync race condition fix from previous commit.
2026-06-26 20:31:50 +02:00
Leopoldadmin 7e530dd09a fix: stale closure bug preventing canvas tools from creating elements
- CanvasArea: add useEffect to refresh InteractionEngine callbacks when props change
- App.tsx: handleElementCreated/Deleted/Modified now use functional setElements updates
- Root cause: CanvasArea init useEffect had empty deps, capturing stale callbacks at mount
- handleElementCreated used [...elements, el] with stale elements=[] closure
- Each new element replaced all previous ones instead of appending
- All 343 tests pass, tsc clean
2026-06-26 18:57:09 +02:00
Leopoldadmin 3bec3938d0 fix: ribbon tabs now show per-tab content; add all missing handleRibbonAction handlers
- RibbonBar: conditional rendering per activeTab (start/insert/format/view/tools/ki)
- App.tsx: add onNavigateBack prop for new/open navigation
- App.tsx: implement handlers for new, open, save, copy, paste, zoom-fit, zoom-100, grid, layer, measure, search, plugins, ki, ki-draw, ki-analyze
- App.tsx: implement insert-line, insert-rect, insert-circle, insert-text, insert-freehand, insert-image
- App.tsx: implement format-* placeholder actions
- App.tsx: add clipboard state for copy/paste
- All 343 tests pass, tsc clean
2026-06-26 18:49:16 +02:00
Leopoldadmin 4ec76fe406 feat: initial commit web-cad-neu with docker-compose, frontend and backend 2026-06-26 10:50:24 +02:00