Workshop › Blackjack › Step 20 of 22
A hand of seven small cards would run off the table. When there are too many cards, they move closer and overlap a little, so the last card always ends 20 pixels before the right edge.
```js
// Cards overlap a little so a long hand still fits.
const step = Math.min(CARD_W + 8, (canvas.width - 40 - CARD_W) / Math.max(1, hand.length - 1))
hand.forEach((c, i) => drawCard(c, 20 + i * step, y, hideSecond && i === 1))
```Math.min keeps the usual 72-pixel step when the hand is short.Math.max(1, ...) avoids dividing by 0 for a hand of one card.drawHand, write the comment.step, and use it instead of CARD_W + 8.Skills: Drawing on a canvas