[Tizen] The problem arises when the timeDelta of the panEvent is 0. Fixed this. 09/281709/3 accepted/tizen/6.0/unified/20220921.123832 submit/tizen_6.0/20220921.080139
authorjoogab.yun <joogab.yun@samsung.com>
Wed, 21 Sep 2022 03:46:54 +0000 (12:46 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Wed, 21 Sep 2022 07:10:01 +0000 (07:10 +0000)
Change-Id: I818598e4425f19fec9b5f0ce4d6ffb2927c9149e

dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp

index b5dc886..853c009 100644 (file)
@@ -1378,7 +1378,11 @@ bool AccessibilityManager::HandlePanGesture(const AccessibilityGestureEvent& pan
   DevelPanGesture::SetNumberOfTouches( pan, panEvent.numberOfTouches  );
   DevelPanGesture::SetScreenPosition( pan, panEvent.currentPosition );
   DevelPanGesture::SetScreenDisplacement( pan, mPreviousPosition - panEvent.currentPosition );
-  DevelPanGesture::SetScreenVelocity( pan, Vector2( pan.GetScreenDisplacement().x / panEvent.timeDelta, pan.GetScreenDisplacement().y / panEvent.timeDelta ) );
+  // Avoid dividing by 0
+  if(panEvent.timeDelta > 0)
+  {
+    DevelPanGesture::SetScreenVelocity( pan, Vector2( pan.GetScreenDisplacement().x / panEvent.timeDelta, pan.GetScreenDisplacement().y / panEvent.timeDelta ) );
+  }
 
   // Only handle the pan gesture when the current focused actor is scrollable or within a scrollable actor
   while(mCurrentGesturedActor && mCurrentGesturedActor != rootActor && !handled)
@@ -1394,7 +1398,11 @@ bool AccessibilityManager::HandlePanGesture(const AccessibilityGestureEvent& pan
       control.ScreenToLocal( localPrevious.x, localPrevious.y, mPreviousPosition.x, mPreviousPosition.y );
 
       DevelPanGesture::SetDisplacement( pan, localCurrent - localPrevious );
-      DevelPanGesture::SetVelocity( pan, Vector2( pan.GetDisplacement().x / panEvent.timeDelta, pan.GetDisplacement().y / panEvent.timeDelta ));
+      // Avoid dividing by 0
+      if(panEvent.timeDelta > 0)
+      {
+        DevelPanGesture::SetVelocity( pan, Vector2( pan.GetDisplacement().x / panEvent.timeDelta, pan.GetDisplacement().y / panEvent.timeDelta ));
+      }
 
       handled = GetImplementation( control ).OnAccessibilityPan(pan);
     }