[144] Öffnungen verschieben: gewählte Tür/Fenster gleiten beim Verschieben entlang der Wand; Objekt-Info Abstand ab Wandende; Griff-Länge entlang der Wand
This commit is contained in:
19 files changed
+393
-12
No files matched your search
@@ -95,7 +95,7 @@ export const scaleCommand: Command = {
|
||||
onInput: (state, input, ctx): [CommandState, CommandResult] => {
|
||||
const s = state as ScState;
|
||||
if (s.phase === "done") return idle();
|
||||
if (!hasTransformSelection(ctx.selection)) {
|
||||
if (!hasTransformSelection(ctx.selection, "scale")) {
|
||||
return [{ phase: "done", lastPoint: null } as ScDone, { draft: null, done: true }];
|
||||
}
|
||||
|
||||
|
||||
@@ -143,4 +143,28 @@ describe("Transformations-Befehle", () => {
|
||||
expect(engine.isActive()).toBe(false);
|
||||
expect(lines(log.project)[0].b).toEqual({ x: 2, y: 0 });
|
||||
});
|
||||
|
||||
// [144] Tür allein gewählt: Bewegen startet, getippte Distanz schiebt sie entlang der Wand (W1: x 0…5).
|
||||
it("Öffnung: Bewegen mit getippter Distanz gleitet entlang der Wand; Drehen/Spiegeln lehnen ab", () => {
|
||||
const sel: CommandSelection = { wallIds: [], drawingId: null, openingIds: ["D1"] };
|
||||
const { engine, log } = setup(sel);
|
||||
const door = () => log.project.openings!.find((o) => o.id === "D1")!;
|
||||
expect(door().position).toBe(0.8);
|
||||
expect(engine.start("move")).toBe(true);
|
||||
engine.pick({ x: 1.25, y: 0 });
|
||||
engine.move({ x: 3, y: 0 });
|
||||
engine.submitText("0.5");
|
||||
expect(engine.isActive()).toBe(false);
|
||||
expect(door().position).toBeCloseTo(1.3, 9);
|
||||
expect(door().hostWallId).toBe("W1");
|
||||
// Relative Koordinate quer zur Wand: nur der Anteil längs zählt; am Wandende geklemmt.
|
||||
engine.start("move");
|
||||
engine.pick({ x: 0, y: 0 });
|
||||
engine.submitText("@9,0.05");
|
||||
expect(door().position).toBeCloseTo(5 - 0.9, 9);
|
||||
for (const op of ["rotate", "mirror"]) {
|
||||
expect(engine.start(op)).toBe(false);
|
||||
}
|
||||
expect(log.notes).toEqual(["transform.needSelection", "transform.needSelection"]);
|
||||
});
|
||||
});
|
||||
@@ -93,7 +93,7 @@ export function makeTransformCommand(op: TransformCmdOp, labelKey: TranslationKe
|
||||
|
||||
const input = (state: CommandState, inp: CmdInput, ctx: CommandContext): [CommandState, CommandResult] => {
|
||||
const s = state as TrState;
|
||||
if (s.phase === "done" || !hasTransformSelection(ctx.selection)) return done();
|
||||
if (s.phase === "done" || !hasTransformSelection(ctx.selection, op)) return done();
|
||||
if (inp.kind === "option") {
|
||||
const mode = MODES.find((m) => m.id === inp.id);
|
||||
if (!mode) return [s, { draft: s.cursor ? preview(s, s.cursor, ctx).draft : null }];
|
||||
|
||||
@@ -333,7 +333,7 @@ export class CommandEngine {
|
||||
this.host.notify?.(blocked, undefined, "warning");
|
||||
return false;
|
||||
}
|
||||
if (cmd.needsSelection && !hasTransformSelection(this.host.context(null).selection)) {
|
||||
if (cmd.needsSelection && !hasTransformSelection(this.host.context(null).selection, cmd.name)) {
|
||||
this.host.notify?.(cmd.needsSelection);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ export interface CommandSelection {
|
||||
stairIds?: string[];
|
||||
/** Gewählte Räume (Mehrfachauswahl). */
|
||||
roomIds?: string[];
|
||||
/** Gewählte Öffnungen ([144]): Wandöffnungen gleiten beim Verschieben entlang ihrer Wand. */
|
||||
openingIds?: string[];
|
||||
}
|
||||
|
||||
/** Live-Kontext, den ein Befehl bei jedem Schritt erhält (analog ToolContext). */
|
||||
|
||||
Reference in new issue
Block a user