Component Opacity problem


#1

Hi.

There’s something basic I probably don’t understand fully:

What causes a component with an opacity lower than 1 to reflect its neighboring components when I hover over it with the mouse?
I have a TextEditor with opacity of 0.4f contained in a custom component with setOpaque(true) and a paint() method with a fillAll(solid colour).

Thanks.


#2

Hmm… Interesting. I had a quick look through the component class and found a little bug - not sure if it’s the same thing you’re getting, but try this tweak in juce_Component.cpp:

[code] static void clipObscuredRegions (const Component& comp, Graphics& g, const Rectangle& clipRect, const Point& delta)
{
for (int i = comp.childComponentList.size(); --i >= 0;)
{
const Component& child = *comp.childComponentList.getUnchecked(i);

        if (child.isVisible() && ! child.isTransformed())
        {
            const Rectangle<int> newClip (clipRect.getIntersection (child.bounds));

            if (! newClip.isEmpty())
            {
                if (child.isOpaque() && child.componentTransparency == 0)
                {

[/code]


#3

This bug costed me ~4 hours, but I am grateful it is fixed - was really worth it :slight_smile:

Thanks a lot!


#4

Ah, good! Thanks for letting me know!