motion-prime/sections/table/table_delegate.rb in motion-prime-0.5.1 vs motion-prime/sections/table/table_delegate.rb in motion-prime-0.5.2
- old
+ new
@@ -20,9 +20,19 @@
def numberOfSectionsInTableView(table)
table_section.number_of_sections(table)
end
def tableView(table, cellForRowAtIndexPath: index)
+ curCallTime = Time.now.to_f
+ curCallOffset = table.contentOffset.y
+ if @prevCallTime
+ timeDelta = curCallTime - @prevCallTime
+ offsetDelta = curCallOffset - @prevCallOffset
+ @deceleration_speed = offsetDelta/timeDelta
+ end
+ @prevCallTime = curCallTime
+ @prevCallOffset = curCallOffset
+
table_section.cell_for_index(table, index)
end
def tableView(table, numberOfRowsInSection: section)
table_section.rows_for_section(section).try(:count).to_i
\ No newline at end of file