feat(scrollView) - pinch to zoom. Fixes #679

This commit is contained in:
Max Lynch
2014-04-29 17:11:07 -05:00
parent 9995f46b22
commit 4e2a6c0037
2 changed files with 10 additions and 4 deletions

View File

@@ -46,6 +46,9 @@ function($timeout, $controller, $ionicBind) {
scroll: '@',
scrollbarX: '@',
scrollbarY: '@',
zooming: '@',
minZoom: '@',
maxZoom: '@'
});
if (angular.isDefined($attr.padding)) {
@@ -67,7 +70,10 @@ function($timeout, $controller, $ionicBind) {
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
scrollingX: $scope.direction.indexOf('x') >= 0,
scrollingY: $scope.direction.indexOf('y') >= 0
scrollingY: $scope.direction.indexOf('y') >= 0,
zooming: $scope.$eval($scope.zooming) === true,
maxZoom: $scope.$eval($scope.maxZoom) || 3,
minZoom: $scope.$eval($scope.minZoom) || 0.5
};
if (isPaging) {
scrollViewOptions.speedMultiplier = 0.8;

View File

@@ -725,7 +725,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
}
}
self.doTouchMove(e.touches, e.timeStamp);
self.doTouchMove(e.touches, e.timeStamp, e.scale);
};
self.touchEnd = function(e) {
@@ -1062,7 +1062,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
if (helperElem.style[perspectiveProperty] !== undef) {
return function(left, top, zoom, wasResize) {
content.style[transformProperty] = 'translate3d(' + (-left) + 'px,' + (-top) + 'px,0)';
content.style[transformProperty] = 'translate3d(' + (-left) + 'px,' + (-top) + 'px,0) scale(' + zoom + ')';
self.__repositionScrollbars();
if(!wasResize) {
self.triggerScrollEvent();
@@ -1072,7 +1072,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
} else if (helperElem.style[transformProperty] !== undef) {
return function(left, top, zoom, wasResize) {
content.style[transformProperty] = 'translate(' + (-left) + 'px,' + (-top) + 'px)';
content.style[transformProperty] = 'translate(' + (-left) + 'px,' + (-top) + 'px) scale(' + zoom + ')';
self.__repositionScrollbars();
if(!wasResize) {
self.triggerScrollEvent();