Reputation: 2466
In Raphaeljs I have content that is exceeding the canvas size. What I want to do is to have the canvas expand and have a container around the canvas that is scrollable so the user can view all of the content.
<div class="canvas_container" id="canvas_container">
<svg>
</svg>
</div>
Is there any way that I can Resize the Raphaeljs canvas after all of the content has been loaded so that it fits everything? Basically, a "scale to fit". My canvas_container div is set to have a scrollable overflow, so if I can just get Raphaeljs to resize to fit everything then it should work.
Upvotes: 1
Views: 314
Reputation: 2388
You can iterate over all elements in your Raphael canvas and get the bounding boxes to calculate the size of your image and then resize the canvas.
The Paper.forEach, Element.getBBox, and Paper.setSize methods would be useful.
Upvotes: 1