mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Define test for hit-testing fill with tolerance.
This commit is contained in:
parent
2884894d0f
commit
2896f14e43
1 changed files with 17 additions and 0 deletions
|
@ -619,4 +619,21 @@ test('Hit testing guides.', function() {
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Hit testing fill with tolerance', function() {
|
||||||
|
var path = new Path.Rectangle({
|
||||||
|
from: [50, 50],
|
||||||
|
to: [200, 200],
|
||||||
|
fillColor: 'red'
|
||||||
|
});
|
||||||
|
|
||||||
|
equals(function() {
|
||||||
|
var tolerance = 10;
|
||||||
|
var result = paper.project.hitTest(path.bounds.bottomRight.add(tolerance / Math.sqrt(2)), {
|
||||||
|
tolerance: tolerance,
|
||||||
|
fill: true
|
||||||
|
});
|
||||||
|
return result && result.item === path;
|
||||||
|
}, true);
|
||||||
|
});
|
||||||
|
|
||||||
// TODO: project.hitTest(point, {type: AnItemType});
|
// TODO: project.hitTest(point, {type: AnItemType});
|
Loading…
Reference in a new issue