I'm using svg.js and I'm loading an image into a SVG.Doc. The image size is sometimes smaller than the SVG.Doc element.
How can I limit the drawing size to the bounds of the image once loaded so that it is not possible to draw outside of the image.
I create the drawing element and load the image as below.
var drawing = SVG('drawing)
drawing.image('./url).loaded(function(loader) {
drawing.size(loader.width, loader.height)
})
Been trying various methods but can't seem to get it to work. Any help would be appreciated. Thanks