ResizableBorderComponent::updateMouseZone (...)

The way this function works at the moment is a little unreliable depending on how small the component is made.

The zone testing currently checks for a proportion of the component area (10%), which is obviously much smaller if the component is very small. As the resizer has a border thickness (which should stay constant regardless of size) i think it makes more sense to check that it’s within the the actual border area.

In my version i’ve changed the testing portion of it to this (i’ve left in comments the lines that i’ve changed)

//    if (e.x < proportionOfWidth (0.1f))
    if (e.x < leftBorder)
        newZone |= zoneL;
//    else if (e.x > proportionOfWidth (0.9f))
    else if (e.x > getWidth () - rightBorder)
        newZone |= zoneR;

//    if (e.y < proportionOfHeight (0.1f))
    if (e.y < topBorder)
        newZone |= zoneT;
//    else if (e.y > proportionOfHeight (0.9f))
    else if (e.y > getHeight () - bottomBorder)
        newZone |= zoneB;

Good point, but surely what you mean would be:

    if (e.x < jmax (leftBorder, proportionOfWidth (0.1f)))



yeah i guess, i hadn’t thought about it too extensively. That just means that the border ‘noticing’ area gets bigger as the component gets bigger. The change i made just means there’s a fixed border size being checked, but yes your change keeps it the current way and stops it getting too small.

The reason it gets bigger is so that you have wide corner sections you can grab. With your code it’d be very hard to grab the corners in larger components.

The hitTest method is what makes sure that only clicks within the border area get used, not the zone stuff.

gotcha. i think the fix you suggested is best then. If you try my RangeSlider component in the components forum you’ll see that if you set the range small (with the current version of ResizableBorderComponent) it becomes very difficult to grab the borders because the zone shrinks to only a pixel, if that! :slight_smile:

Ok. Here’s my fix, to save you the typing:

[code] if (e.x < jmax (leftBorder, proportionOfWidth (0.1f)))
newZone |= zoneL;
else if (e.x >= jmin (getWidth() - rightBorder, proportionOfWidth (0.9f)))
newZone |= zoneR;

if (e.y < jmax (topBorder, proportionOfHeight (0.1f)))
    newZone |= zoneT;
else if (e.y >= jmin (getHeight() - bottomBorder, proportionOfHeight (0.9f)))
    newZone |= zoneB;