cancel
Showing results for 
Search instead for 
Did you mean: 

Draggable on single axis still creates wobbling on the other axis

nico23
Senior III

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

1 ACCEPTED SOLUTION

Accepted Solutions
nico23
Senior III

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

View solution in original post

2 REPLIES 2
nico23
Senior III
Please check below the video to understand better
 
nico23
Senior III

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