Fixed issue 431 by setting a null width/height document's dimensions to that of its contents

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1665 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-08-17 18:43:05 +00:00
parent 4ba054b7ec
commit 16a3d9bc90
1 changed files with 10 additions and 5 deletions

View File

@ -8125,13 +8125,21 @@ this.setSvgString = function(xmlString) {
}); });
} }
// identify layers
identifyLayers();
// Percentage width/height, so let's base it on visible elements // Percentage width/height, so let's base it on visible elements
if(percs) { if(percs) {
var bb = getStrokedBBox(); var bb = getStrokedBBox();
attrs.width = bb.width; attrs.width = bb.width + bb.x;
attrs.height = bb.height; attrs.height = bb.height + bb.y;
} }
// Just in case negative numbers are given or
// result from the percs calculation
if(attrs.width <= 0) attrs.width = 100;
if(attrs.height <= 0) attrs.height = 100;
content.attr(attrs); content.attr(attrs);
this.contentW = attrs['width']; this.contentW = attrs['width'];
this.contentH = attrs['height']; this.contentH = attrs['height'];
@ -8144,9 +8152,6 @@ this.setSvgString = function(xmlString) {
// reset zoom // reset zoom
current_zoom = 1; current_zoom = 1;
// identify layers
identifyLayers();
// reset transform lists // reset transform lists
svgTransformLists = {}; svgTransformLists = {};
clearSelection(); clearSelection();