Skip to main content
Senior III
April 14, 2026
Solved

Draggable on single axis still creates wobbling on the other axis

  • April 14, 2026
  • 2 replies
  • 121 views

I have a self-contained widget (a rectangle of 360x60) which has a draggable mixin and a custom handleDragEvent.

void WarningModal::handleDragEvent(const touchgfx::DragEvent& event)
{
 if (!draggingEnabled || !animator) return;

 int16_t newX = animator->getX() + event.getDeltaX();

 // Hard clamp: never allow leftward movement past the resting position
 if (newX < WARNING_MODAL_VISIBLE_X)
 newX = WARNING_MODAL_VISIBLE_X;

 animator->moveTo(newX, WARNING_MODAL_Y);
}

Basically it can only be dragged from left to right

I'm noticing that, if I try to move it up and down, I'm able to generate a wobbling movement up and down because, the widget tends to return to its WARNING_MODAL_Y due to the modeTo line.

Is there a way to disable the drag for an axis to get a smooth movement right-left or up-down

Best answer by nico23

So the solution was to disable the Draggable Mixins in TouchGFX Designer and just keep the handleDragEvent override in my code

2 replies

nico23Author
Senior III
April 15, 2026
Please check below the video to understand better
 
nico23AuthorBest answer
Senior III
April 15, 2026

So the solution was to disable the Draggable Mixins in TouchGFX Designer and just keep the handleDragEvent override in my code