2026-04-14 6:28 AM
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
Solved! Go to Solution.
2026-04-15 1:12 AM
So the solution was to disable the Draggable Mixins in TouchGFX Designer and just keep the handleDragEvent override in my code
2026-04-15 12:11 AM - edited 2026-04-15 3:35 AM
2026-04-15 1:12 AM
So the solution was to disable the Draggable Mixins in TouchGFX Designer and just keep the handleDragEvent override in my code