Skip to content

Commit c9baba4

Browse files
tmck-codeclaude
andcommitted
fix back-view column culling so squares/grid render when zoomed
draw() computed the visible-column range with the front-view formula while the cell loops ran inside the back-view mirror transform, so zoomed back view culled on-screen columns. Compute c0/c1 with the mirrored mapping when flipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent a1f91d1 commit c9baba4

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

pages/pikachu-stitch-companion/js/render.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,18 @@ export function draw(){
7272
// fabric backdrop
7373
ctx.fillStyle='#14113f';
7474
ctx.fillRect(0,0,N*s,N*s);
75-
// visible range
76-
const c0=Math.max(0,Math.floor(-view.tx/s)), c1=Math.min(N,Math.ceil((w-view.tx)/s));
75+
const back = view.backView;
76+
// visible range — cell-space columns are mirrored in back view (drawn
77+
// inside the translate(N*s,0)+scale(-1,1) block below), so the
78+
// screen->column mapping flips: screenX = tx + N*s - c*s, not tx + c*s.
79+
const c0 = back
80+
? Math.max(0,Math.floor((view.tx+N*s-w)/s))
81+
: Math.max(0,Math.floor(-view.tx/s));
82+
const c1 = back
83+
? Math.min(N,Math.ceil((view.tx+N*s)/s))
84+
: Math.min(N,Math.ceil((w-view.tx)/s));
7785
const r0=Math.max(0,Math.floor(-view.ty/s)), r1=Math.min(N,Math.ceil((h-view.ty)/s));
7886
const detail = s>=7; // draw crosses when zoomed
79-
const back = view.backView;
8087
const topDir = state.settings.topLegDirection; // '/' or '\\'
8188
const showSymbols = symbolsOn && s>=11;
8289
const textQueue = []; // {x,y,text,dark} — drawn un-mirrored after restore

0 commit comments

Comments
 (0)