@@ -78,60 +78,10 @@ const PinchGesture = function (source, target, options) {
7878
7979module . exports = PinchGesture
8080const proto = PinchGesture . prototype
81-
82- proto . bind = function ( ) {
83- // @tapspace .interaction.Pinch:bind()
84- //
85- // Bind gesture event listeners.
86- //
87- if ( this . bound ) {
88- return
89- }
90- this . bound = true
91-
92- // Pass 'this' for handlers.
93- const self = this
94-
95- this . ongesturestart = ( ev ) => {
96- // Mark as active. TODO allow custom class name
97- self . target . element . classList . add ( 'active-pinch' )
98- self . source . emit ( 'pinchstart' , ev )
99- }
100- this . ongesturemove = ( ev ) => {
101- // DEBUG
102- // console.log('pivot', ev.center.point)
103- // console.log('freedom', self.capturer.getFreedom())
104- // console.log('ev.delta', ev.delta.helm)
105- self . applyTransform ( ev )
106- self . source . emit ( 'pinchmove' , ev )
107- self . source . emit ( 'pinch' , ev )
108- }
109- this . ongestureend = ( ev ) => {
110- // Deactivate styling, for example grabbing cursor
111- self . target . element . classList . remove ( 'active-pinch' )
112- self . source . emit ( 'pinchend' , ev )
113- }
114- this . ongesturecancel = ( ev ) => {
115- // TODO Return the target to the original position
116- // TODO by using the total transform.
117- self . target . element . classList . remove ( 'active-pinch' )
118- self . source . emit ( 'pinchcancel' , ev )
119- }
120-
121- // Capturer options determine the gesture freedom.
122- const capturerOptions = { }
123- if ( this . options . freedom ) {
124- capturerOptions . freedom = this . options . freedom
125- }
126- // Bind listeners to the component capturer.
127- this . capturer = this . source . capturer ( 'gesture' , capturerOptions )
128- this . capturer . on ( 'gesturestart' , this . ongesturestart )
129- this . capturer . on ( 'gesturemove' , this . ongesturemove )
130- this . capturer . on ( 'gestureend' , this . ongestureend )
131- this . capturer . on ( 'gesturecancel' , this . ongesturecancel )
132- }
81+ proto . isPinch = true
13382
13483proto . applyTransform = require ( './applyTransform' )
84+ proto . bind = require ( './bind' )
13585proto . disableDilation = require ( './disableDilation' )
13686proto . disableRotation = require ( './disableRotation' )
13787proto . disableTranslation = require ( './disableTranslation' )
0 commit comments