Fixed issue 717: Bounding box not surrounding entire image library image

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1988 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Alexis Deveria
2011-02-09 21:32:53 +00:00
parent 292391150f
commit ca671f90d2
2 changed files with 72 additions and 19 deletions

View File

@@ -96,6 +96,24 @@ var supportsPathBBox_ = (function() {
return (bbox.height > 4 && bbox.height < 5);
})();
// Support for correct bbox sizing on groups with horizontal/vertical lines
var supportsHVLineContainerBBox_ = (function() {
var svgcontent = document.createElementNS(svgns, 'svg');
document.documentElement.appendChild(svgcontent);
var path = document.createElementNS(svgns, 'path');
path.setAttribute('d','M0,0 10,0');
var path2 = document.createElementNS(svgns, 'path');
path2.setAttribute('d','M5,0 15,0');
var g = document.createElementNS(svgns, 'g');
g.appendChild(path);
g.appendChild(path2);
svgcontent.appendChild(g);
var bbox = g.getBBox();
document.documentElement.removeChild(svgcontent);
// Webkit gives 0, FF gives 10, Opera (correctly) gives 15
return (bbox.width == 15);
})();
var supportsEditableText_ = (function() {
// TODO: Find better way to check support for this
return isOpera_;
@@ -141,6 +159,7 @@ svgedit.browser.supportsXpath = function() { return supportsXpath_; }
svgedit.browser.supportsPathReplaceItem = function() { return supportsPathReplaceItem_; }
svgedit.browser.supportsPathInsertItemBefore = function() { return supportsPathInsertItemBefore_; }
svgedit.browser.supportsPathBBox = function() { return supportsPathBBox_; }
svgedit.browser.supportsHVLineContainerBBox = function() { return supportsHVLineContainerBBox_; }
svgedit.browser.supportsTextCharPos = function() { return supportsTextCharPos_; }
svgedit.browser.supportsEditableText = function() { return supportsEditableText_; }
svgedit.browser.supportsGoodDecimals = function() { return supportsGoodDecimals_; }