Commit 3818d79b8ecc810cca0300c83c49de0363582849

Authored by Joogab Yun
Committed by Adeel Kazmi
1 parent b0f915f0

Refactoring Gestures Class

Change-Id: Ic67c98e5bcc58d5f0ce812b043fb7ebff204d41a
examples/cube-transition-effect/cube-transition-effect-example.cpp 100644 → 100755
... ... @@ -296,9 +296,10 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture )
296 296 return;
297 297 }
298 298  
299   - if( gesture.state == Gesture::Continuing )
  299 + if( gesture.GetState() == Gesture::Continuing )
300 300 {
301   - if( gesture.displacement.x < 0)
  301 + const Vector2& displacement = gesture.GetDisplacement();
  302 + if( displacement.x < 0)
302 303 {
303 304 mIndex = (mIndex + 1)%NUM_IMAGES;
304 305 }
... ... @@ -307,8 +308,8 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture )
307 308 mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES;
308 309 }
309 310  
310   - mPanPosition = gesture.position;
311   - mPanDisplacement = gesture.displacement;
  311 + mPanPosition = gesture.GetPosition();
  312 + mPanDisplacement = displacement;
312 313 GoToNextImage();
313 314 }
314 315 }
... ...
examples/deferred-shading/deferred-shading.cpp 100644 → 100755
... ... @@ -770,8 +770,9 @@ private:
770 770 void OnPan(Actor, PanGesture const& gesture)
771 771 {
772 772 Quaternion q = mAxis.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>();
773   - Quaternion qx(Radian(Degree(gesture.screenDisplacement.y) * -.5f), Vector3::XAXIS);
774   - Quaternion qy(Radian(Degree(gesture.screenDisplacement.x) * .5f), Vector3::YAXIS);
  773 + const Vector2& displacement = gesture.GetScreenDisplacement();
  774 + Quaternion qx(Radian(Degree(displacement.y) * -.5f), Vector3::XAXIS);
  775 + Quaternion qy(Radian(Degree(displacement.x) * .5f), Vector3::YAXIS);
775 776 mAxis.SetProperty(Actor::Property::ORIENTATION, qy * qx * q);
776 777 }
777 778  
... ...
examples/dissolve-effect/dissolve-effect-example.cpp 100644 → 100755
... ... @@ -276,9 +276,10 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture )
276 276 return;
277 277 }
278 278  
279   - if( gesture.state == Gesture::Continuing )
  279 + if( gesture.GetState() == Gesture::Continuing )
280 280 {
281   - if( gesture.displacement.x < 0)
  281 + const Vector2& displacement = gesture.GetDisplacement();
  282 + if( displacement.x < 0)
282 283 {
283 284 mIndex = (mIndex + 1)%NUM_IMAGES;
284 285 }
... ... @@ -294,7 +295,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture )
294 295 mNextImage.SetProperty( Actor::Property::POSITION_Z, INITIAL_DEPTH);
295 296 mParent.Add( mNextImage );
296 297 Vector2 size = Vector2( mCurrentImage.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) );
297   - StartTransition( gesture.position / size, gesture.displacement * Vector2(1.0, size.x/size.y));
  298 + StartTransition( gesture.GetPosition() / size, displacement * Vector2(1.0, size.x/size.y));
