ComponentDragger::checkPosition()


#1

Are we missing a virtual function?

From the ComponentDragger class:

    /** Call this from your mouseDrag() callback to move the component.

        This will move the component, but will first check the validity of the
        component's new position using the checkPosition() method, which you
        can override if you need to enforce special positioning limits on the
        component.

        @param componentToDrag      the component that you want to drag
        @param e                    the current mouse-drag event
        @param constrainer          an optional constrainer object that should be used
                                    to apply limits to the component's position. Pass
                                    null if you don't want to contrain the movement.
        @see startDraggingComponent
    */
    void dragComponent (Component* componentToDrag,
                        const MouseEvent& e,
                        ComponentBoundsConstrainer* constrainer);

But I don’t see a checkPosition member function anywhere in the source code… I suspect this was dropped at some point and to check the bounds limits I should either subclass ComponentDragger or ComponentBoundsConstrainer (I need to change the constrained bounds dynamically)

Cheers (and Happy New Year),

Rail


#2

Happy new year! Yes, just looks like an out-of-date comment - the constrainer is used to check the position now. Will correct that..