Fixed bug with missed bbox parameter

master
Dmitry Baranovskiy 2016-12-22 11:33:43 +11:00
parent 2e6a2afa0f
commit 1492b44dac
3 changed files with 51 additions and 48 deletions

File diff suppressed because one or more lines are too long

9
dist/snap.svg.js vendored
View File

@ -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: 2016-12-09 // build: 2016-12-14
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// //
@ -7182,6 +7182,8 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
} }
function equaliseTransform(t1, t2, getBBox) { function equaliseTransform(t1, t2, getBBox) {
t1 = t1 || new Snap.Matrix;
t2 = t2 || new Snap.Matrix;
t1 = Snap.parseTransformString(t1.toTransformString()) || []; t1 = Snap.parseTransformString(t1.toTransformString()) || [];
t2 = Snap.parseTransformString(t2.toTransformString()) || []; t2 = Snap.parseTransformString(t2.toTransformString()) || [];
var maxlength = Math.max(t1.length, t2.length), var maxlength = Math.max(t1.length, t2.length),
@ -7293,11 +7295,10 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
// b = b.toTransformString(); // b = b.toTransformString();
} }
if (!Snap._.rgTransform.test(b)) { if (!Snap._.rgTransform.test(b)) {
b = Snap._.transform2matrix(Snap._.svgTransform2string(b)); b = Snap._.transform2matrix(Snap._.svgTransform2string(b), this.getBBox());
} else { } else {
b = Snap._.transform2matrix(b); b = Snap._.transform2matrix(b, this.getBBox());
} }
console.log(a, b)
return equaliseTransform(a, b, function () { return equaliseTransform(a, b, function () {
return el.getBBox(1); return el.getBBox(1);
}); });

View File

@ -36,6 +36,8 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
} }
function equaliseTransform(t1, t2, getBBox) { function equaliseTransform(t1, t2, getBBox) {
t1 = t1 || new Snap.Matrix;
t2 = t2 || new Snap.Matrix;
t1 = Snap.parseTransformString(t1.toTransformString()) || []; t1 = Snap.parseTransformString(t1.toTransformString()) || [];
t2 = Snap.parseTransformString(t2.toTransformString()) || []; t2 = Snap.parseTransformString(t2.toTransformString()) || [];
var maxlength = Math.max(t1.length, t2.length), var maxlength = Math.max(t1.length, t2.length),
@ -147,9 +149,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
// b = b.toTransformString(); // b = b.toTransformString();
} }
if (!Snap._.rgTransform.test(b)) { if (!Snap._.rgTransform.test(b)) {
b = Snap._.transform2matrix(Snap._.svgTransform2string(b)); b = Snap._.transform2matrix(Snap._.svgTransform2string(b), this.getBBox());
} else { } else {
b = Snap._.transform2matrix(b); b = Snap._.transform2matrix(b, this.getBBox());
} }
console.log(a, b) console.log(a, b)
return equaliseTransform(a, b, function () { return equaliseTransform(a, b, function () {