- commit
- 6f127600ddee73e6d1504f29b5d89a23b9ba1fa4
- parent
- 00670975ccf72e2c22b423b62a7383fd1dfb250f
- author
- Dami <dami.etoile@gmail.com>
| M | src/ | 5 | +++-- |
| M | tests/ | 7 | +++++-- |
@@ -117,9 +117,10 @@ function drawSentenceBars(ctx, state, geometry, colors, objectById, frame = null
117117 ? sentence.frozenCells.map(cell => ({ x: cell.x, y: cell.y }))118118 : words.map(word => { const visual = visualOf(word); return { x: visual.x, y: visual.y }; });119119 if (!cells.length) continue;120- const predicate = sentence.predicate || words[words.length - 1]?.text;121120 const progress = Number.isFinite(sentence.progress) ? Math.max(0, Math.min(1, sentence.progress)) : 1;122- ctx.fillStyle = colors[predicate] || colors.ink;121+ // Sentence bars are persistent structure signals, so they stay neutral;122+ // property colors belong to the tiles and transient rule effects.123+ ctx.fillStyle = colors.fg;123124 if (sentence.axis === 'v') {124125 const px = Math.min(...cells.map(cellPosition => cellPosition.x));125126 const y0 = Math.min(...cells.map(cellPosition => cellPosition.y));@@ -5,17 +5,18 @@ import { drawBoard } from '../src/render/board.js';
55 function context() {66 const calls = [];77 const ctx = {8- canvas: { width: 320, height: 240 }, calls,8+ canvas: { width: 320, height: 240 }, calls, styles: [],99 save() { calls.push(['save']); }, restore() { calls.push(['restore']); },1010 translate(...args) { calls.push(['translate', ...args]); }, scale(...args) { calls.push(['scale', ...args]); },1111 beginPath() { calls.push(['beginPath']); }, closePath() { calls.push(['closePath']); }, moveTo(...args) { calls.push(['moveTo', ...args]); }, lineTo(...args) { calls.push(['lineTo', ...args]); },1212 rect(...args) { calls.push(['rect', ...args]); }, roundRect(...args) { calls.push(['roundRect', ...args]); },13- fill() { calls.push(['fill']); }, stroke() { calls.push(['stroke']); }, clip() { calls.push(['clip']); },13+ fill() { calls.push(['fill', this._fillStyle]); }, stroke() { calls.push(['stroke']); }, clip() { calls.push(['clip']); },1414 fillRect(...args) { calls.push(['fillRect', ...args]); },1515 arc(...args) { calls.push(['arc', ...args]); }, ellipse(...args) { calls.push(['ellipse', ...args]); },1616 fillText(...args) { calls.push(['fillText', ...args]); },1717 measureText(text) { return { width: String(text).length * 8 }; },1818 };19+ Object.defineProperty(ctx, 'fillStyle', { get() { return this._fillStyle; }, set(value) { this._fillStyle = value; this.styles.push(value); } });1920 return ctx;2021 }2122 @@ -48,6 +49,8 @@ test('drawBoard draws sentence bars from physical sentence IDs and merges walls
4849 assert.equal(horizontalBars[0][1], 26.5);4950 assert.equal(horizontalBars[0][3], 139);5051 assert.ok(ctx.calls.some(call => call[0] === 'fillRect' && call[1] === 170 && call[2] === 110 && call[3] === 50 && call[4] === 50));52+ const barIndex = ctx.calls.indexOf(horizontalBars[0]);53+ assert.deepEqual(ctx.calls[barIndex + 1], ['fill', '#F2EEE6']);5154 });5255 5356 test('drawBoard dims a no-YOU board and shows recovery copy', () => {