修复getcomponents获取为空问题
This commit is contained in:
4
source/bin/framework.d.ts
vendored
4
source/bin/framework.d.ts
vendored
@@ -2342,8 +2342,10 @@ declare module es {
|
||||
* @param rightMax
|
||||
*/
|
||||
static map(value: number, leftMin: number, leftMax: number, rightMin: number, rightMax: number): number;
|
||||
static lerp(value1: number, value2: number, amount: number): number;
|
||||
static lerp(from: number, to: number, t: number): number;
|
||||
static inverseLerp(from: number, to: number, t: number): number;
|
||||
static clamp(value: number, min: number, max: number): number;
|
||||
static snap(value: number, increment: number): number;
|
||||
/**
|
||||
* 给定圆心、半径和角度,得到圆周上的一个点。0度是3点钟。
|
||||
* @param circleCenter
|
||||
|
||||
@@ -4223,10 +4223,10 @@ var es;
|
||||
components = [];
|
||||
var fastList = this.fastComponentsMap.get(typeName);
|
||||
if (fastList)
|
||||
components.concat(fastList);
|
||||
components = components.concat(fastList);
|
||||
var fastToAddList = this.fastComponentsToAddMap.get(typeName);
|
||||
if (fastToAddList)
|
||||
components.concat(fastToAddList);
|
||||
components = components.concat(fastToAddList);
|
||||
return components;
|
||||
};
|
||||
ComponentList.prototype.update = function () {
|
||||
@@ -5741,8 +5741,23 @@ var es;
|
||||
MathHelper.map = function (value, leftMin, leftMax, rightMin, rightMax) {
|
||||
return rightMin + (value - leftMin) * (rightMax - rightMin) / (leftMax - leftMin);
|
||||
};
|
||||
MathHelper.lerp = function (value1, value2, amount) {
|
||||
return value1 + (value2 - value1) * amount;
|
||||
MathHelper.lerp = function (from, to, t) {
|
||||
return from + (to - from) * this.clamp01(t);
|
||||
};
|
||||
MathHelper.inverseLerp = function (from, to, t) {
|
||||
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);
|
||||
};
|
||||
MathHelper.clamp = function (value, min, max) {
|
||||
if (value < min)
|
||||
@@ -5751,6 +5766,9 @@ var es;
|
||||
return max;
|
||||
return value;
|
||||
};
|
||||
MathHelper.snap = function (value, increment) {
|
||||
return Math.round(value / increment) * increment;
|
||||
};
|
||||
/**
|
||||
* 给定圆心、半径和角度,得到圆周上的一个点。0度是3点钟。
|
||||
* @param circleCenter
|
||||
|
||||
2
source/bin/framework.min.js
vendored
2
source/bin/framework.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user