Mousing through a Viewport


#1

I noticed that the constructors for Viewport and TabbedButtonBar call setInterceptsMouseClicks(false, true), and I wonder why.

In my image thumbnail browser, I size the image display sheets to accomodate a variable number of images, using Viewports to scroll them. When images are few, a sheet can be smaller than its Viewport. To catch drags outside the sheet, I made the Viewport a drag target. It took me quite a while to find out that I had to re-enable the mouse interception for this to work.


#2

Well, that’s to allow you to click through the transparent bits of those components, which is often quite useful. Since neither of those comps are opaque, it seems reasonable to allow that.

It’d be good if there was a way to have thrown an assertion to warn you about why it wasn’t working, but I can’t think of a way of doing that…