Skip to content

Commit

Permalink
feat($ionicScrollDelegate): expose zoomBy and zoomTo methods
Browse files Browse the repository at this point in the history
Closes #1977
  • Loading branch information
ajoslin committed Aug 20, 2014
1 parent 5d06c4a commit 029f8f3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/angular/controller/scrollController.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
});
};

this.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) {
this.resize().then(function() {
scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop);
});
};

this.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) {
this.resize().then(function() {
scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop);
});
};

this.scrollBy = function(left, top, shouldAnimate) {
this.resize().then(function() {
scrollView.scrollBy(left, top, !!shouldAnimate);
Expand Down
18 changes: 18 additions & 0 deletions js/angular/service/scrollDelegate.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ IonicModule
* @param {boolean=} shouldAnimate Whether the scroll should animate.
*/
'scrollBy',
/**
* @ngdoc method
* @name $ionicScrollDelegate#zoomTo
* @param {number} level Level to zoom to.
* @param {boolean=} animate Whether to animate the zoom.
* @param {number=} originLeft Zoom in at given left coordinate.
* @param {number=} originTop Zoom in at given top coordinate.
*/
'zoomTo',
/**
* @ngdoc method
* @name $ionicScrollDelegate#zoomBy
* @param {number} factor The factor to zoom by.
* @param {boolean=} animate Whether to animate the zoom.
* @param {number=} originLeft Zoom in at given left coordinate.
* @param {number=} originTop Zoom in at given top coordinate.
*/
'zoomBy',
/**
* @ngdoc method
* @name $ionicScrollDelegate#getScrollPosition
Expand Down

0 comments on commit 029f8f3

Please sign in to comment.