Workshop › Candy Crush-style Match 3 › Step 8 of 29
The selected gem gets a white frame, drawn after all the gems so it is on top.
```js
if (selected) {
ctx.lineWidth = 3
ctx.strokeStyle = '#ffffff'
ctx.strokeRect(LEFT + selected.c * SIZE + 2, TOP + selected.r * SIZE + 2, SIZE - 4, SIZE - 4)
}
```if (selected) is false while nothing is selected (undefined or null).strokeRect(x, y, width, height) draws an empty rectangle with strokeStyle and lineWidth. It is 2 pixels inside
the square on each side.In draw, after the two loops (under their closing } lines), write the if block.
Skills: Drawing on a canvas
← Click a gem Swap two neighbours →