2019-10-07 04:51 AM
Hi,
I have a slider added on View. Also, my view overriders handleGestureEvent to handle it globally. Do you have any idea how to discard gesture event, when I quickly move slider?
Same problem when My FrontendApplication overrides handleGestureEvent.
Solved! Go to Solution.
2019-10-07 06:45 AM
/**
* @fn virtual void Drawable::handleDragEvent(const DragEvent& evt)
*
* @brief Defines the event handler interface for DragEvents.
*
* Defines the event handler interface for DragEvents. The event is only received if
* the drawable is touchable.
*
* @param evt The DragEvent received from the HAL.
*/
virtual void handleDragEvent(const DragEvent& evt) { }
Concretely, in your view (having declared handleDragEvent() in MyView.hpp) - Something like this:
void MyView::handleDragEvent(const DragEvent& evt)
{
drag_x = evt.getDeltaX();
if(drag_x < drag_threshhold)
{
View::handleDragEvent(evt);
}
}
/Martin
2019-10-07 06:40 AM
Hi @KMili,
If you override your handleDragEvent() method in the view you can see the delta moved between ticks. If that delta is sufficiently large, the drag must've been quite fast - Then do not forward it to the slider.
/Martin
2019-10-07 06:45 AM
/**
* @fn virtual void Drawable::handleDragEvent(const DragEvent& evt)
*
* @brief Defines the event handler interface for DragEvents.
*
* Defines the event handler interface for DragEvents. The event is only received if
* the drawable is touchable.
*
* @param evt The DragEvent received from the HAL.
*/
virtual void handleDragEvent(const DragEvent& evt) { }
Concretely, in your view (having declared handleDragEvent() in MyView.hpp) - Something like this:
void MyView::handleDragEvent(const DragEvent& evt)
{
drag_x = evt.getDeltaX();
if(drag_x < drag_threshhold)
{
View::handleDragEvent(evt);
}
}
/Martin