Reputation: 4757
Currently I have a sample application that draws a line and has an onmouseclick listener on the line.
However the line is hard to hit because it is one pixel wide. Currently I make the line wider when you hover over it which makes it easier to aim but it is ugly.
Is there a way to make the "target" area for a mouse click bigger for a line without making the actual line bigger?
Upvotes: 1
Views: 707
Reputation: 466
You can create another line with same startX, startY, endX, endY properties and make it more thick by setStrokeWidth(10) and not visible by setOpacity(0) on it. After that you can handle mouse events from new thick invisible line as for actual one.
Upvotes: 3