Fix regression due to earlier fix of issue 937

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2072 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Ahmad Syazwan 2012-03-30 03:50:54 +00:00
parent f2c76b4b39
commit 2d74a7ace5
2 changed files with 15 additions and 2 deletions

View File

@ -345,10 +345,12 @@ svgedit.utilities.getPathBBox = function(path) {
var bounds = [[], []];
var start = seglist.getItem(0);
var P0 = [start.x, start.y];
for(var i=0; i < tot; i++) {
var seg = seglist.getItem(i);
if(typeof seg.x == 'undefined') continue;
// Add actual points to limits
bounds[0].push(P0[0]);
bounds[1].push(P0[1]);

View File

@ -110,6 +110,17 @@
equal(svgedit.utilities.getUrlFromAttr('url("#foo")'), "#foo");
});
test("Test getPathBBox", function() {
if(svgedit.browser.supportsPathBBox()) return;
var doc = svgedit.utilities.text2xml('<svg></svg>');
var path = doc.createElementNS(svgns, 'path');
path.setAttributeNS(null, 'd', 'm0,0l5,0l0,5l-5,0l0,-5z');
var bb = svgedit.utilities.getPathBBox(path);
equals(typeof bb, 'object', 'BBox returned object');
ok(bb.x && !isNaN(bb.x));
ok(bb.y && !isNaN(bb.y));
});
});
</script>
</head>