mock: スタビ位置は、どのサイズも何も選ばない状態から始める(T-30 単位8)
候補が1つのサイズも既定で選ばない。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017yoUu9Xd8dhwyQdCfKfaXG
This commit is contained in:
@@ -44,11 +44,6 @@ export function stabilizerCandidates(size: Size): StabilizerCandidate[] {
|
||||
const length = Math.max(size.w, size.h);
|
||||
return TABLE.find((row) => row.lengths.some((l) => Math.abs(l - length) < EPS))?.candidates ?? [];
|
||||
}
|
||||
/** A size with a single candidate shows it until chosen otherwise; several start unselected. */
|
||||
export function defaultStabilizerSelection(size: Size): string[] {
|
||||
const candidates = stabilizerCandidates(size);
|
||||
return candidates.length === 1 ? [candidates[0]!.id] : [];
|
||||
}
|
||||
/** Mount points in key-local coordinates, around the (w, h) rectangle's center, not the switch. */
|
||||
export function stabilizerPoints(size: Size, ids: string[]): Point[] {
|
||||
const cx = size.w / 2,
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import type { KeyNode, Node, PhyFile, Transform } from "../../domain/phy";
|
||||
import type { ProjectFile } from "../../domain/project";
|
||||
import {
|
||||
defaultStabilizerSelection,
|
||||
stabilizerCandidates,
|
||||
stabilizerPoints,
|
||||
switchPoint,
|
||||
} from "../../domain/stabilizers";
|
||||
import { stabilizerCandidates, stabilizerPoints, switchPoint } from "../../domain/stabilizers";
|
||||
import { apply, compose, inverse, matrix, type Affine } from "../../domain/geometry";
|
||||
|
||||
export function normalizeSelection(file: PhyFile, ids: string[]): string[] {
|
||||
@@ -337,10 +332,9 @@ export function stabilizerSelections(project: ProjectFile): StabilizerSelections
|
||||
const ui = project.ui as { phy?: { stabilizers?: StabilizerSelections } } | undefined;
|
||||
return ui?.phy?.stabilizers ?? {};
|
||||
}
|
||||
/** 記録がなければサイズの既定。サイズが変わって候補にない記録は捨てて読む。 */
|
||||
/** 記録がなければ何も選ばない。サイズが変わって候補にない記録は捨てて読む。 */
|
||||
export function selectedStabilizers(selections: StabilizerSelections, key: KeyNode): string[] {
|
||||
const ids = selections[key.id];
|
||||
if (!ids) return defaultStabilizerSelection(key.size);
|
||||
const ids = selections[key.id] ?? [];
|
||||
const known = new Set(stabilizerCandidates(key.size).map((c) => c.id));
|
||||
return ids.filter((id) => known.has(id));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user