mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-08 00:10:59 +00:00
Update misc.js
some more polishing
This commit is contained in:
parent
0bb156f308
commit
dfbd1887bf
1 changed files with 7 additions and 2 deletions
|
|
@ -4,7 +4,6 @@
|
|||
atan2 = Math.atan2,
|
||||
PiBy180 = Math.PI / 180;
|
||||
|
||||
fabric.DPI = 96;
|
||||
/**
|
||||
* @namespace fabric.util
|
||||
*/
|
||||
|
|
@ -133,9 +132,15 @@
|
|||
return parseFloat(Number(number).toFixed(fractionDigits));
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts from attribute value to pixel value if applicable.
|
||||
* Returns converted pixels or original value not converted.
|
||||
* @param {Number | String} number to operate on
|
||||
* @return {Number | String}
|
||||
*/
|
||||
parseUnit: function(value) {
|
||||
var unit = /\D{0,2}$/.exec(value),
|
||||
number = parseFloat(value.slice(0, unit.index));
|
||||
number = parseFloat(value);
|
||||
switch (unit[0]) {
|
||||
case 'mm':
|
||||
return number * fabric.DPI / 25.4;
|
||||
|
|
|
|||
Loading…
Reference in a new issue