Skip to content
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

node-scroll-info's .getOnscreenNodes uses bad coordinates #767

Closed
tivac opened this issue May 20, 2013 · 2 comments
Closed

node-scroll-info's .getOnscreenNodes uses bad coordinates #767

tivac opened this issue May 20, 2013 · 2 comments
Labels

Comments

@tivac
Copy link
Contributor

tivac commented May 20, 2013

Bug is in 3.10.1 & earlier versions, presumably.

.getOnscreenNodes() uses Y.DOM.getXY() to get the position of each node, which is in page coordinates. It's compared against the plugin's _lastScroll property which is in container-relative coordinates. It ends up working sometimes, but not always. I'm not 100% sure why.

http://jsbin.com/exekux/4/edit shows the practical implications of this bug, some images just never get triggered.

Talked with @rgrove about this in IRC & it sounded like he was volunteering to fix it.

[16:39] <@rgrove> It's the Y.DOM.getXY() call in getOnscreenNodes(). DOM.getXY() returns a viewport-relative position, but it's compared with a container-relative position, which is invalid.
[16:40] <@rgrove> Coincidentally, the fix is to use getBoundingClientRect(), which I want to do anyway!
@ghost ghost assigned rgrove May 20, 2013
@tivac
Copy link
Contributor Author

tivac commented May 21, 2013

https://gist.github.com/tivac/5616180

has a lazy-loading plugin which provides a fixed version of .getOnscreenNodes() that would almost drop-in to node-scroll-info.

rgrove added a commit that referenced this issue May 21, 2013
…de coordinates. Fixes #767

Also improves performance significantly.
@rgrove
Copy link
Contributor

rgrove commented Jun 3, 2013

Weird. GitHub caught the commit that fixed this, but didn't close the issue. Anyway, this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants