More fixes for zoom: handle old content that does not have a viewBox
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@617 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
9e925d1e1f
commit
fe4cac17e6
|
@ -2443,9 +2443,18 @@ function BatchCommand(text) {
|
|||
svgzoom = svgroot.appendChild(svgdoc.importNode(newDoc.documentElement, true));
|
||||
svgzoom.setAttribute('id', 'svgzoom');
|
||||
// determine proper size
|
||||
var w, h;
|
||||
if (svgzoom.getAttribute("viewBox")) {
|
||||
var vb = svgzoom.getAttribute("viewBox").split(' ');
|
||||
var w = vb[2];
|
||||
var h = vb[3];
|
||||
w = vb[2];
|
||||
h = vb[3];
|
||||
}
|
||||
// handle old content that doesn't have a viewBox
|
||||
else {
|
||||
w = svgzoom.getAttribute("width");
|
||||
h = svgzoom.getAttribute("height");
|
||||
svgzoom.setAttribute("viewBox", ["0", "0", w, h].join(" "));
|
||||
}
|
||||
// just to be safe, remove any width/height from text so that they are 100%/100%
|
||||
svgzoom.removeAttribute('width');
|
||||
svgzoom.removeAttribute('height');
|
||||
|
|
Loading…
Reference in New Issue