File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 6464 _container . style . webkitPerspective = _container . style . perspective = _cubeZ + 'px' ;
6565 } ;
6666
67+ /**
68+ * sets the z value based on the container size
69+ * @public
70+ */
71+ this . resetZ = function ( ) {
72+ _cubeZ = ( Math . sqrt ( _container . clientWidth * _container . clientHeight ) / 2.5 ) ;
73+
74+ _updateCubeTransform ( ) ;
75+ _updatePerspective ( ) ;
76+ } ;
77+
6778 /**
6879 * clamps and sets the z value
6980 * @param {number } z
7889 * calculates the z value
7990 * @param {number } amt
8091 */
81- var _increaseZoom = function ( amt ) {
92+ var _adjustZoom = function ( amt ) {
8293 amt /= 15 ;
8394 amt = ( ( 0.2 * _cubeZ ) - 8.2 ) * amt ;
8495
94105 var _onScroll = function ( ev ) {
95106 ev . preventDefault ( ) ;
96107 var delta = Math . max ( - 1 , Math . min ( 1 , ( ev . wheelDelta || - ev . deltaY ) ) ) ;
97- _increaseZoom ( delta * 15 ) ;
108+ _adjustZoom ( delta * 15 ) ;
98109 } ;
99110
100111 _container . addEventListener ( 'wheel' , _onScroll ) ;
103114 if ( ( 'ontouchstart' in window ) || window . DocumentTouch && document instanceof DocumentTouch ) {
104115 var _lastScale = 1 ;
105116 var _onGestureChange = function ( ev ) {
106- _increaseZoom ( ( ev . scale - _lastScale ) * 50 ) ;
117+ _adjustZoom ( ( ev . scale - _lastScale ) * 50 ) ;
107118 _lastScale = ev . scale ;
108119 } ;
109120 document . body . addEventListener ( 'gesturestart' , function ( e ) {
182193 }
183194 } . bind ( this ) ;
184195
185- /**
186- * sets the z value based on the container size
187- * @public
188- */
189- this . resetZ = function ( ) {
190- _cubeZ = ( Math . sqrt ( _container . clientWidth * _container . clientHeight ) / 2.5 ) ;
191-
192- _updateCubeTransform ( ) ;
193- _updatePerspective ( ) ;
194- } ;
195196
196197
197198 ( function init ( ) {
You can’t perform that action at this time.
0 commit comments