-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isPartiallyOnScreen method #4856
Conversation
isPartiallyOnScreen isOffScreen
src/mixins/object_geometry.mixin.js
Outdated
/** | ||
* Checks if object is partially contained within the canvas with current viewportTransform | ||
* the check is done stopping at first point that appears off screen | ||
* @param {Boolean} [calculate] use coordinates of current position instead of .oCoords |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use coordinates of current position, calculated just in time, instead of precalculated .aCoords
Also the check is made with intersection, the old comment does not really apply anymore.
the check is done stopping at first point that appears off screen
is not really relevant in this implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply to the other function too.
test/unit/object_geometry.js
Outdated
cObj.top = -1000; | ||
cObj.setCoords(); | ||
assert.equal(cObj.isPartiallyOnScreen(cObj.aCoords), false, 'object is not partially on screen because it is outside the canvas'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have more test to cover and edge cases i believe. Intersect can return true for coincidents segments too.
* appears * new methods isPartiallyOnScreen isOffScreen * UT * test * comment improved * removed isOffScreen * removed isOffScreen * Update object_geometry.mixin.js * Update object_geometry.mixin.js * lint... * omg
Close #4823,
Issue: to know if the object is partially off screen, completely off screen.
Solution: create a simple helper methods which return boolean for object partially off screen
isPartiallyOnScreen
, completely offscreenisOffScreen
.