[140] Plandarstellung Teil 6: Raumstempel weichen Treppen, Türschwenk, Bemassung, Koten, Texten und Symbolen aus; Unterbau (Kies, Magerbeton, Erdreich) im Schnitt 1:100 schraffiert; CLI-SVG setzt Stempel wie gemessen (Inter, 12 pt fett, 0.8×), Zeilen im zentrierten Block; Stempel-Griff an der gezeichneten Lage; Goldens neu

This commit is contained in:
Claude committed 2026-11-06 16:59:31 +00:00
1 parent f29ffde6f8
commit 016c02e28c
29 files changed
+808 -90

No files matched your search

+3 -3
View File
@@ -4,9 +4,9 @@
<g stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4">
<polygon points="0,4.6725 5,4.6725 5,0.6725 0,0.6725" fill="#f0f0f0" stroke="none" stroke-width="0"/>
<polygon points="0.1725,4.5 4.8275,4.5 4.8275,0.845 0.1725,0.845" fill="#6b728000" stroke="#6b7280" stroke-width="0.002"/>
<text x="2.5" y="2.6725" font-size="0.3528" fill="#111111" font-family="sans-serif" text-anchor="middle">Wohnen</text>
<text x="2.5" y="3.09586" font-size="0.3528" fill="#111111" font-family="sans-serif" text-anchor="middle">17.01 m²</text>
<text x="2.5" y="3.51922" font-size="0.3528" fill="#111111" font-family="sans-serif" text-anchor="middle">HNF · Hauptnutzfläche</text>
<text x="0.98291" y="2.31972" font-family="Inter, sans-serif" text-anchor="start"><tspan font-size="0.3528" fill="#111111">Wohnen</tspan></text>
<text x="2.5" y="2.77833" font-family="Inter, sans-serif" text-anchor="middle"><tspan font-size="0.28222" fill="#111111">17.01 m²</tspan></text>
<text x="2.5" y="3.23694" font-family="Inter, sans-serif" text-anchor="middle"><tspan font-size="0.28222" fill="#111111">HNF · Hauptnutzfläche</tspan></text>
<polygon points="-0.1725,4.845 0.8,4.845 0.8,4.5 0.1725,4.5" fill="#0f0f0f" stroke="none"/>
<polygon points="1.7,4.845 3,4.845 3,4.5 1.7,4.5" fill="#0f0f0f" stroke="#1a1a1a" stroke-width="0.025"/>
<polygon points="4,4.845 5.1725,4.845 4.8275,4.5 4,4.5" fill="#0f0f0f" stroke="none"/>

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

