您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

53 行
1.3 KiB

using UnityEngine;
namespace Unity.UIWidgets.ui {
static class uiXformUtils {
public static float getScaleX(uiMatrix3 matrix) {
// ignore perspective parameters for now.
if (matrix.isIdentity()) {
return 1.0f;
}
if (matrix.getSkewY() == 0) {
return matrix.getScaleX();
}
var x = matrix.getScaleX();
var y = matrix.getSkewY();
return Mathf.Sqrt(x * x + y * y);
}
public static float getScaleY(uiMatrix3 matrix) {
// ignore perspective parameters for now.
if (matrix.isIdentity()) {
return 1.0f;
}
if (matrix.getSkewX() == 0) {
return matrix.getScaleY();
}
var x = matrix.getSkewX();
var y = matrix.getScaleY();
return Mathf.Sqrt(x * x + y * y);
}
public static float getScale(uiMatrix3 matrix) {
var scaleX = getScaleX(matrix);
var scaleY = getScaleY(matrix);
if (scaleX == 1.0) {
return scaleY;
}
if (scaleY == 1.0) {
return scaleX;
}
// geometric mean of len0 and len1.
return Mathf.Sqrt(scaleX * scaleY);
}
}
}