I realized that my ComboBox was actually a drop down menu :), so I renamed it to DropDown and then created an actual ComboBox. During the process I noticed that when a button is resized the collision detection bounds are only resized if the button shrinks, but not if it grows. Here’s a couple of screen caps to illustrate:
When I start out with the first image then select the larger text the button grows, but the new larger button only responds to hover events or button click events if they occur in the green highlighted area which is the original size of the button. Any thoughts on this, do you think this would be Lemur or jME related?
I’ve tried adding Geometry.updateModelBound() whenever the GradientBackgroundComponent mesh is resized and also tried detaching the Geometry, creating a new one with the resized Mesh then attaching the new Geometry with the same results.
Yeah, but I wonder why I haven’t hit this with my own components. I may have to do a little testing to confirm but I don’t believe I’ve seen it.
I’ve traced through the Quad and Mesh code and I can’t see how I avoid it, though. Could be I neew a similar fix to call clearCollisionData() when I change size. You probably want to call clear instead of create to avoid creating the collision data multiple times before it’s needed. (Say the component is resized a couple times before clicked again.)
I guess I can’t say for sure. Looking at your TbtQuad Mesh the only thing I’m doing different in terms of modifying the buffers and such is that you’re calling setBuffer(Type type, int components, float buf) with new float/short arrays whenever the mesh is updated.
I use that same method on the initial creation of the mesh, but when the mesh is updated I getBuffer(Type type) to get the VertexBuffer already set on the Mesh then get the underlying Float/ShortBuffer from that and modify it’s contents in order to reuse the existing buffers, when I’m done I call VertexBuffer.updateData(Buffer data) and then setBuffer(VertexBuffer vb).
Looking through Mesh.java and VertexBuffer.java there isn’t really anything different between the two methods, the only difference is that in one the old buffer becomes garbage in the other the old buffer is reused with new data.
There doesn’t appear to be any calls to createCollisionData() or clearCollisionData() at any point along the path when updating buffers. I’m also calling updateBound() when I’m done, but that method does not clear the collision data.