@@ -113,6 +113,57 @@ angular.module('ui.scroll', [])
113
113
114
114
buffer
115
115
116
+ Padding = (tagName ) ->
117
+
118
+ if tagName in [' dl' ]
119
+ throw new Error ' ui-scroll directive does not support <' + template .localName + ' > as a repeating tag: ' + template .outerHTML
120
+ tagName = ' div' if tagName not in [' li' , ' tr' ]
121
+
122
+ switch tagName
123
+ when ' tr'
124
+ table = angular .element (' <table><tr><td><div></div></td></tr></table>' )
125
+ div = table .find (' div' )
126
+ result = table .find (' tr' )
127
+ else
128
+ result = angular .element (' <' + repeaterType + ' ></' + repeaterType + ' >' )
129
+ result
130
+
131
+
132
+
133
+ Viewport = (element , controllers ) ->
134
+
135
+ self = this
136
+
137
+ viewport = if controllers[0 ] and controllers[0 ].viewport then controllers[0 ].viewport else angular .element (window )
138
+ viewport .css ({' overflow-y' : ' auto' , ' display' : ' block' })
139
+
140
+ topPadding = null
141
+
142
+ bottomPadding = null
143
+
144
+ self .createPaddingElements = (template ) ->
145
+
146
+ topPadding = new Padding template .localName
147
+ element .before topPadding
148
+ self .topPadding = topPadding .height
149
+
150
+ bottomPadding = new Padding template .localName
151
+ element .after bottomPadding
152
+ self .bottomPadding = bottomPadding .height
153
+
154
+ self .bottomDataPos = ->
155
+ (viewport .scrollHeight ? viewport .document .documentElement .scrollHeight ) - bottomPadding .height ()
156
+
157
+ self .topDataPos = -> topPadding .height ()
158
+
159
+ self .insertElement = (e , sibling ) -> insertElement (e, sibling || topPadding)
160
+
161
+ self .insertElementAnimated = (e , sibling ) -> insertElementAnimated (e, sibling || topPadding)
162
+
163
+ return
164
+
165
+
166
+
116
167
require : [' ?^uiScrollViewport' ]
117
168
transclude : ' element'
118
169
priority : 1000
@@ -204,6 +255,8 @@ angular.module('ui.scroll', [])
204
255
viewport = builder .viewport
205
256
viewportScope = viewport .scope () || $rootScope
206
257
258
+ # v = new Viewport element, controllers
259
+
207
260
topVisible = (item ) ->
208
261
adapter .topVisible = item .scope [itemName]
209
262
adapter .topVisibleElement = item .element
0 commit comments