cdglabs / apparatus

A hybrid graphics editor and programming environment for creating interactive diagrams.

Home Page:http://aprt.us/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Impossible to click a line

joshuahhh opened this issue · 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