any easy way to select visible joints?

I'm using World.query() to find visible shapes before drawing shapes. But I'm drawing joints too, and I don't see an easy way to find visible joints. I can get most of them from the visible shapes' bodies, but in order to find ones whose bodies are totally out of view, I have to expand the query rectangle by the length of the longest joint segment in the scene--which means that if even one joint happens to be very long, the query will return all shapes rather than only the visible ones.

I guess there probably isn't a nice way to find visible joints--one could either expand the query rectangle as I'm doing, or just draw all joints, or add some external spatial index to track joints. But I thought I'd ask anyhow: Is there a better way than these?

I suppose I could query with a small rectangle for visible shapes, draw visible shapes, query a second time with an expanded rectangle for visible joints, and draw visible joints. Hmm... that's probably better than what I'm doing. Two queries would only be slightly slower than one, and it'd save me lots of shape-drawing (occasionally).
hm... I'm not sure actually, as joints aren't incorporated in any of the collision detection. I would test to see if it's too big of a performance hit to just draw all joints, as opposed to doing another query

Original thread: https://box2d.org/forum/viewtopic.php?t=4925