Merge branch 'worktree-agent-a393753346e69ff4e' into claude/practical-noether-1hb2s1
# Conflicts: # src/plan/__golden__/komplex-grundriss-eg-100.txt # src/plan/__golden__/komplex-grundriss-og-100.txt # src/plan/__golden__/komplex-grundriss-og-50.txt # src/plan/__golden__/komplex-grundriss-ug-100.txt # src/plan/__golden__/muster-grundriss-eg-100.txt
This commit is contained in:
31 files changed
+459
-83
No files matched your search
@@ -36,9 +36,9 @@
|
||||
<line x1="3.2" y1="1.49917" x2="4.2" y2="1.49917" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<line x1="3.2" y1="1.28583" x2="4.2" y2="1.28583" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.05"/>
|
||||
<polygon points="3.78,3.09917 3.72667,3.15917 3.67333,3.03917 3.62,3.09917 3.2,3.09917 3.2,4.2725 4.2,4.2725 4.2,3.09917" fill="none" stroke="#1a1a1a" stroke-width="0.013"/>
|
||||
<line x1="3.7" y1="4.16583" x2="3.7" y2="1.1045" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.579" y1="1.3245" x2="3.7" y2="1.1045" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.7" y1="1.1045" x2="3.821" y2="1.3245" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.7" y1="4.16583" x2="3.7" y2="3.09917" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="3.7" y1="3.09917" x2="3.7" y2="1.1045" stroke="#1a1a1a" stroke-width="0.01" stroke-dasharray="0.2 0.1" stroke-dashoffset="0.00267"/>
|
||||
<polyline points="3.579,1.3245 3.7,1.1045 3.821,1.3245" fill="none" stroke="#1a1a1a" stroke-width="0.01"/>
|
||||
<line x1="-1" y1="2.6725" x2="6" y2="2.6725" stroke="#1f242c" stroke-width="0.018" stroke-dasharray="0.6 0.15 0.04 0.15" stroke-dashoffset="0.09"/>
|
||||
<polyline points="-1,2.9725 -1,2.3725 -1,1.7725" fill="none" stroke="#1f242c" stroke-width="0.025"/>
|
||||
<line x1="-1" y1="1.7725" x2="-0.85" y2="2.0125" stroke="#1f242c" stroke-width="0.025"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
+38
-11
@@ -36,39 +36,66 @@ describe("Bemassung: Griffe der Masszahl", () => {
|
||||
expect(p.y).toBeCloseTo(base.y + 2, 9);
|
||||
});
|
||||
|
||||
const drag = (d: Drawing2D, pt: { x: number; y: number }) => {
|
||||
const drag = (d: Drawing2D, pt: { x: number; y: number }, free = false) => {
|
||||
const p = { drawings2d: [d], walls: [] } as unknown as Project;
|
||||
const res = documentFor(p).gripOps({ op: "moveGrip", drawingId: "m", wallId: null, index: d.geom.shape === "dimension" ? d.geom.pts.length + 1 : 0, pt: [pt.x, pt.y], scale: 50 });
|
||||
const res = documentFor(p).gripOps({ op: "moveGrip", drawingId: "m", wallId: null, index: d.geom.shape === "dimension" ? d.geom.pts.length + 1 : 0, pt: [pt.x, pt.y], scale: 50, ...(free ? { free: true } : {}) });
|
||||
const e = res.ops[0] as unknown as { entity: Drawing2D };
|
||||
return (e.entity.geom as { textOffsetsMm: { along: number; perp: number }[] }).textOffsetsMm[0];
|
||||
};
|
||||
|
||||
it("nahe der Standardlage rastet BEIDES auf 0 ein", () => {
|
||||
it("nahe der Mitte rastet BEIDES auf 0 ein (Vorgabe)", () => {
|
||||
const base = drawingVertices(dim([A, B], 0), 50)[3];
|
||||
expect(drag(dim([A, B], 0), { x: base.x + H * 0.2, y: base.y - H * 0.2 })).toEqual({ along: 0, perp: 0 });
|
||||
});
|
||||
|
||||
it("die Achsen rasten UNABHÄNGIG ein (seitlich verschoben, Höhe exakt Standard)", () => {
|
||||
it("rastet an festen Stellen ein: innen, aussen, eine Zeile über/unter der Linie", () => {
|
||||
const base = drawingVertices(dim([A, B], 0), 50)[3];
|
||||
const o = drag(dim([A, B], 0), { x: base.x + 1.5, y: base.y + H * 0.1 });
|
||||
expect(o.along).toBeCloseTo(30, 9);
|
||||
expect(o.perp).toBe(0);
|
||||
const at = (dx: number, dy = 0) => drag(dim([A, B], 0), { x: base.x + dx, y: base.y + dy });
|
||||
// Segment 4 m, Zahl „4.00" ~ 0.4 m breit: innen bündig vor der Hilfslinie, aussen dahinter.
|
||||
const inner = at(1.5);
|
||||
const outer = at(2.6);
|
||||
expect(inner.perp).toBe(0);
|
||||
expect(outer.perp).toBe(0);
|
||||
expect(inner.along).toBeGreaterThan(0);
|
||||
expect(outer.along).toBeGreaterThan(inner.along);
|
||||
expect(outer.along * (50 / 1000)).toBeGreaterThan(2); // Mitte der Zahl hinter der Hilfslinie
|
||||
expect(at(-1.5).along).toBeCloseTo(-inner.along, 9);
|
||||
expect(at(-2.6).along).toBeCloseTo(-outer.along, 9);
|
||||
// Leicht schief gezogen: trotzdem genau eine Stelle (kein Zwischenwert).
|
||||
expect(at(2.5, 0.05)).toEqual(outer);
|
||||
const up = at(0.1, 0.3);
|
||||
const down = at(0.1, -0.3);
|
||||
expect(up).toEqual({ along: 0, perp: 5.4 });
|
||||
expect(down).toEqual({ along: 0, perp: -7.8 });
|
||||
});
|
||||
|
||||
it("ausserhalb des Fangbereichs bleibt der gezogene Wert erhalten", () => {
|
||||
it("mit gehaltener Taste (free) bleibt die gezogene Position erhalten", () => {
|
||||
const base = drawingVertices(dim([A, B], 0), 50)[3];
|
||||
const o = drag(dim([A, B], 0), { x: base.x + 0.8, y: base.y + 0.6 });
|
||||
const o = drag(dim([A, B], 0), { x: base.x + 0.8, y: base.y + 0.6 }, true);
|
||||
expect(o.along).toBeCloseTo(16, 9);
|
||||
expect(o.perp).toBeCloseTo(12, 9);
|
||||
});
|
||||
|
||||
it("Rundreise: gezogene Position → Versatz → Griff liegt wieder am Punkt", () => {
|
||||
it("Rundreise (frei): gezogene Position → Versatz → Griff liegt wieder am Punkt", () => {
|
||||
const pt = { x: 3.1, y: 1.4 };
|
||||
const o = drag(dim([A, B], 0.5), pt);
|
||||
const o = drag(dim([A, B], 0.5), pt, true);
|
||||
const back = drawingVertices(dim([A, B], 0.5, [o]), 50)[3];
|
||||
expect(back.x).toBeCloseTo(pt.x, 9);
|
||||
expect(back.y).toBeCloseTo(pt.y, 9);
|
||||
});
|
||||
|
||||
it("Rundreise (eingerastet): Griff liegt auf der Einrast-Stelle", () => {
|
||||
const base = drawingVertices(dim([A, B], 0), 50)[3];
|
||||
const o = drag(dim([A, B], 0), { x: base.x + 2.6, y: base.y });
|
||||
const back = drawingVertices(dim([A, B], 0, [o]), 50)[3];
|
||||
expect(back.x).toBeGreaterThan(base.x + 2);
|
||||
expect(back.y).toBeCloseTo(base.y, 9);
|
||||
});
|
||||
|
||||
it("Zu schmales Segment: Griff steht dort, wo die Zahl nach aussen gewichen ist", () => {
|
||||
const short = drawingVertices(dim([A, { x: 0.3, y: 0 }], 0), 50);
|
||||
expect(short[3].x).toBeLessThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Kanten-Griffe von Ringen und Ketten", () => {
|
||||
|
||||
@@ -19,7 +19,7 @@ type P = [number, number];
|
||||
|
||||
/** Eine Griff-Änderung für den Kern (`grips.rs::run`); Zahlen dürfen NaN/±∞ sein (Marken). */
|
||||
export type GripRequest =
|
||||
| { op: "moveGrip"; drawingId: string | null; wallId: string | null; index: number; pt: P; scale: number }
|
||||
| { op: "moveGrip"; drawingId: string | null; wallId: string | null; index: number; pt: P; scale: number; free?: boolean }
|
||||
| { op: "moveBy"; drawingId: string | null; wallId: string | null; delta: P }
|
||||
| { op: "moveEdge"; drawingId: string | null; wallId: string | null; a: number; b: number; delta: P }
|
||||
| { op: "resize"; kind: string; id: string; w: number; h: number; fx: number; fy: number }
|
||||
|
||||
@@ -2139,6 +2139,7 @@ export const de = {
|
||||
"cmd.align.distY": "senkrecht verteilen",
|
||||
"cmd.explode.label": "Auflösen",
|
||||
"cmd.dimdetach.label": "Bemassung lösen",
|
||||
"cmd.dimtextreset.label": "Text zurücksetzen",
|
||||
"cmd.autodim.label": "Aussenbemassung",
|
||||
"cmd.scale.label": "Skalieren",
|
||||
"cmd.scale.base": "Basispunkt:",
|
||||
|
||||
@@ -2127,6 +2127,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"cmd.align.distY": "Distribute vertically",
|
||||
"cmd.explode.label": "Explode",
|
||||
"cmd.dimdetach.label": "Detach dimension",
|
||||
"cmd.dimtextreset.label": "Reset text",
|
||||
"cmd.autodim.label": "Exterior dimensions",
|
||||
"cmd.scale.label": "Scale",
|
||||
"cmd.scale.base": "Base point:",
|
||||
|
||||
@@ -71,9 +71,10 @@ export function AppContextMenu(props: {
|
||||
isolateSelectionLayers,
|
||||
toggleSelectionNoPrint,
|
||||
detachDimensions,
|
||||
resetDimensionTexts,
|
||||
} = props.selCmds;
|
||||
const project = useStore((s) => s.project);
|
||||
const { selectionAllLocked, selectionLayerCodes, selectionAllNoPrint, attachedDimensionIds } = selectionMenuState(
|
||||
const { selectionAllLocked, selectionLayerCodes, selectionAllNoPrint, attachedDimensionIds, movedDimTextIds } = selectionMenuState(
|
||||
project,
|
||||
selection,
|
||||
true,
|
||||
@@ -123,6 +124,8 @@ export function AppContextMenu(props: {
|
||||
toggleSelectionNoPrint,
|
||||
attachedDimensionCount: attachedDimensionIds.length,
|
||||
detachDimensions,
|
||||
movedDimensionTextCount: movedDimTextIds.length,
|
||||
resetDimensionTexts,
|
||||
bringToFront: () => reorderDrawings(selection.drawings, "front"),
|
||||
bringForward: () => reorderDrawings(selection.drawings, "forward"),
|
||||
sendBackward: () => reorderDrawings(selection.drawings, "backward"),
|
||||
|
||||
@@ -120,6 +120,9 @@ export interface MenuActions {
|
||||
/** Gewählte Bemassungen mit Bezügen ([38]); ab 1 erscheint „Bemassung lösen". */
|
||||
attachedDimensionCount?: number;
|
||||
detachDimensions?: () => void;
|
||||
/** [172] Gewählte Bemassungen mit verschobener Masszahl und „Text zurücksetzen". */
|
||||
movedDimensionTextCount?: number;
|
||||
resetDimensionTexts?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,6 +388,11 @@ function planMenuItems(
|
||||
a.attachedDimensionCount && a.detachDimensions
|
||||
? [{ label: t("cmd.dimdetach.label"), icon: <MenuIcon name="link_off" />, onClick: a.detachDimensions }]
|
||||
: [];
|
||||
// „Text zurücksetzen" ([172]) — nur wenn eine Masszahl von der Vorgabe (mittig) abweicht.
|
||||
const dimTextResetItems: ContextMenuItem[] =
|
||||
a.movedDimensionTextCount && a.resetDimensionTexts
|
||||
? [{ label: t("cmd.dimtextreset.label"), icon: <MenuIcon name="format_align_center" />, onClick: a.resetDimensionTexts }]
|
||||
: [];
|
||||
|
||||
// Boolean-Einträge (Vereinigen/Subtrahieren/Schneiden) auf die 2D-Auswahl.
|
||||
// Aktiv ab 2 geschlossenen Flächen; sonst deaktiviert mit erklärendem Tooltip.
|
||||
@@ -462,6 +470,8 @@ function planMenuItems(
|
||||
...(layerItems.length ? [{ divider: true } as ContextMenuItem] : []),
|
||||
...noPrintItems,
|
||||
...dimDetachItems,
|
||||
...dimTextResetItems,
|
||||
...dimTextResetItems,
|
||||
...(noPrintItems.length ? [{ divider: true } as ContextMenuItem] : []),
|
||||
{
|
||||
label: t("ctx.fitSelection"),
|
||||
@@ -496,6 +506,7 @@ function planMenuItems(
|
||||
...(layerItems.length ? [{ divider: true } as ContextMenuItem] : []),
|
||||
...noPrintItems,
|
||||
...dimDetachItems,
|
||||
...dimTextResetItems,
|
||||
...(noPrintItems.length ? [{ divider: true } as ContextMenuItem] : []),
|
||||
...booleanItems,
|
||||
{ divider: true },
|
||||
|
||||
@@ -51,7 +51,7 @@ import { StairSection } from "./objectInfo/StairSection";
|
||||
import { RoomSection } from "./objectInfo/RoomSection";
|
||||
import { ExtrudedSolidSection, ColumnSection } from "./objectInfo/SolidSections";
|
||||
import { SectionLineSection } from "./objectInfo/SectionLineSection";
|
||||
import { DetailRefSection, DimRefsSection } from "./objectInfo/RefSections";
|
||||
import { DetailRefSection, DimRefsSection, DimTextSection } from "./objectInfo/RefSections";
|
||||
import { SurfacePatternPlacement } from "./SurfacePatternPlacement";
|
||||
|
||||
/** UI-Zustand des 3-Optionen-Quellen-Dropdowns (nicht 1:1 das Modell-Feld:
|
||||
@@ -869,6 +869,7 @@ export function AttributesPanel() {
|
||||
{sel.column && <ColumnSection column={sel.column} host={host} />}
|
||||
{sel.detailRef && <DetailRefSection detailRef={sel.detailRef} drawingId={sel.id} host={host} />}
|
||||
{sel.dimRefs && <DimRefsSection refs={sel.dimRefs} drawingId={sel.id} host={host} />}
|
||||
{sel.dimTextMoved && <DimTextSection drawingId={sel.id} host={host} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -285,6 +285,8 @@ export interface PanelHostValue {
|
||||
onSetDetailRefSheetLabel: (drawingId: string, sheetLabel: string) => void;
|
||||
/** „Bemassung lösen" ([38]): Bezüge der Bemassung entfernen, Punkte bleiben. */
|
||||
onDetachDimension: (drawingId: string) => void;
|
||||
/** „Text zurücksetzen" ([172]): Masszahlen der Bemassung zurück auf die Vorgabe (mittig). */
|
||||
onResetDimensionText: (drawingId: string) => void;
|
||||
onSetHatchPlacement: (
|
||||
drawingId: string,
|
||||
patch: { angleDeg?: number | null; scale?: number | null; origin?: Vec2 | null },
|
||||
|
||||
@@ -47,6 +47,21 @@ export function DimRefsSection({
|
||||
}
|
||||
|
||||
|
||||
// ── Masszahl ([172]) ─────────────────────────────────────────────────────────
|
||||
// Vorgabe: mittig über dem Massstrich; eine verschobene Zahl lässt sich dorthin zurücksetzen.
|
||||
export function DimTextSection({ drawingId, host }: { drawingId: string; host: ReturnType<typeof usePanelHost> }) {
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
<div className="objinfo-field">
|
||||
<button type="button" className="objinfo-btn" onClick={() => host.onResetDimensionText(drawingId)}>
|
||||
{t("cmd.dimtextreset.label")}
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// ── Detail-/Schnitt-Verweis-Attribut-Abschnitt ──────────────────────────────
|
||||
// Bezeichner (obere Zeile) + Blattverknüpfung (Dropdown der Project.layouts,
|
||||
// „kein Verweis" löst sie); ohne Verknüpfung zusätzlich ein manueller
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 68020
|
||||
bytes 68194
|
||||
circle 16
|
||||
g 1
|
||||
line 172
|
||||
line 171
|
||||
path 35
|
||||
polygon 79
|
||||
polyline 114
|
||||
polyline 115
|
||||
rect 1
|
||||
svg 1
|
||||
text 114
|
||||
tspan 24
|
||||
hash 205916044d15e651
|
||||
hash 19aba299f88b08d0
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 112474
|
||||
bytes 112644
|
||||
circle 16
|
||||
g 1
|
||||
line 419
|
||||
line 418
|
||||
path 66
|
||||
polygon 200
|
||||
polyline 132
|
||||
polyline 133
|
||||
rect 1
|
||||
svg 1
|
||||
text 119
|
||||
tspan 32
|
||||
hash d1ce1efc614bccce
|
||||
hash bdfbc7accc7f94f6
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -12.8 0 37.6 33.6
|
||||
bytes 47347
|
||||
bytes 47672
|
||||
circle 14
|
||||
g 1
|
||||
line 142
|
||||
line 141
|
||||
path 9
|
||||
polygon 44
|
||||
polyline 105
|
||||
polygon 45
|
||||
polyline 106
|
||||
rect 1
|
||||
svg 1
|
||||
text 86
|
||||
tspan 19
|
||||
hash 56539e8b37286122
|
||||
hash 3dd8578e3ef5c5f9
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -12.65 0 37.3 33.3
|
||||
bytes 358952
|
||||
bytes 359263
|
||||
circle 14
|
||||
g 1
|
||||
line 3238
|
||||
line 3237
|
||||
path 37
|
||||
polygon 144
|
||||
polyline 174
|
||||
polygon 145
|
||||
polyline 175
|
||||
rect 1
|
||||
svg 1
|
||||
text 89
|
||||
tspan 24
|
||||
hash c58c6f21f02cb3a3
|
||||
hash 59e65557ad5ce624
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -12.8 0 37.6 33.6
|
||||
bytes 41129
|
||||
bytes 41256
|
||||
circle 15
|
||||
g 1
|
||||
line 121
|
||||
path 22
|
||||
line 119
|
||||
path 23
|
||||
polygon 35
|
||||
polyline 71
|
||||
polyline 72
|
||||
rect 1
|
||||
svg 1
|
||||
text 72
|
||||
tspan 18
|
||||
hash 10120a432e658967
|
||||
hash fe3ac92f79a05b2a
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -12.65 0 37.3 33.3
|
||||
bytes 47747
|
||||
bytes 47879
|
||||
circle 15
|
||||
g 1
|
||||
line 117
|
||||
path 37
|
||||
line 115
|
||||
path 38
|
||||
polygon 70
|
||||
polyline 78
|
||||
polyline 79
|
||||
rect 1
|
||||
svg 1
|
||||
text 74
|
||||
tspan 20
|
||||
hash 5662567f86e7620a
|
||||
hash 43eee872c063493e
|
||||
@@ -1,11 +1,11 @@
|
||||
viewBox -1.961 0 8.922 7.473
|
||||
bytes 6727
|
||||
bytes 6795
|
||||
g 1
|
||||
line 29
|
||||
line 28
|
||||
polygon 16
|
||||
polyline 5
|
||||
polyline 6
|
||||
rect 1
|
||||
svg 1
|
||||
text 7
|
||||
tspan 3
|
||||
hash dffe9704c9cbff9f
|
||||
hash 659c902abde2a255
|
||||
@@ -1,11 +1,11 @@
|
||||
viewBox -1.731 0 8.461 7.322
|
||||
bytes 10157
|
||||
bytes 10226
|
||||
g 1
|
||||
line 30
|
||||
line 29
|
||||
polygon 43
|
||||
polyline 9
|
||||
polyline 10
|
||||
rect 1
|
||||
svg 1
|
||||
text 7
|
||||
tspan 3
|
||||
hash 02f3ed4056f36531
|
||||
hash 45acd3ebb788ed59
|
||||
@@ -180,6 +180,16 @@ export function buildSelectionStyleHost(c: FlatHostOpts) {
|
||||
onSetDashScale: (drawingId, scale) =>
|
||||
setProject(opsMutation((p) => patchItem(p, "drawings2d", drawingId, { dashScale: scale }))),
|
||||
onDetachDimension: (drawingId) => setProject(cmdMutation({ cmd: "dimdetach", ids: [drawingId] })),
|
||||
onResetDimensionText: (drawingId) =>
|
||||
setProject(
|
||||
opsMutation((p) =>
|
||||
patchItem(p, "drawings2d", drawingId, (d) => {
|
||||
if (d.geom.shape !== "dimension") return d;
|
||||
const { textOffsetsMm: _drop, ...geom } = d.geom;
|
||||
return { ...d, geom };
|
||||
}),
|
||||
),
|
||||
),
|
||||
onSetDetailRefLabel: (drawingId, label) =>
|
||||
setProject(
|
||||
opsMutation((p) =>
|
||||
|
||||
@@ -244,6 +244,8 @@ export interface ProjectSlice {
|
||||
pt: Vec2,
|
||||
/** Papier-Massstab (1:N), nur für den Masszahl-Griff der Bemassung. */
|
||||
scaleDenominator?: number,
|
||||
/** [172] Masszahl-Griff ohne Einrasten (Alt gehalten). */
|
||||
free?: boolean,
|
||||
) => void;
|
||||
moveElementByOf: (
|
||||
drawingId: string | null,
|
||||
@@ -1143,9 +1145,9 @@ export function createProjectSlice(
|
||||
// Diese Aktionen laufen AD-HOC bei jedem Maus-Move-Schritt eines Drags
|
||||
// (kein Draft/Commit-Muster wie bei den Zeichenwerkzeugen) — daher mit
|
||||
// coalesceKey, damit EIN Drag EINEN Undo-Schritt erzeugt statt vieler.
|
||||
moveGripOf: (drawingId, wallId, index, pt, scaleDenominator = DEFAULT_SCALE_DENOMINATOR) =>
|
||||
moveGripOf: (drawingId, wallId, index, pt, scaleDenominator = DEFAULT_SCALE_DENOMINATOR, free) =>
|
||||
applyGrip(
|
||||
{ op: "moveGrip", drawingId, wallId, index, pt: gripPt(pt), scale: scaleDenominator },
|
||||
{ op: "moveGrip", drawingId, wallId, index, pt: gripPt(pt), scale: scaleDenominator, ...(free ? { free: true } : {}) },
|
||||
`moveGripOf:${drawingId ?? ""}:${wallId ?? ""}:${index}`,
|
||||
),
|
||||
|
||||
|
||||
@@ -531,6 +531,8 @@ export interface SelectionInfo {
|
||||
* `geom.shape === "dimension"` mit Bezügen.
|
||||
*/
|
||||
dimRefs?: (DimRef | null)[];
|
||||
/** [172] Bemassung mit verschobener Masszahl (Abweichung von „mittig"): „Text zurücksetzen". */
|
||||
dimTextMoved?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -115,6 +115,7 @@ export function useGripEditing(opts: {
|
||||
index: number,
|
||||
pt: Vec2,
|
||||
scaleDenominator?: number,
|
||||
free?: boolean,
|
||||
) => void;
|
||||
moveRoomEdge: (id: string, aIndex: number, bIndex: number, delta: Vec2) => void;
|
||||
moveCeilingEdge: (id: string, aIndex: number, bIndex: number, delta: Vec2) => void;
|
||||
@@ -555,6 +556,8 @@ export function useGripEditing(opts: {
|
||||
// Letzter roher Cursor des laufenden Vertex-Drags (für die Lock-Auflösung beim
|
||||
// Tippen, wenn gerade kein Move-Event kommt). Plus der gezogene Griff-Index.
|
||||
const gripDragInfoRef = useRef<{ index: number; raw: Vec2 } | null>(null);
|
||||
/** [172] Alt gehalten beim Ziehen: Masszahl frei statt an festen Stellen einrastend. */
|
||||
const gripFreeRef = useRef(false);
|
||||
// AUSSTEHENDER Vertex-Zug eines Polylinien-Elements: Während des Ziehens wird das
|
||||
// PROJEKT NICHT verändert (sonst rechnet jede Mausbewegung den ganzen Plan neu —
|
||||
// bei Katasterdaten Sekunden); nur eine Vorschau (`gripPreviewShapes`) wird
|
||||
@@ -920,7 +923,7 @@ export function useGripEditing(opts: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
moveGripOf(dId, wId, local, pt, scaleDenominator);
|
||||
moveGripOf(dId, wId, local, pt, scaleDenominator, gripFreeRef.current);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1275,6 +1278,16 @@ export function useGripEditing(opts: {
|
||||
setDraft({ preview: gripPreviewShapes(), vertices: [], snap: null, hud: hudFor(index, pt) });
|
||||
return;
|
||||
}
|
||||
// [172] Masszahl-Griff: der Kern rastet an festen Stellen ein (Alt = frei); Objektfang würde das stören.
|
||||
gripFreeRef.current = !!mods.alt;
|
||||
if (owner?.drawingId) {
|
||||
const od = project.drawings2d.find((x) => x.id === owner.drawingId);
|
||||
if (od?.geom.shape === "dimension" && !od.geom.kind && owner.localIndex > od.geom.pts.length) {
|
||||
applyGrip(index, raw);
|
||||
setDraft({ preview: gripPreviewShapes(), vertices: [], snap: null, hud: hudFor(index, raw) });
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Snap gegen das Projekt OHNE das gerade gezogene Element (sonst fängt der
|
||||
// Punkt an sich selbst); Bezug ist der feste Nachbar-Griff, nicht der
|
||||
// laufende Werkzeug-Zustand (kein aktives Zeichenwerkzeug während des Drags).
|
||||
|
||||
@@ -58,7 +58,11 @@ export function selectionMenuState(project: Project, selection: Selection, withL
|
||||
const g = project.drawings2d.find((d) => d.id === id)?.geom;
|
||||
return g?.shape === "dimension" && !!g.refs?.some(Boolean);
|
||||
});
|
||||
return { selectionAllLocked, selectionLayerCodes, selectionAllNoPrint, attachedDimensionIds };
|
||||
const movedDimTextIds = selection.drawings.filter((id) => {
|
||||
const g = project.drawings2d.find((d) => d.id === id)?.geom;
|
||||
return g?.shape === "dimension" && !!g.textOffsetsMm?.some((o) => o.along !== 0 || o.perp !== 0);
|
||||
});
|
||||
return { selectionAllLocked, selectionLayerCodes, selectionAllNoPrint, attachedDimensionIds, movedDimTextIds };
|
||||
}
|
||||
|
||||
export function useSelectionCommands(opts: {
|
||||
@@ -275,6 +279,19 @@ export function useSelectionCommands(opts: {
|
||||
if (attachedDimensionIds.length) applyChange((p) => cmdMutation({ cmd: "dimdetach", ids: attachedDimensionIds }).toOps(p));
|
||||
};
|
||||
|
||||
// „Text zurücksetzen" ([172]): Masszahlen der gewählten Bemassungen zurück auf die Vorgabe (mittig).
|
||||
const resetDimensionTexts = () => {
|
||||
const { movedDimTextIds } = menuState();
|
||||
if (!movedDimTextIds.length) return;
|
||||
applyChange((p) =>
|
||||
patchItems(p, "drawings2d", movedDimTextIds, (d) => {
|
||||
if (d.geom.shape !== "dimension") return d;
|
||||
const { textOffsetsMm: _drop, ...geom } = d.geom;
|
||||
return { ...d, geom };
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
// Ctrl/Cmd+G / Ctrl/Cmd+Shift+G = Gruppieren/Auflösen (Vectorworks-artig,
|
||||
// s. state/groupActions.ts). `applyGroupSelection` setzt nach dem Gruppieren/
|
||||
// Auflösen alle betroffenen Auswahl-Kanäle auf einen Schlag.
|
||||
@@ -370,6 +387,7 @@ export function useSelectionCommands(opts: {
|
||||
isolateSelectionLayers,
|
||||
toggleSelectionNoPrint,
|
||||
detachDimensions,
|
||||
resetDimensionTexts,
|
||||
onEnterGroup,
|
||||
onLeaveGroup,
|
||||
onSegmentCut,
|
||||
|
||||
Reference in new issue
Block a user