[329] [330] Werkzeug-Tooltips mit Kürzel, Klasse für ganze Mehrfachauswahl, Lauflinie mit Antrittspunkt (SIA 400)

This commit is contained in:
Claude committed 2026-11-24 14:56:56 +00:00
1 parent fe31440182
commit a0e4290175
27 files changed
+228 -56

No files matched your search

+28
View File
@@ -534,6 +534,34 @@ export const de = {
"objinfo.kind.roof": "Dach",
"objinfo.kind.contextObject": "Gelände/Umgebung",
"objinfo.kind.buildingMesh": "Importierter Körper",
"objinfo.multi": "{n} Elemente gewählt: {list}",
"objinfo.multi.hint": "Die Felder zeigen das erste Element; Klasse, Farbe und Strichstärke gelten für alle gewählten.",
"objinfo.multi.kind.walls": "Wände",
"objinfo.multi.kind.walls.one": "Wand",
"objinfo.multi.kind.drawings": "2D-Objekte",
"objinfo.multi.kind.drawings.one": "2D-Objekt",
"objinfo.multi.kind.ceilings": "Decken",
"objinfo.multi.kind.ceilings.one": "Decke",
"objinfo.multi.kind.openings": "Türen/Fenster",
"objinfo.multi.kind.openings.one": "Tür/Fenster",
"objinfo.multi.kind.stairs": "Treppen",
"objinfo.multi.kind.stairs.one": "Treppe",
"objinfo.multi.kind.rooms": "Räume",
"objinfo.multi.kind.rooms.one": "Raum",
"objinfo.multi.kind.solids": "Körper",
"objinfo.multi.kind.solids.one": "Körper",
"objinfo.multi.kind.columns": "Stützen/Träger",
"objinfo.multi.kind.columns.one": "Stütze/Träger",
"objinfo.multi.kind.roofs": "Dächer",
"objinfo.multi.kind.roofs.one": "Dach",
"objinfo.multi.kind.contextObjects": "Umgebungs-Elemente",
"objinfo.multi.kind.contextObjects.one": "Umgebungs-Element",
"objinfo.multi.kind.trees": "Bäume",
"objinfo.multi.kind.trees.one": "Baum",
"objinfo.multi.kind.cameras": "Kameras",
"objinfo.multi.kind.cameras.one": "Kamera",
"objinfo.multi.kind.railings": "Geländer",
"objinfo.multi.kind.railings.one": "Geländer",
"objinfo.kind.sunStudy": "Schatten (Sonnenstand)",
"objinfo.kind.siteRules": "Baurecht",
"objinfo.kind.viewShadows": "Schlagschatten (Ansicht)",
+28
View File
@@ -532,6 +532,34 @@ export const en: Record<TranslationKey, string> = {
"objinfo.kind.roof": "Roof",
"objinfo.kind.contextObject": "Site element",
"objinfo.kind.buildingMesh": "Imported body",
"objinfo.multi": "{n} elements selected: {list}",
"objinfo.multi.hint": "The fields show the first element; class, color and line weight apply to all selected.",
"objinfo.multi.kind.walls": "walls",
"objinfo.multi.kind.walls.one": "wall",
"objinfo.multi.kind.drawings": "2D objects",
"objinfo.multi.kind.drawings.one": "2D object",
"objinfo.multi.kind.ceilings": "slabs",
"objinfo.multi.kind.ceilings.one": "slab",
"objinfo.multi.kind.openings": "doors/windows",
"objinfo.multi.kind.openings.one": "door/window",
"objinfo.multi.kind.stairs": "stairs",
"objinfo.multi.kind.stairs.one": "stair",
"objinfo.multi.kind.rooms": "rooms",
"objinfo.multi.kind.rooms.one": "room",
"objinfo.multi.kind.solids": "solids",
"objinfo.multi.kind.solids.one": "solid",
"objinfo.multi.kind.columns": "columns/beams",
"objinfo.multi.kind.columns.one": "column/beam",
"objinfo.multi.kind.roofs": "roofs",
"objinfo.multi.kind.roofs.one": "roof",
"objinfo.multi.kind.contextObjects": "site objects",
"objinfo.multi.kind.contextObjects.one": "site object",
"objinfo.multi.kind.trees": "trees",
"objinfo.multi.kind.trees.one": "tree",
"objinfo.multi.kind.cameras": "cameras",
"objinfo.multi.kind.cameras.one": "camera",
"objinfo.multi.kind.railings": "railings",
"objinfo.multi.kind.railings.one": "railing",
"objinfo.kind.sunStudy": "Shadow (sun position)",
"objinfo.kind.siteRules": "Building regulations",
"objinfo.kind.viewShadows": "Cast shadow (elevation)",
+1 -1
View File
@@ -2755,7 +2755,7 @@ export type ModelViewStairs = {
runStartMm?: number;
/** Versatz der Lauflinie am Ende in Papier-mm (Basis 0: bis zur Austrittskante). */
runEndMm?: number;
/** Antrittspunkt am Anfang der Lauflinie (Basis: nein). */
/** Antrittspunkt am Anfang der Lauflinie (Basis: ja, SIA 400). */
startMark?: boolean;
/** [173] Stufennummern im Grundriss (Basis: nein). */
stepNumbers?: boolean;
+15 -4
View File
@@ -27,6 +27,7 @@ import { Dropdown } from "../ui/Dropdown";
import { usePanelHost } from "./host";
import { useStore } from "../state/appStore";
import { excavationQuantities } from "../core";
import { selectionCounts } from "../state/selectionCategory";
import { ContextObjectProps } from "./ContextObjectProps";
import { SunStudySection } from "./SunStudySection";
import { SiteRulesSection } from "./SiteRulesSection";
@@ -60,10 +61,6 @@ function toDeg360(rad: number): number {
}
/**
* `showPlacement` = false: ohne Bezugspunkt/Lage und Masse (Breite/Höhe/Drehen) — so zeigt sie das Fenster
* Objekteinstellungen ([218], Wunsch Maintainer: Platzierung und Masse gehören nur ins Objekt-Info-Panel).
*/
/** [328] Liegt die Klasse `code` unter „05 Kontext“ (oder ist sie es)? Umgebung statt Gebäude. */
function isContextCode(layers: readonly LayerCategory[], code: string): boolean {
const ctx = layers.find((c) => c.code === "05");
@@ -71,12 +68,17 @@ function isContextCode(layers: readonly LayerCategory[], code: string): boolean
return code === "05" || flattenCategories([ctx]).some((c) => c.code === code);
}
/**
* `showPlacement` = false: ohne Bezugspunkt/Lage und Masse (Breite/Höhe/Drehen) — so zeigt sie das Fenster
* Objekteinstellungen ([218], Wunsch Maintainer: Platzierung und Masse gehören nur ins Objekt-Info-Panel).
*/
export function ObjectInfoPanel({ showPlacement = true }: { showPlacement?: boolean } = {}) {
const host = usePanelHost();
const storeProject = useStore((st) => st.project);
// [121] Abschnitts-Rahmen ohne eigene Komponente (kein Render je Abschnitt bei Inhaltsänderung).
const gst = useInfoGroupState();
const sel = useSelectionInfo();
const allSel = useStore((s) => s.selection);
// Gewählter Bezugspunkt — Default Mitte (Vectorworks-Standardanker beim
// Skalieren). Bleibt erhalten, solange das Panel montiert ist.
@@ -131,6 +133,9 @@ export function ObjectInfoPanel({ showPlacement = true }: { showPlacement?: bool
);
}
const counts = selectionCounts(allSel);
const total = counts.reduce((n, x) => n + x.n, 0);
const multi = total > 1 ? { total, list: counts.map((x) => `${x.n} ${t(`objinfo.multi.kind.${x.kind}${x.n === 1 ? ".one" : ""}`)}`).join(", ") } : null;
const { bbox } = sel;
const elementDims = elementDimensions(sel);
const width = bbox.maxX - bbox.minX;
@@ -174,6 +179,12 @@ export function ObjectInfoPanel({ showPlacement = true }: { showPlacement?: bool
{/* Kopfzeile: Typ + editierbare Klasse (Grafik-Kategorie) + Zeichnungsebene
(VW-Muster „Klasse"/„Ebene"). */}
<div className="objinfo-head">
{multi && (
// [287] (6) Mehrfachauswahl: wie viele und welche; die Felder zeigen das erste Element, die Klasse gilt für alle.
<div className="objinfo-multi" data-testid="objinfo-multi" title={t("objinfo.multi.hint")}>
{t("objinfo.multi", { n: multi.total, list: multi.list })}
</div>
)}
<span className="objinfo-kind">
{/* [328] Importiertes Netz auf einer Gebäudeklasse (Archicad-Morph, Möbel …) ist kein Gelände. */}
{sel.kind === "contextObject" && sel.contextObject?.objType === "importedMesh" && !isContextCode(storeProject.layers, sel.categoryCode)
+6 -2
View File
@@ -16,6 +16,7 @@ import { t } from "../i18n";
import { usePanelHostAction, usePanelHostSelect } from "./host";
import type { ToolId } from "./host";
import { toolInfo } from "../tools/tools";
import { toolShortcutLabel } from "../state/keyboardShortcuts";
import { getCommand } from "../commands/registry";
import { CommandIcon } from "../ui/ribbon/CommandIcon";
@@ -422,13 +423,16 @@ export const ToolsPanel = memo(function ToolsPanel() {
const active = host.activeTool === id;
const disabled = !!tool.floorOnly && !host.toolsEnabled;
const label = t(tool.labelKey);
const title = disabled ? t("tool.floorOnlyDisabled") : t(tool.hintKey);
// [287] (12) Kürzel im Tooltip („Linie (L)“), damit man es beim Überfahren lernt.
const key = toolShortcutLabel(id);
const withKey = (s: string) => (key ? `${s} (${key})` : s);
const title = disabled ? t("tool.floorOnlyDisabled") : withKey(t(tool.hintKey));
return (
<button
key={id}
type="button"
className={"tp-item" + (active ? " active" : "") + (disabled ? " disabled" : "")}
title={view === "icons" ? label : title}
title={view === "icons" ? withKey(label) : title}
disabled={disabled}
onClick={() => onSelectTool(id)}
>
@@ -1,6 +1,6 @@
viewBox -41.5 0 95 64.4
bytes 67497
circle 16
bytes 67684
circle 18
g 1
line 135
path 36
@@ -10,4 +10,4 @@ rect 1
svg 1
text 112
tspan 25
hash 4c8e70ff64f0e99f
hash ddbe47666be2997b
@@ -1,6 +1,6 @@
viewBox -41.5 0 95 64.4
bytes 109498
circle 16
bytes 109687
circle 18
g 1
line 347
path 55
@@ -10,4 +10,4 @@ rect 1
svg 1
text 112
tspan 25
hash a804216dc5e278de
hash 653b8a39c026178d
@@ -1,6 +1,6 @@
viewBox -13.448 0 38.615 33.813
bytes 43019
circle 14
bytes 43114
circle 15
g 1
line 108
path 10
@@ -10,4 +10,4 @@ rect 1
svg 1
text 81
tspan 18
hash 602612ae9e29b19d
hash 0334ef31acd6d3a2
@@ -1,6 +1,6 @@
viewBox -12.974 0 37.808 33.406
bytes 353606
circle 14
bytes 353703
circle 15
g 1
line 3244
path 26
@@ -10,4 +10,4 @@ rect 1
svg 1
text 81
tspan 18
hash f024c8739931ecf9
hash 1197a476e1d92d19
@@ -1,6 +1,6 @@
viewBox -13.693 0 38.86 33.813
bytes 41839
circle 16
bytes 41933
circle 17
g 1
line 99
path 23
@@ -10,4 +10,4 @@ rect 1
svg 1
text 69
tspan 15
hash f131d64fdd40ad29
hash f0facbdfc6ebd276
@@ -1,6 +1,6 @@
viewBox -13.693 0 38.527 33.406
bytes 49293
circle 16
bytes 49389
circle 17
g 1
line 94
path 36
@@ -10,4 +10,4 @@ rect 1
svg 1
text 69
tspan 15
hash 30c495bd4bb540d7
hash 0a8b71604aae6e9a
@@ -1,5 +1,6 @@
viewBox -1.621 0 8.242 7.535
bytes 5568
bytes 5660
circle 1
g 1
line 16
polygon 19
@@ -8,4 +9,4 @@ rect 1
svg 1
text 5
tspan 2
hash aa7787a19c497fbc
hash 67bb8edfc21fb658
@@ -1,5 +1,6 @@
viewBox -1.56 0 8.121 7.354
bytes 9150
bytes 9243
circle 1
g 1
line 17
polygon 49
@@ -8,4 +9,4 @@ rect 1
svg 1
text 5
tspan 2
hash c85802c3265720ba
hash 5573d1ca99ede3a8
@@ -1,5 +1,6 @@
viewBox -1.621 0 8.242 7.763
bytes 4121
bytes 4211
circle 1
g 1
line 18
polygon 15
@@ -7,4 +8,4 @@ polyline 2
rect 1
svg 1
text 3
hash 936e546160c97d00
hash 66eef319f17699b8
@@ -1,5 +1,6 @@
viewBox -1.56 0 8.121 7.581
bytes 6177
bytes 6268
circle 1
g 1
line 18
polygon 33
@@ -7,4 +8,4 @@ polyline 2
rect 1
svg 1
text 3
hash 1d301343498bce1b
hash e5de16e6ae4a23a0
+11
View File
@@ -15,6 +15,7 @@ import {
resolveCombo,
SHORTCUT_DEFS,
type ShortcutOverrides,
toolShortcutLabel,
} from "./keyboardShortcuts";
// Reines Objekt statt `new KeyboardEvent(...)` — Letzteres braucht ein DOM
@@ -223,3 +224,13 @@ describe("[170] Datei-Kürzel ausserhalb von Tauri (Browser/Electron-Linux)", ()
for (const c of ["mod+s", "mod+shift+s", "mod+o"]) expect(combos).not.toContain(c);
});
});
describe("toolShortcutLabel", () => {
// [287] (12) Werkzeug-Tooltips mit Kürzel; Übersteuerung gilt, Werkzeug ohne Kürzel `null`.
it("zeigt das wirksame Kürzel", () => {
const def = toolShortcutLabel("wall", {});
expect(def).toBeTruthy();
expect(toolShortcutLabel("wall", { toolWall: "shift+w" })).toMatch(/W$/);
expect(toolShortcutLabel("gibts-nicht", {})).toBeNull();
});
});
+21
View File
@@ -422,3 +422,24 @@ export function formatCombo(combo: string, mac: boolean = isMacPlatform()): stri
segs.push(keyLabel);
return segs.join(mac ? "" : "+");
}
/** Reihenfolge/Zuordnung Ziffer→Werkzeug — Ids der rebindbaren Kombination in `keyboardShortcuts.ts`. */
export const TOOL_SHORTCUT_IDS: { id: ShortcutId; tool: string }[] = [
{ id: "toolText", tool: "text" },
{ id: "toolLine", tool: "line" },
{ id: "toolCircle", tool: "circle" },
{ id: "toolRect", tool: "rect" },
{ id: "toolPolyline", tool: "polyline" },
{ id: "toolWall", tool: "wall" },
{ id: "toolCeiling", tool: "ceiling" },
{ id: "toolWindow", tool: "window" },
{ id: "toolDoor", tool: "door" },
{ id: "toolRoom", tool: "room" },
];
/** [287] (12) Tastenkürzel eines Werkzeugs zur Anzeige (Tooltip „Linie (L)“), mit Übersteuerung; ohne Kürzel `null`. */
export function toolShortcutLabel(tool: string, overrides: ShortcutOverrides = loadShortcutOverrides()): string | null {
const m = TOOL_SHORTCUT_IDS.find((x) => x.tool === tool);
const combo = m ? resolveCombo(m.id, overrides) : "";
return combo ? formatCombo(combo) : null;
}
@@ -6,6 +6,7 @@
import { applyFillMode } from "../fillMode";
import { cmdMutation, opsMutation, patchItem, patchItems } from "../../core";
import { getState } from "../appStore";
import { categoryOpsForSelection, selectionCounts } from "../selectionCategory";
import { STYLE_KINDS } from "../mixedValues";
import { resolvePenColor } from "../../model/penSets";
import type { TransformSelection } from "../../tools/transform";
@@ -355,6 +356,12 @@ export function buildSelectionStyleHost(c: FlatHostOpts) {
// (VW-Muster „Klasse"/„Ebene"). Je Elementart der passende Store-Weg.
onSetSelectionCategory: (code) => {
if (!selection || !code) return;
// [287] (6) Mehrfachauswahl: Klasse für alle gewählten Elemente, ein Undo-Schritt (Vectorworks-Muster).
const all = getState().selection;
if (selectionCounts(all).reduce((n, x) => n + x.n, 0) > 1) {
applyChange((p) => categoryOpsForSelection(p, all, code));
return;
}
const id = selection.id;
switch (selection.kind) {
case "wall": updateWall(id, { categoryCode: code }); break;
+19
View File
@@ -0,0 +1,19 @@
import { describe, expect, it } from "vitest";
import { applyOps } from "../core/ops";
import { sampleProject } from "../model/sampleProject";
import { emptySelection } from "./selection";
import { categoryOpsForSelection, selectionCounts } from "./selectionCategory";
describe("categoryOpsForSelection", () => {
// [287] (6) Klasse im Objekt-Info-Kopf gilt für die ganze Auswahl, nicht nur für das erste Element.
it("setzt die Klasse für alle gewählten Wände und Öffnungen", () => {
const p = sampleProject;
const walls = p.walls.slice(0, 2).map((w) => w.id);
const op = (p.openings ?? [])[0].id;
const sel = { ...emptySelection(), walls, openings: [op] };
const next = applyOps(p, categoryOpsForSelection(p, sel, "99"));
expect(next.walls.filter((w) => w.categoryCode === "99").map((w) => w.id)).toEqual(walls);
expect(next.openings?.find((o) => o.id === op)?.categoryCode).toBe("99");
expect(selectionCounts(sel)).toEqual([{ kind: "walls", n: 2 }, { kind: "openings", n: 1 }]);
});
});
+40
View File
@@ -0,0 +1,40 @@
// [287] (6) Objekt-Info bei Mehrfachauswahl (Vectorworks-Muster): die Klasse im Kopf gilt für ALLE gewählten Elemente,
// ein Undo-Schritt; dazu die Zusammenfassung „3 Elemente (2 Wände, 1 Tür)“ für den Kopf.
import type { CoreOp } from "../core";
import { patchItems } from "../core";
import type { Project } from "../model/types";
import type { Selection } from "./selection";
/** Auswahl-Art → Sammlungen im Projekt (der Kanal „columns“ trägt Stützen UND Träger). */
const KIND_COLLECTIONS = [
["walls", ["walls"]],
["drawings", ["drawings2d"]],
["ceilings", ["ceilings"]],
["openings", ["openings"]],
["stairs", ["stairs"]],
["rooms", ["rooms"]],
["solids", ["extrudedSolids"]],
["columns", ["columns", "beams"]],
["roofs", ["roofs"]],
["contextObjects", ["context"]],
["trees", ["trees"]],
["cameras", ["cameras"]],
["railings", ["railings"]],
] as const;
/** Ops: Klasse `code` für jedes gewählte Element (ohne Änderung, wo sie schon gilt). */
export function categoryOpsForSelection(p: Project, sel: Selection, code: string): CoreOp[] {
const ops: CoreOp[] = [];
for (const [kind, collections] of KIND_COLLECTIONS) {
const ids = sel[kind];
if (!ids?.length) continue;
for (const col of collections) ops.push(...patchItems(p, col, ids, (e) => ({ ...e, categoryCode: code })));
}
return ops;
}
/** Anzahl gewählter Modell-Elemente je Auswahl-Art (ohne Gruppen, Schnittlinien, Lage-Darstellung). */
export function selectionCounts(sel: Selection): { kind: (typeof KIND_COLLECTIONS)[number][0]; n: number }[] {
return KIND_COLLECTIONS.map(([kind]) => ({ kind, n: sel[kind]?.length ?? 0 })).filter((x) => x.n > 0);
}
+2 -15
View File
@@ -32,7 +32,7 @@ import {
} from "../editors/elementClipboard";
import type { ElementClipboard, ElementSelectionIds, PastedIds } from "../editors/elementClipboard";
import { parseClipboardText, serializeClipboardText } from "../editors/elementClipboardSerialize";
import { SHORTCUT_DEFS, fileShortcutFor, matchesShortcut, tabKeyAction, type FileShortcut, type ShortcutId, type ShortcutOverrides } from "./keyboardShortcuts";
import { SHORTCUT_DEFS, TOOL_SHORTCUT_IDS, fileShortcutFor, matchesShortcut, tabKeyAction, type FileShortcut, type ShortcutOverrides } from "./keyboardShortcuts";
import { isPrimaryMod } from "./platform";
import { isTauriRuntime } from "../native/projectFile";
import { isolateSelectionLayerCodes, showAllLayerCodes } from "./layerIsolate";
@@ -175,19 +175,6 @@ export function useCommandTabShortcut(
* Ebenen-Art über ein Ref (sonst müsste der Effekt bei jedem Render neu
* registrieren).
*/
/** Reihenfolge/Zuordnung Ziffer→Werkzeug — Ids der rebindbaren Kombination in `keyboardShortcuts.ts`. */
const TOOL_SHORTCUT_IDS: { id: ShortcutId; tool: ToolId }[] = [
{ id: "toolText", tool: "text" },
{ id: "toolLine", tool: "line" },
{ id: "toolCircle", tool: "circle" },
{ id: "toolRect", tool: "rect" },
{ id: "toolPolyline", tool: "polyline" },
{ id: "toolWall", tool: "wall" },
{ id: "toolCeiling", tool: "ceiling" },
{ id: "toolWindow", tool: "window" },
{ id: "toolDoor", tool: "door" },
{ id: "toolRoom", tool: "room" },
];
export function useToolNumberShortcuts(
onSelectTool: (id: ToolId) => void,
@@ -228,7 +215,7 @@ export function useToolNumberShortcuts(
if (!match) return;
if (!toolShortcutRef.current.floor) return; // Werkzeuge nur auf Geschossen
e.preventDefault();
toolShortcutRef.current.onSelectTool(match.tool);
toolShortcutRef.current.onSelectTool(match.tool as ToolId);
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
+8
View File
@@ -5507,6 +5507,7 @@ body {
}
.objinfo-head {
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: space-between;
gap: 8px;
@@ -5515,6 +5516,13 @@ body {
font-weight: 600;
color: var(--label);
}
/* [287] (6) Mehrfachauswahl: Zeile über der Art, ganze Breite. */
.objinfo-multi {
flex-basis: 100%;
font-size: 11px;
color: var(--muted);
padding: 2px 0 4px;
}
.objinfo-cat {
color: var(--muted);
font-size: 11px;