298 299 }
299 300 }
300 301  
... ...
examples/gestures/gesture-example.cpp 100644 → 100755
... ... @@ -266,7 +266,7 @@ private:
266 266 */
267 267 void OnLongPress( Actor actor, const LongPressGesture& longPress )
268 268 {
269   - if( longPress.state == Gesture::Started )
  269 + if( longPress.GetState() == Gesture::Started )
270 270 {
271 271 // When we first receive a long press, attach the actor to the pan detector.
272 272 mPanDetector.Attach( actor );
... ... @@ -294,7 +294,7 @@ private:
294 294  
295 295 // As the displacement is in local actor coords, we will have to multiply the displacement by the
296 296 // actor's scale so that it moves the correct amount in the parent's coordinate system.
297   - Vector3 scaledDisplacement( pan.displacement );
  297 + Vector3 scaledDisplacement( pan.GetDisplacement() );
298 298 scaledDisplacement *= actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE );
299 299  
300 300 Vector3 currentPosition;
... ... @@ -303,7 +303,7 @@ private:
303 303 Vector3 newPosition = currentPosition + scaledDisplacement;
304 304 actor.SetProperty( Actor::Property::POSITION, newPosition );
305 305  
306   - switch( pan.state )
  306 + switch( pan.GetState() )
307 307 {
308 308 case Gesture::Started:
309 309 {
... ... @@ -369,7 +369,7 @@ private:
369 369 */
370 370 void OnPinch( Actor actor, const PinchGesture& pinch )
371 371 {
372   - switch( pinch.state )
  372 + switch( pinch.GetState() )
373 373 {
374 374 case Gesture::Started:
375 375 {
... ... @@ -406,7 +406,7 @@ private:
406 406 }
407 407 }
408 408  
409   - actor.SetProperty( Actor::Property::SCALE, mStartingScale * pinch.scale );
  409 + actor.SetProperty( Actor::Property::SCALE, mStartingScale * pinch.GetScale() );
410 410 }
411 411  
412 412 /**
... ... @@ -417,7 +417,7 @@ private:
417 417 */
418 418 void OnRotation( Actor actor, const RotationGesture& rotation )
419 419 {
420   - switch( rotation.state )
  420 + switch( rotation.GetState() )
421 421 {
422 422 case Gesture::Started:
423 423 {
... ... @@ -442,7 +442,7 @@ private:
442 442 }
443 443 }
444 444  
445   - actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( mStartingOrientation * Quaternion( rotation.rotation, Vector3::ZAXIS ) ) );
  445 + actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( mStartingOrientation * Quaternion( rotation.GetRotation(), Vector3::ZAXIS ) ) );
446 446 }
447 447  
448 448 /**
... ...
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp 100644 → 100755
... ... @@ -530,11 +530,11 @@ public:
530 530  
531 531 void OnPinch( Actor actor, const PinchGesture& pinch )
532 532 {
533   - if( pinch.state == Gesture::Started )
  533 + if( pinch.GetState() == Gesture::Started )
534 534 {
535   - mLastPinchScale = pinch.scale;
  535 + mLastPinchScale = pinch.GetScale();
536 536 }
537   - const float scale = pinch.scale;
  537 + const float scale = pinch.GetScale();
538 538  
539 539 if( ! Equals( scale, mLastPinchScale ) )
540 540 {
... ... @@ -557,9 +557,11 @@ public:
557 557 {
558 558 Window window = mApplication.GetWindow();
559 559 Vector2 windowSize = window.GetSize();
  560 + const Vector2& displacement = gesture.GetDisplacement();
  561 +
560 562 // 1.0f and 0.75f are the maximum size caps of the resized image, as a factor of window-size.
561   - mImageWindowScale.x = std::max( 0.05f, std::min( 0.95f, mImageWindowScale.x + ( gesture.displacement.x * 2.0f / windowSize.width ) ) );
562   - mImageWindowScale.y = std::max( 0.05f, std::min( 0.70f, mImageWindowScale.y + ( gesture.displacement.y * 2.0f / windowSize.height ) ) );
  563 + mImageWindowScale.x = std::max( 0.05f, std::min( 0.95f, mImageWindowScale.x + ( displacement.x * 2.0f / windowSize.width ) ) );
  564 + mImageWindowScale.y = std::max( 0.05f, std::min( 0.70f, mImageWindowScale.y + ( displacement.y * 2.0f / windowSize.height ) ) );
563 565  
564 566 ResizeImage();
565 567 }
... ...
examples/image-view-svg/image-view-svg-example.cpp 100644 → 100755
... ... @@ -153,11 +153,11 @@ public:
153 153 // Callback of pan gesture, for moving the actors
154 154 void OnPanGesture( Actor actor, const PanGesture& gesture )
155 155 {
156   - if( gesture.state == Gesture::Continuing )
  156 + if( gesture.GetState() == Gesture::Continuing )
157 157 {
158 158 for( unsigned int i = 0; i < NUM_IMAGES_DISPLAYED; i++ )
159 159 {
160   - mSvgActor[i].TranslateBy(Vector3(gesture.displacement));
  160 + mSvgActor[i].TranslateBy(Vector3(gesture.GetDisplacement()));
161 161 }
162 162 }
163 163 }
... ... @@ -165,14 +165,14 @@ public:
165 165 // Callback of pinch gesture, for resizing the actors
166 166 void OnPinch(Actor actor, const PinchGesture& gesture)
167 167 {
168   - switch( gesture.state )
  168 + switch( gesture.GetState() )
169 169 {
170 170 // Only scale the image when we start or continue pinching
171 171  
172 172 case Gesture::Started:
173 173 case Gesture::Continuing:
174 174 {
175   - float scale = std::max( gesture.scale, MIN_SCALE / mScale );
  175 + float scale = std::max( gesture.GetScale(), MIN_SCALE / mScale );
176 176 scale = std::min( MAX_SCALE / mScale, scale );
177 177  
178 178 for( unsigned int i = 0; i < NUM_IMAGES_DISPLAYED; i++ )
... ... @@ -186,7 +186,7 @@ public:
186 186 {
187 187 // Resize the image when pinching is complete, this will rasterize the SVG to the new size
188 188  
189   - mScale = mScale * gesture.scale;
  189 + mScale = mScale * gesture.GetScale();
190 190 mScale = mScale > MAX_SCALE ? MAX_SCALE : mScale;
191 191 mScale = mScale < MIN_SCALE ? MIN_SCALE : mScale;
192 192 for( unsigned int i = 0; i < NUM_IMAGES_DISPLAYED; i++ )
... ...
examples/item-view/item-view-example.cpp 100644 → 100755
... ... @@ -549,7 +549,7 @@ public:
549 549  
550 550 void OnLongPress( Actor actor, const LongPressGesture& gesture )
551 551 {
552   - switch( gesture.state )
  552 + switch( gesture.GetState() )
553 553 {
554 554 case Gesture::Started:
555 555 {
... ... @@ -558,7 +558,7 @@ public:
558 558 ItemRange range( 0u, 0u );
559 559 mItemView.GetItemsRange( range );
560 560  
561   - const unsigned int item = ( gesture.screenPoint.y < 0.5f * size.height ) ? range.begin : range.end;
  561 + const unsigned int item = ( gesture.GetScreenPoint().y < 0.5f * size.height ) ? range.begin : range.end;
562 562 mItemView.ScrollToItem( item, SCROLL_TO_ITEM_ANIMATION_TIME );
563 563  
564 564 break;
... ...
examples/model3d-view/model3d-view-example.cpp 100644 → 100755
... ... @@ -179,9 +179,10 @@ public:
179 179 Window window = mApplication.GetWindow();
180 180 Vector2 screenSize = window.GetSize();
181 181  
  182 + const Vector2& screenPoint = tap.GetScreenPoint();
182 183 Vector2 position;
183   - position.x = tap.screenPoint.x - screenSize.x * 0.5;
184   - position.y = tap.screenPoint.y - screenSize.y * 0.5;
  184 + position.x = screenPoint.x - screenSize.x * 0.5;
  185 + position.y = screenPoint.y - screenSize.y * 0.5;
185 186  
186 187 float size = 2.5;
187 188  
... ...
examples/motion-blur/motion-blur-example.cpp 100644 → 100755
... ... @@ -285,8 +285,9 @@ public:
285 285 actor.ScreenToLocal(originOffsetX, originOffsetY, windowSize.width * 0.5f, windowSize.height * 0.5f);
286 286  
287 287 // get dest point in local actor space
288   - destPos.x = tapGesture.localPoint.x - originOffsetX;
289   - destPos.y = tapGesture.localPoint.y - originOffsetY;
  288 + const Vector2& localPoint = tapGesture.GetLocalPoint();
  289 + destPos.x = localPoint.x - originOffsetX;
  290 + destPos.y = localPoint.y - originOffsetY;
290 291 destPos.z = 0.0f;
291 292  
292 293 float animDuration = 0.5f;
... ...
examples/motion-stretch/motion-stretch-example.cpp 100644 → 100755
... ... @@ -257,8 +257,9 @@ public:
257 257 actor.ScreenToLocal(originOffsetX, originOffsetY, windowSize.width * 0.5f, windowSize.height * 0.5f);
258 258  
259 259 // get dest point in local actor space
260   - destPos.x = tapGesture.localPoint.x - originOffsetX;
261   - destPos.y = tapGesture.localPoint.y - originOffsetY;
  260 + const Vector2& localPoint = tapGesture.GetLocalPoint();
  261 + destPos.x = localPoint.x - originOffsetX;
  262 + destPos.y = localPoint.y - originOffsetY;
262 263 destPos.z = 0.0f;
263 264  
264 265 float animDuration = 0.5f;
... ...
examples/primitive-shapes/primitive-shapes-example.cpp 100644 → 100755
... ... @@ -631,7 +631,7 @@ public:
631 631 //Panning around the shape rotates it.
632 632 void OnPan( Actor actor, const PanGesture& gesture )
633 633 {
634   - switch( gesture.state )
  634 + switch( gesture.GetState() )
635 635 {
636 636 case Gesture::Started:
637 637 {
... ... @@ -643,8 +643,9 @@ public:
643 643 case Gesture::Continuing:
644 644 {
645 645 //Rotate based off the gesture.
646   - mRotation.x -= gesture.displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis
647   - mRotation.y += gesture.displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis
  646 + const Vector2& displacement = gesture.GetDisplacement();
  647 + mRotation.x -= displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis
  648 + mRotation.y += displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis
648 649 Quaternion rotation = Quaternion( Radian( mRotation.x ), Vector3::XAXIS) *
649 650 Quaternion( Radian( mRotation.y ), Vector3::YAXIS);
650 651  
... ...
examples/reflection-demo/reflection-example.cpp 100644 → 100755
... ... @@ -610,7 +610,7 @@ private:
610 610  
611 611 void OnPan( Actor actor, const PanGesture& panGesture )
612 612 {
613   - auto displacement = panGesture.screenDisplacement;
  613 + const auto& displacement = panGesture.GetScreenDisplacement();
614 614 mCenterActor.RotateBy( Degree( displacement.y *0.1f ), Vector3( 0.0, 0.0, 1.0) );
615 615 mCenterActor.RotateBy( Degree( displacement.x *0.1f ), Vector3( 0.0, 1.0, 0.0) );
616 616 Quaternion q;
... ...
examples/shadows-and-lights/shadows-and-lights-example.cpp 100644 → 100755
... ... @@ -335,17 +335,18 @@ public:
335 335  
336 336 void OnPan(Actor actor, const PanGesture& gesture)
337 337 {
338   - switch (gesture.state)
  338 + switch (gesture.GetState())
339 339 {
340 340 case Gesture::Continuing:
341 341 {
  342 + const Vector2& displacement = gesture.GetDisplacement();
342 343 switch(mPanState)
343 344 {
344 345 case PAN_LIGHT:
345 346 {
346   - mLightXRotation = mLightXRotation - gesture.displacement.y * LIGHT_PAN_X_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis
  347 + mLightXRotation = mLightXRotation - displacement.y * LIGHT_PAN_X_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis
347 348 mLightXRotation = Clamp(mLightXRotation, -Dali::ANGLE_45, Dali::ANGLE_45 );
348   - mLightYRotation = mLightYRotation + gesture.displacement.x * LIGHT_PAN_Y_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis
  349 + mLightYRotation = mLightYRotation + displacement.x * LIGHT_PAN_Y_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis
349 350 mLightYRotation = Clamp(mLightYRotation, -Dali::ANGLE_45, Dali::ANGLE_45 );
350 351 mLightAnchor.SetProperty( Actor::Property::ORIENTATION, CalculateWorldRotation( mLightXRotation, mLightYRotation ) );
351 352 break;
... ... @@ -353,16 +354,16 @@ public:
353 354  
354 355 case PAN_SCENE:
355 356 {
356   - mTranslation += Vector3(gesture.displacement.x, gesture.displacement.y, 0.f);
  357 + mTranslation += Vector3(displacement.x, displacement.y, 0.f);
357 358 mContents.SetProperty( Actor::Property::POSITION, mTranslation );
358 359 break;
359 360 }
360 361  
361 362 case ROTATE_SCENE:
362 363 {
363   - mSceneXRotation = mSceneXRotation - gesture.displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis
  364 + mSceneXRotation = mSceneXRotation - displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis
364 365 mSceneXRotation = Clamp( mSceneXRotation, -Dali::ANGLE_90, Dali::ANGLE_90 );
365   - mSceneYRotation = mSceneYRotation + gesture.displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis
  366 + mSceneYRotation = mSceneYRotation + displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis
366 367 mSceneYRotation = Clamp( mSceneYRotation, -Dali::ANGLE_90, Dali::ANGLE_90 );
367 368 mContents.SetProperty( Actor::Property::ORIENTATION, CalculateWorldRotation( mSceneXRotation, mSceneYRotation ) );
368 369 break;
... ... @@ -370,8 +371,8 @@ public:
370 371  
371 372 case ROTATE_OBJECT:
372 373 {
373   - mObjectXRotation = mObjectXRotation - gesture.displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis
374   - mObjectYRotation = mObjectYRotation + gesture.displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis
  374 + mObjectXRotation = mObjectXRotation - displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis
  375 + mObjectYRotation = mObjectYRotation + displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis
375 376 mSceneActor.SetProperty( Actor::Property::ORIENTATION, CalculateWorldRotation( mObjectXRotation, mObjectYRotation ) );
376 377 break;
377 378 }
... ... @@ -390,11 +391,11 @@ public:
390 391  
391 392 void OnPinch(Actor actor, const PinchGesture& gesture)
392 393 {
393   - if (gesture.state == Gesture::Started)
  394 + if (gesture.GetState() == Gesture::Started)
394 395 {
395 396 mScaleAtPinchStart = mContents.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x;
396 397 }
397   - mPinchScale = Clamp(mScaleAtPinchStart * gesture.scale, MIN_PINCH_SCALE, MAX_PINCH_SCALE);
  398 + mPinchScale = Clamp(mScaleAtPinchStart * gesture.GetScale(), MIN_PINCH_SCALE, MAX_PINCH_SCALE);
398 399  
399 400 mContents.SetProperty( Actor::Property::SCALE, Vector3( mPinchScale, mPinchScale, mPinchScale ) );
400 401 }
... ...
examples/sparkle/sparkle-effect-example.cpp 100644 → 100755
... ... @@ -263,7 +263,7 @@ private:
263 263 void OnTap( Actor actor, const TapGesture& tap )
264 264 {
265 265 {
266   - PlayTapAnimation(5.f, tap.localPoint);
  266 + PlayTapAnimation(5.f, tap.GetLocalPoint());
267 267 }
268 268 }
269 269  
... ... @@ -272,7 +272,7 @@ private:
272 272 */
273 273 void OnPan( Actor actor, const PanGesture& gesture )
274 274 {
275   - if( gesture.state == Gesture::Finished )
  275 + if( gesture.GetState() == Gesture::Finished )
276 276 {
277 277 switch(mAnimationIndex)
278 278 {
... ...
examples/styling/styling-application.cpp 100644 → 100755
... ... @@ -628,7 +628,7 @@ void StylingApplication::PopupHidden()
628 628 void StylingApplication::OnPan( Actor actor, const PanGesture& gesture )
629 629 {
630 630 Vector3 size = mContentPane.GetTargetSize();
631   - mContentPane.SetProperty( Actor::Property::SIZE, Vector2( size.GetVectorXY() + gesture.displacement * 2.0f ) );
  631 + mContentPane.SetProperty( Actor::Property::SIZE, Vector2( size.GetVectorXY() + gesture.GetDisplacement() * 2.0f ) );
632 632 }
633 633  
634 634 void StylingApplication::OnKeyEvent( const KeyEvent& keyEvent )
... ...
examples/text-label/text-label-example.cpp 100644 → 100755
... ... @@ -572,7 +572,8 @@ public:
572 572 void OnPan( Actor actor, const PanGesture& gesture )
573 573 {
574 574 // Reset mLayoutSize when the pan starts
575   - if( gesture.state == Gesture::Started )
  575 + Gesture::State state = gesture.GetState();
  576 + if( state == Gesture::Started )
576 577 {
577 578 if( mLayoutSize.x < 2.0f )
578 579 {
... ... @@ -590,8 +591,9 @@ public:
590 591 HideStyleAndColorButtons();
591 592 }
592 593  
593   - mLayoutSize.x += gesture.displacement.x * 2.0f;
594   - mLayoutSize.y += gesture.displacement.y * 2.0f;
  594 + const Vector2& displacement = gesture.GetDisplacement();
  595 + mLayoutSize.x += displacement.x * 2.0f;
  596 + mLayoutSize.y += displacement.y * 2.0f;
595 597  
596 598 if( mLayoutSize.x >= 2.0f ||
597 599 mLayoutSize.y >= 2.0f )
... ... @@ -606,7 +608,7 @@ public:
606 608 mContainer.SetProperty( Actor::Property::SIZE, clampedSize );
607 609 }
608 610  
609   - if( gesture.state == Gesture::Cancelled || gesture.state == Gesture::Finished )
  611 + if( state == Gesture::Cancelled || state == Gesture::Finished )
610 612 {
611 613 // Resize the text label to match the container size when panning is finished
612 614 mLabel.SetProperty( Actor::Property::SIZE, mLayoutSize );
... ...
examples/text-overlap/text-overlap-example.cpp 100644 → 100755
... ... @@ -75,25 +75,29 @@ void TextOverlapController::Create( Application&amp; app )
75 75  
76 76 void TextOverlapController::OnPan( Actor actor, const PanGesture& gesture )
77 77 {
78   - if( ! mGrabbedActor || gesture.state == PanGesture::Started )
  78 + const Gesture::State state = gesture.GetState();
  79 + if( ! mGrabbedActor || state == PanGesture::Started )
79 80 {
  81 + const Vector2& gesturePosition = gesture.GetPosition();
80 82 for( int i=0; i<NUMBER_OF_LABELS; ++i )
81 83 {
82 84 Vector3 position = mLabels[i].GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
83 85 Vector3 size = mLabels[i].GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
84   - if( gesture.position.y > position.y - size.y * 0.5f &&
85   - gesture.position.y <= position.y + size.y * 0.5f )
  86 + if( gesturePosition.y > position.y - size.y * 0.5f &&
  87 + gesturePosition.y <= position.y + size.y * 0.5f )
86 88 {
87 89 mGrabbedActor = mLabels[i];
88 90 break;
89 91 }
90 92 }
91 93 }
92   - else if( mGrabbedActor && gesture.state == PanGesture::Continuing )
  94 + else if( mGrabbedActor && state == PanGesture::Continuing )
93 95 {
94 96 Vector2 windowSize = mApplication.GetWindow().GetSize();
95 97 Vector3 size = mGrabbedActor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
96   - float y = Clamp( gesture.position.y, size.y * 0.5f, windowSize.y - size.y*0.5f );
  98 + const Vector2& gesturePosition = gesture.GetPosition();
  99 +
  100 + float y = Clamp( gesturePosition.y, size.y * 0.5f, windowSize.y - size.y*0.5f );
97 101 mGrabbedActor.SetProperty( Actor::Property::POSITION, Vector2( 0, y ));
98 102 }
99 103 else
... ...
examples/text-scrolling/text-scrolling-example.cpp 100644 → 100755
... ... @@ -377,10 +377,9 @@ public:
377 377  
378 378 void OnPanGesture( Actor actor, const PanGesture& gesture )
379 379 {
380   - if( gesture.state == Gesture::Continuing )
  380 + if( gesture.GetState() == Gesture::Continuing )
381 381 {
382   - Vector2 position = Vector2( gesture.displacement );
383   - mTargetActorPosition.y = mTargetActorPosition.y + position.y;
  382 + mTargetActorPosition.y = mTargetActorPosition.y + gesture.GetDisplacement().y;
384 383 mTargetActorPosition.y = std::min( mTargetActorPosition.y, -mTargetActorSize.height );
385 384 mTargetActorPosition.y = std::max( mTargetActorPosition.y, ( mTargetActorSize.height - mWindowSize.height*0.25f ) );
386 385 actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, mTargetActorPosition.y ));
... ...
examples/video-view/video-view-example.cpp 100644 → 100755
... ... @@ -221,22 +221,23 @@ class VideoViewController: public ConnectionTracker
221 221  
222 222 void OnPan( Actor actor, const PanGesture& gesture )
223 223 {
224   - if( !mIsFullScreen && gesture.state == Gesture::Continuing )
  224 + if( !mIsFullScreen && gesture.GetState() == Gesture::Continuing )
225 225 {
226   - mVideoView.TranslateBy( Vector3( gesture.displacement ) );
  226 + mVideoView.TranslateBy( Vector3( gesture.GetDisplacement() ) );
227 227 }
228 228 }
229 229  
230 230 void OnPinch( Actor actor, const PinchGesture& gesture )
231 231 {
232   - if( gesture.state == Gesture::Started )
  232 + Gesture::State state = gesture.GetState();
  233 + if( state == Gesture::Started )
233 234 {
234 235 mPinchStartScale = mScale;
235 236 }
236 237  
237   - if( gesture.state == Gesture::Finished )
  238 + if( state == Gesture::Finished )
238 239 {
239   - mScale = mPinchStartScale * gesture.scale;
  240 + mScale = mPinchStartScale * gesture.GetScale();
240 241 mVideoView.SetProperty( Actor::Property::SCALE, mScale );
241 242 }
242 243 }
... ...