diff --git a/A00_Common/spreadsheet/spreadsheet_grid.ts b/A00_Common/spreadsheet/spreadsheet_grid.ts index 4963d5b3..9aec9cba 100644 --- a/A00_Common/spreadsheet/spreadsheet_grid.ts +++ b/A00_Common/spreadsheet/spreadsheet_grid.ts @@ -576,6 +576,20 @@ export function createGrid(ctx: SpreadsheetContext): GridHandle { return { x, y, w: box.w, h: box.h }; } + /** `overlay` 안 자리 — `overlay` 자신이 이미 머리 칸(headColW·headRowH)만큼 밀려 있어 + * `screenBoxOf`(격자 뿌리 기준)를 그대로 쓰면 머리 칸만큼 두 번 밀림(찾은 버그 · 2026-09-27). */ + function overlayBoxOf(r: number, c: number): CellBox { + const box = boxOf(r, c); + const inFrozenCol = c < frozenCols; + const inFrozenRow = r < frozenRows; + return { + x: inFrozenCol ? box.x : box.x - paneBR.scrollLeft, + y: inFrozenRow ? box.y : box.y - paneBR.scrollTop, + w: box.w, + h: box.h, + }; + } + function renderSelection(): void { let selLayer = overlay.querySelector(".aislo-grid__sel-layer"); if (!selLayer) { @@ -596,8 +610,8 @@ export function createGrid(ctx: SpreadsheetContext): GridHandle { const inFrozenCol = range.c0 < frozenCols; const inFrozenRow = range.r0 < frozenRows; const screen: CellBox = { - x: headColW() + (inFrozenCol ? box.x : box.x - paneBR.scrollLeft), - y: headRowH() + (inFrozenRow ? box.y : box.y - paneBR.scrollTop), + x: inFrozenCol ? box.x : box.x - paneBR.scrollLeft, + y: inFrozenRow ? box.y : box.y - paneBR.scrollTop, w: box.w, h: box.h, }; @@ -611,13 +625,11 @@ export function createGrid(ctx: SpreadsheetContext): GridHandle { node.style.borderWidth = i === 0 ? "2px" : "1px"; selLayer!.append(node); } - const active = boxOf(sel.활성.r, sel.활성.c); - const inFrozenCol = sel.활성.c < frozenCols; - const inFrozenRow = sel.활성.r < frozenRows; + const active = overlayBoxOf(sel.활성.r, sel.활성.c); const handle = document.createElement("div"); handle.className = "aislo-grid__fill-handle"; - handle.style.left = `${headColW() + (inFrozenCol ? active.x : active.x - paneBR.scrollLeft) + active.w - 4}px`; - handle.style.top = `${headRowH() + (inFrozenRow ? active.y : active.y - paneBR.scrollTop) + active.h - 4}px`; + handle.style.left = `${active.x + active.w - 4}px`; + handle.style.top = `${active.y + active.h - 4}px`; selLayer!.append(handle); } @@ -643,8 +655,8 @@ export function createGrid(ctx: SpreadsheetContext): GridHandle { const inFrozenRow = ref.범위.r0 < frozenRows; const node = document.createElement("div"); node.className = "aislo-grid__ref-highlight"; - node.style.left = `${headColW() + (inFrozenCol ? merged.x : merged.x - paneBR.scrollLeft)}px`; - node.style.top = `${headRowH() + (inFrozenRow ? merged.y : merged.y - paneBR.scrollTop)}px`; + node.style.left = `${inFrozenCol ? merged.x : merged.x - paneBR.scrollLeft}px`; + node.style.top = `${inFrozenRow ? merged.y : merged.y - paneBR.scrollTop}px`; node.style.width = `${merged.w}px`; node.style.height = `${merged.h}px`; node.style.borderColor = REF_COLORS[ref.색번호 % REF_COLORS.length];