mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
24 lines
420 B
JavaScript
24 lines
420 B
JavaScript
/**
|
|
* 精度
|
|
* @author mrdoob / http://mrdoob.com/
|
|
*/
|
|
var NUMBER_PRECISION = 6;
|
|
|
|
/**
|
|
* 打包数字
|
|
* @param {*} key
|
|
* @param {*} value
|
|
*/
|
|
function parseNumber(key, value) {
|
|
return typeof value === 'number' ? parseFloat(value.toFixed(NUMBER_PRECISION)) : value;
|
|
}
|
|
|
|
/**
|
|
* 数学工具
|
|
*/
|
|
const MathUtils = {
|
|
NUMBER_PRECISION: NUMBER_PRECISION,
|
|
parseNumber: parseNumber
|
|
};
|
|
|
|
export default MathUtils; |