Skip to content

Commit

Permalink
Made ionContent and ionScroll reactive again after making a carbon
Browse files Browse the repository at this point in the history
copy of the original ionic components.
  • Loading branch information
Joey Arnold committed Mar 5, 2016
1 parent 77dfea8 commit d9a3993
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
14 changes: 13 additions & 1 deletion components/ionContent/ionContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 14 additions & 13 deletions components/ionScroll/ionScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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);
});
Expand All @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
@@ -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"
});

Expand All @@ -25,7 +25,7 @@ Package.onUse(function (api) {
"session",
"jquery",
"jandres:[email protected]",
"fourseven:scss@3.3.1",
"fourseven:scss@3.4.1",

"jandres:[email protected]"
], "client");
Expand Down

0 comments on commit d9a3993

Please sign in to comment.