Skip to main content
Senior III
Apr 14, 2026 1:28 PM UTC
Solved

Draggable on single axis still creates wobbling on the other axis

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

nico23Best answer
Senior III
Apr 15, 2026 8:12 AM UTC

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
Apr 15, 2026 7:11 AM UTC
Please check below the video to understand better
 
nico23AuthorBest answer
Senior III
Apr 15, 2026 8:12 AM UTC

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