Fixed incorrect Fit to Content crop by making getVisibleElements ignore groups

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@886 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2009-10-28 19:20:56 +00:00
parent b59e989b12
commit fc92f6fff1
1 changed files with 6 additions and 7 deletions

View File

@ -5003,7 +5003,7 @@ function BatchCommand(text) {
var min_x = full_bb.x;
var min_y = full_bb.y;
var getOffset = function(elem) {
var sw = round(elem.getAttribute("stroke-width"));
var sw = elem.getAttribute("stroke-width");
var offset = 0;
if (elem.getAttribute("stroke") != "none" && !isNaN(sw)) {
offset += sw/2;
@ -5035,20 +5035,19 @@ function BatchCommand(text) {
this.getVisibleElements = function(parent, includeBBox) {
if(!parent) parent = svgcontent;
var nodes = parent.childNodes;
var i = nodes.length;
var contentElems = [];
while (i--) {
var elem = nodes[i];
var contentElems = [];
$(parent).find('*').each(function(i, elem) {
if(elem.nodeName == 'g') return;
try {
var box = canvas.getBBox(elem);
if (box) {
var item = includeBBox?{'elem':elem, 'bbox':box}:elem;
console.log('item',item);
contentElems.push(item);
}
} catch(e) {}
}
});
return contentElems;
}