From 2fb2e09bb24340a7cc33ae30037f45125791131c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 10 May 2018 17:15:14 +0200 Subject: androidz --- .../android/assets/www/js/lib/view/Scrollable.js | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 StoneIsland/platforms/android/assets/www/js/lib/view/Scrollable.js (limited to 'StoneIsland/platforms/android/assets/www/js/lib/view/Scrollable.js') diff --git a/StoneIsland/platforms/android/assets/www/js/lib/view/Scrollable.js b/StoneIsland/platforms/android/assets/www/js/lib/view/Scrollable.js new file mode 100755 index 00000000..7f90929a --- /dev/null +++ b/StoneIsland/platforms/android/assets/www/js/lib/view/Scrollable.js @@ -0,0 +1,44 @@ +var ScrollableView = View.extend({ + + events: { + "load img": "deferRefresh", + }, + + deferScrollToTop: function(){ + this.scrollPosition = 0 + setTimeout(this.scrollToTop.bind(this), 0) + }, + + scrollPosition: 0, + + resetScroll: function(){ + this.scrollPosition = 0 + }, + + saveScroll: function(){ + this.scrollPosition = this.scroller.y + }, + + restoreScroll: function(){ + setTimeout(function(){ + this.scroller.scrollTo(0, this.scrollPosition) + }.bind(this), 0) + }, + + refreshScroller: function(){ + this.scroller.refresh() + clearTimeout( this.scrollerRefreshTimeout ) + }, + + scrollerRefreshTimeout: null, + deferRefresh: function(){ + clearTimeout( this.scrollerRefreshTimeout ) + this.scrollerRefreshTimeout = setTimeout(this.refreshScroller.bind(this)) + }, + + scrollToTop: function(){ + this.scroller.refresh() + this.scroller.scrollTo(0, 0) + }, + +}) \ No newline at end of file -- cgit v1.2.3-70-g09d2