Problem dragging an ImageButton

I need to select a part of a displayed waveform, by dragging horizontally a “Start” and “End” ImageButton, but I guess I would have same issue with any type of Button.

I naively tried the following (showing only code for “Start” button), but it only moves the button a little bit and then no more on further dragging.

void MutineerAudioProcessorEditor::mouseDrag (const MouseEvent& event)
    if (event.eventComponent == 
		int xPos = event.getMouseDownX ();

                (xPos, wavetableImportComponent.waveformPlotYPos);

Any suggestions on getting this to work is much appreciated.

Use the ComponentDragger:

    An object to take care of the logic for dragging components around with the mouse.

    Very easy to use - in your mouseDown() callback, call startDraggingComponent(),
    then in your mouseDrag() callback, call dragComponent().

    When starting a drag, you can give it a ComponentBoundsConstrainer to use
    to limit the component's position and keep it on-screen.

    e.g. @code
    class MyDraggableComp
        ComponentDragger myDragger;

        void mouseDown (const MouseEvent& e)
            myDragger.startDraggingComponent (this, e);

        void mouseDrag (const MouseEvent& e)
            myDragger.dragComponent (this, e, nullptr);

class JUCE_API  ComponentDragger

Thank you very much!