修复getcomponents获取为空问题

This commit is contained in:
yhh
2021-04-29 11:00:15 +08:00
parent 9fa0442b20
commit 0748652a8d
5 changed files with 51 additions and 10 deletions

View File

@@ -231,11 +231,11 @@ module es {
let fastList = this.fastComponentsMap.get(typeName);
if (fastList)
components.concat(fastList);
components = components.concat(fastList);
let fastToAddList = this.fastComponentsToAddMap.get(typeName);
if (fastToAddList)
components.concat(fastToAddList);
components =components.concat(fastToAddList);
return components;
}

View File

@@ -36,8 +36,24 @@ module es {
return rightMin + (value - leftMin) * (rightMax - rightMin) / (leftMax - leftMin);
}
public static lerp(value1: number, value2: number, amount: number) {
return value1 + (value2 - value1) * amount;
public static lerp(from: number, to: number, t: number) {
return from + (to - from) * this.clamp01(t);
}
public static inverseLerp(from: number, to: number, t: number) {
if (from < to) {
if (t < from)
return 0;
else if(t > to)
return 1;
} else {
if (t < to)
return 1;
else if(t > from)
return 0;
}
return (t - from) / (to - from);
}
public static clamp(value: number, min: number, max: number) {
@@ -50,6 +66,10 @@ module es {
return value;
}
public static snap(value: number, increment: number) {
return Math.round(value / increment) * increment;
}
/**
* 给定圆心、半径和角度得到圆周上的一个点。0度是3点钟。
* @param circleCenter
@@ -157,5 +177,6 @@ module es {
public static repeat(t: number, length: number) {
return t - Math.floor(t / length) * length;
}
}
}