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