fixed problem when svg elements contain mm units, by converting them to pixel with a fixed dpi of 90.
This commit is contained in:
parent
25be52587e
commit
12a3f092e2
1 changed files with 49 additions and 36 deletions
|
|
@ -438,6 +438,19 @@ Snap.plugin(function (Snap, Element, Paper, global) {
|
||||||
// Possibly the cubed root of 6, but 1.81 works best
|
// Possibly the cubed root of 6, but 1.81 works best
|
||||||
var num = 1.81;
|
var num = 1.81;
|
||||||
var tag = old_element.type;
|
var tag = old_element.type;
|
||||||
|
|
||||||
|
var convertMMtoPixel = function (val) {
|
||||||
|
attrList = ['rx','ry','r','cx','cy','x1','x2','y1','y2','x','y','width','height'];
|
||||||
|
for(var attrIdx in attrList) {
|
||||||
|
if(val.attr(attrList[attrIdx]) != null && val.attr(attrList[attrIdx]).indexOf('mm') > -1) {
|
||||||
|
var tmp = parseFloat(val.attr(attrList[attrIdx])) * 3.5433;
|
||||||
|
val.attr(attrList[attrIdx], tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
convertMMtoPixel(old_element);
|
||||||
|
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 'ellipse':
|
case 'ellipse':
|
||||||
case 'circle':
|
case 'circle':
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue