Reputation: 11763
Is there a way to resize a container so it's always compressed to fit absolute positioned elements inside it?
I like to create a drawing canvas and resize it to fit whatever user drags into it. If user moves the element outside of current size frame, I like the frame to resize to include element.
Sort of like Adobe Fireworks' FIT CANVAS feature.
Here's what I have so far. I have figured how to find outer wrap of right and bottom. But how to get the LEFT and TOP to wrap tight and not have empty space?
Thanks!
Upvotes: 0
Views: 307
Reputation: 1310
Off the top of my head I think you would have to loop through each child element and find four numbers...
You container width would be the largest offsetX minus smallest offsetX and the height would be the largest offsetY minus the smallest offsetY.
Upvotes: 1