mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-16 22:10:32 +00:00
Fixed incorrect Object.isOnScreen functionality. (#4763)
* Added missing calculate parameter in Object.isOnScreen. * Update object_geometry.js
This commit is contained in:
parent
8235c1aea5
commit
38f2d5cd99
2 changed files with 4 additions and 2 deletions
|
|
@ -176,12 +176,12 @@
|
|||
}
|
||||
}
|
||||
// no points on screen, check intersection with absolute coordinates
|
||||
if (this.intersectsWithRect(pointTL, pointBR, true)) {
|
||||
if (this.intersectsWithRect(pointTL, pointBR, true, calculate)) {
|
||||
return true;
|
||||
}
|
||||
// worst case scenario the object is so big that contains the screen
|
||||
var centerPoint = { x: (pointTL.x + pointBR.x) / 2, y: (pointTL.y + pointBR.y) / 2 };
|
||||
if (this.containsPoint(centerPoint, null, true)) {
|
||||
if (this.containsPoint(centerPoint, null, true, calculate)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -324,6 +324,8 @@
|
|||
cObj.setCoords();
|
||||
assert.ok(cObj.isOnScreen(), 'object is onScreen');
|
||||
cObj.top = 1000;
|
||||
assert.ok(cObj.isOnScreen(), 'object is still wrongly on screen since setCoords is not called and calculate is not set, even when top is already at 1000');
|
||||
assert.ok(!cObj.isOnScreen(true), 'object is not onScreen with top 1000 with calculate true and no setCoords call');
|
||||
cObj.setCoords();
|
||||
assert.ok(!cObj.isOnScreen(), 'object is not onScreen with top 1000');
|
||||
canvas.setZoom(0.1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue