mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(scrollView) - pinch to zoom. Fixes #679
This commit is contained in:
8
js/angular/directive/scroll.js
vendored
8
js/angular/directive/scroll.js
vendored
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user