Fix for multiple reloads in the same instance causes skipping #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a reload(number) is called multiple times on the ui-scroll, any call after first causes the reload to skip buffer.length pages down and load more than is necessary. What is happening is that the viewport top and bottom padding does not get reset during the reload. This causes any call after the first to be based on the height of the viewport with the padding. This is not a big issue when the items in the viewport are small (many items visible at a time) but is a huge issue when only one item is visible at a time.
Solution Reset the top and bottom padding divs before anything in the reload is set.
Example issue:
Environment
Loading 75 images with a width of 90% of the viewport, a height of almost twice the size of the viewport, and a buffer of 11. The images must have their height set before ui-scroll does anything otherwise too many calls are made since the height of the images is not known at the time the check to load more top or bottom is fired.