Can (and how) DrawableImages get Mouse Events?

To preface, I think this is a misunderstand I’m having, and not any issue with particular Components, but man, is this tricky!

I want to get an event for clicking on a DrawableImage, but I can’t get mouseDown to produce anything. The code is as follows…
In the header:
image

Initializing the Parent Component:
image

Setting the mouse listener:
image

But when debugging, I don’t get so much as a peep from my debugger:
image

I do have both my Editor and some buttons listening to the mouse, and they work fine, but I was worried that having a mouse listener on the entire editor was blocking out my Graph Component. If that was true, though, I would also expect my buttons to be blocked by the Editor, which is not the case:
image

I also wonder if it’s because I’m using only setBoundingBox on the images in the Editor’s resize() function:

There’s gotta be something I’m doing wrong with having DrawableImages listen to Mouse Events, right? Thanks all for the help!

Check out

bool DrawableImage::hitTest (int x, int y)
{
    return Drawable::hitTest (x, y) && image.isValid() && image.getPixelAt (x, y).getAlpha() >= 127;
}

Rail

Hi Rail! Thank you for pointing me to this. While I couldn’t get this particular thing to work, I did figure out a way to do the same thing as hitTest when monitoring mouse clicks on my entire editor (just looking to see if it hit any particular components).

Thank you for the help!