mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
parent
3ffd7c4ac2
commit
083a09604d
2 changed files with 16 additions and 2 deletions
|
@ -1901,7 +1901,7 @@ new function() { // Injection scope for hit-test functions shared with project
|
|||
// need to apply the inverted item matrix.
|
||||
tolerancePadding = options._tolerancePadding = new Size(
|
||||
Path._getStrokePadding(tolerance,
|
||||
matrix.inverted()._shiftless()));
|
||||
matrix._shiftless().invert()));
|
||||
// Transform point to local coordinates.
|
||||
point = matrix._inverseTransform(point);
|
||||
// If the matrix is non-reversible, point will now be `null`:
|
||||
|
@ -1980,7 +1980,7 @@ new function() { // Injection scope for hit-test functions shared with project
|
|||
// If the item has a non-scaling stroke, we need to
|
||||
// apply the inverted viewMatrix to stroke dimensions.
|
||||
this.getStrokeScaling() ? null
|
||||
: viewMatrix.inverted()._shiftless()))
|
||||
: viewMatrix._shiftless().invert()))
|
||||
|| null;
|
||||
}
|
||||
// Transform the point back to the outer coordinate system.
|
||||
|
|
|
@ -854,4 +854,18 @@ test('hit-testing scaled items with different settings of view.zoom and item.str
|
|||
testItem(Path, 2, true);
|
||||
});
|
||||
|
||||
test('hit-testing items scaled to 0', function() {
|
||||
var item = new Shape.Rectangle({
|
||||
point: [0, 0],
|
||||
size: [100, 100],
|
||||
fillColor: 'red',
|
||||
selected: true
|
||||
});
|
||||
|
||||
item.scale(0);
|
||||
|
||||
testHitResult(project.hitTest(item.position), null,
|
||||
'should not throw an exception.');
|
||||
});
|
||||
|
||||
// TODO: project.hitTest(point, {type: AnItemType});
|
||||
|
|
Loading…
Reference in a new issue