- 칠한 결과(고른 측점선 · 없으면 고른 구조물 알약)를 보고 보이는 칸 밖일 때만 가운데로 옮김(createSelectionReveal · design_profile_viewport) - 같은 고름을 다시 칠하면 안 밂(사용자가 옮겨 본 자리 지킴) · 그래프 안 누름은 보이는 자리라 안 움직임 · 고른 뒤 다시 그리기가 끊지 않게 바로 옮김 - 요구 168 원문 기록 · 시험 test_273_1 새로 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLCk2y5xE8YGVgjbTntWsY
61 lines
2.2 KiB
JavaScript
61 lines
2.2 KiB
JavaScript
/* 273-1 종단 고름 → 화면 밖이면 가운데로 — 진짜 `createSelectionReveal`(design_profile_viewport.ts)을
|
|
* 가짜 스크롤러로 돌림. 표준출력 JSON 한 벌.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
const js = ts.transpileModule(
|
|
fs.readFileSync(path.join(ROOT, "A00_Common/design/design_profile_viewport.ts"), "utf8"),
|
|
{ compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 } },
|
|
).outputText;
|
|
const box = { exports: {} };
|
|
const stubs = {
|
|
"../../B05_Profile/B05_Profile_UI_Profile_Wheel": { attachWheelHorizontalScroll: () => {} },
|
|
"@util/common_util_chart_ywindow": { needsFullRedraw: () => false },
|
|
"@util/common_util_view_window": { viewOf: () => globalThis },
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, (name) => {
|
|
if (!stubs[name]) throw new Error(`stub 없음: ${name}`);
|
|
return stubs[name];
|
|
});
|
|
|
|
/** 폭 700 스크롤러 — 고른 선은 내용 좌표 `lineAt`(없으면 null). */
|
|
function scroller(lineAt) {
|
|
const body = {
|
|
scrollLeft: 0,
|
|
clientWidth: 700,
|
|
line: lineAt,
|
|
getBoundingClientRect: () => ({ left: 0, width: 700 }),
|
|
querySelector(selector) {
|
|
if (this.line === null || !selector.includes("--selected")) return null;
|
|
const x = this.line - this.scrollLeft;
|
|
return { getBoundingClientRect: () => ({ left: x - 1, width: 2 }) };
|
|
},
|
|
};
|
|
return body;
|
|
}
|
|
|
|
const out = {};
|
|
const far = scroller(3000);
|
|
const reveal = box.exports.createSelectionReveal(far);
|
|
reveal("a");
|
|
out.far = far.scrollLeft; // 3000 - 350
|
|
far.scrollLeft = 100; // 사용자가 옮겨 봄
|
|
reveal("a"); // 같은 고름 다시 칠함
|
|
out.same = far.scrollLeft;
|
|
|
|
const near = scroller(400);
|
|
box.exports.createSelectionReveal(near)("b");
|
|
out.near = near.scrollLeft; // 보이는 자리 — 안 밂
|
|
|
|
const late = scroller(null);
|
|
const revealLate = box.exports.createSelectionReveal(late);
|
|
revealLate("c"); // 아직 안 그려짐
|
|
late.line = 2000;
|
|
revealLate("c"); // 그린 뒤 같은 고름 — 이제 밂
|
|
out.late = late.scrollLeft;
|
|
|
|
process.stdout.write(JSON.stringify(out));
|