- commit
- af8582ad2a8ee2788a8337fcfa470842f6d02231
- parent
- c797f7d75d5bcc1c670227119af5ce79130430d1
- author
- Dami <dami.etoile@gmail.com>
| M | src/ | 5 | ++++- |
| M | tests/ | 1 | + |
@@ -223,7 +223,10 @@ export function createGiftScene({ pack = null, collision = false, warnings: init
223223 row.forEach(({ key, label, labelSize, keyWidth, width: itemWidth }, rowItemIndex) => {224224 const index = hintRows.slice(0, rowIndex).reduce((sum, previous) => sum + previous.length, 0) + rowItemIndex;225225 const hintAction = warnings.length ? [['noop'], ['details'], ['copy'], ['noop'], ['noop']][index]?.[0] : 'noop';226- if (hintAction !== 'noop') hintButtons.push({ action: hintAction, x: hintX - 4, y: hintY - 4, width: keyWidth + 8, height: 28 });226+ if (hintAction !== 'noop') {227+ const targetWidth = Math.max(44, keyWidth + 16);228+ hintButtons.push({ action: hintAction, x: hintX - (targetWidth - keyWidth) / 2, y: hintY - 12, width: targetWidth, height: 44 });229+ }227230 ctx.save(); ctx.fillStyle = COLORS.board; rounded(ctx, hintX, hintY, keyWidth, rowHeight, 3); ctx.fill(); ctx.strokeStyle = COLORS.edge; ctx.lineWidth = 1; rounded(ctx, hintX, hintY, keyWidth, rowHeight, 3); ctx.stroke(); text(ctx, key, hintX + keyWidth / 2, hintY + rowHeight / 2, { size: hintSize - 1, weight: 850, color: COLORS.fg, align: 'center' }); text(ctx, label, hintX + keyWidth + 6, hintY + rowHeight / 2, { size: labelSize, weight: 700, color: COLORS.muted }); ctx.restore(); hintX += itemWidth + hintGap;228231 });229232 });@@ -173,6 +173,7 @@ test('Gift note keycaps are tappable on mobile and details stay above the previe
173173 assert.ok(layout.hints.x >= layout.x + 8);174174 assert.ok(layout.hints.x + layout.hints.width <= layout.x + layout.width - 8);175175 assert.ok(layout.hintActions.every(item => item.x >= layout.x && item.x + item.width <= layout.x + layout.width));176+ assert.ok(layout.hintActions.every(item => item.width >= 44 && item.height >= 44));176177 assert.ok(layout.actions.at(-1).y + layout.actions.at(-1).height + 8 <= Math.min(...layout.hintActions.map(item => item.y)));177178 const expandedCopyKey = layout.hintActions.find(item => item.action === 'copy');178179 assert.ok(scene.hit(expandedCopyKey.x + expandedCopyKey.width / 2, expandedCopyKey.y + expandedCopyKey.height / 2).ok);