+1
View File
@@ -220,6 +220,7 @@ export {
planPrimAt,
planTextEntries,
planWithExtra,
roomStampAt,
type TextEntryPrim,
} from "../plan/planLazy";
@@ -1,5 +1,5 @@
viewBox -4 0 23 18
bytes 310337
bytes 310751
circle 14
g 1
line 3226
@@ -8,4 +8,5 @@ polyline 68
rect 1
svg 1
text 36
hash 45b4d584a3e141d6
tspan 12
hash e61aae0e3fc4f9ec
@@ -1,5 +1,5 @@
viewBox -4 0 23 18
bytes 320692
bytes 321106
circle 14
g 1
line 3227
@@ -8,4 +8,5 @@ polyline 73
rect 1
svg 1
text 36
hash e0545755beab6d46
tspan 12
hash 625ac60580256f1b
@@ -1,5 +1,5 @@
viewBox -41.5 0 95 63.6
bytes 85358
bytes 86178
circle 16
g 1
line 314
@@ -9,4 +9,5 @@ polyline 110
rect 1
svg 1
text 118
hash cef117cef66ccd65
tspan 26
hash 2fc5e3bab2df1b38
@@ -1,5 +1,5 @@
viewBox -41.5 0 95 63.6
bytes 113593
bytes 114680
circle 16
g 1
line 338
@@ -9,4 +9,5 @@ polyline 126
rect 1
svg 1
text 121
hash 7e22563a4804f932
tspan 32
hash c02df9796df56fd8
@@ -1,5 +1,5 @@
viewBox -4.055 0 25.109 23.11
bytes 339103
bytes 339847
circle 14
g 1
line 3310
@@ -8,4 +8,5 @@ polyline 154
rect 1
svg 1
text 91
hash 46723498044c422b
tspan 23
hash f4e69298c1be11bd
@@ -1,5 +1,5 @@
viewBox -4.055 0 25.109 23.11
bytes 369846
bytes 370654
circle 14
g 1
line 3333
@@ -9,4 +9,5 @@ polyline 169
rect 1
svg 1
text 91
hash be529b7ce07ecad8
tspan 24
hash 532589653aac9cdb
@@ -1,5 +1,5 @@
viewBox -10.004 0 31.058 26.958
bytes 52665
bytes 53341
circle 14
g 1
line 166
@@ -9,4 +9,5 @@ polyline 73
rect 1
svg 1
text 75
hash 5819887a677f289a
tspan 20
hash a49820b978df2cc8
@@ -1,5 +1,5 @@
viewBox -10.004 0 31.058 26.958
bytes 61331
bytes 62001
circle 14
g 1
line 171
@@ -9,4 +9,5 @@ polyline 77
rect 1
svg 1
text 75
hash 1f584745aa154d01
tspan 20
hash 195e8bb714b78f17
@@ -1,5 +1,5 @@
viewBox 4.457 0 21.343 17.678
bytes 40531
bytes 40538
circle 3
g 1
line 96
@@ -8,4 +8,4 @@ polyline 13
rect 1
svg 1
text 3
hash 2bfa93e2c1d3a9c8
hash 420d8ffd7bb583e9
@@ -1,5 +1,5 @@
viewBox -0.672 0 6.345 5.345
bytes 7890
bytes 7956
g 1
line 32
polygon 30
@@ -7,4 +7,5 @@ polyline 4
rect 1
svg 1
text 7
hash bdf6e70cae4a0a08
tspan 3
hash bf3017439b3240f6
@@ -1,5 +1,5 @@
viewBox -0.672 0 6.345 5.345
bytes 11830
bytes 11897
g 1
line 33
polygon 62
@@ -7,4 +7,5 @@ polyline 8
rect 1
svg 1
text 7
hash 24dc3848bf391596
tspan 3
hash 2691a9f68cf90842
+14 -1
View File
@@ -3,7 +3,7 @@
import { describe, expect, it } from "vitest";
import { generatePlan, generateVisibleLevelsPlan, materializeUnderlay, type Primitive } from "./generatePlan";
import { isLazyUnread, planCount, planPrimAt, planTextEntries, planWithExtra } from "./planLazy";
import { isLazyUnread, planCount, planPrimAt, planTextEntries, planWithExtra, roomStampAt } from "./planLazy";
import { planSceneBin, planToRenderScene } from "./toRenderScene";
import { planToSvgString } from "../export/planToSvgString";
import { PlanPickIndex } from "./planView/planPick";
@@ -51,6 +51,19 @@ describe("lazy Plan", () => {
expect(isLazyUnread(plan)).toBe(true);
});
it("[140] Lage des Raumstempels aus dem Plan (auch weggerückt vom Pol)", () => {
const room = (sampleProject.rooms ?? []).find((r) => r.floorId === "eg")!;
// L-Raum ohne eigenen Anker mit langem Namen: der Kern rückt den Stempel vom Pol weg.
const l = [[0, 0], [8, 0], [8, 1.2], [1.2, 1.2], [1.2, 8], [0, 8]].map(([x, y]) => ({ x: x + 50, y: y + 50 }));
const p: Project = { ...sampleProject, rooms: (sampleProject.rooms ?? []).map((r) => (r.id === room.id ? { ...r, boundary: l, stampAnchor: undefined, stamp: undefined, name: "Wohnen Essen Kochen" } : r)) };
const plan = generatePlan(p, "eg", codes(p));
const at = roomStampAt(plan, room.id)!;
expect(at).toBeDefined();
const text = planTextEntries(plan).find((e) => e.p.kind === "text" && e.p.roomId === room.id)!;
expect(at).toEqual((text.p as { at: { x: number; y: number } }).at);
expect(roomStampAt(plan, "gibt-es-nicht")).toBeUndefined();
});
it("Einzelzugriff, Text-Einträge und Anzahl == gelesene Liste (dieselben Objekte)", () => {
for (const l of ["eg", "og"]) {
const plan = generatePlan(withText, l, codes(withText));
+13
View File
@@ -11,6 +11,7 @@
*/
import type { Plan, PlanBufRun, Primitive } from "./generatePlan";
import type { Vec2 } from "../model/types";
import type { DecodedPlanBuf } from "./planBuf";
/** Abschnitt `[from, to)` eines Kern-Puffers. */
@@ -197,6 +198,18 @@ export function planTextEntries(plan: Plan): ReadonlyArray<{ i: number; p: TextE
return out;
}
/**
* [140] Tatsächliche Lage des Raumstempels von `roomId` im Plan (Anker des Stempel-Texts): ohne eigenen
* `stampAnchor` rückt der Kern den Stempel vom Pol weg (L-Raum, Hindernisse) — Griff und Ziehen gehen von
* hier aus. `undefined`, wenn der Plan keinen Stempel dieses Raums zeigt.
*/
export function roomStampAt(plan: Plan, roomId: string): Vec2 | undefined {
for (const e of planTextEntries(plan)) {
if (e.p.kind === "text" && e.p.roomId === roomId) return e.p.at;
}
return undefined;
}
/**
* Plan um Primitive davor/danach ergänzt, ohne die Primitive des Plans zu lesen (Überlagerungen
* der Ansicht). Gedimmte Bereiche wandern mit.
+17 -7
View File
@@ -51,7 +51,7 @@ import { PlanRulers } from "./planView/PlanRulers";
import { PlanGrid } from "./planView/PlanGrid";
import { expandRegion, indexedInRegion, regionContains, type Bounds } from "../../core";
import { PlanPickIndex, type ClientMap, type OwnerField } from "../../core";
import { planPrimAt, planTextEntries } from "../../core";
import { planPrimAt, planTextEntries, roomStampAt } from "../../core";
import { buildDrawingIndex, drawingsWithinDistance, marqueeHitUnderlay, nearestInDrawings, type DrawingIndex } from "../../core";
import { endBusyAfterPaint } from "../../state/busyStore";
import { EMPTY_SELECTION, single } from "../../state/selection";
@@ -814,6 +814,12 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
const lines = !useGpuRenderer || wantWasm;
return materializeGreyed(lines ? materializeUnderlay(planRaw) : planRaw, lines);
}, [planRaw, useGpuRenderer, wantWasm]);
// [140] Stempel-Griff an der tatsächlichen Lage des Stempels im Plan (ohne eigenen Anker rückt der Kern
// ihn vom Pol weg: L-Raum, Hindernisse); sonst am Anker.
const stampAt = useMemo(
() => (roomStamp ? (roomStampAt(planRaw, roomStamp.roomId) ?? roomStamp.anchor) : null),
[planRaw, roomStamp],
);
// Kompakte Linien-Unterlage (nur im reinen WebGL-Modus noch als `plan.underlay`
// vorhanden): Hover/Pick/Marquee/Hervorhebung greifen direkt auf die Zeichnungen
// zu, Strukturen entstehen LAZY je Plan (s. planView/underlayAccess.ts).
@@ -1240,7 +1246,9 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
} | null>(null);
// Transiente Stempel-Griff-Zieh-Daten: letzter Modellpunkt, gegen den das
// inkrementelle Delta gebildet wird (verschiebt NUR den Raum-Stempel-Anker).
const stampDrag = useRef<{ pointerId: number; roomId: string; last: Vec2 } | null>(
// `offset` ([140]): Abstand der gezeichneten Lage vom Anker (Pol), einmal mit dem ersten Delta
// übergeben — der Kern setzt den Anker auf Pol + Delta, der Stempel springt so nicht zum Pol.
const stampDrag = useRef<{ pointerId: number; roomId: string; last: Vec2; offset: Vec2 } | null>(
null,
);
// Letzter Links-Klick (Zeit + Bildschirmposition) für die manuelle Doppelklick-
@@ -1284,8 +1292,8 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
/** Bildschirm-px-Distanz Cursor → Stempel-Griff; null = kein einzelner Raum. */
const stampHandleAt = (clientX: number, clientY: number): string | null => {
if (!roomStamp) return null;
const s = vbToClient(toScreen(roomStamp.anchor).x, toScreen(roomStamp.anchor).y);
if (!roomStamp || !stampAt) return null;
const s = vbToClient(toScreen(stampAt).x, toScreen(stampAt).y);
const d = Math.hypot(clientX - s.x, clientY - s.y);
return d <= GRIP_HIT_PX ? roomStamp.roomId : null;
};
@@ -1774,6 +1782,7 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
pointerId: e.pointerId,
roomId: rid,
last: rawModelAt(e.clientX, e.clientY),
offset: stampAt && roomStamp ? { x: stampAt.x - roomStamp.anchor.x, y: stampAt.y - roomStamp.anchor.y } : { x: 0, y: 0 },
};
return;
}
@@ -1992,7 +2001,8 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
if (sd && sd.pointerId === p.pointerId) {
const delta = { x: raw.x - sd.last.x, y: raw.y - sd.last.y };
if ((delta.x !== 0 || delta.y !== 0) && onStampMove) {
onStampMove(sd.roomId, delta);
onStampMove(sd.roomId, { x: delta.x + sd.offset.x, y: delta.y + sd.offset.y });
sd.offset = { x: 0, y: 0 };
sd.last = raw;
}
return;
@@ -3564,9 +3574,9 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
{/* Raum-Stempel-Griff: eine ziehbare Raute am Anker des gewählten Raums.
Verschiebt NUR den Stempel (nicht die Kontur); Doppelklick öffnet den
Editor. Bildschirmkonstante Größe. */}
{roomStamp && (
{stampAt && (
<LiveMeet store={meetStore} base={meetScale(view, canvasRef.current ?? svgRef.current) ?? 1}>{(meet) => {
const s = toLocal(roomStamp.anchor);
const s = toLocal(stampAt);
const size = 4 / meet;
const pts = [
`${s.x},${s.y - size}`,