xingwei.zhu
6 年前
当前提交
c4eb6034
共有 11 个文件被更改,包括 250 次插入 和 106 次删除
-
30Runtime/ui/utils/renderer/cmdbufferCanvas/rendering/canvas_impl.cs
-
51Runtime/ui/utils/renderer/cmdbufferCanvas/rendering/canvas_utils.cs
-
12Runtime/ui/utils/renderer/common/base_canvas.cs
-
88Runtime/ui/utils/renderer/common/picture.cs
-
70Runtime/ui/utils/renderer/geometry/matrix/ui_matrix.cs
-
2Runtime/ui/utils/renderer/geometry/path/path.cs
-
31Runtime/ui/utils/renderer/geometry/rect.cs
-
8Runtime/flow.meta
-
53Runtime/ui/utils/renderer/common/utils.cs
-
11Runtime/ui/utils/renderer/common/utils.cs.meta
|
|||
fileFormatVersion: 2 |
|||
guid: e1056a6e2b8247cbaf7db24691b913ec |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: fb644db0d0fbd48208a50a3321bc5840 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue