Using a ComponentDragger to resize a second component?

Relevant git repo here

So I’m trying to build a GUI to graphically represent an ADSR with points that can be dragged around to change parameters of the envelope. The idea is that each moveable point (the end of the attack, the end of the decay, etc.) is controlled by a nested component. The limits of a parameter are the bounds of a DragNodeContainer component which has a child component DragNode which is dragged around within its parent’s limits by a ComponentDragger object.
The nested component to drag a smaller component within the bounds of a larger one is working fine, the trouble comes with putting multiple DragNodeContainer instances into a parent component. I need to continuously adjust the bounds of one DragNodeContainer based on the position of the DragNode of a different container component. For example, I have one DragNode to control the attack which can be drug to any x position from 0 to some fixed maximum value. A second container for the decay has its maximum X also at some other fixed maximum value, but its minimum X value needs to be equal to the position of the attack dragger (the decay can’t end before the attack does, of course).
The constructor for the DragNode looks like this:

DragNode()
    {
        int initSideLength = getParentHeight();
        sideLength = initSideLength;
        setSize(sideLength, sideLength);
        float parentSideRatio = getParentWidth() / getParentHeight();
        setBoundsRelative(0.0f, 0.0f, parentSideRatio, 1.0f);
        juce::Rectangle<int> bounds = getBoundsInParent().reduced(5);
        constrainer.setSizeLimits(bounds.getY(),
                                  bounds.getX(),
                                  bounds.getWidth(),
                                  bounds.getHeight());
        constrainer.setMinimumOnscreenAmounts(0xffffff, 0xffffff, 0xffffff, 0xffffff);
        setTopLeftPosition(0, 0);
    }

And the DragNodeContainer constructor:

DragNodeContainer(int ix, int iy, int iwidth, int iheight)
    {
        addAndMakeVisible(dragNode);
        x = ix;
        y = iy;
        width = iwidth;
        height = iheight;
        setBounds(x, y, width, height);
        dragNode.setBounds(x, y, height, height);
        dragNode.setTopLeftPosition(0, 0);
    }

I’ve tried calling a setBounds() method on the container from the mouseDrag function of the parent containing both containers but to no avail. If anyone cares to look at the details, the stuff described here is all in the “DraggerClass.h” and “DraggersOnly.h” files on the “draggerSetup” branch on github. I get the feeling that there’s some obvious solution that I’m missing, but any insight into how this dynamic resizing based on a ComponentDragger could be done is greatly appreciated!

I’ve done this manually, but not with ComponentDragger… like you, I was making a generic envelope editor, and I wanted to have a variety of UX options (select and move multiple points at once, have some points be lockable in a given axis, etc). I am interested in hearing the outcome of your work. :slight_smile:

Thanks, I’d be interested to hear how you handled it. Right now I’m trying to see if a ComponentMovementWatcher might be the ticket but I have no clue how to use it :joy: