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

89
dist/snap.svg.js vendored
View File

@ -14,16 +14,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// build: 2016-12-09
// build: 2016-12-14
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -185,7 +185,7 @@
}
return out;
};
/*\
* eve.on
[ method ]
@ -200,7 +200,7 @@
- name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
- f (function) event handler function
**
= (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment.
= (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment.
> Example:
| eve.on("mouse", eatIt)(2);
| eve.on("mouse", scream);
@ -439,13 +439,13 @@
}(window || this, function (window, eve) {
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -4001,13 +4001,13 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -4561,13 +4561,13 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -4650,13 +4650,13 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
})(-10);
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -6829,13 +6829,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -7182,6 +7182,8 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}
}
function equaliseTransform(t1, t2, getBBox) {
t1 = t1 || new Snap.Matrix;
t2 = t2 || new Snap.Matrix;
t1 = Snap.parseTransformString(t1.toTransformString()) || [];
t2 = Snap.parseTransformString(t2.toTransformString()) || [];
var maxlength = Math.max(t1.length, t2.length),
@ -7293,11 +7295,10 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
// b = b.toTransformString();
}
if (!Snap._.rgTransform.test(b)) {
b = Snap._.transform2matrix(Snap._.svgTransform2string(b));
b = Snap._.transform2matrix(Snap._.svgTransform2string(b), this.getBBox());
} else {
b = Snap._.transform2matrix(b);
b = Snap._.transform2matrix(b, this.getBBox());
}
console.log(a, b)
return equaliseTransform(a, b, function () {
return el.getBBox(1);
});
@ -7345,13 +7346,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -7494,7 +7495,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.dblclick
[ method ]
@ -7511,7 +7512,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.mousedown
[ method ]
@ -7528,7 +7529,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.mousemove
[ method ]
@ -7545,7 +7546,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.mouseout
[ method ]
@ -7562,7 +7563,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.mouseover
[ method ]
@ -7579,7 +7580,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.mouseup
[ method ]
@ -7596,7 +7597,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.touchstart
[ method ]
@ -7613,7 +7614,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.touchmove
[ method ]
@ -7630,7 +7631,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.touchend
[ method ]
@ -7647,7 +7648,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- handler (function) handler for the event
= (object) @Element
\*/
/*\
* Element.touchcancel
[ method ]
@ -7741,8 +7742,8 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
- mcontext (object) #optional context for moving handler
- scontext (object) #optional context for drag start handler
- econtext (object) #optional context for drag end handler
* Additionaly following `drag` events are triggered: `drag.start.<id>` on start,
* `drag.end.<id>` on end and `drag.move.<id>` on every move. When element is dragged over another element
* Additionaly following `drag` events are triggered: `drag.start.<id>` on start,
* `drag.end.<id>` on end and `drag.move.<id>` on every move. When element is dragged over another element
* `drag.over.<id>` fires as well.
*
* Start event and start handler are called in specified context or in context of the element with following parameters:
@ -7822,13 +7823,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -7874,7 +7875,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
paper.defs.appendChild(filter);
return new Element(filter);
};
eve.on("snap.util.getattr.filter", function () {
eve.stop();
var p = $(this.node, "filter");
@ -8242,4 +8243,4 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
});
return Snap;
}));
}));

View File

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