fixed problem when svg elements contain mm units, by converting them to pixel with a fixed dpi of 90.

This commit is contained in:
make-ing 2016-06-17 14:18:44 +02:00
parent 25be52587e
commit 12a3f092e2

View file

@ -438,6 +438,19 @@ Snap.plugin(function (Snap, Element, Paper, global) {
// Possibly the cubed root of 6, but 1.81 works best
var num = 1.81;
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) {
case 'ellipse':
case 'circle':