feat: editor improvements and collapsible sidebars

Add collapse/expand toggle for the AppShell navigation sidebar and the
editor properties panel (both persisted to localStorage). Bundles other
in-progress editor work including position anchors, outlet sizing, PBR
textures, window slope/frame depth, curtain metadata, and various 2D/3D
rendering tweaks.
This commit is contained in:
2026-04-08 12:27:57 +03:00
parent aa8a874348
commit d8a914bf2a
116 changed files with 7324 additions and 1114 deletions
@@ -0,0 +1,109 @@
-- CreateTable
CREATE TABLE "Annotation" (
"id" TEXT NOT NULL PRIMARY KEY,
"roomId" TEXT NOT NULL,
"x" REAL NOT NULL DEFAULT 0,
"y" REAL NOT NULL DEFAULT 0,
"text" TEXT NOT NULL,
"fontSize" INTEGER,
"color" TEXT,
"attachedToId" TEXT,
"projectionOffsetX" REAL,
"projectionOffsetY" REAL,
CONSTRAINT "Annotation_roomId_fkey" FOREIGN KEY ("roomId") REFERENCES "Room" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_ElectricalItem" (
"id" TEXT NOT NULL PRIMARY KEY,
"roomId" TEXT NOT NULL,
"type" TEXT NOT NULL,
"x" REAL NOT NULL,
"y" REAL NOT NULL,
"wallId" TEXT,
"elevationFromFloor" REAL,
"rotation" REAL NOT NULL DEFAULT 0,
"count" INTEGER NOT NULL DEFAULT 1,
"anchorH" TEXT NOT NULL DEFAULT 'middle',
"anchorV" TEXT NOT NULL DEFAULT 'middle',
"metadata" TEXT,
CONSTRAINT "ElectricalItem_roomId_fkey" FOREIGN KEY ("roomId") REFERENCES "Room" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_ElectricalItem" ("elevationFromFloor", "id", "metadata", "roomId", "rotation", "type", "wallId", "x", "y") SELECT "elevationFromFloor", "id", "metadata", "roomId", "rotation", "type", "wallId", "x", "y" FROM "ElectricalItem";
DROP TABLE "ElectricalItem";
ALTER TABLE "new_ElectricalItem" RENAME TO "ElectricalItem";
CREATE INDEX "ElectricalItem_roomId_idx" ON "ElectricalItem"("roomId");
CREATE TABLE "new_FurnitureItem" (
"id" TEXT NOT NULL PRIMARY KEY,
"roomId" TEXT NOT NULL,
"type" TEXT NOT NULL,
"x" REAL NOT NULL,
"y" REAL NOT NULL,
"width" REAL NOT NULL,
"depth" REAL NOT NULL,
"height" REAL NOT NULL,
"rotation" REAL NOT NULL DEFAULT 0,
"elevationFromFloor" REAL NOT NULL DEFAULT 0,
"label" TEXT,
"anchorH" TEXT NOT NULL DEFAULT 'middle',
"anchorV" TEXT NOT NULL DEFAULT 'middle',
"showProjection" BOOLEAN NOT NULL DEFAULT false,
"opacity" REAL NOT NULL DEFAULT 1,
CONSTRAINT "FurnitureItem_roomId_fkey" FOREIGN KEY ("roomId") REFERENCES "Room" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_FurnitureItem" ("depth", "height", "id", "label", "roomId", "rotation", "type", "width", "x", "y") SELECT "depth", "height", "id", "label", "roomId", "rotation", "type", "width", "x", "y" FROM "FurnitureItem";
DROP TABLE "FurnitureItem";
ALTER TABLE "new_FurnitureItem" RENAME TO "FurnitureItem";
CREATE INDEX "FurnitureItem_roomId_idx" ON "FurnitureItem"("roomId");
CREATE TABLE "new_Room" (
"id" TEXT NOT NULL PRIMARY KEY,
"apartmentId" TEXT NOT NULL,
"name" TEXT NOT NULL,
"shape" TEXT NOT NULL DEFAULT '[]',
"width" REAL,
"height" REAL,
"wallHeight" REAL NOT NULL DEFAULT 2.7,
"plinthHeight" REAL NOT NULL DEFAULT 0.06,
"plinthThickness" REAL NOT NULL DEFAULT 0.01,
"order" INTEGER NOT NULL DEFAULT 0,
"posX" REAL NOT NULL DEFAULT 0,
"posY" REAL NOT NULL DEFAULT 0,
"floorType" TEXT NOT NULL DEFAULT 'CONCRETE',
"wallColor" TEXT NOT NULL DEFAULT '#f5f0eb',
"outletWidth" REAL NOT NULL DEFAULT 0.07,
"outletHeight" REAL NOT NULL DEFAULT 0.07,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "Room_apartmentId_fkey" FOREIGN KEY ("apartmentId") REFERENCES "Apartment" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_Room" ("apartmentId", "createdAt", "height", "id", "name", "order", "plinthHeight", "plinthThickness", "posX", "posY", "shape", "updatedAt", "wallHeight", "width") SELECT "apartmentId", "createdAt", "height", "id", "name", "order", "plinthHeight", "plinthThickness", "posX", "posY", "shape", "updatedAt", "wallHeight", "width" FROM "Room";
DROP TABLE "Room";
ALTER TABLE "new_Room" RENAME TO "Room";
CREATE INDEX "Room_apartmentId_idx" ON "Room"("apartmentId");
CREATE TABLE "new_WallOpening" (
"id" TEXT NOT NULL PRIMARY KEY,
"roomId" TEXT NOT NULL,
"wallId" TEXT NOT NULL,
"type" TEXT NOT NULL,
"positionAlongWall" REAL NOT NULL,
"width" REAL NOT NULL,
"height" REAL NOT NULL,
"elevationFromFloor" REAL NOT NULL DEFAULT 0,
"openDirection" TEXT NOT NULL DEFAULT 'LEFT',
"anchorH" TEXT NOT NULL DEFAULT 'middle',
"anchorV" TEXT NOT NULL DEFAULT 'middle',
CONSTRAINT "WallOpening_roomId_fkey" FOREIGN KEY ("roomId") REFERENCES "Room" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "WallOpening_wallId_fkey" FOREIGN KEY ("wallId") REFERENCES "Wall" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_WallOpening" ("elevationFromFloor", "height", "id", "positionAlongWall", "roomId", "type", "wallId", "width") SELECT "elevationFromFloor", "height", "id", "positionAlongWall", "roomId", "type", "wallId", "width" FROM "WallOpening";
DROP TABLE "WallOpening";
ALTER TABLE "new_WallOpening" RENAME TO "WallOpening";
CREATE INDEX "WallOpening_roomId_idx" ON "WallOpening"("roomId");
CREATE INDEX "WallOpening_wallId_idx" ON "WallOpening"("wallId");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
-- CreateIndex
CREATE INDEX "Annotation_roomId_idx" ON "Annotation"("roomId");
@@ -0,0 +1,3 @@
-- Add reveal (откос) depth to WallOpening. Existing rows default to 0
-- (no visible slope), preserving prior render output for legacy windows.
ALTER TABLE "WallOpening" ADD COLUMN "slopeDepth" REAL NOT NULL DEFAULT 0;
@@ -0,0 +1,4 @@
-- Per-opening frame member thickness (doors and windows). Existing rows
-- default to 0.03 m which matches the previous hard-coded constant in the
-- 3D renderers, so legacy openings render unchanged.
ALTER TABLE "WallOpening" ADD COLUMN "frameThickness" REAL NOT NULL DEFAULT 0.03;
+35
View File
@@ -32,6 +32,9 @@ model Room {
posY Float @default(0)
floorType String @default("CONCRETE")
wallColor String @default("#f5f0eb")
wallFinish String @default("PAINT")
outletWidth Float @default(0.07)
outletHeight Float @default(0.07)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
apartment Apartment @relation(fields: [apartmentId], references: [id], onDelete: Cascade)
@@ -39,6 +42,7 @@ model Room {
openings WallOpening[]
electricalItems ElectricalItem[]
furnitureItems FurnitureItem[]
annotations Annotation[]
@@index([apartmentId])
}
@@ -68,6 +72,12 @@ model WallOpening {
height Float
elevationFromFloor Float @default(0)
openDirection String @default("LEFT") // LEFT, RIGHT, INWARD, OUTWARD
anchorH String @default("middle") // left, middle, right (positionAlongWall = center by default)
anchorV String @default("bottom") // top, middle, bottom (elevationFromFloor = bottom edge by default)
gridCols Int @default(2) // window pane subdivision — columns
gridRows Int @default(2) // window pane subdivision — rows
slopeDepth Float @default(0) // window reveal (откос) depth in meters; 0 = no slope shown
frameThickness Float @default(0.03) // door/window frame member thickness in meters
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
wall Wall @relation(fields: [wallId], references: [id], onDelete: Cascade)
@@ -84,6 +94,10 @@ model ElectricalItem {
wallId String?
elevationFromFloor Float?
rotation Float @default(0)
count Int @default(1)
anchorH String @default("middle") // left, middle, right
anchorV String @default("middle") // top, middle, bottom
label String? // user-supplied display name; falls back to symbol def label when null
metadata String? // JSON
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
@@ -102,7 +116,28 @@ model FurnitureItem {
rotation Float @default(0)
elevationFromFloor Float @default(0)
label String?
anchorH String @default("middle") // left, middle, right
anchorV String @default("middle") // top, middle, bottom
showProjection Boolean @default(false)
opacity Float @default(1)
metadata String? // JSON — type-specific extension bag (e.g. curtain open amount + fabric color)
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
@@index([roomId])
}
model Annotation {
id String @id @default(cuid())
roomId String
x Float @default(0)
y Float @default(0)
text String
fontSize Int?
color String?
attachedToId String?
projectionOffsetX Float?
projectionOffsetY Float?
room Room @relation(fields: [roomId], references: [id], onDelete: Cascade)
@@index([roomId])
}