Skip to content

Commit 029f8f3

Browse files
committed
feat($ionicScrollDelegate): expose zoomBy and zoomTo methods
Closes #1977
1 parent 5d06c4a commit 029f8f3

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

js/angular/controller/scrollController.js

+12
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
140140
});
141141
};
142142

143+
this.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) {
144+
this.resize().then(function() {
145+
scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop);
146+
});
147+
};
148+
149+
this.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) {
150+
this.resize().then(function() {
151+
scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop);
152+
});
153+
};
154+
143155
this.scrollBy = function(left, top, shouldAnimate) {
144156
this.resize().then(function() {
145157
scrollView.scrollBy(left, top, !!shouldAnimate);

js/angular/service/scrollDelegate.js

+18
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,24 @@ IonicModule
9393
* @param {boolean=} shouldAnimate Whether the scroll should animate.
9494
*/
9595
'scrollBy',
96+
/**
97+
* @ngdoc method
98+
* @name $ionicScrollDelegate#zoomTo
99+
* @param {number} level Level to zoom to.
100+
* @param {boolean=} animate Whether to animate the zoom.
101+
* @param {number=} originLeft Zoom in at given left coordinate.
102+
* @param {number=} originTop Zoom in at given top coordinate.
103+
*/
104+
'zoomTo',
105+
/**
106+
* @ngdoc method
107+
* @name $ionicScrollDelegate#zoomBy
108+
* @param {number} factor The factor to zoom by.
109+
* @param {boolean=} animate Whether to animate the zoom.
110+
* @param {number=} originLeft Zoom in at given left coordinate.
111+
* @param {number=} originTop Zoom in at given top coordinate.
112+
*/
113+
'zoomBy',
96114
/**
97115
* @ngdoc method
98116
* @name $ionicScrollDelegate#getScrollPosition

0 commit comments

Comments
 (0)