Created
November 19, 2011 01:15
-
-
Save penguinbroker/1378258 to your computer and use it in GitHub Desktop.
Paper.js hit test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hitTool = new paper.Tool(); | |
hitTool.activate(); | |
hitTool.onMouseDown = function (event) { | |
hitOptions = { | |
segments: true, | |
stroke: true, | |
fill: true, | |
tolerance: 5 | |
}; | |
hitResult = paper.project.hitTest(event.point, hitOptions); | |
if (hitResult) { | |
// we have a hit, do something here | |
hitResult.item.selected = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment