Fixed incorrect Object.isOnScreen functionality. (#4763)

* Added missing calculate parameter in Object.isOnScreen.

* Update object_geometry.js
This commit is contained in:
scriptspry 2018-03-01 06:14:43 +05:30 committed by Andrea Bogazzi
parent 8235c1aea5
commit 38f2d5cd99
2 changed files with 4 additions and 2 deletions

View file

@ -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;

View file

@ -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);