Skip to content

Commit

Permalink
Merge pull request #36 from admorphit/configurable-element-size
Browse files Browse the repository at this point in the history
ability to set size of each element on reinitialization
  • Loading branch information
kamilkp committed Apr 8, 2015
2 parents 21138a9 + 1d20bfd commit f57eaa1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,7 @@ example:
- `vs-scroll-settings` - an object with 2 possible properties: `scrollIndex: "value"` - index of the item that should be scrolled to; the exact position of this item in the viewport may be further defined by `scrollIndexPosition: "value"` - a position where the element at `scrollIndex` index will be scrolled to; either a number of pixels or one of the following strings: 'top', 'middle', 'bottom', 'inview' is the same as 'inview#top', 'inview#middle', 'inview#bottom', 'inview#auto'; the 'inview#\<position\>' settings means that if the item is already in the view, nothing is scrolled, but if it is not, then the item will be scrolled accordingly (to be in the \<position\>); position 'auto' means that it will be either 'top' or 'bottom' depending on what is closer to the current item position

###EVENTS:
- `vsRepeatTrigger` - an event the directive listens for to manually trigger reinitialization; it may receive additional argument - an object with two properties: `scrollIndex` and `scrollIndexPosition` - their meaning is the same as in the optional attribute `vs-scroll-settings`
- `vsRepeatTrigger` - an event the directive listens for to manually trigger reinitialization; it may receive additional argument - an object with following properties:
1. `scrollIndex` and `scrollIndexPosition` - their meaning is the same as in the optional attribute `vs-scroll-settings`
2. `elementSize` - set the size in pixels of each element in the reinitialized list
- `vsRepeatReinitialized` - an event the directive emits upon reinitialization done; the listener may accepts three arguments: `event`, `startIndex` and `endIndex`
2 changes: 2 additions & 0 deletions src/angular-vs-repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@
var scrollChange = true,
position,
visibleStartIndex;

if (data && data.elementSize !== undefined) $scope.elementSize = data.elementSize;

if (data && data.scrollIndex !== undefined) {
if (typeof $scope.scrollSettings !== 'undefined') {
Expand Down

0 comments on commit f57eaa1

Please sign in to comment.