Reputation: 260
We have attached mouseMove/mouseEnter/mouseLeave events to shapes/lines and so on, but we are looking for a way to allows paperjs trigger those events when mouse is close to the items (not necessarily be on top of them to trigger the events)
We are looking for something like (those don't seem to do the job):
paper.project.options.hitTolerance = X;
- or -
paper.settings.hitTolerance = X;
'hitTolerance' seems to be a value that paperjs uses for when we use .hitTest() without passing the options Object as param; are not used for internal paperjs events like mouseMove/mouseDown (taking in consideration that paperjs does an internal .hitTest(), when triggering those events, in order to check mouse collision with items)
Upvotes: 1
Views: 493
Reputation: 46
For now, there is no such option in paper.js. However, if you really need it, you can edit this line:
https://github.com/paperjs/paper.js/blob/master/src/view/CanvasView.js#L190
and build your custom version of library (or edit built file). As you can see, the tolerance is explicitly set to 0
. I've tried to set it to other value and it works - mouseEnter
and mouseLeave
events are fired earlier.
Upvotes: 2