Fix for use getBBox()
parent
1bbd8e9fdd
commit
c1e8a98db9
File diff suppressed because one or more lines are too long
|
@ -14,7 +14,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// build: 2014-05-16
|
// build: 2014-05-20
|
||||||
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
|
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -2043,16 +2043,20 @@ function arrayFirstValue(arr) {
|
||||||
o }
|
o }
|
||||||
\*/
|
\*/
|
||||||
elproto.getBBox = function (isWithoutTransform) {
|
elproto.getBBox = function (isWithoutTransform) {
|
||||||
var el = this;
|
var el = this,
|
||||||
|
m = new Snap.Matrix;
|
||||||
if (el.removed) {
|
if (el.removed) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
if (el.type == "use") {
|
while (el.type == "use") {
|
||||||
|
if (!isWithoutTransform) {
|
||||||
|
m = m.add(el.transform().localMatrix.translate(el.attr("x") || 0, el.attr("y") || 0));
|
||||||
|
}
|
||||||
if (el.original) {
|
if (el.original) {
|
||||||
el = el.original;
|
el = el.original;
|
||||||
} else {
|
} else {
|
||||||
var href = el.attr("xlink:href");
|
var href = el.attr("xlink:href");
|
||||||
el = el.node.ownerDocument.getElementById(href.substring(href.indexOf("#") + 1));
|
el = el.original = el.node.ownerDocument.getElementById(href.substring(href.indexOf("#") + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var _ = el._;
|
var _ = el._;
|
||||||
|
@ -2062,7 +2066,7 @@ function arrayFirstValue(arr) {
|
||||||
} else {
|
} else {
|
||||||
el.realPath = (Snap.path.get[el.type] || Snap.path.get.deflt)(el);
|
el.realPath = (Snap.path.get[el.type] || Snap.path.get.deflt)(el);
|
||||||
el.matrix = el.transform().localMatrix;
|
el.matrix = el.transform().localMatrix;
|
||||||
_.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, el.matrix));
|
_.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));
|
||||||
}
|
}
|
||||||
return Snap._.box(_.bbox);
|
return Snap._.box(_.bbox);
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
19
dr.json
19
dr.json
|
@ -4,27 +4,30 @@
|
||||||
"template": "template.dot",
|
"template": "template.dot",
|
||||||
"files": [{
|
"files": [{
|
||||||
"url": "src/svg.js",
|
"url": "src/svg.js",
|
||||||
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/svg.js"
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js"
|
||||||
|
}, {
|
||||||
|
"url": "src/matrix.js",
|
||||||
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/matrix.js"
|
||||||
}, {
|
}, {
|
||||||
"url": "src/paper.js",
|
"url": "src/paper.js",
|
||||||
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/paper.js"
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/paper.js"
|
||||||
}, {
|
}, {
|
||||||
"url": "src/equal.js",
|
"url": "src/equal.js",
|
||||||
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/equal.js"
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/equal.js"
|
||||||
}, {
|
}, {
|
||||||
"url": "src/mina.js",
|
"url": "src/mina.js",
|
||||||
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/mina.js"
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/mina.js"
|
||||||
}, {
|
}, {
|
||||||
"url": "src/filter.js",
|
"url": "src/filter.js",
|
||||||
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/filter.js"
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/filter.js"
|
||||||
}, {
|
}, {
|
||||||
"url": "src/mouse.js",
|
"url": "src/mouse.js",
|
||||||
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/mouse.js"
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/mouse.js"
|
||||||
}, {
|
}, {
|
||||||
"url": "src/path.js",
|
"url": "src/path.js",
|
||||||
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/path.js"
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/path.js"
|
||||||
}, {
|
}, {
|
||||||
"url": "src/set.js",
|
"url": "src/set.js",
|
||||||
"link": "https://github.com/adobe-webplatform/savage/blob/master/src/set.js"
|
"link": "https://github.com/adobe-webplatform/Snap.svg/blob/master/src/set.js"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
12
src/svg.js
12
src/svg.js
|
@ -1285,16 +1285,20 @@ function arrayFirstValue(arr) {
|
||||||
o }
|
o }
|
||||||
\*/
|
\*/
|
||||||
elproto.getBBox = function (isWithoutTransform) {
|
elproto.getBBox = function (isWithoutTransform) {
|
||||||
var el = this;
|
var el = this,
|
||||||
|
m = new Snap.Matrix;
|
||||||
if (el.removed) {
|
if (el.removed) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
if (el.type == "use") {
|
while (el.type == "use") {
|
||||||
|
if (!isWithoutTransform) {
|
||||||
|
m = m.add(el.transform().localMatrix.translate(el.attr("x") || 0, el.attr("y") || 0));
|
||||||
|
}
|
||||||
if (el.original) {
|
if (el.original) {
|
||||||
el = el.original;
|
el = el.original;
|
||||||
} else {
|
} else {
|
||||||
var href = el.attr("xlink:href");
|
var href = el.attr("xlink:href");
|
||||||
el = el.node.ownerDocument.getElementById(href.substring(href.indexOf("#") + 1));
|
el = el.original = el.node.ownerDocument.getElementById(href.substring(href.indexOf("#") + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var _ = el._;
|
var _ = el._;
|
||||||
|
@ -1304,7 +1308,7 @@ function arrayFirstValue(arr) {
|
||||||
} else {
|
} else {
|
||||||
el.realPath = (Snap.path.get[el.type] || Snap.path.get.deflt)(el);
|
el.realPath = (Snap.path.get[el.type] || Snap.path.get.deflt)(el);
|
||||||
el.matrix = el.transform().localMatrix;
|
el.matrix = el.transform().localMatrix;
|
||||||
_.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, el.matrix));
|
_.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));
|
||||||
}
|
}
|
||||||
return Snap._.box(_.bbox);
|
return Snap._.box(_.bbox);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue