From d9a399337b8b5e0a70936944f14da5dbf22ccbf8 Mon Sep 17 00:00:00 2001 From: Joey Arnold Date: Fri, 4 Mar 2016 21:46:05 -0700 Subject: [PATCH] Made ionContent and ionScroll reactive again after making a carbon copy of the original ionic components. --- components/ionContent/ionContent.js | 14 +++++++++++++- components/ionScroll/ionScroll.js | 27 ++++++++++++++------------- package.js | 4 ++-- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/components/ionContent/ionContent.js b/components/ionContent/ionContent.js index a00028e..f18f8f5 100644 --- a/components/ionContent/ionContent.js +++ b/components/ionContent/ionContent.js @@ -73,14 +73,26 @@ Template.ionContent.onRendered(function() { // Use JS scrolling scrollViewOptions = { el: $element[0], - locking: !this.locking.get(), + locking: this.locking.get(), bouncing: this.hasBouncing.get(), scrollbarX: this.scrollbarX.get(), scrollbarY: this.scrollbarY.get(), scrollingX: this.direction.get().indexOf('x') !== -1, scrollingY: this.direction.get().indexOf('y') !== -1, + scrollEventInterval: this.scrollEventInterval.get(), scrollingComplete: onScrollComplete }; + + this.autorun(() => { + if (!this._controller) return; + this._controller.scrollView.options.locking = this.locking.get(); + this._controller.scrollView.options.scrollbarX = this.scrollbarX.get(); + this._controller.scrollView.options.scrollbarY = this.scrollbarY.get(); + this._controller.scrollView.options.scrollingX = this.direction.get().indexOf('x') !== -1; + this._controller.scrollView.options.scrollingY = this.direction.get().indexOf('y') !== -1; + this._controller.scrollView.options.scrollEventInterval = this.scrollEventInterval.get(); + this._controller.scrollView.options.bouncing = this.hasBouncing.get(); + }); } // init scroll controller with appropriate options diff --git a/components/ionScroll/ionScroll.js b/components/ionScroll/ionScroll.js index d4440ec..9ae2e17 100644 --- a/components/ionScroll/ionScroll.js +++ b/components/ionScroll/ionScroll.js @@ -73,7 +73,7 @@ Template.ionScroll.onRendered(function() { var scrollViewOptions = { el: $element[0], - locking: !this.locking.get(), + locking: this.locking.get(), bouncing: this.hasBouncing.get(), paging: this.paging.get(), scrollbarX: this.scrollbarX.get(), @@ -98,6 +98,19 @@ Template.ionScroll.onRendered(function() { e => {} }, scrollViewOptions, Meteor.setTimeout); + this.autorun(() => { + this._controller.scrollView.options.locking = this.locking.get(); + this._controller.scrollView.options.paging = this.paging.get(); + this._controller.scrollView.options.scrollbarX = this.scrollbarX.get(); + this._controller.scrollView.options.scrollbarY = this.scrollbarY.get(); + this._controller.scrollView.options.scrollingX = this.direction.get().indexOf('x') !== -1; + this._controller.scrollView.options.scrollingY = this.direction.get().indexOf('y') !== -1; + this._controller.scrollView.options.zooming = this.zooming.get(); + this._controller.scrollView.options.minZoom = this.minZoom.get(); + this._controller.scrollView.options.maxZoom = this.maxZoom.get(); + this._controller.scrollView.options.bouncing = this.hasBouncing.get(); + }); + this.autorun(() => { this._controller.scrollTo(parseInt(this.startX.get(), 10), parseInt(this.startY.get(), 10), true); }); @@ -106,18 +119,6 @@ Template.ionScroll.onRendered(function() { _.isFunction(this.onScrollComplete) ? this.onScrollComplete : e => {}; this.controller.set(this._controller); - - /* TODO: Use case for reactive? Original is not. - this.autorun(() => { - this._scroller.options.locking = !this.locking.get(); - this._scroller.options.paging = this.paging.get(); - this._scroller.options.scrollingX = this.direction.get().indexOf('x') !== -1; - this._scroller.options.scrollingY = this.direction.get().indexOf('y') !== -1; - this._scroller.options.zooming = this.zooming.get(); - this._scroller.options.minZoom = this.minZoom.get(); - this._scroller.options.maxZoom = this.maxZoom.get(); - this._scroller.options.bouncing = this.hasBouncing.get(); - });*/ }); Template.ionScroll.onDestroyed(function() { diff --git a/package.js b/package.js index ad4d025..7f8ff4e 100644 --- a/package.js +++ b/package.js @@ -1,7 +1,7 @@ Package.describe({ name: "jandres:ionic", summary: "Ionic components for Meteor. No Angular!", - version: "0.1.54", + version: "0.1.55", git: "https://github.com/JoeyAndres/meteor-ionic.git" }); @@ -25,7 +25,7 @@ Package.onUse(function (api) { "session", "jquery", "jandres:snapjs@2.0.9", - "fourseven:scss@3.3.1", + "fourseven:scss@3.4.1", "jandres:meteoric-sass@1.2.5" ], "client");