cdglabs/apparatus

Impossible to click a line

joshuahhh opened this issue · 2 comments

I believe a two-point path is currently only selectable via the outline. It should probably be hoverable and selectable in the canvas.

Yes, and this is an easy fix!

The Model generates Graphic objects which represent every mark that will be drawn to the screen. The Graphic object is responsible for rendering (via canvas) and hit detection (using canvas isPointInPath).

So to make lines hit detect properly, you'll just need to modify Graphic.Path's hit detection to use canvas's isPointInStroke in addition to isPointInPath,
https://github.com/cdglabs/apparatus/blob/master/src/Graphic/Graphic.coffee#L107

Looking forward to your first PR @joshuahhh 😉

such excite