@@ -66,7 +66,7 @@ touchlessApp.controller('mapCtrl', ['$scope', 'leafletData', 'persistentAppSetti
66
66
var gz = 0
67
67
var zoomSensitivity , moveSensitivity // updated in stateChangeSuccess callback to be properly expired when edited in settingss
68
68
69
- var gzHistory = [ 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 ]
69
+ var gzHistory = [ 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 , 9.8 ]
70
70
71
71
var avg = function ( arr ) {
72
72
var sum = arr . reduce ( function ( a , b ) { return a + b ; } ) ;
@@ -80,16 +80,19 @@ touchlessApp.controller('mapCtrl', ['$scope', 'leafletData', 'persistentAppSetti
80
80
return ( notUsingMoveX && notUsingMoveY && notReturningFromVerticalPosition )
81
81
}
82
82
83
+
84
+
83
85
inZoomInAcceleration = function ( ) {
84
- var movingUpFirst = avg ( gzHistory . slice ( 0 , 11 ) ) > ( 11.5 - zoomSensitivity * 2 )
85
- var movingDownLater = avg ( gzHistory . slice ( 11 , 20 ) ) < ( 7.5 + zoomSensitivity * 2 )
86
- return ( movingUpFirst && movingDownLater )
86
+
87
+
88
+ return ( false )
89
+ //var movingUpFirst = avg(gzHistory.slice(0,11)) > (11.5 - zoomSensitivity*2)
90
+ //var movingDownLater = avg(gzHistory.slice(11,20)) < (7.5 + zoomSensitivity*2)
91
+ //return(movingUpFirst && movingDownLater)
87
92
}
88
93
89
94
inZoomOutAcceleration = function ( ) {
90
- var movingDownFirst = avg ( gzHistory . slice ( 0 , 11 ) ) < ( 7.5 + zoomSensitivity * 2 )
91
- var movingUpLater = avg ( gzHistory . slice ( 11 , 20 ) ) > ( 11.5 - zoomSensitivity * 2 )
92
- return ( movingDownFirst && movingUpLater )
95
+ return ( false )
93
96
}
94
97
95
98
isZoomTime = function ( ) {
@@ -112,6 +115,9 @@ touchlessApp.controller('mapCtrl', ['$scope', 'leafletData', 'persistentAppSetti
112
115
var now = Date . now ( )
113
116
return ( ( now - lastMovedAt > 300 ) && ( now - lastZoomedInAt > 700 ) && ( now - lastZoomedOutAt > 700 ) && ( now - lastShakedAt > 1000 ) )
114
117
}
118
+
119
+ $scope . zSpeed = 0
120
+
115
121
function onAccelerationUpdated ( acceleration ) {
116
122
117
123
gx = acceleration . x
@@ -121,6 +127,15 @@ touchlessApp.controller('mapCtrl', ['$scope', 'leafletData', 'persistentAppSetti
121
127
gzHistory . shift ( )
122
128
123
129
$scope . $apply ( function ( ) {
130
+
131
+ var zs = 0
132
+ for ( i = 0 ; i < gzHistory . length ; i ++ ) {
133
+ zs += gzHistory [ i ] - 9.5
134
+ }
135
+
136
+ $scope . zSpeed = Math . round ( zs * 1000 ) / 1000.0
137
+
138
+
124
139
try {
125
140
if ( inZoomPosition ( ) && isZoomTime ( ) ) {
126
141
if ( inZoomInAcceleration ( ) ) {
0 commit comments