@antv/g 5.13.3 → 5.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.js +377 -1108
- package/dist/index.umd.min.js +1 -3
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -5284,16 +5284,11 @@
|
|
|
5284
5284
|
return result[0].length === result[1].length ? result : equalizeSegments(result[0], result[1], tl);
|
|
5285
5285
|
}
|
|
5286
5286
|
|
|
5287
|
-
var toString = {}.toString;
|
|
5288
|
-
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
|
|
5289
|
-
|
|
5290
5287
|
/**
|
|
5291
|
-
*
|
|
5292
|
-
* @param {*} fn 对象
|
|
5293
|
-
* @return {Boolean} 是否函数
|
|
5288
|
+
* @see https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isfunction
|
|
5294
5289
|
*/
|
|
5295
5290
|
var isFunction = (function (value) {
|
|
5296
|
-
return
|
|
5291
|
+
return typeof value === 'function';
|
|
5297
5292
|
});
|
|
5298
5293
|
|
|
5299
5294
|
// isFinite,
|
|
@@ -5305,6 +5300,9 @@
|
|
|
5305
5300
|
return value === null || value === undefined;
|
|
5306
5301
|
};
|
|
5307
5302
|
|
|
5303
|
+
var toString = {}.toString;
|
|
5304
|
+
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
|
|
5305
|
+
|
|
5308
5306
|
var isArray = (function (value) {
|
|
5309
5307
|
return Array.isArray ? Array.isArray(value) : isType(value, 'Array');
|
|
5310
5308
|
});
|
|
@@ -5837,17 +5835,14 @@
|
|
|
5837
5835
|
* @param {number} y2 结束点 y
|
|
5838
5836
|
* @return {number} 距离
|
|
5839
5837
|
*/
|
|
5840
|
-
|
|
5841
5838
|
function distance$1(x1, y1, x2, y2) {
|
|
5842
5839
|
var dx = x1 - x2;
|
|
5843
5840
|
var dy = y1 - y2;
|
|
5844
5841
|
return Math.sqrt(dx * dx + dy * dy);
|
|
5845
5842
|
}
|
|
5846
|
-
|
|
5847
5843
|
function isNumberEqual$1(v1, v2) {
|
|
5848
5844
|
return Math.abs(v1 - v2) < 0.001;
|
|
5849
5845
|
}
|
|
5850
|
-
|
|
5851
5846
|
function getBBoxByArray(xArr, yArr) {
|
|
5852
5847
|
var minX = Math.min.apply(Math, xArr);
|
|
5853
5848
|
var minY = Math.min.apply(Math, yArr);
|
|
@@ -5860,7 +5855,6 @@
|
|
|
5860
5855
|
height: maxY - minY
|
|
5861
5856
|
};
|
|
5862
5857
|
}
|
|
5863
|
-
|
|
5864
5858
|
function piMod(angle) {
|
|
5865
5859
|
return (angle + Math.PI * 2) % (Math.PI * 2);
|
|
5866
5860
|
}
|
|
@@ -5876,7 +5870,6 @@
|
|
|
5876
5870
|
box: function box(x1, y1, x2, y2) {
|
|
5877
5871
|
return getBBoxByArray([x1, x2], [y1, y2]);
|
|
5878
5872
|
},
|
|
5879
|
-
|
|
5880
5873
|
/**
|
|
5881
5874
|
* 线段的长度
|
|
5882
5875
|
* @param {number} x1 起始点 x
|
|
@@ -5888,7 +5881,6 @@
|
|
|
5888
5881
|
length: function length(x1, y1, x2, y2) {
|
|
5889
5882
|
return distance$1(x1, y1, x2, y2);
|
|
5890
5883
|
},
|
|
5891
|
-
|
|
5892
5884
|
/**
|
|
5893
5885
|
* 根据比例获取点
|
|
5894
5886
|
* @param {number} x1 起始点 x
|
|
@@ -5904,7 +5896,6 @@
|
|
|
5904
5896
|
y: (1 - t) * y1 + t * y2
|
|
5905
5897
|
};
|
|
5906
5898
|
},
|
|
5907
|
-
|
|
5908
5899
|
/**
|
|
5909
5900
|
* 点到线段的距离
|
|
5910
5901
|
* @param {number} x1 起始点 x
|
|
@@ -5919,20 +5910,15 @@
|
|
|
5919
5910
|
// 投影距离 x1, y1 的向量,假设 p, p1, p2 三个点,投影点为 a
|
|
5920
5911
|
// p1a = p1p.p1p2/|p1p2| * (p1p 的单位向量)
|
|
5921
5912
|
var cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
|
|
5922
|
-
|
|
5923
5913
|
if (cross < 0) {
|
|
5924
5914
|
return distance$1(x1, y1, x, y);
|
|
5925
5915
|
}
|
|
5926
|
-
|
|
5927
5916
|
var lengthSquare = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
|
|
5928
|
-
|
|
5929
5917
|
if (cross > lengthSquare) {
|
|
5930
5918
|
return distance$1(x2, y2, x, y);
|
|
5931
5919
|
}
|
|
5932
|
-
|
|
5933
5920
|
return this.pointToLine(x1, y1, x2, y2, x, y);
|
|
5934
5921
|
},
|
|
5935
|
-
|
|
5936
5922
|
/**
|
|
5937
5923
|
* 点到直线的距离,而不是点到线段的距离
|
|
5938
5924
|
* @param {number} x1 起始点 x
|
|
@@ -5944,18 +5930,16 @@
|
|
|
5944
5930
|
* @return {number} 距离
|
|
5945
5931
|
*/
|
|
5946
5932
|
pointToLine: function pointToLine(x1, y1, x2, y2, x, y) {
|
|
5947
|
-
var d = [x2 - x1, y2 - y1];
|
|
5948
|
-
|
|
5933
|
+
var d = [x2 - x1, y2 - y1];
|
|
5934
|
+
// 如果端点相等,则判定点到点的距离
|
|
5949
5935
|
if (exactEquals$1(d, [0, 0])) {
|
|
5950
5936
|
return Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
|
|
5951
5937
|
}
|
|
5952
|
-
|
|
5953
5938
|
var u = [-d[1], d[0]];
|
|
5954
5939
|
normalize$3(u, u);
|
|
5955
5940
|
var a = [x - x1, y - y1];
|
|
5956
5941
|
return Math.abs(dot$1(a, u));
|
|
5957
5942
|
},
|
|
5958
|
-
|
|
5959
5943
|
/**
|
|
5960
5944
|
* 线段的角度
|
|
5961
5945
|
* @param {number} x1 起始点 x
|
|
@@ -5977,40 +5961,32 @@
|
|
|
5977
5961
|
* @param {number} y 指定的点 y
|
|
5978
5962
|
* @param {Function} tCallback 差值函数
|
|
5979
5963
|
*/
|
|
5980
|
-
|
|
5981
5964
|
function nearestPoint(xArr, yArr, x, y, tCallback, length) {
|
|
5982
5965
|
var t = -1;
|
|
5983
5966
|
var d = Infinity;
|
|
5984
5967
|
var v0 = [x, y];
|
|
5985
5968
|
var segNum = 20;
|
|
5986
|
-
|
|
5987
5969
|
if (length && length > 200) {
|
|
5988
5970
|
segNum = length / 10;
|
|
5989
5971
|
}
|
|
5990
|
-
|
|
5991
5972
|
var increaseRate = 1 / segNum;
|
|
5992
5973
|
var interval = increaseRate / 10;
|
|
5993
|
-
|
|
5994
5974
|
for (var i = 0; i <= segNum; i++) {
|
|
5995
5975
|
var _t = i * increaseRate;
|
|
5996
|
-
|
|
5997
5976
|
var v1 = [tCallback.apply(void 0, xArr.concat([_t])), tCallback.apply(void 0, yArr.concat([_t]))];
|
|
5998
5977
|
var d1 = distance$1(v0[0], v0[1], v1[0], v1[1]);
|
|
5999
|
-
|
|
6000
5978
|
if (d1 < d) {
|
|
6001
5979
|
t = _t;
|
|
6002
5980
|
d = d1;
|
|
6003
5981
|
}
|
|
6004
|
-
}
|
|
6005
|
-
|
|
6006
|
-
|
|
5982
|
+
}
|
|
5983
|
+
// 提前终止
|
|
6007
5984
|
if (t === 0) {
|
|
6008
5985
|
return {
|
|
6009
5986
|
x: xArr[0],
|
|
6010
5987
|
y: yArr[0]
|
|
6011
5988
|
};
|
|
6012
5989
|
}
|
|
6013
|
-
|
|
6014
5990
|
if (t === 1) {
|
|
6015
5991
|
var count = xArr.length;
|
|
6016
5992
|
return {
|
|
@@ -6018,27 +5994,21 @@
|
|
|
6018
5994
|
y: yArr[count - 1]
|
|
6019
5995
|
};
|
|
6020
5996
|
}
|
|
6021
|
-
|
|
6022
5997
|
d = Infinity;
|
|
6023
|
-
|
|
6024
5998
|
for (var _i = 0; _i < 32; _i++) {
|
|
6025
5999
|
if (interval < EPSILON$1) {
|
|
6026
6000
|
break;
|
|
6027
6001
|
}
|
|
6028
|
-
|
|
6029
6002
|
var prev = t - interval;
|
|
6030
6003
|
var next = t + interval;
|
|
6031
6004
|
var _v = [tCallback.apply(void 0, xArr.concat([prev])), tCallback.apply(void 0, yArr.concat([prev]))];
|
|
6032
|
-
|
|
6033
6005
|
var _d = distance$1(v0[0], v0[1], _v[0], _v[1]);
|
|
6034
|
-
|
|
6035
6006
|
if (prev >= 0 && _d < d) {
|
|
6036
6007
|
t = prev;
|
|
6037
6008
|
d = _d;
|
|
6038
6009
|
} else {
|
|
6039
6010
|
var v2 = [tCallback.apply(void 0, xArr.concat([next])), tCallback.apply(void 0, yArr.concat([next]))];
|
|
6040
6011
|
var d2 = distance$1(v0[0], v0[1], v2[0], v2[1]);
|
|
6041
|
-
|
|
6042
6012
|
if (next <= 1 && d2 < d) {
|
|
6043
6013
|
t = next;
|
|
6044
6014
|
d = d2;
|
|
@@ -6047,18 +6017,15 @@
|
|
|
6047
6017
|
}
|
|
6048
6018
|
}
|
|
6049
6019
|
}
|
|
6050
|
-
|
|
6051
6020
|
return {
|
|
6052
6021
|
x: tCallback.apply(void 0, xArr.concat([t])),
|
|
6053
6022
|
y: tCallback.apply(void 0, yArr.concat([t]))
|
|
6054
6023
|
};
|
|
6055
|
-
}
|
|
6056
|
-
|
|
6057
|
-
|
|
6024
|
+
}
|
|
6025
|
+
// 近似求解 https://community.khronos.org/t/3d-cubic-bezier-segment-length/62363/2
|
|
6058
6026
|
function snapLength(xArr, yArr) {
|
|
6059
6027
|
var totalLength = 0;
|
|
6060
6028
|
var count = xArr.length;
|
|
6061
|
-
|
|
6062
6029
|
for (var i = 0; i < count; i++) {
|
|
6063
6030
|
var x = xArr[i];
|
|
6064
6031
|
var y = yArr[i];
|
|
@@ -6066,54 +6033,45 @@
|
|
|
6066
6033
|
var nextY = yArr[(i + 1) % count];
|
|
6067
6034
|
totalLength += distance$1(x, y, nextX, nextY);
|
|
6068
6035
|
}
|
|
6069
|
-
|
|
6070
6036
|
return totalLength / 2;
|
|
6071
6037
|
}
|
|
6072
6038
|
|
|
6039
|
+
// 差值公式
|
|
6073
6040
|
function quadraticAt(p0, p1, p2, t) {
|
|
6074
6041
|
var onet = 1 - t;
|
|
6075
6042
|
return onet * onet * p0 + 2 * t * onet * p1 + t * t * p2;
|
|
6076
|
-
}
|
|
6077
|
-
|
|
6078
|
-
|
|
6043
|
+
}
|
|
6044
|
+
// 求极值
|
|
6079
6045
|
function extrema(p0, p1, p2) {
|
|
6080
6046
|
var a = p0 + p2 - 2 * p1;
|
|
6081
|
-
|
|
6082
6047
|
if (isNumberEqual$1(a, 0)) {
|
|
6083
6048
|
return [0.5];
|
|
6084
6049
|
}
|
|
6085
|
-
|
|
6086
6050
|
var rst = (p0 - p1) / a;
|
|
6087
|
-
|
|
6088
6051
|
if (rst <= 1 && rst >= 0) {
|
|
6089
6052
|
return [rst];
|
|
6090
6053
|
}
|
|
6091
|
-
|
|
6092
6054
|
return [];
|
|
6093
6055
|
}
|
|
6094
|
-
|
|
6095
6056
|
function derivativeAt(p0, p1, p2, t) {
|
|
6096
6057
|
return 2 * (1 - t) * (p1 - p0) + 2 * t * (p2 - p1);
|
|
6097
|
-
}
|
|
6098
|
-
|
|
6099
|
-
|
|
6058
|
+
}
|
|
6059
|
+
// 分割贝塞尔曲线
|
|
6100
6060
|
function divideQuadratic(x1, y1, x2, y2, x3, y3, t) {
|
|
6101
6061
|
// 划分点
|
|
6102
6062
|
var xt = quadraticAt(x1, x2, x3, t);
|
|
6103
|
-
var yt = quadraticAt(y1, y2, y3, t);
|
|
6104
|
-
|
|
6105
|
-
var controlPoint1 = line.pointAt(x1, y1, x2, y2, t);
|
|
6106
|
-
|
|
6063
|
+
var yt = quadraticAt(y1, y2, y3, t);
|
|
6064
|
+
// 分割的第一条曲线的控制点
|
|
6065
|
+
var controlPoint1 = line.pointAt(x1, y1, x2, y2, t);
|
|
6066
|
+
// 分割的第二条曲线的控制点
|
|
6107
6067
|
var controlPoint2 = line.pointAt(x2, y2, x3, y3, t);
|
|
6108
6068
|
return [[x1, y1, controlPoint1.x, controlPoint1.y, xt, yt], [xt, yt, controlPoint2.x, controlPoint2.y, x3, y3]];
|
|
6109
|
-
}
|
|
6110
|
-
|
|
6111
|
-
|
|
6069
|
+
}
|
|
6070
|
+
// 使用迭代法取贝塞尔曲线的长度
|
|
6112
6071
|
function quadraticLength(x1, y1, x2, y2, x3, y3, iterationCount) {
|
|
6113
6072
|
if (iterationCount === 0) {
|
|
6114
6073
|
return (distance$1(x1, y1, x2, y2) + distance$1(x2, y2, x3, y3) + distance$1(x1, y1, x3, y3)) / 2;
|
|
6115
6074
|
}
|
|
6116
|
-
|
|
6117
6075
|
var quadratics = divideQuadratic(x1, y1, x2, y2, x3, y3, 0.5);
|
|
6118
6076
|
var left = quadratics[0];
|
|
6119
6077
|
var right = quadratics[1];
|
|
@@ -6121,23 +6079,19 @@
|
|
|
6121
6079
|
right.push(iterationCount - 1);
|
|
6122
6080
|
return quadraticLength.apply(void 0, left) + quadraticLength.apply(void 0, right);
|
|
6123
6081
|
}
|
|
6124
|
-
|
|
6125
6082
|
var quadratic = {
|
|
6126
6083
|
box: function box(x1, y1, x2, y2, x3, y3) {
|
|
6127
6084
|
var xExtrema = extrema(x1, x2, x3)[0];
|
|
6128
|
-
var yExtrema = extrema(y1, y2, y3)[0];
|
|
6129
|
-
|
|
6085
|
+
var yExtrema = extrema(y1, y2, y3)[0];
|
|
6086
|
+
// 控制点不加入 box 的计算
|
|
6130
6087
|
var xArr = [x1, x3];
|
|
6131
6088
|
var yArr = [y1, y3];
|
|
6132
|
-
|
|
6133
6089
|
if (xExtrema !== undefined) {
|
|
6134
6090
|
xArr.push(quadraticAt(x1, x2, x3, xExtrema));
|
|
6135
6091
|
}
|
|
6136
|
-
|
|
6137
6092
|
if (yExtrema !== undefined) {
|
|
6138
6093
|
yArr.push(quadraticAt(y1, y2, y3, yExtrema));
|
|
6139
6094
|
}
|
|
6140
|
-
|
|
6141
6095
|
return getBBoxByArray(xArr, yArr);
|
|
6142
6096
|
},
|
|
6143
6097
|
length: function length(x1, y1, x2, y2, x3, y3) {
|
|
@@ -6167,18 +6121,14 @@
|
|
|
6167
6121
|
return piMod(angle);
|
|
6168
6122
|
}
|
|
6169
6123
|
};
|
|
6170
|
-
|
|
6171
6124
|
function cubicAt(p0, p1, p2, p3, t) {
|
|
6172
6125
|
var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍
|
|
6173
|
-
|
|
6174
6126
|
return onet * onet * onet * p0 + 3 * p1 * t * onet * onet + 3 * p2 * t * t * onet + p3 * t * t * t;
|
|
6175
6127
|
}
|
|
6176
|
-
|
|
6177
6128
|
function derivativeAt$1(p0, p1, p2, p3, t) {
|
|
6178
6129
|
var onet = 1 - t;
|
|
6179
6130
|
return 3 * (onet * onet * (p1 - p0) + 2 * onet * t * (p2 - p1) + t * t * (p3 - p2));
|
|
6180
6131
|
}
|
|
6181
|
-
|
|
6182
6132
|
function extrema$1(p0, p1, p2, p3) {
|
|
6183
6133
|
var a = -3 * p0 + 9 * p1 - 9 * p2 + 3 * p3;
|
|
6184
6134
|
var b = 6 * p0 - 12 * p1 + 6 * p2;
|
|
@@ -6187,64 +6137,54 @@
|
|
|
6187
6137
|
var t1;
|
|
6188
6138
|
var t2;
|
|
6189
6139
|
var discSqrt;
|
|
6190
|
-
|
|
6191
6140
|
if (isNumberEqual$1(a, 0)) {
|
|
6192
6141
|
if (!isNumberEqual$1(b, 0)) {
|
|
6193
6142
|
t1 = -c / b;
|
|
6194
|
-
|
|
6195
6143
|
if (t1 >= 0 && t1 <= 1) {
|
|
6196
6144
|
extremas.push(t1);
|
|
6197
6145
|
}
|
|
6198
6146
|
}
|
|
6199
6147
|
} else {
|
|
6200
6148
|
var disc = b * b - 4 * a * c;
|
|
6201
|
-
|
|
6202
6149
|
if (isNumberEqual$1(disc, 0)) {
|
|
6203
6150
|
extremas.push(-b / (2 * a));
|
|
6204
6151
|
} else if (disc > 0) {
|
|
6205
6152
|
discSqrt = Math.sqrt(disc);
|
|
6206
6153
|
t1 = (-b + discSqrt) / (2 * a);
|
|
6207
6154
|
t2 = (-b - discSqrt) / (2 * a);
|
|
6208
|
-
|
|
6209
6155
|
if (t1 >= 0 && t1 <= 1) {
|
|
6210
6156
|
extremas.push(t1);
|
|
6211
6157
|
}
|
|
6212
|
-
|
|
6213
6158
|
if (t2 >= 0 && t2 <= 1) {
|
|
6214
6159
|
extremas.push(t2);
|
|
6215
6160
|
}
|
|
6216
6161
|
}
|
|
6217
6162
|
}
|
|
6218
|
-
|
|
6219
6163
|
return extremas;
|
|
6220
|
-
}
|
|
6221
|
-
|
|
6222
|
-
|
|
6164
|
+
}
|
|
6165
|
+
// 分割贝塞尔曲线
|
|
6223
6166
|
function divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, t) {
|
|
6224
6167
|
// 划分点
|
|
6225
6168
|
var xt = cubicAt(x1, x2, x3, x4, t);
|
|
6226
|
-
var yt = cubicAt(y1, y2, y3, y4, t);
|
|
6227
|
-
|
|
6169
|
+
var yt = cubicAt(y1, y2, y3, y4, t);
|
|
6170
|
+
// 计算两点之间的差值点
|
|
6228
6171
|
var c1 = line.pointAt(x1, y1, x2, y2, t);
|
|
6229
6172
|
var c2 = line.pointAt(x2, y2, x3, y3, t);
|
|
6230
6173
|
var c3 = line.pointAt(x3, y3, x4, y4, t);
|
|
6231
6174
|
var c12 = line.pointAt(c1.x, c1.y, c2.x, c2.y, t);
|
|
6232
6175
|
var c23 = line.pointAt(c2.x, c2.y, c3.x, c3.y, t);
|
|
6233
6176
|
return [[x1, y1, c1.x, c1.y, c12.x, c12.y, xt, yt], [xt, yt, c23.x, c23.y, c3.x, c3.y, x4, y4]];
|
|
6234
|
-
}
|
|
6235
|
-
|
|
6236
|
-
|
|
6177
|
+
}
|
|
6178
|
+
// 使用迭代法取贝塞尔曲线的长度,二阶和三阶分开写,更清晰和便于调试
|
|
6237
6179
|
function cubicLength(x1, y1, x2, y2, x3, y3, x4, y4, iterationCount) {
|
|
6238
6180
|
if (iterationCount === 0) {
|
|
6239
6181
|
return snapLength([x1, x2, x3, x4], [y1, y2, y3, y4]);
|
|
6240
6182
|
}
|
|
6241
|
-
|
|
6242
6183
|
var cubics = divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, 0.5);
|
|
6243
6184
|
var left = [].concat(cubics[0], [iterationCount - 1]);
|
|
6244
6185
|
var right = [].concat(cubics[1], [iterationCount - 1]);
|
|
6245
6186
|
return cubicLength.apply(void 0, left) + cubicLength.apply(void 0, right);
|
|
6246
6187
|
}
|
|
6247
|
-
|
|
6248
6188
|
var cubic = {
|
|
6249
6189
|
extrema: extrema$1,
|
|
6250
6190
|
box: function box(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
@@ -6252,15 +6192,12 @@
|
|
|
6252
6192
|
var yArr = [y1, y4];
|
|
6253
6193
|
var xExtrema = extrema$1(x1, x2, x3, x4);
|
|
6254
6194
|
var yExtrema = extrema$1(y1, y2, y3, y4);
|
|
6255
|
-
|
|
6256
6195
|
for (var i = 0; i < xExtrema.length; i++) {
|
|
6257
6196
|
xArr.push(cubicAt(x1, x2, x3, x4, xExtrema[i]));
|
|
6258
6197
|
}
|
|
6259
|
-
|
|
6260
6198
|
for (var _i = 0; _i < yExtrema.length; _i++) {
|
|
6261
6199
|
yArr.push(cubicAt(y1, y2, y3, y4, yExtrema[_i]));
|
|
6262
6200
|
}
|
|
6263
|
-
|
|
6264
6201
|
return getBBoxByArray(xArr, yArr);
|
|
6265
6202
|
},
|
|
6266
6203
|
length: function length(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
@@ -6290,18 +6227,17 @@
|
|
|
6290
6227
|
return piMod(Math.atan2(dy, dx));
|
|
6291
6228
|
}
|
|
6292
6229
|
};
|
|
6230
|
+
|
|
6293
6231
|
/**
|
|
6294
6232
|
* @fileoverview 椭圆的一些计算,
|
|
6295
6233
|
* - 周长计算参考:https://www.mathsisfun.com/geometry/ellipse-perimeter.html
|
|
6296
6234
|
* - 距离计算参考:https://wet-robots.ghost.io/simple-method-for-distance-to-ellipse/
|
|
6297
6235
|
* @author dxq613@gmail.com
|
|
6298
6236
|
*/
|
|
6299
|
-
|
|
6300
6237
|
function copysign(v1, v2) {
|
|
6301
6238
|
var absv = Math.abs(v1);
|
|
6302
6239
|
return v2 > 0 ? absv : absv * -1;
|
|
6303
6240
|
}
|
|
6304
|
-
|
|
6305
6241
|
var ellipse = {
|
|
6306
6242
|
/**
|
|
6307
6243
|
* 包围盒计算
|
|
@@ -6319,7 +6255,6 @@
|
|
|
6319
6255
|
height: ry * 2
|
|
6320
6256
|
};
|
|
6321
6257
|
},
|
|
6322
|
-
|
|
6323
6258
|
/**
|
|
6324
6259
|
* 计算周长,使用近似法
|
|
6325
6260
|
* @param {number} x 椭圆中心 x
|
|
@@ -6331,7 +6266,6 @@
|
|
|
6331
6266
|
length: function length(x, y, rx, ry) {
|
|
6332
6267
|
return Math.PI * (3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)));
|
|
6333
6268
|
},
|
|
6334
|
-
|
|
6335
6269
|
/**
|
|
6336
6270
|
* 距离椭圆最近的点
|
|
6337
6271
|
* @param {number} x 椭圆中心 x
|
|
@@ -6344,28 +6278,26 @@
|
|
|
6344
6278
|
*/
|
|
6345
6279
|
nearestPoint: function nearestPoint(x, y, rx, ry, x0, y0) {
|
|
6346
6280
|
var a = rx;
|
|
6347
|
-
var b = ry;
|
|
6348
|
-
|
|
6281
|
+
var b = ry;
|
|
6282
|
+
// 假如椭圆半径为0则返回圆心
|
|
6349
6283
|
if (a === 0 || b === 0) {
|
|
6350
6284
|
return {
|
|
6351
6285
|
x: x,
|
|
6352
6286
|
y: y
|
|
6353
6287
|
};
|
|
6354
|
-
}
|
|
6355
|
-
|
|
6356
|
-
|
|
6288
|
+
}
|
|
6289
|
+
// 转换成 0, 0 为中心的椭圆计算
|
|
6357
6290
|
var relativeX = x0 - x;
|
|
6358
6291
|
var relativeY = y0 - y;
|
|
6359
6292
|
var px = Math.abs(relativeX);
|
|
6360
6293
|
var py = Math.abs(relativeY);
|
|
6361
6294
|
var squareA = a * a;
|
|
6362
|
-
var squareB = b * b;
|
|
6363
|
-
|
|
6295
|
+
var squareB = b * b;
|
|
6296
|
+
// const angle0 = Math.atan2(relativeY, relativeX);
|
|
6364
6297
|
var t = Math.PI / 4;
|
|
6365
6298
|
var nearestX = 0; // 椭圆上的任一点
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6299
|
+
var nearestY = 0;
|
|
6300
|
+
// 迭代 4 次
|
|
6369
6301
|
for (var i = 0; i < 4; i++) {
|
|
6370
6302
|
nearestX = a * Math.cos(t);
|
|
6371
6303
|
nearestY = b * Math.sin(t);
|
|
@@ -6382,13 +6314,11 @@
|
|
|
6382
6314
|
t += delta_t;
|
|
6383
6315
|
t = Math.min(Math.PI / 2, Math.max(0, t));
|
|
6384
6316
|
}
|
|
6385
|
-
|
|
6386
6317
|
return {
|
|
6387
6318
|
x: x + copysign(nearestX, relativeX),
|
|
6388
6319
|
y: y + copysign(nearestY, relativeY)
|
|
6389
6320
|
};
|
|
6390
6321
|
},
|
|
6391
|
-
|
|
6392
6322
|
/**
|
|
6393
6323
|
* 点到椭圆最近的距离
|
|
6394
6324
|
* @param {number} x 椭圆中心 x
|
|
@@ -6403,7 +6333,6 @@
|
|
|
6403
6333
|
var nearestPoint = this.nearestPoint(x, y, rx, ry, x0, y0);
|
|
6404
6334
|
return distance$1(nearestPoint.x, nearestPoint.y, x0, y0);
|
|
6405
6335
|
},
|
|
6406
|
-
|
|
6407
6336
|
/**
|
|
6408
6337
|
* 根据比例获取点
|
|
6409
6338
|
* @param {number} x 椭圆中心 x
|
|
@@ -6415,13 +6344,11 @@
|
|
|
6415
6344
|
*/
|
|
6416
6345
|
pointAt: function pointAt(x, y, rx, ry, t) {
|
|
6417
6346
|
var angle = 2 * Math.PI * t; // 按照角度进行计算,而不按照周长计算
|
|
6418
|
-
|
|
6419
6347
|
return {
|
|
6420
6348
|
x: x + rx * Math.cos(angle),
|
|
6421
6349
|
y: y + ry * Math.sin(angle)
|
|
6422
6350
|
};
|
|
6423
6351
|
},
|
|
6424
|
-
|
|
6425
6352
|
/**
|
|
6426
6353
|
* 根据比例计算切线角度
|
|
6427
6354
|
* @param {number} x 椭圆中心 x
|
|
@@ -6434,69 +6361,60 @@
|
|
|
6434
6361
|
tangentAngle: function tangentAngle(x, y, rx, ry, t) {
|
|
6435
6362
|
var angle = 2 * Math.PI * t; // 按照角度进行计算,而不按照周长计算
|
|
6436
6363
|
// 直接使用 x,y 的导数计算, x' = -rx * sin(t); y' = ry * cos(t);
|
|
6437
|
-
|
|
6438
|
-
|
|
6364
|
+
var tangentAngle = Math.atan2(ry * Math.cos(angle), -rx * Math.sin(angle));
|
|
6365
|
+
// 也可以使用指定点的切线方程计算,成本有些高
|
|
6439
6366
|
// const point = this.pointAt(0, 0, rx, ry, t); // 椭圆的切线同椭圆的中心不相关
|
|
6440
6367
|
// let tangentAngle = -1 * Math.atan((ry * ry * point.x) / (rx * rx * point.y));
|
|
6441
6368
|
// if (angle >= 0 && angle <= Math.PI) {
|
|
6442
6369
|
// tangentAngle += Math.PI;
|
|
6443
6370
|
// }
|
|
6444
|
-
|
|
6445
6371
|
return piMod(tangentAngle);
|
|
6446
6372
|
}
|
|
6447
6373
|
};
|
|
6448
6374
|
|
|
6375
|
+
// 偏导数 x
|
|
6449
6376
|
function derivativeXAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle) {
|
|
6450
6377
|
return -1 * rx * Math.cos(xRotation) * Math.sin(angle) - ry * Math.sin(xRotation) * Math.cos(angle);
|
|
6451
|
-
}
|
|
6452
|
-
|
|
6453
|
-
|
|
6378
|
+
}
|
|
6379
|
+
// 偏导数 y
|
|
6454
6380
|
function derivativeYAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle) {
|
|
6455
6381
|
return -1 * rx * Math.sin(xRotation) * Math.sin(angle) + ry * Math.cos(xRotation) * Math.cos(angle);
|
|
6456
|
-
}
|
|
6457
|
-
|
|
6458
|
-
|
|
6382
|
+
}
|
|
6383
|
+
// x 的极值
|
|
6459
6384
|
function xExtrema(rx, ry, xRotation) {
|
|
6460
6385
|
return Math.atan(-ry / rx * Math.tan(xRotation));
|
|
6461
|
-
}
|
|
6462
|
-
|
|
6463
|
-
|
|
6386
|
+
}
|
|
6387
|
+
// y 的极值
|
|
6464
6388
|
function yExtrema(rx, ry, xRotation) {
|
|
6465
6389
|
return Math.atan(ry / (rx * Math.tan(xRotation)));
|
|
6466
|
-
}
|
|
6467
|
-
|
|
6468
|
-
|
|
6390
|
+
}
|
|
6391
|
+
// 根据角度求 x 坐标
|
|
6469
6392
|
function xAt(cx, cy, rx, ry, xRotation, angle) {
|
|
6470
6393
|
return rx * Math.cos(xRotation) * Math.cos(angle) - ry * Math.sin(xRotation) * Math.sin(angle) + cx;
|
|
6471
|
-
}
|
|
6472
|
-
|
|
6473
|
-
|
|
6394
|
+
}
|
|
6395
|
+
// 根据角度求 y 坐标
|
|
6474
6396
|
function yAt(cx, cy, rx, ry, xRotation, angle) {
|
|
6475
6397
|
return rx * Math.sin(xRotation) * Math.cos(angle) + ry * Math.cos(xRotation) * Math.sin(angle) + cy;
|
|
6476
|
-
}
|
|
6477
|
-
|
|
6478
|
-
|
|
6398
|
+
}
|
|
6399
|
+
// 获取点在椭圆上的角度
|
|
6479
6400
|
function getAngle(rx, ry, x0, y0) {
|
|
6480
|
-
var angle = Math.atan2(y0 * rx, x0 * ry);
|
|
6481
|
-
|
|
6401
|
+
var angle = Math.atan2(y0 * rx, x0 * ry);
|
|
6402
|
+
// 转换到 0 - 2PI 内
|
|
6482
6403
|
return (angle + Math.PI * 2) % (Math.PI * 2);
|
|
6483
|
-
}
|
|
6484
|
-
|
|
6485
|
-
|
|
6404
|
+
}
|
|
6405
|
+
// 根据角度获取,x,y
|
|
6486
6406
|
function getPoint(rx, ry, angle) {
|
|
6487
6407
|
return {
|
|
6488
6408
|
x: rx * Math.cos(angle),
|
|
6489
6409
|
y: ry * Math.sin(angle)
|
|
6490
6410
|
};
|
|
6491
|
-
}
|
|
6492
|
-
|
|
6493
|
-
|
|
6411
|
+
}
|
|
6412
|
+
// 旋转
|
|
6494
6413
|
function rotate$1(x, y, angle) {
|
|
6495
6414
|
var cos = Math.cos(angle);
|
|
6496
6415
|
var sin = Math.sin(angle);
|
|
6497
6416
|
return [x * cos - y * sin, x * sin + y * cos];
|
|
6498
6417
|
}
|
|
6499
|
-
|
|
6500
6418
|
var arc = {
|
|
6501
6419
|
/**
|
|
6502
6420
|
* 计算包围盒
|
|
@@ -6514,10 +6432,8 @@
|
|
|
6514
6432
|
var minX = Infinity;
|
|
6515
6433
|
var maxX = -Infinity;
|
|
6516
6434
|
var xs = [startAngle, endAngle];
|
|
6517
|
-
|
|
6518
6435
|
for (var i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) {
|
|
6519
6436
|
var xAngle = xDim + i;
|
|
6520
|
-
|
|
6521
6437
|
if (startAngle < endAngle) {
|
|
6522
6438
|
if (startAngle < xAngle && xAngle < endAngle) {
|
|
6523
6439
|
xs.push(xAngle);
|
|
@@ -6528,27 +6444,21 @@
|
|
|
6528
6444
|
}
|
|
6529
6445
|
}
|
|
6530
6446
|
}
|
|
6531
|
-
|
|
6532
6447
|
for (var _i = 0; _i < xs.length; _i++) {
|
|
6533
6448
|
var x = xAt(cx, cy, rx, ry, xRotation, xs[_i]);
|
|
6534
|
-
|
|
6535
6449
|
if (x < minX) {
|
|
6536
6450
|
minX = x;
|
|
6537
6451
|
}
|
|
6538
|
-
|
|
6539
6452
|
if (x > maxX) {
|
|
6540
6453
|
maxX = x;
|
|
6541
6454
|
}
|
|
6542
6455
|
}
|
|
6543
|
-
|
|
6544
6456
|
var yDim = yExtrema(rx, ry, xRotation);
|
|
6545
6457
|
var minY = Infinity;
|
|
6546
6458
|
var maxY = -Infinity;
|
|
6547
6459
|
var ys = [startAngle, endAngle];
|
|
6548
|
-
|
|
6549
6460
|
for (var _i2 = -Math.PI * 2; _i2 <= Math.PI * 2; _i2 += Math.PI) {
|
|
6550
6461
|
var yAngle = yDim + _i2;
|
|
6551
|
-
|
|
6552
6462
|
if (startAngle < endAngle) {
|
|
6553
6463
|
if (startAngle < yAngle && yAngle < endAngle) {
|
|
6554
6464
|
ys.push(yAngle);
|
|
@@ -6559,19 +6469,15 @@
|
|
|
6559
6469
|
}
|
|
6560
6470
|
}
|
|
6561
6471
|
}
|
|
6562
|
-
|
|
6563
6472
|
for (var _i3 = 0; _i3 < ys.length; _i3++) {
|
|
6564
6473
|
var y = yAt(cx, cy, rx, ry, xRotation, ys[_i3]);
|
|
6565
|
-
|
|
6566
6474
|
if (y < minY) {
|
|
6567
6475
|
minY = y;
|
|
6568
6476
|
}
|
|
6569
|
-
|
|
6570
6477
|
if (y > maxY) {
|
|
6571
6478
|
maxY = y;
|
|
6572
6479
|
}
|
|
6573
6480
|
}
|
|
6574
|
-
|
|
6575
6481
|
return {
|
|
6576
6482
|
x: minX,
|
|
6577
6483
|
y: minY,
|
|
@@ -6579,7 +6485,6 @@
|
|
|
6579
6485
|
height: maxY - minY
|
|
6580
6486
|
};
|
|
6581
6487
|
},
|
|
6582
|
-
|
|
6583
6488
|
/**
|
|
6584
6489
|
* 获取圆弧的长度,计算圆弧长度时不考虑旋转角度,
|
|
6585
6490
|
* 仅跟 rx, ry, startAngle, endAngle 相关
|
|
@@ -6592,7 +6497,6 @@
|
|
|
6592
6497
|
* @param {number} endAngle 结束角度
|
|
6593
6498
|
*/
|
|
6594
6499
|
length: function length(cx, cy, rx, ry, xRotation, startAngle, endAngle) {},
|
|
6595
|
-
|
|
6596
6500
|
/**
|
|
6597
6501
|
* 获取指定点到圆弧的最近距离的点
|
|
6598
6502
|
* @param {number} cx 圆心 x
|
|
@@ -6610,21 +6514,20 @@
|
|
|
6610
6514
|
// 将最近距离问题转换成到椭圆中心 0,0 没有旋转的椭圆问题
|
|
6611
6515
|
var relativeVector = rotate$1(x0 - cx, y0 - cy, -xRotation);
|
|
6612
6516
|
var x1 = relativeVector[0],
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
var relativePoint = ellipse.nearestPoint(0, 0, rx, ry, x1, y1);
|
|
6616
|
-
|
|
6617
|
-
var angle = getAngle(rx, ry, relativePoint.x, relativePoint.y);
|
|
6618
|
-
|
|
6517
|
+
y1 = relativeVector[1];
|
|
6518
|
+
// 计算点到椭圆的最近的点
|
|
6519
|
+
var relativePoint = ellipse.nearestPoint(0, 0, rx, ry, x1, y1);
|
|
6520
|
+
// 获取点在椭圆上的角度
|
|
6521
|
+
var angle = getAngle(rx, ry, relativePoint.x, relativePoint.y);
|
|
6522
|
+
// 点没有在圆弧上
|
|
6619
6523
|
if (angle < startAngle) {
|
|
6620
6524
|
// 小于起始圆弧
|
|
6621
6525
|
relativePoint = getPoint(rx, ry, startAngle);
|
|
6622
6526
|
} else if (angle > endAngle) {
|
|
6623
6527
|
// 大于结束圆弧
|
|
6624
6528
|
relativePoint = getPoint(rx, ry, endAngle);
|
|
6625
|
-
}
|
|
6626
|
-
|
|
6627
|
-
|
|
6529
|
+
}
|
|
6530
|
+
// 旋转到 xRotation 的角度
|
|
6628
6531
|
var vector = rotate$1(relativePoint.x, relativePoint.y, xRotation);
|
|
6629
6532
|
return {
|
|
6630
6533
|
x: vector[0] + cx,
|
|
@@ -6649,12 +6552,10 @@
|
|
|
6649
6552
|
return piMod(Math.atan2(dy, dx));
|
|
6650
6553
|
}
|
|
6651
6554
|
};
|
|
6652
|
-
|
|
6653
6555
|
function analyzePoints(points) {
|
|
6654
6556
|
// 计算每段的长度和总的长度
|
|
6655
6557
|
var totalLength = 0;
|
|
6656
6558
|
var segments = [];
|
|
6657
|
-
|
|
6658
6559
|
for (var i = 0; i < points.length - 1; i++) {
|
|
6659
6560
|
var from = points[i];
|
|
6660
6561
|
var to = points[i + 1];
|
|
@@ -6667,26 +6568,21 @@
|
|
|
6667
6568
|
segments.push(seg);
|
|
6668
6569
|
totalLength += length;
|
|
6669
6570
|
}
|
|
6670
|
-
|
|
6671
6571
|
return {
|
|
6672
6572
|
segments: segments,
|
|
6673
6573
|
totalLength: totalLength
|
|
6674
6574
|
};
|
|
6675
6575
|
}
|
|
6676
|
-
|
|
6677
6576
|
function lengthOfSegment(points) {
|
|
6678
6577
|
if (points.length < 2) {
|
|
6679
6578
|
return 0;
|
|
6680
6579
|
}
|
|
6681
|
-
|
|
6682
6580
|
var totalLength = 0;
|
|
6683
|
-
|
|
6684
6581
|
for (var i = 0; i < points.length - 1; i++) {
|
|
6685
6582
|
var from = points[i];
|
|
6686
6583
|
var to = points[i + 1];
|
|
6687
6584
|
totalLength += distance$1(from[0], from[1], to[0], to[1]);
|
|
6688
6585
|
}
|
|
6689
|
-
|
|
6690
6586
|
return totalLength;
|
|
6691
6587
|
}
|
|
6692
6588
|
/**
|
|
@@ -6695,45 +6591,36 @@
|
|
|
6695
6591
|
* @param {number} t 百分比 0-1
|
|
6696
6592
|
* @return {object} 点的坐标
|
|
6697
6593
|
*/
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
6594
|
function pointAtSegments(points, t) {
|
|
6701
6595
|
// 边界判断
|
|
6702
6596
|
if (t > 1 || t < 0 || points.length < 2) {
|
|
6703
6597
|
return null;
|
|
6704
6598
|
}
|
|
6705
|
-
|
|
6706
6599
|
var _analyzePoints = analyzePoints(points),
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6600
|
+
segments = _analyzePoints.segments,
|
|
6601
|
+
totalLength = _analyzePoints.totalLength;
|
|
6602
|
+
// 多个点有可能重合
|
|
6711
6603
|
if (totalLength === 0) {
|
|
6712
6604
|
return {
|
|
6713
6605
|
x: points[0][0],
|
|
6714
6606
|
y: points[0][1]
|
|
6715
6607
|
};
|
|
6716
|
-
}
|
|
6717
|
-
|
|
6718
|
-
|
|
6608
|
+
}
|
|
6609
|
+
// 计算比例
|
|
6719
6610
|
var startRatio = 0;
|
|
6720
6611
|
var point = null;
|
|
6721
|
-
|
|
6722
6612
|
for (var i = 0; i < segments.length; i++) {
|
|
6723
6613
|
var seg = segments[i];
|
|
6724
6614
|
var from = seg.from,
|
|
6725
|
-
|
|
6615
|
+
to = seg.to;
|
|
6726
6616
|
var currentRatio = seg.length / totalLength;
|
|
6727
|
-
|
|
6728
6617
|
if (t >= startRatio && t <= startRatio + currentRatio) {
|
|
6729
6618
|
var localRatio = (t - startRatio) / currentRatio;
|
|
6730
6619
|
point = line.pointAt(from[0], from[1], to[0], to[1], localRatio);
|
|
6731
6620
|
break;
|
|
6732
6621
|
}
|
|
6733
|
-
|
|
6734
6622
|
startRatio += currentRatio;
|
|
6735
6623
|
}
|
|
6736
|
-
|
|
6737
6624
|
return point;
|
|
6738
6625
|
}
|
|
6739
6626
|
/**
|
|
@@ -6741,56 +6628,42 @@
|
|
|
6741
6628
|
* @param {array} points 点的集合
|
|
6742
6629
|
* @param {number} t 百分比 0-1
|
|
6743
6630
|
*/
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
6631
|
function angleAtSegments(points, t) {
|
|
6747
6632
|
// 边界判断
|
|
6748
6633
|
if (t > 1 || t < 0 || points.length < 2) {
|
|
6749
6634
|
return 0;
|
|
6750
6635
|
}
|
|
6751
|
-
|
|
6752
6636
|
var _analyzePoints2 = analyzePoints(points),
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6637
|
+
segments = _analyzePoints2.segments,
|
|
6638
|
+
totalLength = _analyzePoints2.totalLength;
|
|
6639
|
+
// 计算比例
|
|
6757
6640
|
var startRatio = 0;
|
|
6758
6641
|
var angle = 0;
|
|
6759
|
-
|
|
6760
6642
|
for (var i = 0; i < segments.length; i++) {
|
|
6761
6643
|
var seg = segments[i];
|
|
6762
6644
|
var from = seg.from,
|
|
6763
|
-
|
|
6645
|
+
to = seg.to;
|
|
6764
6646
|
var currentRatio = seg.length / totalLength;
|
|
6765
|
-
|
|
6766
6647
|
if (t >= startRatio && t <= startRatio + currentRatio) {
|
|
6767
6648
|
angle = Math.atan2(to[1] - from[1], to[0] - from[0]);
|
|
6768
6649
|
break;
|
|
6769
6650
|
}
|
|
6770
|
-
|
|
6771
6651
|
startRatio += currentRatio;
|
|
6772
6652
|
}
|
|
6773
|
-
|
|
6774
6653
|
return angle;
|
|
6775
6654
|
}
|
|
6776
|
-
|
|
6777
6655
|
function distanceAtSegment(points, x, y) {
|
|
6778
6656
|
var minDistance = Infinity;
|
|
6779
|
-
|
|
6780
6657
|
for (var i = 0; i < points.length - 1; i++) {
|
|
6781
6658
|
var point = points[i];
|
|
6782
6659
|
var nextPoint = points[i + 1];
|
|
6783
|
-
|
|
6784
6660
|
var _distance = line.pointDistance(point[0], point[1], nextPoint[0], nextPoint[1], x, y);
|
|
6785
|
-
|
|
6786
6661
|
if (_distance < minDistance) {
|
|
6787
6662
|
minDistance = _distance;
|
|
6788
6663
|
}
|
|
6789
6664
|
}
|
|
6790
|
-
|
|
6791
6665
|
return minDistance;
|
|
6792
6666
|
}
|
|
6793
|
-
|
|
6794
6667
|
var polyline = {
|
|
6795
6668
|
/**
|
|
6796
6669
|
* 计算多折线的包围盒
|
|
@@ -6800,16 +6673,13 @@
|
|
|
6800
6673
|
box: function box(points) {
|
|
6801
6674
|
var xArr = [];
|
|
6802
6675
|
var yArr = [];
|
|
6803
|
-
|
|
6804
6676
|
for (var i = 0; i < points.length; i++) {
|
|
6805
6677
|
var point = points[i];
|
|
6806
6678
|
xArr.push(point[0]);
|
|
6807
6679
|
yArr.push(point[1]);
|
|
6808
6680
|
}
|
|
6809
|
-
|
|
6810
6681
|
return getBBoxByArray(xArr, yArr);
|
|
6811
6682
|
},
|
|
6812
|
-
|
|
6813
6683
|
/**
|
|
6814
6684
|
* 计算多折线的长度
|
|
6815
6685
|
* @param {array} points 点的集合 [x,y] 的形式
|
|
@@ -6818,7 +6688,6 @@
|
|
|
6818
6688
|
length: function length(points) {
|
|
6819
6689
|
return lengthOfSegment(points);
|
|
6820
6690
|
},
|
|
6821
|
-
|
|
6822
6691
|
/**
|
|
6823
6692
|
* 根据比例获取多折线的点
|
|
6824
6693
|
* @param {array} points 点的集合 [x,y] 的形式
|
|
@@ -6828,7 +6697,6 @@
|
|
|
6828
6697
|
pointAt: function pointAt(points, t) {
|
|
6829
6698
|
return pointAtSegments(points, t);
|
|
6830
6699
|
},
|
|
6831
|
-
|
|
6832
6700
|
/**
|
|
6833
6701
|
* 指定点到多折线的距离
|
|
6834
6702
|
* @param {array} points 点的集合 [x,y] 的形式
|
|
@@ -6839,7 +6707,6 @@
|
|
|
6839
6707
|
pointDistance: function pointDistance(points, x, y) {
|
|
6840
6708
|
return distanceAtSegment(points, x, y);
|
|
6841
6709
|
},
|
|
6842
|
-
|
|
6843
6710
|
/**
|
|
6844
6711
|
* 根据比例获取多折线的切线角度
|
|
6845
6712
|
* @param {array} points 点的集合 [x,y] 的形式
|
|
@@ -7258,7 +7125,7 @@
|
|
|
7258
7125
|
* destroy existed canvas with the same id
|
|
7259
7126
|
*/function cleanExistedCanvas(container,canvas){if(container){var id=typeof container==='string'?container:container.id||defaultCanvasIdCounter++;if(canvasMap[id]){canvasMap[id].destroy();}canvasMap[id]=canvas;}}var isBrowser=typeof window!=='undefined'&&typeof window.document!=='undefined';function sortByZIndex(o1,o2){var zIndex1=Number(o1.style.zIndex);var zIndex2=Number(o2.style.zIndex);if(zIndex1===zIndex2){// return o1.entity.getComponent(Sortable).lastSortedIndex - o2.entity.getComponent(Sortable).lastSortedIndex;
|
|
7260
7127
|
var parent=o1.parentNode;if(parent){var children=parent.childNodes||[];return children.indexOf(o1)-children.indexOf(o2);}}return zIndex1-zIndex2;}function findClosestClipPathTarget(object){var el=object;do{var _el$style;var clipPath=(_el$style=el.style)===null||_el$style===void 0?void 0:_el$style.clipPath;if(clipPath)return el;el=el.parentElement;}while(el!==null);return null;}var PX_SUFFIX='px';function setDOMSize($el,width,height){if(isBrowser&&$el.style){$el.style.width=width+PX_SUFFIX;$el.style.height=height+PX_SUFFIX;}}function getStyle($el,property){if(isBrowser){return document.defaultView.getComputedStyle($el,null).getPropertyValue(property);}}function getWidth($el){var width=getStyle($el,'width');if(width==='auto'){return $el.offsetWidth;}return parseFloat(width);}function getHeight($el){var height=getStyle($el,'height');if(height==='auto'){return $el.offsetHeight;}return parseFloat(height);}var ERROR_MSG_METHOD_NOT_IMPLEMENTED='Method not implemented.';var ERROR_MSG_USE_DOCUMENT_ELEMENT='Use document.documentElement instead.';var ERROR_MSG_APPEND_DESTROYED_ELEMENT='Cannot append a destroyed element.';// borrow from hammer.js
|
|
7261
|
-
var MOUSE_POINTER_ID=1;var TOUCH_TO_POINTER={touchstart:'pointerdown',touchend:'pointerup',touchendoutside:'pointerupoutside',touchmove:'pointermove',touchcancel:'pointercancel'};function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key];}try{define({},"");}catch(err){define=function define(obj,key,value){return obj[key]=value;};}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult();}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg);}else "return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return {value:record.arg,done:context.done};}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg);}};}(innerFn,self,context),generator;}function tryCatch(fn,obj,arg){try{return {type:"normal",arg:fn.call(obj,arg)};}catch(err){return {type:"throw",arg:err};}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this;});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg);});});}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==typeof value&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject);},function(err){invoke("throw",err,resolve,reject);}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result);},function(error){return invoke("throw",error,resolve,reject);});}reject(record.arg);}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();};}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(undefined===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=undefined),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel);}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record;}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0);}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;){if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;}return next.value=undefined,next.done=!0,next;};return next.next=next;}}return {next:doneResult};}function doneResult(){return {value:undefined,done:!0};}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return !!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name));},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun;},exports.awrap=function(arg){return {__await:arg};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this;}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next();});},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this;}),define(Gp,"toString",function(){return "[object Generator]";}),exports.keys=function(object){var keys=[];for(var key in object){keys.push(key);}return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next;}return next.done=!0,next;};},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this){"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=undefined);}},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval;},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=undefined),!!caught;}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);}else {if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break;}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record);},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return "break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel;},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel;}},catch:function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel;}},exports;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _extends(){_extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return {};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _createForOfIteratorHelperLoose(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;return function(){if(i>=o.length)return {done:true};return {done:false,value:o[i++]};};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}// These units are iterated through, so be careful when adding or changing the
|
|
7128
|
+
var MOUSE_POINTER_ID=1;var TOUCH_TO_POINTER={touchstart:'pointerdown',touchend:'pointerup',touchendoutside:'pointerupoutside',touchmove:'pointermove',touchcancel:'pointercancel'};function _regeneratorRuntime(){_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value;},$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key];}try{define({},"");}catch(err){define=function define(obj,key,value){return obj[key]=value;};}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return defineProperty(generator,"_invoke",{value:makeInvokeMethod(innerFn,self,context)}),generator;}function tryCatch(fn,obj,arg){try{return {type:"normal",arg:fn.call(obj,arg)};}catch(err){return {type:"throw",arg:err};}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this;});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg);});});}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==typeof value&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject);},function(err){invoke("throw",err,resolve,reject);}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result);},function(error){return invoke("throw",error,resolve,reject);});}reject(record.arg);}var previousPromise;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult();}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg);}else "return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return {value:record.arg,done:context.done};}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg);}};}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(undefined===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=undefined),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel);}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record;}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0);}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;){if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;}return next.value=undefined,next.done=!0,next;};return next.next=next;}}return {next:doneResult};}function doneResult(){return {value:undefined,done:!0};}return GeneratorFunction.prototype=GeneratorFunctionPrototype,defineProperty(Gp,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),defineProperty(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return !!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name));},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun;},exports.awrap=function(arg){return {__await:arg};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this;}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next();});},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this;}),define(Gp,"toString",function(){return "[object Generator]";}),exports.keys=function(val){var object=Object(val),keys=[];for(var key in object){keys.push(key);}return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next;}return next.done=!0,next;};},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this){"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=undefined);}},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval;},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=undefined),!!caught;}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);}else {if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break;}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record);},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return "break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel;},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel;}},catch:function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel;}},exports;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _extends(){_extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return {};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _createForOfIteratorHelperLoose(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;return function(){if(i>=o.length)return {done:true};return {done:false,value:o[i++]};};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}// These units are iterated through, so be careful when adding or changing the
|
|
7262
7129
|
// order.
|
|
7263
7130
|
(function(UnitType){UnitType[UnitType["kUnknown"]=0]="kUnknown";UnitType[UnitType["kNumber"]=1]="kNumber";UnitType[UnitType["kPercentage"]=2]="kPercentage";// Length units
|
|
7264
7131
|
UnitType[UnitType["kEms"]=3]="kEms";// kExs,
|
|
@@ -7325,7 +7192,8 @@
|
|
|
7325
7192
|
// kQuirkyEms,
|
|
7326
7193
|
})(exports.UnitType||(exports.UnitType={}));var UnitCategory;(function(UnitCategory){UnitCategory[UnitCategory["kUNumber"]=0]="kUNumber";UnitCategory[UnitCategory["kUPercent"]=1]="kUPercent";UnitCategory[UnitCategory["kULength"]=2]="kULength";UnitCategory[UnitCategory["kUAngle"]=3]="kUAngle";UnitCategory[UnitCategory["kUTime"]=4]="kUTime";// kUFrequency,
|
|
7327
7194
|
// kUResolution,
|
|
7328
|
-
UnitCategory[UnitCategory["kUOther"]=5]="kUOther";})(UnitCategory||(UnitCategory={}));var ValueRange;(function(ValueRange){ValueRange[ValueRange["kAll"]=0]="kAll";ValueRange[ValueRange["kNonNegative"]=1]="kNonNegative";ValueRange[ValueRange["kInteger"]=2]="kInteger";ValueRange[ValueRange["kNonNegativeInteger"]=3]="kNonNegativeInteger";ValueRange[ValueRange["kPositiveInteger"]=4]="kPositiveInteger";})(ValueRange||(ValueRange={}));var Nested;(function(Nested){Nested[Nested["kYes"]=0]="kYes";Nested[Nested["kNo"]=1]="kNo";})(Nested||(Nested={}));var ParenLess;(function(ParenLess){ParenLess[ParenLess["kYes"]=0]="kYes";ParenLess[ParenLess["kNo"]=1]="kNo";})(ParenLess||(ParenLess={}))
|
|
7195
|
+
UnitCategory[UnitCategory["kUOther"]=5]="kUOther";})(UnitCategory||(UnitCategory={}));var ValueRange;(function(ValueRange){ValueRange[ValueRange["kAll"]=0]="kAll";ValueRange[ValueRange["kNonNegative"]=1]="kNonNegative";ValueRange[ValueRange["kInteger"]=2]="kInteger";ValueRange[ValueRange["kNonNegativeInteger"]=3]="kNonNegativeInteger";ValueRange[ValueRange["kPositiveInteger"]=4]="kPositiveInteger";})(ValueRange||(ValueRange={}));var Nested;(function(Nested){Nested[Nested["kYes"]=0]="kYes";Nested[Nested["kNo"]=1]="kNo";})(Nested||(Nested={}));var ParenLess;(function(ParenLess){ParenLess[ParenLess["kYes"]=0]="kYes";ParenLess[ParenLess["kNo"]=1]="kNo";})(ParenLess||(ParenLess={}));// This file specifies the unit strings used in CSSPrimitiveValues.
|
|
7196
|
+
var data=[{name:'em',unit_type:exports.UnitType.kEms},// {
|
|
7329
7197
|
// name: 'ex',
|
|
7330
7198
|
// unit_type: UnitType.kExs,
|
|
7331
7199
|
// },
|
|
@@ -7642,7 +7510,7 @@
|
|
|
7642
7510
|
* eg. 'initial'
|
|
7643
7511
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSKeywordValue
|
|
7644
7512
|
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_keyword_value.idl
|
|
7645
|
-
*/var CSSKeywordValue=/*#__PURE__*/function(_CSSStyleValue){_inheritsLoose(CSSKeywordValue,_CSSStyleValue);function CSSKeywordValue(value){var _this;_this=_CSSStyleValue.call(this)||this;_this.value=void 0;_this.value=value;return _this;}var _proto=CSSKeywordValue.prototype;_proto.clone=function clone(){return new CSSKeywordValue(this.value);};_proto.getType=function getType(){return CSSStyleValueType.kKeywordType;};_proto.buildCSSText=function buildCSSText(n,p,result){return result+this.value;};return CSSKeywordValue;}(CSSStyleValue);var CSSMathOperator;(function(CSSMathOperator){CSSMathOperator["kAdd"]="+";CSSMathOperator["kSubtract"]="-";CSSMathOperator["kMultiply"]="*";CSSMathOperator["kDivide"]="/";CSSMathOperator["kMin"]="min";CSSMathOperator["kMax"]="max";CSSMathOperator["kClamp"]="clamp";CSSMathOperator["kInvalid"]="";})(CSSMathOperator||(CSSMathOperator={}));//
|
|
7513
|
+
*/var CSSKeywordValue=/*#__PURE__*/function(_CSSStyleValue){_inheritsLoose(CSSKeywordValue,_CSSStyleValue);function CSSKeywordValue(value){var _this;_this=_CSSStyleValue.call(this)||this;_this.value=void 0;_this.value=value;return _this;}var _proto=CSSKeywordValue.prototype;_proto.clone=function clone(){return new CSSKeywordValue(this.value);};_proto.getType=function getType(){return CSSStyleValueType.kKeywordType;};_proto.buildCSSText=function buildCSSText(n,p,result){return result+this.value;};return CSSKeywordValue;}(CSSStyleValue);var CSSMathOperator;(function(CSSMathOperator){CSSMathOperator["kAdd"]="+";CSSMathOperator["kSubtract"]="-";CSSMathOperator["kMultiply"]="*";CSSMathOperator["kDivide"]="/";CSSMathOperator["kMin"]="min";CSSMathOperator["kMax"]="max";CSSMathOperator["kClamp"]="clamp";CSSMathOperator["kInvalid"]="";})(CSSMathOperator||(CSSMathOperator={}));// https://drafts.css-houdini.org/css-typed-om/#enumdef-cssnumericbasetype
|
|
7646
7514
|
var BaseType;(function(BaseType){BaseType[BaseType["kLength"]=0]="kLength";BaseType[BaseType["kAngle"]=1]="kAngle";BaseType[BaseType["kTime"]=2]="kTime";BaseType[BaseType["kFrequency"]=3]="kFrequency";BaseType[BaseType["kResolution"]=4]="kResolution";BaseType[BaseType["kFlex"]=5]="kFlex";BaseType[BaseType["kPercent"]=6]="kPercent";BaseType[BaseType["kNumBaseTypes"]=7]="kNumBaseTypes";})(BaseType||(BaseType={}));function unitTypeToBaseType(unit){DCHECK_NE(unit,exports.UnitType.kNumber);switch(unit){case exports.UnitType.kEms:// case UnitType.kExs:
|
|
7647
7515
|
case exports.UnitType.kPixels:// case UnitType.kCentimeters:
|
|
7648
7516
|
// case UnitType.kMillimeters:
|
|
@@ -8094,7 +7962,8 @@
|
|
|
8094
7962
|
* update local position
|
|
8095
7963
|
*/_proto.postProcessor=function postProcessor(object){if(object.nodeName===exports.Shape.PATH){var _object$parsedStyle=object.parsedStyle,_object$parsedStyle$d=_object$parsedStyle.defX,defX=_object$parsedStyle$d===void 0?0:_object$parsedStyle$d,_object$parsedStyle$d2=_object$parsedStyle.defY,defY=_object$parsedStyle$d2===void 0?0:_object$parsedStyle$d2;object.setLocalPosition(defX,defY);}};return CSSPropertyPath;}();var CSSPropertyPoints=/*#__PURE__*/function(){function CSSPropertyPoints(){this.parser=parsePoints;}var _proto=CSSPropertyPoints.prototype;/**
|
|
8096
7964
|
* update local position
|
|
8097
|
-
*/_proto.postProcessor=function postProcessor(object){if(object.nodeName===exports.Shape.POLYGON||object.nodeName===exports.Shape.POLYLINE){var _object$parsedStyle=object.parsedStyle,defX=_object$parsedStyle.defX,defY=_object$parsedStyle.defY;object.setLocalPosition(defX,defY);}};return CSSPropertyPoints;}();var CSSPropertyShadowBlur=/*#__PURE__*/function(_CSSPropertyLengthOrP){_inheritsLoose(CSSPropertyShadowBlur,_CSSPropertyLengthOrP);function CSSPropertyShadowBlur(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_CSSPropertyLengthOrP.call.apply(_CSSPropertyLengthOrP,[this].concat(args))||this;_this.mixer=clampedMergeNumbers(0,Infinity);return _this;}return CSSPropertyShadowBlur;}(CSSPropertyLengthOrPercentage);var CSSPropertyText=/*#__PURE__*/function(){function CSSPropertyText(){}var _proto=CSSPropertyText.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){if(parsed instanceof CSSKeywordValue){if(parsed.value==='unset'){return '';}else {return parsed.value;}}
|
|
7965
|
+
*/_proto.postProcessor=function postProcessor(object){if(object.nodeName===exports.Shape.POLYGON||object.nodeName===exports.Shape.POLYLINE){var _object$parsedStyle=object.parsedStyle,defX=_object$parsedStyle.defX,defY=_object$parsedStyle.defY;object.setLocalPosition(defX,defY);}};return CSSPropertyPoints;}();var CSSPropertyShadowBlur=/*#__PURE__*/function(_CSSPropertyLengthOrP){_inheritsLoose(CSSPropertyShadowBlur,_CSSPropertyLengthOrP);function CSSPropertyShadowBlur(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_CSSPropertyLengthOrP.call.apply(_CSSPropertyLengthOrP,[this].concat(args))||this;_this.mixer=clampedMergeNumbers(0,Infinity);return _this;}return CSSPropertyShadowBlur;}(CSSPropertyLengthOrPercentage);var CSSPropertyText=/*#__PURE__*/function(){function CSSPropertyText(){}var _proto=CSSPropertyText.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){if(parsed instanceof CSSKeywordValue){if(parsed.value==='unset'){return '';}else {return parsed.value;}}// allow number as valid text content
|
|
7966
|
+
return ""+parsed;};_proto.postProcessor=function postProcessor(object){object.nodeValue=""+object.parsedStyle.text||'';};return CSSPropertyText;}();/**
|
|
8098
7967
|
* it must transform after text get parsed
|
|
8099
7968
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-transform
|
|
8100
7969
|
*/var CSSPropertyTextTransform=/*#__PURE__*/function(){function CSSPropertyTextTransform(){}var _proto=CSSPropertyTextTransform.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){var rawText=object.getAttribute('text');if(rawText){var transformedText=rawText;if(parsed.value==='capitalize'){transformedText=rawText.charAt(0).toUpperCase()+rawText.slice(1);}else if(parsed.value==='lowercase'){transformedText=rawText.toLowerCase();}else if(parsed.value==='uppercase'){transformedText=rawText.toUpperCase();}object.parsedStyle.text=transformedText;}return parsed.value;};return CSSPropertyTextTransform;}();/**
|
|
@@ -8252,7 +8121,7 @@
|
|
|
8252
8121
|
var startMovePoint=null;// 开始 M 的点,可能会有多个
|
|
8253
8122
|
var lastStartMovePointIndex=0;// 最近一个开始点 M 的索引
|
|
8254
8123
|
var count=path.length;for(var i=0;i<count;i++){var params=path[i];nextParams=path[i+1];var command=params[0];// 数学定义上的参数,便于后面的计算
|
|
8255
|
-
var segment={command:command,prePoint:currentPoint,params:params,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null};switch(command){case'M':startMovePoint=[params[1],params[2]];lastStartMovePointIndex=i;break;case'A':var arcParams=getArcParams(currentPoint,params);segment.arcParams=arcParams;break;}if(command==='Z'){// 有了 Z 后,当前节点从开始 M 的点开始
|
|
8124
|
+
var segment={command:command,prePoint:currentPoint,params:params,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(command){case'M':startMovePoint=[params[1],params[2]];lastStartMovePointIndex=i;break;case'A':var arcParams=getArcParams(currentPoint,params);segment.arcParams=arcParams;break;}if(command==='Z'){// 有了 Z 后,当前节点从开始 M 的点开始
|
|
8256
8125
|
currentPoint=startMovePoint;// 如果当前点的命令为 Z,相当于当前点为最近一个 M 点,则下一个点直接指向最近一个 M 点的下一个点
|
|
8257
8126
|
nextParams=path[lastStartMovePointIndex+1];}else {var len=params.length;currentPoint=[params[len-2],params[len-1]];}if(nextParams&&nextParams[0]==='Z'){// 如果下一个点的命令为 Z,则下一个点直接指向最近一个 M 点
|
|
8258
8127
|
nextParams=path[lastStartMovePointIndex];if(segments[lastStartMovePointIndex]){// 如果下一个点的命令为 Z,则最近一个 M 点的前一个点为当前点
|
|
@@ -8288,7 +8157,7 @@
|
|
|
8288
8157
|
* * transform & origin
|
|
8289
8158
|
* * anchor
|
|
8290
8159
|
* * lineWidth
|
|
8291
|
-
*/function convertToPath(object,transform){if(transform===void 0){transform=object.getLocalTransform();}var commands=[];switch(object.nodeName){case exports.Shape.LINE:var _object$parsedStyle2=object.parsedStyle,x1=_object$parsedStyle2.x1,y1=_object$parsedStyle2.y1,x2=_object$parsedStyle2.x2,y2=_object$parsedStyle2.y2;commands=lineToCommands(x1,y1,x2,y2);break;case exports.Shape.CIRCLE:{var _object$parsedStyle3=object.parsedStyle,r=_object$parsedStyle3.r,cx=_object$parsedStyle3.cx,cy=_object$parsedStyle3.cy;commands=ellipseToCommands(r,r,cx,cy);break;}case exports.Shape.ELLIPSE:{var _object$parsedStyle4=object.parsedStyle,rx=_object$parsedStyle4.rx,ry=_object$parsedStyle4.ry,_cx=_object$parsedStyle4.cx,_cy=_object$parsedStyle4.cy;commands=ellipseToCommands(rx,ry,_cx,_cy);break;}case exports.Shape.POLYLINE:case exports.Shape.POLYGON:var points=object.parsedStyle.points;commands=polygonToCommands(points.points,object.nodeName===exports.Shape.POLYGON);break;case exports.Shape.RECT:var _object$parsedStyle5=object.parsedStyle,width=_object$parsedStyle5.width,height=_object$parsedStyle5.height,x=_object$parsedStyle5.x,y=_object$parsedStyle5.y,radius=_object$parsedStyle5.radius;var hasRadius=radius&&radius.some(function(r){return r!==0;});commands=rectToCommands(width,height,x,y,hasRadius&&radius.map(function(r){return clamp(r,0,Math.min(Math.abs(width)/2,Math.abs(height)/2));}));break;case exports.Shape.PATH:var absolutePath=object.parsedStyle.path.absolutePath;commands=[].concat(absolutePath);break;}if(commands.length){return commandsToPathString(commands,object,transform);}}function translatePathToString(absolutePath,defX,defY,startOffsetX,startOffsetY,endOffsetX,endOffsetY){if(startOffsetX===void 0){startOffsetX=0;}if(startOffsetY===void 0){startOffsetY=0;}if(endOffsetX===void 0){endOffsetX=0;}if(endOffsetY===void 0){endOffsetY=0;}var newValue=absolutePath.map(function(params,i){var command=params[0];var nextSegment=absolutePath[i+1];var useStartOffset=i===0&&startOffsetX!==0
|
|
8160
|
+
*/function convertToPath(object,transform){if(transform===void 0){transform=object.getLocalTransform();}var commands=[];switch(object.nodeName){case exports.Shape.LINE:var _object$parsedStyle2=object.parsedStyle,x1=_object$parsedStyle2.x1,y1=_object$parsedStyle2.y1,x2=_object$parsedStyle2.x2,y2=_object$parsedStyle2.y2;commands=lineToCommands(x1,y1,x2,y2);break;case exports.Shape.CIRCLE:{var _object$parsedStyle3=object.parsedStyle,r=_object$parsedStyle3.r,cx=_object$parsedStyle3.cx,cy=_object$parsedStyle3.cy;commands=ellipseToCommands(r,r,cx,cy);break;}case exports.Shape.ELLIPSE:{var _object$parsedStyle4=object.parsedStyle,rx=_object$parsedStyle4.rx,ry=_object$parsedStyle4.ry,_cx=_object$parsedStyle4.cx,_cy=_object$parsedStyle4.cy;commands=ellipseToCommands(rx,ry,_cx,_cy);break;}case exports.Shape.POLYLINE:case exports.Shape.POLYGON:var points=object.parsedStyle.points;commands=polygonToCommands(points.points,object.nodeName===exports.Shape.POLYGON);break;case exports.Shape.RECT:var _object$parsedStyle5=object.parsedStyle,width=_object$parsedStyle5.width,height=_object$parsedStyle5.height,x=_object$parsedStyle5.x,y=_object$parsedStyle5.y,radius=_object$parsedStyle5.radius;var hasRadius=radius&&radius.some(function(r){return r!==0;});commands=rectToCommands(width,height,x,y,hasRadius&&radius.map(function(r){return clamp(r,0,Math.min(Math.abs(width)/2,Math.abs(height)/2));}));break;case exports.Shape.PATH:var absolutePath=object.parsedStyle.path.absolutePath;commands=[].concat(absolutePath);break;}if(commands.length){return commandsToPathString(commands,object,transform);}}function translatePathToString(absolutePath,defX,defY,startOffsetX,startOffsetY,endOffsetX,endOffsetY){if(startOffsetX===void 0){startOffsetX=0;}if(startOffsetY===void 0){startOffsetY=0;}if(endOffsetX===void 0){endOffsetX=0;}if(endOffsetY===void 0){endOffsetY=0;}var newValue=absolutePath.map(function(params,i){var command=params[0];var nextSegment=absolutePath[i+1];var useStartOffset=i===0&&(startOffsetX!==0||startOffsetY!==0);var useEndOffset=(i===absolutePath.length-1||nextSegment&&(nextSegment[0]==='M'||nextSegment[0]==='Z'))&&endOffsetX!==0&&endOffsetY!==0;switch(command){case'M':// Use start marker offset
|
|
8292
8161
|
if(useStartOffset){return "M "+(params[1]-defX+startOffsetX)+","+(params[2]-defY+startOffsetY)+" L "+(params[1]-defX)+","+(params[2]-defY);}else {return "M "+(params[1]-defX)+","+(params[2]-defY);}case'L':return "L "+(params[1]-defX+(useEndOffset?endOffsetX:0))+","+(params[2]-defY+(useEndOffset?endOffsetY:0));case'Q':return "Q "+(params[1]-defX)+" "+(params[2]-defY)+","+(params[3]-defX)+" "+(params[4]-defY)+(useEndOffset?" L "+(params[3]-defX+endOffsetX)+","+(params[4]-defY+endOffsetY):'');case'C':return "C "+(params[1]-defX)+" "+(params[2]-defY)+","+(params[3]-defX)+" "+(params[4]-defY)+","+(params[5]-defX)+" "+(params[6]-defY)+(useEndOffset?" L "+(params[5]-defX+endOffsetX)+","+(params[6]-defY+endOffsetY):'');case'A':return "A "+params[1]+" "+params[2]+" "+params[3]+" "+params[4]+" "+params[5]+" "+(params[6]-defX)+" "+(params[7]-defY)+(useEndOffset?" L "+(params[6]-defX+endOffsetX)+","+(params[7]-defY+endOffsetY):'');case'Z':return 'Z';}}).join(' ');if(~newValue.indexOf('NaN')){return '';}return newValue;}function isFillOrStrokeAffected(pointerEvents,fill,stroke){// account for pointerEvents
|
|
8293
8162
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
8294
8163
|
var hasFill=false;var hasStroke=false;var isFillOtherThanNone=!!fill&&!fill.isNone;var isStrokeOtherThanNone=!!stroke&&!stroke.isNone;if(pointerEvents==='visiblepainted'||pointerEvents==='painted'||pointerEvents==='auto'){hasFill=isFillOtherThanNone;hasStroke=isStrokeOtherThanNone;}else if(pointerEvents==='visiblefill'||pointerEvents==='fill'){hasFill=true;}else if(pointerEvents==='visiblestroke'||pointerEvents==='stroke'){hasStroke=true;}else if(pointerEvents==='visible'||pointerEvents==='all'){// The values of the fill and stroke do not affect event processing.
|
|
@@ -8575,7 +8444,7 @@
|
|
|
8575
8444
|
* Objects that can receive events and may have listeners for them.
|
|
8576
8445
|
* eg. Element, Canvas, DisplayObject
|
|
8577
8446
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
|
|
8578
|
-
*/var EventTarget=/*#__PURE__*/function(){function EventTarget(){this.emitter=new eventemitter3
|
|
8447
|
+
*/var EventTarget=/*#__PURE__*/function(){function EventTarget(){this.emitter=new eventemitter3();}var _proto=EventTarget.prototype;/**
|
|
8579
8448
|
* @deprecated
|
|
8580
8449
|
* @alias addEventListener
|
|
8581
8450
|
*/_proto.on=function on(type,listener,options){this.addEventListener(type,listener,options);return this;}/**
|
|
@@ -9139,7 +9008,7 @@
|
|
|
9139
9008
|
* 2. pan 沿 u v 轴移动
|
|
9140
9009
|
* 3. rotate 以方位角旋转
|
|
9141
9010
|
* 4. 移动到 Landmark,具有平滑的动画效果,其间禁止其他用户交互
|
|
9142
|
-
*/var Camera=/*#__PURE__*/function(){function Camera(){this.canvas=void 0;this.eventEmitter=new eventemitter3
|
|
9011
|
+
*/var Camera=/*#__PURE__*/function(){function Camera(){this.canvas=void 0;this.eventEmitter=new eventemitter3();this.matrix=create$1();this.right=fromValues$2(1,0,0);this.up=fromValues$2(0,1,0);this.forward=fromValues$2(0,0,1);this.position=fromValues$2(0,0,1);this.focalPoint=fromValues$2(0,0,0);this.distanceVector=fromValues$2(0,0,-1);this.distance=1;this.azimuth=0;this.elevation=0;this.roll=0;this.relAzimuth=0;this.relElevation=0;this.relRoll=0;this.dollyingStep=0;this.maxDistance=Infinity;this.minDistance=-Infinity;this.zoom=1;this.rotateWorld=false;this.fov=30;this.near=0.1;this.far=1000;this.aspect=1;this.left=void 0;this.rright=void 0;this.top=void 0;this.bottom=void 0;this.projectionMatrix=create$1();this.projectionMatrixInverse=create$1();this.jitteredProjectionMatrix=undefined;this.view=void 0;this.enableUpdate=true;this.type=exports.CameraType.EXPLORING;this.trackingMode=exports.CameraTrackingMode.DEFAULT;this.projectionMode=exports.CameraProjectionMode.PERSPECTIVE;this.frustum=new Frustum();this.orthoMatrix=create$1();}var _proto=Camera.prototype;// constructor(type = CameraType.EXPLORING, trackingMode = CameraTrackingMode.DEFAULT) {
|
|
9143
9012
|
// this.setType(type, trackingMode);
|
|
9144
9013
|
// }
|
|
9145
9014
|
_proto.isOrtho=function isOrtho(){return this.projectionMode===exports.CameraProjectionMode.ORTHOGRAPHIC;};_proto.getProjectionMode=function getProjectionMode(){return this.projectionMode;};_proto.getPerspective=function getPerspective(){// account for TAA
|
|
@@ -9220,7 +9089,7 @@
|
|
|
9220
9089
|
var anchor=[0,1];var lineXOffset=0;if(textAlign==='center'||textAlign==='middle'){lineXOffset=lineWidth/2;anchor=[0.5,1];}else if(textAlign==='right'||textAlign==='end'){lineXOffset=lineWidth;anchor=[1,1];}var lineYOffset=0;if(textBaseline==='middle'){// eslint-disable-next-line prefer-destructuring
|
|
9221
9090
|
lineYOffset=halfExtents[1];}else if(textBaseline==='top'||textBaseline==='hanging'){lineYOffset=halfExtents[1]*2;}else if(textBaseline==='alphabetic'){lineYOffset=lineHeight-fontProperties.ascent;}else if(textBaseline==='bottom'||textBaseline==='ideographic'){lineYOffset=0;}// TODO: ideographic & bottom
|
|
9222
9091
|
if(dx){lineXOffset+=dx;}if(dy){lineYOffset+=dy;}// update anchor
|
|
9223
|
-
parsedStyle.anchor=[anchor[0],anchor[1],0];return {width:halfExtents[0]*2,height:halfExtents[1]*2,offsetX:lineXOffset,offsetY:lineYOffset};};return TextUpdater;}();var PROPAGATION_LIMIT=2048;var EventService=/*#__PURE__*/function(){function EventService(globalRuntime,context){var _this=this;this.globalRuntime=void 0;this.context=void 0;this.rootTarget=void 0;this.emitter=new eventemitter3
|
|
9092
|
+
parsedStyle.anchor=[anchor[0],anchor[1],0];return {width:halfExtents[0]*2,height:halfExtents[1]*2,offsetX:lineXOffset,offsetY:lineYOffset};};return TextUpdater;}();var PROPAGATION_LIMIT=2048;var EventService=/*#__PURE__*/function(){function EventService(globalRuntime,context){var _this=this;this.globalRuntime=void 0;this.context=void 0;this.rootTarget=void 0;this.emitter=new eventemitter3();this.cursor='default';this.mappingTable={};this.mappingState={trackingData:{}};this.eventPool=new Map();this.pickHandler=void 0;this.tmpMatrix=create$1();this.tmpVec3=create$2();this.onPointerDown=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(from){var e,isRightButton,trackingData;return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(from instanceof FederatedPointerEvent){_context.next=2;break;}return _context.abrupt("return");case 2:_context.next=4;return _this.createPointerEvent(from);case 4:e=_context.sent;_this.dispatchEvent(e,'pointerdown');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchstart');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightdown':'mousedown');}trackingData=_this.trackingData(from.pointerId);trackingData.pressTargetsByButton[from.button]=e.composedPath();_this.freeEvent(e);case 10:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}();this.onPointerUp=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(from){var now,e,isRightButton,trackingData,pressTarget,clickTarget,currentTarget,_isRightButton,_e$detail,clickEvent,clickHistory;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(from instanceof FederatedPointerEvent){_context2.next=2;break;}return _context2.abrupt("return");case 2:now=performance.now();_context2.next=5;return _this.createPointerEvent(from);case 5:e=_context2.sent;_this.dispatchEvent(e,'pointerup');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchend');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightup':'mouseup');}trackingData=_this.trackingData(from.pointerId);pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);clickTarget=pressTarget;// pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
9224
9093
|
// the pointerup location.
|
|
9225
9094
|
if(pressTarget&&!e.composedPath().includes(pressTarget)){currentTarget=pressTarget;while(currentTarget&&!e.composedPath().includes(currentTarget)){e.currentTarget=currentTarget;_this.notifyTarget(e,'pointerupoutside');if(e.pointerType==='touch'){_this.notifyTarget(e,'touchendoutside');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){_isRightButton=e.button===2;_this.notifyTarget(e,_isRightButton?'rightupoutside':'mouseupoutside');}if(Node.isNode(currentTarget)){currentTarget=currentTarget.parentNode;}}delete trackingData.pressTargetsByButton[from.button];// currentTarget is the most specific ancestor holding both the pointerdown and pointerup
|
|
9226
9095
|
// targets. That is - it's our click target!
|
|
@@ -9442,7 +9311,8 @@
|
|
|
9442
9311
|
if(fontProperties.fontSize===0){fontProperties.fontSize=fontSize;fontProperties.ascent=fontSize;}var context=this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);context.font=font;// no overflowing by default
|
|
9443
9312
|
parsedStyle.isOverflowing=false;var outputText=wordWrap?this.wordWrap(text,parsedStyle,offscreenCanvas):text;var lines=outputText.split(/(?:\r\n|\r|\n)/);var lineWidths=new Array(lines.length);var maxLineWidth=0;// account for textPath
|
|
9444
9313
|
if(textPath){var totalPathLength=textPath.getTotalLength();// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9445
|
-
var startingPoint=textPath.getPoint(0);for(var i=0;i<lines.length;i++){var width=context.measureText(lines[i]).width+(lines[i].length-1)*letterSpacing;//
|
|
9314
|
+
var startingPoint=textPath.getPoint(0);for(var i=0;i<lines.length;i++){var width=context.measureText(lines[i]).width+(lines[i].length-1)*letterSpacing;// for (
|
|
9315
|
+
// let i = reverse ? lines[0].length - 1 : 0;
|
|
9446
9316
|
// reverse ? i >= 0 : i < lines[0].length;
|
|
9447
9317
|
// reverse ? i-- : i++
|
|
9448
9318
|
// ) {
|
|
@@ -9523,7 +9393,8 @@
|
|
|
9523
9393
|
*/;_proto.transferMouseData=function transferMouseData(event,nativeEvent){event.isTrusted=nativeEvent.isTrusted;event.srcElement=nativeEvent.srcElement;event.timeStamp=performance.now();event.type=nativeEvent.type;event.altKey=nativeEvent.altKey;event.metaKey=nativeEvent.metaKey;event.shiftKey=nativeEvent.shiftKey;event.ctrlKey=nativeEvent.ctrlKey;event.button=nativeEvent.button;event.buttons=nativeEvent.buttons;event.client.x=nativeEvent.clientX;event.client.y=nativeEvent.clientY;event.movement.x=nativeEvent.movementX;event.movement.y=nativeEvent.movementY;event.page.x=nativeEvent.pageX;event.page.y=nativeEvent.pageY;event.screen.x=nativeEvent.screenX;event.screen.y=nativeEvent.screenY;event.relatedTarget=null;};_proto.setCursor=function setCursor(cursor){this.context.contextService.applyCursorStyle(cursor||this.context.config.cursor||'default');};_proto.normalizeToPointerEvent=function normalizeToPointerEvent(event,canvas){var normalizedEvents=[];if(canvas.isTouchEvent(event)){for(var i=0;i<event.changedTouches.length;i++){var touch=event.changedTouches[i];// use changedTouches instead of touches since touchend has no touches
|
|
9524
9394
|
// @see https://stackoverflow.com/a/10079076
|
|
9525
9395
|
if(isUndefined(touch.button))touch.button=0;if(isUndefined(touch.buttons))touch.buttons=1;if(isUndefined(touch.isPrimary)){touch.isPrimary=event.touches.length===1&&event.type==='touchstart';}if(isUndefined(touch.width))touch.width=touch.radiusX||1;if(isUndefined(touch.height))touch.height=touch.radiusY||1;if(isUndefined(touch.tiltX))touch.tiltX=0;if(isUndefined(touch.tiltY))touch.tiltY=0;if(isUndefined(touch.pointerType))touch.pointerType='touch';// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Touch/identifier
|
|
9526
|
-
if(isUndefined(touch.pointerId))touch.pointerId=touch.identifier||0;if(isUndefined(touch.pressure))touch.pressure=touch.force||0.5;if(isUndefined(touch.twist))touch.twist=0;if(isUndefined(touch.tangentialPressure))touch.tangentialPressure=0;touch.isNormalized=true;touch.type=event.type;normalizedEvents.push(touch);}}else if(canvas.isMouseEvent(event)){var tempEvent=event;if(isUndefined(tempEvent.isPrimary))tempEvent.isPrimary=true;if(isUndefined(tempEvent.width))tempEvent.width=1;if(isUndefined(tempEvent.height))tempEvent.height=1;if(isUndefined(tempEvent.tiltX))tempEvent.tiltX=0;if(isUndefined(tempEvent.tiltY))tempEvent.tiltY=0;if(isUndefined(tempEvent.pointerType))tempEvent.pointerType='mouse';if(isUndefined(tempEvent.pointerId))tempEvent.pointerId=MOUSE_POINTER_ID;if(isUndefined(tempEvent.pressure))tempEvent.pressure=0.5;if(isUndefined(tempEvent.twist))tempEvent.twist=0;if(isUndefined(tempEvent.tangentialPressure))tempEvent.tangentialPressure=0;tempEvent.isNormalized=true;normalizedEvents.push(tempEvent);}else {normalizedEvents.push(event);}return normalizedEvents;};return EventPlugin;}();EventPlugin.tag='Event'
|
|
9396
|
+
if(isUndefined(touch.pointerId))touch.pointerId=touch.identifier||0;if(isUndefined(touch.pressure))touch.pressure=touch.force||0.5;if(isUndefined(touch.twist))touch.twist=0;if(isUndefined(touch.tangentialPressure))touch.tangentialPressure=0;touch.isNormalized=true;touch.type=event.type;normalizedEvents.push(touch);}}else if(canvas.isMouseEvent(event)){var tempEvent=event;if(isUndefined(tempEvent.isPrimary))tempEvent.isPrimary=true;if(isUndefined(tempEvent.width))tempEvent.width=1;if(isUndefined(tempEvent.height))tempEvent.height=1;if(isUndefined(tempEvent.tiltX))tempEvent.tiltX=0;if(isUndefined(tempEvent.tiltY))tempEvent.tiltY=0;if(isUndefined(tempEvent.pointerType))tempEvent.pointerType='mouse';if(isUndefined(tempEvent.pointerId))tempEvent.pointerId=MOUSE_POINTER_ID;if(isUndefined(tempEvent.pressure))tempEvent.pressure=0.5;if(isUndefined(tempEvent.twist))tempEvent.twist=0;if(isUndefined(tempEvent.tangentialPressure))tempEvent.tangentialPressure=0;tempEvent.isNormalized=true;normalizedEvents.push(tempEvent);}else {normalizedEvents.push(event);}return normalizedEvents;};return EventPlugin;}();EventPlugin.tag='Event';// group is not a 2d shape
|
|
9397
|
+
var shape2D=[exports.Shape.CIRCLE,exports.Shape.ELLIPSE,exports.Shape.IMAGE,exports.Shape.RECT,exports.Shape.LINE,exports.Shape.POLYLINE,exports.Shape.POLYGON,exports.Shape.TEXT,exports.Shape.PATH,exports.Shape.HTML];var FrustumCullingStrategy=/*#__PURE__*/function(){function FrustumCullingStrategy(){}var _proto=FrustumCullingStrategy.prototype;_proto.isVisible=function isVisible(camera,object){var _object$parentNode,_object$parentNode$cu;// return true;
|
|
9527
9398
|
var cullable=object.cullable;if(!cullable.enable){return true;}var renderBounds=object.getRenderBounds();if(AABB.isEmpty(renderBounds)){return false;}// get VP matrix from camera
|
|
9528
9399
|
var frustum=camera.getFrustum();var parentVisibilityPlaneMask=(_object$parentNode=object.parentNode)===null||_object$parentNode===void 0?void 0:(_object$parentNode$cu=_object$parentNode.cullable)===null||_object$parentNode$cu===void 0?void 0:_object$parentNode$cu.visibilityPlaneMask;cullable.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(object,renderBounds,parentVisibilityPlaneMask||exports.Mask.INDETERMINATE,frustum.planes);cullable.visible=cullable.visibilityPlaneMask!==exports.Mask.OUTSIDE;return cullable.visible;}/**
|
|
9529
9400
|
*
|
|
@@ -9633,7 +9504,7 @@
|
|
|
9633
9504
|
// });
|
|
9634
9505
|
if(destroyScenegraph){// destroy Document
|
|
9635
9506
|
this.document.destroy();}// destroy services
|
|
9636
|
-
this.
|
|
9507
|
+
this.getRenderingService().destroy();this.getContextService().destroy();if(!skipTriggerEvent){this.dispatchEvent(new CustomEvent(exports.CanvasEvent.AFTER_DESTROY));}}/**
|
|
9637
9508
|
* compatible with G 3.0
|
|
9638
9509
|
* @deprecated
|
|
9639
9510
|
* @alias resize
|
|
@@ -9673,10 +9544,8 @@
|
|
|
9673
9544
|
function _inheritsLoose$1(subClass, superClass) {
|
|
9674
9545
|
subClass.prototype = Object.create(superClass.prototype);
|
|
9675
9546
|
subClass.prototype.constructor = subClass;
|
|
9676
|
-
|
|
9677
9547
|
_setPrototypeOf$1(subClass, superClass);
|
|
9678
9548
|
}
|
|
9679
|
-
|
|
9680
9549
|
function _setPrototypeOf$1(o, p) {
|
|
9681
9550
|
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
9682
9551
|
o.__proto__ = p;
|
|
@@ -9684,27 +9553,22 @@
|
|
|
9684
9553
|
};
|
|
9685
9554
|
return _setPrototypeOf$1(o, p);
|
|
9686
9555
|
}
|
|
9556
|
+
|
|
9687
9557
|
/**
|
|
9688
9558
|
* Provides camera action & animation.
|
|
9689
9559
|
*/
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
9560
|
var AdvancedCamera = /*#__PURE__*/function (_Camera) {
|
|
9693
9561
|
_inheritsLoose$1(AdvancedCamera, _Camera);
|
|
9694
|
-
|
|
9695
9562
|
function AdvancedCamera() {
|
|
9696
9563
|
var _this;
|
|
9697
|
-
|
|
9698
9564
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9699
9565
|
args[_key] = arguments[_key];
|
|
9700
9566
|
}
|
|
9701
|
-
|
|
9702
9567
|
_this = _Camera.call.apply(_Camera, [this].concat(args)) || this;
|
|
9703
9568
|
_this.landmarks = [];
|
|
9704
9569
|
_this.landmarkAnimationID = void 0;
|
|
9705
9570
|
return _this;
|
|
9706
9571
|
}
|
|
9707
|
-
|
|
9708
9572
|
var _proto = AdvancedCamera.prototype;
|
|
9709
9573
|
/**
|
|
9710
9574
|
* Changes the azimuth and elevation with respect to the current camera axes
|
|
@@ -9712,7 +9576,6 @@
|
|
|
9712
9576
|
* @param {Number} elevation the relative elevation
|
|
9713
9577
|
* @param {Number} roll the relative roll
|
|
9714
9578
|
*/
|
|
9715
|
-
|
|
9716
9579
|
_proto.rotate = function rotate(azimuth, elevation, roll) {
|
|
9717
9580
|
this.relElevation = getAngle$1(elevation);
|
|
9718
9581
|
this.relAzimuth = getAngle$1(azimuth);
|
|
@@ -9720,7 +9583,6 @@
|
|
|
9720
9583
|
this.elevation += this.relElevation;
|
|
9721
9584
|
this.azimuth += this.relAzimuth;
|
|
9722
9585
|
this.roll += this.relRoll;
|
|
9723
|
-
|
|
9724
9586
|
if (this.type === exports.CameraType.EXPLORING) {
|
|
9725
9587
|
var rotX = setAxisAngle(create$4(), [1, 0, 0], deg2rad((this.rotateWorld ? 1 : -1) * this.relElevation));
|
|
9726
9588
|
var rotY = setAxisAngle(create$4(), [0, 1, 0], deg2rad((this.rotateWorld ? 1 : -1) * this.relAzimuth));
|
|
@@ -9735,56 +9597,43 @@
|
|
|
9735
9597
|
if (Math.abs(this.elevation) > 90) {
|
|
9736
9598
|
return this;
|
|
9737
9599
|
}
|
|
9738
|
-
|
|
9739
9600
|
this.computeMatrix();
|
|
9740
9601
|
}
|
|
9741
|
-
|
|
9742
9602
|
this._getAxes();
|
|
9743
|
-
|
|
9744
9603
|
if (this.type === exports.CameraType.ORBITING || this.type === exports.CameraType.EXPLORING) {
|
|
9745
9604
|
this._getPosition();
|
|
9746
9605
|
} else if (this.type === exports.CameraType.TRACKING) {
|
|
9747
9606
|
this._getFocalPoint();
|
|
9748
9607
|
}
|
|
9749
|
-
|
|
9750
9608
|
this._update();
|
|
9751
|
-
|
|
9752
9609
|
return this;
|
|
9753
9610
|
}
|
|
9754
9611
|
/**
|
|
9755
9612
|
* 沿水平(right) & 垂直(up)平移相机
|
|
9756
|
-
|
|
9757
|
-
;
|
|
9758
|
-
|
|
9613
|
+
*/;
|
|
9759
9614
|
_proto.pan = function pan(tx, ty) {
|
|
9760
9615
|
var coords = createVec3(tx, ty, 0);
|
|
9761
9616
|
var pos = clone$1(this.position);
|
|
9762
9617
|
add$1(pos, pos, scale$1(create$2(), this.right, coords[0]));
|
|
9763
9618
|
add$1(pos, pos, scale$1(create$2(), this.up, coords[1]));
|
|
9764
|
-
|
|
9765
9619
|
this._setPosition(pos);
|
|
9766
|
-
|
|
9767
9620
|
this.triggerUpdate();
|
|
9768
9621
|
return this;
|
|
9769
9622
|
}
|
|
9770
9623
|
/**
|
|
9771
9624
|
* 沿 n 轴移动,当距离视点远时移动速度较快,离视点越近速度越慢
|
|
9772
|
-
|
|
9773
|
-
;
|
|
9774
|
-
|
|
9625
|
+
*/;
|
|
9775
9626
|
_proto.dolly = function dolly(value) {
|
|
9776
9627
|
var n = this.forward;
|
|
9777
9628
|
var pos = clone$1(this.position);
|
|
9778
9629
|
var step = value * this.dollyingStep;
|
|
9779
|
-
var updatedDistance = this.distance + value * this.dollyingStep;
|
|
9780
|
-
|
|
9630
|
+
var updatedDistance = this.distance + value * this.dollyingStep;
|
|
9631
|
+
// 限制视点距离范围
|
|
9781
9632
|
step = Math.max(Math.min(updatedDistance, this.maxDistance), this.minDistance) - this.distance;
|
|
9782
9633
|
pos[0] += step * n[0];
|
|
9783
9634
|
pos[1] += step * n[1];
|
|
9784
9635
|
pos[2] += step * n[2];
|
|
9785
|
-
|
|
9786
9636
|
this._setPosition(pos);
|
|
9787
|
-
|
|
9788
9637
|
if (this.type === exports.CameraType.ORBITING || this.type === exports.CameraType.EXPLORING) {
|
|
9789
9638
|
// 重新计算视点距离
|
|
9790
9639
|
this._getDistance();
|
|
@@ -9792,23 +9641,20 @@
|
|
|
9792
9641
|
// 保持视距,移动视点位置
|
|
9793
9642
|
add$1(this.focalPoint, pos, this.distanceVector);
|
|
9794
9643
|
}
|
|
9795
|
-
|
|
9796
9644
|
this.triggerUpdate();
|
|
9797
9645
|
return this;
|
|
9798
9646
|
};
|
|
9799
|
-
|
|
9800
9647
|
_proto.createLandmark = function createLandmark(name, params) {
|
|
9801
9648
|
if (params === void 0) {
|
|
9802
9649
|
params = {};
|
|
9803
9650
|
}
|
|
9804
|
-
|
|
9805
9651
|
var _params = params,
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9652
|
+
_params$position = _params.position,
|
|
9653
|
+
position = _params$position === void 0 ? this.position : _params$position,
|
|
9654
|
+
_params$focalPoint = _params.focalPoint,
|
|
9655
|
+
focalPoint = _params$focalPoint === void 0 ? this.focalPoint : _params$focalPoint,
|
|
9656
|
+
roll = _params.roll,
|
|
9657
|
+
zoom = _params.zoom;
|
|
9812
9658
|
var camera = new runtime.CameraContribution();
|
|
9813
9659
|
camera.setType(this.type, undefined);
|
|
9814
9660
|
camera.setPosition(position[0], position[1] || this.position[1], position[2] || this.position[2]);
|
|
@@ -9837,86 +9683,65 @@
|
|
|
9837
9683
|
this.landmarks.push(landmark);
|
|
9838
9684
|
return landmark;
|
|
9839
9685
|
};
|
|
9840
|
-
|
|
9841
9686
|
_proto.gotoLandmark = function gotoLandmark(name, options) {
|
|
9842
9687
|
var _this2 = this;
|
|
9843
|
-
|
|
9844
9688
|
if (options === void 0) {
|
|
9845
9689
|
options = {};
|
|
9846
9690
|
}
|
|
9847
|
-
|
|
9848
9691
|
var landmark = isString(name) ? this.landmarks.find(function (l) {
|
|
9849
9692
|
return l.name === name;
|
|
9850
9693
|
}) : name;
|
|
9851
|
-
|
|
9852
9694
|
if (landmark) {
|
|
9853
9695
|
var _ref = isNumber(options) ? {
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9696
|
+
duration: options
|
|
9697
|
+
} : options,
|
|
9698
|
+
_ref$easing = _ref.easing,
|
|
9699
|
+
easing = _ref$easing === void 0 ? 'linear' : _ref$easing,
|
|
9700
|
+
_ref$duration = _ref.duration,
|
|
9701
|
+
duration = _ref$duration === void 0 ? 100 : _ref$duration,
|
|
9702
|
+
_ref$easingFunction = _ref.easingFunction,
|
|
9703
|
+
easingFunction = _ref$easingFunction === void 0 ? undefined : _ref$easingFunction,
|
|
9704
|
+
_ref$onfinish = _ref.onfinish,
|
|
9705
|
+
onfinish = _ref$onfinish === void 0 ? undefined : _ref$onfinish;
|
|
9865
9706
|
var epsilon = 0.01;
|
|
9866
|
-
|
|
9867
9707
|
if (duration === 0) {
|
|
9868
9708
|
this.syncFromLandmark(landmark);
|
|
9869
|
-
|
|
9870
9709
|
if (onfinish) {
|
|
9871
9710
|
onfinish();
|
|
9872
9711
|
}
|
|
9873
|
-
|
|
9874
9712
|
return;
|
|
9875
|
-
}
|
|
9876
|
-
|
|
9877
|
-
|
|
9713
|
+
}
|
|
9714
|
+
// cancel ongoing animation
|
|
9878
9715
|
if (this.landmarkAnimationID !== undefined) {
|
|
9879
9716
|
this.canvas.cancelAnimationFrame(this.landmarkAnimationID);
|
|
9880
9717
|
}
|
|
9881
|
-
|
|
9882
9718
|
var destPosition = landmark.position;
|
|
9883
9719
|
var destFocalPoint = landmark.focalPoint;
|
|
9884
9720
|
var destZoom = landmark.zoom;
|
|
9885
9721
|
var destRoll = landmark.roll;
|
|
9886
9722
|
var easingFunc = easingFunction || runtime.EasingFunction(easing);
|
|
9887
9723
|
var timeStart;
|
|
9888
|
-
|
|
9889
9724
|
var endAnimation = function endAnimation() {
|
|
9890
9725
|
_this2.setFocalPoint(destFocalPoint);
|
|
9891
|
-
|
|
9892
9726
|
_this2.setPosition(destPosition);
|
|
9893
|
-
|
|
9894
9727
|
_this2.setRoll(destRoll);
|
|
9895
|
-
|
|
9896
9728
|
_this2.setZoom(destZoom);
|
|
9897
|
-
|
|
9898
9729
|
_this2.computeMatrix();
|
|
9899
|
-
|
|
9900
9730
|
_this2.triggerUpdate();
|
|
9901
|
-
|
|
9902
9731
|
if (onfinish) {
|
|
9903
9732
|
onfinish();
|
|
9904
9733
|
}
|
|
9905
9734
|
};
|
|
9906
|
-
|
|
9907
9735
|
var animate = function animate(timestamp) {
|
|
9908
9736
|
if (timeStart === undefined) {
|
|
9909
9737
|
timeStart = timestamp;
|
|
9910
9738
|
}
|
|
9911
|
-
|
|
9912
9739
|
var elapsed = timestamp - timeStart;
|
|
9913
|
-
|
|
9914
9740
|
if (elapsed > duration) {
|
|
9915
9741
|
endAnimation();
|
|
9916
9742
|
return;
|
|
9917
|
-
}
|
|
9918
|
-
|
|
9919
|
-
|
|
9743
|
+
}
|
|
9744
|
+
// use the same ease function in animation system
|
|
9920
9745
|
var t = easingFunc(elapsed / duration);
|
|
9921
9746
|
var interFocalPoint = create$2();
|
|
9922
9747
|
var interPosition = create$2();
|
|
@@ -9926,35 +9751,24 @@
|
|
|
9926
9751
|
lerp(interPosition, _this2.position, destPosition, t);
|
|
9927
9752
|
interRoll = _this2.roll * (1 - t) + destRoll * t;
|
|
9928
9753
|
interZoom = _this2.zoom * (1 - t) + destZoom * t;
|
|
9929
|
-
|
|
9930
9754
|
_this2.setFocalPoint(interFocalPoint);
|
|
9931
|
-
|
|
9932
9755
|
_this2.setPosition(interPosition);
|
|
9933
|
-
|
|
9934
9756
|
_this2.setRoll(interRoll);
|
|
9935
|
-
|
|
9936
9757
|
_this2.setZoom(interZoom);
|
|
9937
|
-
|
|
9938
9758
|
var dist$1 = dist(interFocalPoint, destFocalPoint) + dist(interPosition, destPosition);
|
|
9939
|
-
|
|
9940
9759
|
if (dist$1 <= epsilon) {
|
|
9941
9760
|
endAnimation();
|
|
9942
9761
|
return;
|
|
9943
9762
|
}
|
|
9944
|
-
|
|
9945
9763
|
_this2.computeMatrix();
|
|
9946
|
-
|
|
9947
9764
|
_this2.triggerUpdate();
|
|
9948
|
-
|
|
9949
9765
|
if (elapsed < duration) {
|
|
9950
9766
|
_this2.landmarkAnimationID = _this2.canvas.requestAnimationFrame(animate);
|
|
9951
9767
|
}
|
|
9952
9768
|
};
|
|
9953
|
-
|
|
9954
9769
|
this.canvas.requestAnimationFrame(animate);
|
|
9955
9770
|
}
|
|
9956
9771
|
};
|
|
9957
|
-
|
|
9958
9772
|
_proto.syncFromLandmark = function syncFromLandmark(landmark) {
|
|
9959
9773
|
this.matrix = copy(this.matrix, landmark.matrix);
|
|
9960
9774
|
this.right = copy$1(this.right, landmark.right);
|
|
@@ -9973,10 +9787,8 @@
|
|
|
9973
9787
|
this.distance = landmark.distance;
|
|
9974
9788
|
this.zoom = landmark.zoom;
|
|
9975
9789
|
};
|
|
9976
|
-
|
|
9977
9790
|
return AdvancedCamera;
|
|
9978
9791
|
}(Camera);
|
|
9979
|
-
|
|
9980
9792
|
runtime.CameraContribution = AdvancedCamera;
|
|
9981
9793
|
|
|
9982
9794
|
// export const ContextNode = Syringe.defineToken('');
|
|
@@ -10001,29 +9813,21 @@
|
|
|
10001
9813
|
this.node = _node;
|
|
10002
9814
|
};
|
|
10003
9815
|
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
9816
|
(function (LayoutTaskType) {
|
|
10007
9817
|
LayoutTaskType["Layout"] = "layout";
|
|
10008
9818
|
LayoutTaskType["IntrinsicSizes"] = "intrinsic-sizes";
|
|
10009
9819
|
})(exports.LayoutTaskType || (exports.LayoutTaskType = {}));
|
|
10010
|
-
|
|
10011
9820
|
var ChildDisplayType;
|
|
10012
|
-
|
|
10013
9821
|
(function (ChildDisplayType) {
|
|
10014
9822
|
ChildDisplayType[ChildDisplayType["block"] = 0] = "block";
|
|
10015
9823
|
ChildDisplayType[ChildDisplayType["normal"] = 1] = "normal";
|
|
10016
9824
|
})(ChildDisplayType || (ChildDisplayType = {}));
|
|
10017
|
-
|
|
10018
9825
|
var LayoutSizingMode;
|
|
10019
|
-
|
|
10020
9826
|
(function (LayoutSizingMode) {
|
|
10021
9827
|
LayoutSizingMode[LayoutSizingMode["block-like"] = 0] = "block-like";
|
|
10022
9828
|
LayoutSizingMode[LayoutSizingMode["manual"] = 1] = "manual";
|
|
10023
9829
|
})(LayoutSizingMode || (LayoutSizingMode = {}));
|
|
10024
9830
|
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
9831
|
(function (PropertyName) {
|
|
10028
9832
|
PropertyName["LAYOUT"] = "display";
|
|
10029
9833
|
PropertyName["LEFT"] = "left";
|
|
@@ -10067,21 +9871,20 @@
|
|
|
10067
9871
|
PropertyName["OFFSET_HEIGHT"] = "offsetHeight";
|
|
10068
9872
|
PropertyName["ORDER"] = "order";
|
|
10069
9873
|
})(exports.PropertyName || (exports.PropertyName = {}));
|
|
10070
|
-
|
|
10071
9874
|
function _regeneratorRuntime$1() {
|
|
10072
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
10073
9875
|
_regeneratorRuntime$1 = function _regeneratorRuntime() {
|
|
10074
9876
|
return exports;
|
|
10075
9877
|
};
|
|
10076
|
-
|
|
10077
9878
|
var exports = {},
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
9879
|
+
Op = Object.prototype,
|
|
9880
|
+
hasOwn = Op.hasOwnProperty,
|
|
9881
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
9882
|
+
obj[key] = desc.value;
|
|
9883
|
+
},
|
|
9884
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
9885
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
9886
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
9887
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
10085
9888
|
function define(obj, key, value) {
|
|
10086
9889
|
return Object.defineProperty(obj, key, {
|
|
10087
9890
|
value: value,
|
|
@@ -10090,7 +9893,6 @@
|
|
|
10090
9893
|
writable: !0
|
|
10091
9894
|
}), obj[key];
|
|
10092
9895
|
}
|
|
10093
|
-
|
|
10094
9896
|
try {
|
|
10095
9897
|
define({}, "");
|
|
10096
9898
|
} catch (err) {
|
|
@@ -10098,54 +9900,14 @@
|
|
|
10098
9900
|
return obj[key] = value;
|
|
10099
9901
|
};
|
|
10100
9902
|
}
|
|
10101
|
-
|
|
10102
9903
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
10103
9904
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
return generator
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
10110
|
-
|
|
10111
|
-
if ("completed" === state) {
|
|
10112
|
-
if ("throw" === method) throw arg;
|
|
10113
|
-
return doneResult();
|
|
10114
|
-
}
|
|
10115
|
-
|
|
10116
|
-
for (context.method = method, context.arg = arg;;) {
|
|
10117
|
-
var delegate = context.delegate;
|
|
10118
|
-
|
|
10119
|
-
if (delegate) {
|
|
10120
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
10121
|
-
|
|
10122
|
-
if (delegateResult) {
|
|
10123
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
10124
|
-
return delegateResult;
|
|
10125
|
-
}
|
|
10126
|
-
}
|
|
10127
|
-
|
|
10128
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
10129
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
10130
|
-
context.dispatchException(context.arg);
|
|
10131
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
10132
|
-
state = "executing";
|
|
10133
|
-
var record = tryCatch(innerFn, self, context);
|
|
10134
|
-
|
|
10135
|
-
if ("normal" === record.type) {
|
|
10136
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
10137
|
-
return {
|
|
10138
|
-
value: record.arg,
|
|
10139
|
-
done: context.done
|
|
10140
|
-
};
|
|
10141
|
-
}
|
|
10142
|
-
|
|
10143
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
10144
|
-
}
|
|
10145
|
-
};
|
|
10146
|
-
}(innerFn, self, context), generator;
|
|
9905
|
+
generator = Object.create(protoGenerator.prototype),
|
|
9906
|
+
context = new Context(tryLocsList || []);
|
|
9907
|
+
return defineProperty(generator, "_invoke", {
|
|
9908
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
9909
|
+
}), generator;
|
|
10147
9910
|
}
|
|
10148
|
-
|
|
10149
9911
|
function tryCatch(fn, obj, arg) {
|
|
10150
9912
|
try {
|
|
10151
9913
|
return {
|
|
@@ -10159,25 +9921,19 @@
|
|
|
10159
9921
|
};
|
|
10160
9922
|
}
|
|
10161
9923
|
}
|
|
10162
|
-
|
|
10163
9924
|
exports.wrap = wrap;
|
|
10164
9925
|
var ContinueSentinel = {};
|
|
10165
|
-
|
|
10166
9926
|
function Generator() {}
|
|
10167
|
-
|
|
10168
9927
|
function GeneratorFunction() {}
|
|
10169
|
-
|
|
10170
9928
|
function GeneratorFunctionPrototype() {}
|
|
10171
|
-
|
|
10172
9929
|
var IteratorPrototype = {};
|
|
10173
9930
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
10174
9931
|
return this;
|
|
10175
9932
|
});
|
|
10176
9933
|
var getProto = Object.getPrototypeOf,
|
|
10177
|
-
|
|
9934
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
10178
9935
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
10179
9936
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
10180
|
-
|
|
10181
9937
|
function defineIteratorMethods(prototype) {
|
|
10182
9938
|
["next", "throw", "return"].forEach(function (method) {
|
|
10183
9939
|
define(prototype, method, function (arg) {
|
|
@@ -10185,14 +9941,12 @@
|
|
|
10185
9941
|
});
|
|
10186
9942
|
});
|
|
10187
9943
|
}
|
|
10188
|
-
|
|
10189
9944
|
function AsyncIterator(generator, PromiseImpl) {
|
|
10190
9945
|
function invoke(method, arg, resolve, reject) {
|
|
10191
9946
|
var record = tryCatch(generator[method], generator, arg);
|
|
10192
|
-
|
|
10193
9947
|
if ("throw" !== record.type) {
|
|
10194
9948
|
var result = record.arg,
|
|
10195
|
-
|
|
9949
|
+
value = result.value;
|
|
10196
9950
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
10197
9951
|
invoke("next", value, resolve, reject);
|
|
10198
9952
|
}, function (err) {
|
|
@@ -10203,92 +9957,116 @@
|
|
|
10203
9957
|
return invoke("throw", error, resolve, reject);
|
|
10204
9958
|
});
|
|
10205
9959
|
}
|
|
10206
|
-
|
|
10207
9960
|
reject(record.arg);
|
|
10208
9961
|
}
|
|
10209
|
-
|
|
10210
9962
|
var previousPromise;
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
9963
|
+
defineProperty(this, "_invoke", {
|
|
9964
|
+
value: function value(method, arg) {
|
|
9965
|
+
function callInvokeWithMethodAndArg() {
|
|
9966
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
9967
|
+
invoke(method, arg, resolve, reject);
|
|
9968
|
+
});
|
|
9969
|
+
}
|
|
9970
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
9971
|
+
}
|
|
9972
|
+
});
|
|
9973
|
+
}
|
|
9974
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
9975
|
+
var state = "suspendedStart";
|
|
9976
|
+
return function (method, arg) {
|
|
9977
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
9978
|
+
if ("completed" === state) {
|
|
9979
|
+
if ("throw" === method) throw arg;
|
|
9980
|
+
return doneResult();
|
|
9981
|
+
}
|
|
9982
|
+
for (context.method = method, context.arg = arg;;) {
|
|
9983
|
+
var delegate = context.delegate;
|
|
9984
|
+
if (delegate) {
|
|
9985
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
9986
|
+
if (delegateResult) {
|
|
9987
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
9988
|
+
return delegateResult;
|
|
9989
|
+
}
|
|
9990
|
+
}
|
|
9991
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
9992
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
9993
|
+
context.dispatchException(context.arg);
|
|
9994
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
9995
|
+
state = "executing";
|
|
9996
|
+
var record = tryCatch(innerFn, self, context);
|
|
9997
|
+
if ("normal" === record.type) {
|
|
9998
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
9999
|
+
return {
|
|
10000
|
+
value: record.arg,
|
|
10001
|
+
done: context.done
|
|
10002
|
+
};
|
|
10003
|
+
}
|
|
10004
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
10217
10005
|
}
|
|
10218
|
-
|
|
10219
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
10220
10006
|
};
|
|
10221
10007
|
}
|
|
10222
|
-
|
|
10223
10008
|
function maybeInvokeDelegate(delegate, context) {
|
|
10224
10009
|
var method = delegate.iterator[context.method];
|
|
10225
|
-
|
|
10226
10010
|
if (undefined === method) {
|
|
10227
10011
|
if (context.delegate = null, "throw" === context.method) {
|
|
10228
10012
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
10229
10013
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
10230
10014
|
}
|
|
10231
|
-
|
|
10232
10015
|
return ContinueSentinel;
|
|
10233
10016
|
}
|
|
10234
|
-
|
|
10235
10017
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
10236
10018
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
10237
10019
|
var info = record.arg;
|
|
10238
10020
|
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
10239
10021
|
}
|
|
10240
|
-
|
|
10241
10022
|
function pushTryEntry(locs) {
|
|
10242
10023
|
var entry = {
|
|
10243
10024
|
tryLoc: locs[0]
|
|
10244
10025
|
};
|
|
10245
10026
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
10246
10027
|
}
|
|
10247
|
-
|
|
10248
10028
|
function resetTryEntry(entry) {
|
|
10249
10029
|
var record = entry.completion || {};
|
|
10250
10030
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
10251
10031
|
}
|
|
10252
|
-
|
|
10253
10032
|
function Context(tryLocsList) {
|
|
10254
10033
|
this.tryEntries = [{
|
|
10255
10034
|
tryLoc: "root"
|
|
10256
10035
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
10257
10036
|
}
|
|
10258
|
-
|
|
10259
10037
|
function values(iterable) {
|
|
10260
10038
|
if (iterable) {
|
|
10261
10039
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
10262
10040
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
10263
10041
|
if ("function" == typeof iterable.next) return iterable;
|
|
10264
|
-
|
|
10265
10042
|
if (!isNaN(iterable.length)) {
|
|
10266
10043
|
var i = -1,
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
};
|
|
10274
|
-
|
|
10044
|
+
next = function next() {
|
|
10045
|
+
for (; ++i < iterable.length;) {
|
|
10046
|
+
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
10047
|
+
}
|
|
10048
|
+
return next.value = undefined, next.done = !0, next;
|
|
10049
|
+
};
|
|
10275
10050
|
return next.next = next;
|
|
10276
10051
|
}
|
|
10277
10052
|
}
|
|
10278
|
-
|
|
10279
10053
|
return {
|
|
10280
10054
|
next: doneResult
|
|
10281
10055
|
};
|
|
10282
10056
|
}
|
|
10283
|
-
|
|
10284
10057
|
function doneResult() {
|
|
10285
10058
|
return {
|
|
10286
10059
|
value: undefined,
|
|
10287
10060
|
done: !0
|
|
10288
10061
|
};
|
|
10289
10062
|
}
|
|
10290
|
-
|
|
10291
|
-
|
|
10063
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
10064
|
+
value: GeneratorFunctionPrototype,
|
|
10065
|
+
configurable: !0
|
|
10066
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
10067
|
+
value: GeneratorFunction,
|
|
10068
|
+
configurable: !0
|
|
10069
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
10292
10070
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
10293
10071
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
10294
10072
|
}, exports.mark = function (genFun) {
|
|
@@ -10309,19 +10087,17 @@
|
|
|
10309
10087
|
return this;
|
|
10310
10088
|
}), define(Gp, "toString", function () {
|
|
10311
10089
|
return "[object Generator]";
|
|
10312
|
-
}), exports.keys = function (
|
|
10313
|
-
var
|
|
10314
|
-
|
|
10090
|
+
}), exports.keys = function (val) {
|
|
10091
|
+
var object = Object(val),
|
|
10092
|
+
keys = [];
|
|
10315
10093
|
for (var key in object) {
|
|
10316
10094
|
keys.push(key);
|
|
10317
10095
|
}
|
|
10318
|
-
|
|
10319
10096
|
return keys.reverse(), function next() {
|
|
10320
10097
|
for (; keys.length;) {
|
|
10321
10098
|
var key = keys.pop();
|
|
10322
10099
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
10323
10100
|
}
|
|
10324
|
-
|
|
10325
10101
|
return next.done = !0, next;
|
|
10326
10102
|
};
|
|
10327
10103
|
}, exports.values = values, Context.prototype = {
|
|
@@ -10340,20 +10116,16 @@
|
|
|
10340
10116
|
dispatchException: function dispatchException(exception) {
|
|
10341
10117
|
if (this.done) throw exception;
|
|
10342
10118
|
var context = this;
|
|
10343
|
-
|
|
10344
10119
|
function handle(loc, caught) {
|
|
10345
10120
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
10346
10121
|
}
|
|
10347
|
-
|
|
10348
10122
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
10349
10123
|
var entry = this.tryEntries[i],
|
|
10350
|
-
|
|
10124
|
+
record = entry.completion;
|
|
10351
10125
|
if ("root" === entry.tryLoc) return handle("end");
|
|
10352
|
-
|
|
10353
10126
|
if (entry.tryLoc <= this.prev) {
|
|
10354
10127
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
10355
|
-
|
|
10356
|
-
|
|
10128
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
10357
10129
|
if (hasCatch && hasFinally) {
|
|
10358
10130
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
10359
10131
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -10369,13 +10141,11 @@
|
|
|
10369
10141
|
abrupt: function abrupt(type, arg) {
|
|
10370
10142
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
10371
10143
|
var entry = this.tryEntries[i];
|
|
10372
|
-
|
|
10373
10144
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
10374
10145
|
var finallyEntry = entry;
|
|
10375
10146
|
break;
|
|
10376
10147
|
}
|
|
10377
10148
|
}
|
|
10378
|
-
|
|
10379
10149
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
10380
10150
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
10381
10151
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -10393,19 +10163,15 @@
|
|
|
10393
10163
|
catch: function _catch(tryLoc) {
|
|
10394
10164
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
10395
10165
|
var entry = this.tryEntries[i];
|
|
10396
|
-
|
|
10397
10166
|
if (entry.tryLoc === tryLoc) {
|
|
10398
10167
|
var record = entry.completion;
|
|
10399
|
-
|
|
10400
10168
|
if ("throw" === record.type) {
|
|
10401
10169
|
var thrown = record.arg;
|
|
10402
10170
|
resetTryEntry(entry);
|
|
10403
10171
|
}
|
|
10404
|
-
|
|
10405
10172
|
return thrown;
|
|
10406
10173
|
}
|
|
10407
10174
|
}
|
|
10408
|
-
|
|
10409
10175
|
throw new Error("illegal catch attempt");
|
|
10410
10176
|
},
|
|
10411
10177
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -10417,7 +10183,6 @@
|
|
|
10417
10183
|
}
|
|
10418
10184
|
}, exports;
|
|
10419
10185
|
}
|
|
10420
|
-
|
|
10421
10186
|
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10422
10187
|
try {
|
|
10423
10188
|
var info = gen[key](arg);
|
|
@@ -10426,34 +10191,28 @@
|
|
|
10426
10191
|
reject(error);
|
|
10427
10192
|
return;
|
|
10428
10193
|
}
|
|
10429
|
-
|
|
10430
10194
|
if (info.done) {
|
|
10431
10195
|
resolve(value);
|
|
10432
10196
|
} else {
|
|
10433
10197
|
Promise.resolve(value).then(_next, _throw);
|
|
10434
10198
|
}
|
|
10435
10199
|
}
|
|
10436
|
-
|
|
10437
10200
|
function _asyncToGenerator$1(fn) {
|
|
10438
10201
|
return function () {
|
|
10439
10202
|
var self = this,
|
|
10440
|
-
|
|
10203
|
+
args = arguments;
|
|
10441
10204
|
return new Promise(function (resolve, reject) {
|
|
10442
10205
|
var gen = fn.apply(self, args);
|
|
10443
|
-
|
|
10444
10206
|
function _next(value) {
|
|
10445
10207
|
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
10446
10208
|
}
|
|
10447
|
-
|
|
10448
10209
|
function _throw(err) {
|
|
10449
10210
|
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
10450
10211
|
}
|
|
10451
|
-
|
|
10452
10212
|
_next(undefined);
|
|
10453
10213
|
});
|
|
10454
10214
|
};
|
|
10455
10215
|
}
|
|
10456
|
-
|
|
10457
10216
|
function _defineProperties$1(target, props) {
|
|
10458
10217
|
for (var i = 0; i < props.length; i++) {
|
|
10459
10218
|
var descriptor = props[i];
|
|
@@ -10463,7 +10222,6 @@
|
|
|
10463
10222
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
10464
10223
|
}
|
|
10465
10224
|
}
|
|
10466
|
-
|
|
10467
10225
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
|
10468
10226
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
10469
10227
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
@@ -10472,22 +10230,21 @@
|
|
|
10472
10230
|
});
|
|
10473
10231
|
return Constructor;
|
|
10474
10232
|
}
|
|
10233
|
+
|
|
10475
10234
|
/**
|
|
10476
10235
|
* This function allow you to modify a JS Promise by adding some status properties.
|
|
10477
10236
|
* Based on: http://stackoverflow.com/questions/21485545/is-there-a-way-to-tell-if-an-es6-promise-is-fulfilled-rejected-resolved
|
|
10478
10237
|
* But modified according to the specs of promises : https://promisesaplus.com/
|
|
10479
10238
|
*/
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
10239
|
var makeQuerablePromise = function makeQuerablePromise(promise) {
|
|
10483
10240
|
// Don't modify any promise that has been already modified.
|
|
10484
|
-
if (promise.isRejected || promise.isFulfilled) return promise;
|
|
10485
|
-
|
|
10241
|
+
if (promise.isRejected || promise.isFulfilled) return promise;
|
|
10242
|
+
// Set initial state
|
|
10486
10243
|
var isPending = true;
|
|
10487
10244
|
var isRejected = false;
|
|
10488
10245
|
var isFulfilled = false;
|
|
10489
|
-
var fullFilledValue;
|
|
10490
|
-
|
|
10246
|
+
var fullFilledValue;
|
|
10247
|
+
// Observe the promise, saving the fulfillment in a closure scope.
|
|
10491
10248
|
var result = promise.then(function (v) {
|
|
10492
10249
|
isFulfilled = true;
|
|
10493
10250
|
isPending = false;
|
|
@@ -10498,34 +10255,26 @@
|
|
|
10498
10255
|
isPending = false;
|
|
10499
10256
|
throw e;
|
|
10500
10257
|
});
|
|
10501
|
-
|
|
10502
10258
|
result.isFulfilled = function () {
|
|
10503
10259
|
return isFulfilled;
|
|
10504
10260
|
};
|
|
10505
|
-
|
|
10506
10261
|
result.isPending = function () {
|
|
10507
10262
|
return isPending;
|
|
10508
10263
|
};
|
|
10509
|
-
|
|
10510
10264
|
result.isRejected = function () {
|
|
10511
10265
|
return isRejected;
|
|
10512
10266
|
};
|
|
10513
|
-
|
|
10514
10267
|
result.getFullFilledValue = function () {
|
|
10515
10268
|
return fullFilledValue;
|
|
10516
10269
|
};
|
|
10517
|
-
|
|
10518
10270
|
return result;
|
|
10519
10271
|
};
|
|
10520
10272
|
/**
|
|
10521
10273
|
* Simple implementation of the deferred pattern.
|
|
10522
10274
|
* An object that exposes a promise and functions to resolve and reject it.
|
|
10523
10275
|
*/
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
10276
|
var Deferred = function Deferred() {
|
|
10527
10277
|
var _this = this;
|
|
10528
|
-
|
|
10529
10278
|
this.resolve = void 0;
|
|
10530
10279
|
this.reject = void 0;
|
|
10531
10280
|
this.promise = new Promise(function (resolve, reject) {
|
|
@@ -10533,7 +10282,6 @@
|
|
|
10533
10282
|
_this.reject = reject;
|
|
10534
10283
|
});
|
|
10535
10284
|
};
|
|
10536
|
-
|
|
10537
10285
|
var LayoutChildren = /*#__PURE__*/function () {
|
|
10538
10286
|
function LayoutChildren(_layoutContext, options) {
|
|
10539
10287
|
this._layoutContext = void 0;
|
|
@@ -10547,9 +10295,7 @@
|
|
|
10547
10295
|
this.node = options.node;
|
|
10548
10296
|
this.styleMap = options.node.getAllStyle();
|
|
10549
10297
|
}
|
|
10550
|
-
|
|
10551
10298
|
var _proto = LayoutChildren.prototype;
|
|
10552
|
-
|
|
10553
10299
|
_proto.intrinsicSizes = function intrinsicSizes() {
|
|
10554
10300
|
// if (this.contextId !== this.layoutContext.contextId) {
|
|
10555
10301
|
// throw new Error('Invalid State: wrong layout context');
|
|
@@ -10562,7 +10308,6 @@
|
|
|
10562
10308
|
});
|
|
10563
10309
|
return deferred.promise;
|
|
10564
10310
|
};
|
|
10565
|
-
|
|
10566
10311
|
_proto.layoutNextFragment = function layoutNextFragment(constraints) {
|
|
10567
10312
|
// if (this.layoutContext.contextId !== this.layoutContext.contextId) {
|
|
10568
10313
|
// throw new Error('Invalid State: wrong layout context');
|
|
@@ -10570,7 +10315,6 @@
|
|
|
10570
10315
|
if (this.layoutContext.mode === exports.LayoutTaskType.IntrinsicSizes) {
|
|
10571
10316
|
throw new Error('Not Supported: cant call layoutNextFragment in intrinsicSizes');
|
|
10572
10317
|
}
|
|
10573
|
-
|
|
10574
10318
|
var deferred = new Deferred();
|
|
10575
10319
|
this.layoutContext.appendWorkTask({
|
|
10576
10320
|
layoutConstraints: constraints,
|
|
@@ -10580,15 +10324,12 @@
|
|
|
10580
10324
|
});
|
|
10581
10325
|
return deferred.promise;
|
|
10582
10326
|
};
|
|
10583
|
-
|
|
10584
10327
|
return LayoutChildren;
|
|
10585
10328
|
}();
|
|
10586
|
-
|
|
10587
10329
|
var guid = 0;
|
|
10588
10330
|
/**
|
|
10589
10331
|
* 每次layout 有单独的 context
|
|
10590
10332
|
*/
|
|
10591
|
-
|
|
10592
10333
|
var LayoutContext = /*#__PURE__*/function () {
|
|
10593
10334
|
function LayoutContext(options) {
|
|
10594
10335
|
this.options = void 0;
|
|
@@ -10605,22 +10346,16 @@
|
|
|
10605
10346
|
this.fragmentResultFactory = options.fragmentResultFactory;
|
|
10606
10347
|
this.layoutFragmentFactory = options.layoutFragmentFactory;
|
|
10607
10348
|
}
|
|
10608
|
-
|
|
10609
10349
|
var _proto = LayoutContext.prototype;
|
|
10610
|
-
|
|
10611
10350
|
_proto.appendWorkTask = function appendWorkTask(work) {
|
|
10612
10351
|
this.workQueue.push(work);
|
|
10613
10352
|
};
|
|
10614
|
-
|
|
10615
10353
|
_proto.clearWorkQueue = function clearWorkQueue() {
|
|
10616
10354
|
this.workQueue = [];
|
|
10617
10355
|
};
|
|
10618
|
-
|
|
10619
10356
|
return LayoutContext;
|
|
10620
10357
|
}();
|
|
10621
|
-
|
|
10622
10358
|
var AbstractLayoutDefinition = function AbstractLayoutDefinition() {};
|
|
10623
|
-
|
|
10624
10359
|
AbstractLayoutDefinition.inputProperties = void 0;
|
|
10625
10360
|
AbstractLayoutDefinition.childrenInputProperties = void 0;
|
|
10626
10361
|
AbstractLayoutDefinition.layoutOptions = void 0;
|
|
@@ -10629,11 +10364,11 @@
|
|
|
10629
10364
|
* https://drafts.css-houdini.org/css-layout-api/#layoutedges
|
|
10630
10365
|
* the size of border, scrollbar, padding
|
|
10631
10366
|
*/
|
|
10367
|
+
var LayoutEdges =
|
|
10368
|
+
// Convenience attributes for the sum in one direction.
|
|
10632
10369
|
|
|
10633
|
-
var LayoutEdges = // Convenience attributes for the sum in one direction.
|
|
10634
10370
|
function LayoutEdges(options) {
|
|
10635
10371
|
var _styleMap$get$value, _styleMap$get, _styleMap$get$value2, _styleMap$get2, _styleMap$get$value3, _styleMap$get3, _styleMap$get$value4, _styleMap$get4, _styleMap$get$value5, _styleMap$get5, _styleMap$get$value6, _styleMap$get6, _styleMap$get$value7, _styleMap$get7, _styleMap$get$value8, _styleMap$get8;
|
|
10636
|
-
|
|
10637
10372
|
this.options = void 0;
|
|
10638
10373
|
this.inlineStart = void 0;
|
|
10639
10374
|
this.inlineEnd = void 0;
|
|
@@ -10659,19 +10394,16 @@
|
|
|
10659
10394
|
this.block = this.blockStart + this.blockEnd;
|
|
10660
10395
|
this.inline = this.inlineStart + this.inlineEnd;
|
|
10661
10396
|
};
|
|
10662
|
-
|
|
10663
10397
|
var delay = function delay(minisecond) {
|
|
10664
10398
|
if (minisecond === void 0) {
|
|
10665
10399
|
minisecond = 0;
|
|
10666
10400
|
}
|
|
10667
|
-
|
|
10668
10401
|
return new Promise(function (resolve) {
|
|
10669
10402
|
setTimeout(function () {
|
|
10670
10403
|
resolve();
|
|
10671
10404
|
}, minisecond);
|
|
10672
10405
|
});
|
|
10673
10406
|
};
|
|
10674
|
-
|
|
10675
10407
|
var LayoutEngine = /*#__PURE__*/function () {
|
|
10676
10408
|
function LayoutEngine(_layoutRegistry, _layoutContextFactory, _layoutEdgesFactory) {
|
|
10677
10409
|
this._layoutRegistry = void 0;
|
|
@@ -10685,7 +10417,8 @@
|
|
|
10685
10417
|
this._layoutEdgesFactory = _layoutEdgesFactory;
|
|
10686
10418
|
this.layoutRegistry = _layoutRegistry;
|
|
10687
10419
|
this.layoutContextFactory = _layoutContextFactory;
|
|
10688
|
-
this.layoutEdgesFactory = _layoutEdgesFactory;
|
|
10420
|
+
this.layoutEdgesFactory = _layoutEdgesFactory;
|
|
10421
|
+
// layoutContributions.getContributions().forEach((layoutContrib) => {
|
|
10689
10422
|
// layoutContrib.registerLayout(_layoutRegistry);
|
|
10690
10423
|
// });
|
|
10691
10424
|
}
|
|
@@ -10695,11 +10428,9 @@
|
|
|
10695
10428
|
* @param rootPageConstraints layout constraints
|
|
10696
10429
|
* @returns
|
|
10697
10430
|
*/
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
10431
|
var _proto = LayoutEngine.prototype;
|
|
10701
|
-
|
|
10702
|
-
|
|
10432
|
+
_proto.computeLayout = /*#__PURE__*/
|
|
10433
|
+
function () {
|
|
10703
10434
|
var _computeLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(rootNode, rootPageConstraints) {
|
|
10704
10435
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
10705
10436
|
while (1) {
|
|
@@ -10707,11 +10438,9 @@
|
|
|
10707
10438
|
case 0:
|
|
10708
10439
|
_context.next = 2;
|
|
10709
10440
|
return this.determineIntrinsicSizes(rootNode, rootNode.children);
|
|
10710
|
-
|
|
10711
10441
|
case 2:
|
|
10712
10442
|
_context.next = 4;
|
|
10713
10443
|
return this.calculateLayout(rootNode, rootNode.children, rootPageConstraints);
|
|
10714
|
-
|
|
10715
10444
|
case 4:
|
|
10716
10445
|
case "end":
|
|
10717
10446
|
return _context.stop();
|
|
@@ -10719,20 +10448,18 @@
|
|
|
10719
10448
|
}
|
|
10720
10449
|
}, _callee, this);
|
|
10721
10450
|
}));
|
|
10722
|
-
|
|
10723
10451
|
function computeLayout(_x, _x2) {
|
|
10724
10452
|
return _computeLayout.apply(this, arguments);
|
|
10725
10453
|
}
|
|
10726
|
-
|
|
10727
10454
|
return computeLayout;
|
|
10728
10455
|
}()
|
|
10729
10456
|
/**
|
|
10730
10457
|
* calculate intrinsicSize of node tree, use depth dirst / post order traversal
|
|
10731
10458
|
* @param rootNode
|
|
10732
|
-
|
|
10733
|
-
;
|
|
10459
|
+
*/;
|
|
10734
10460
|
|
|
10735
|
-
_proto.determineAllIntrinsicSizes = /*#__PURE__*/
|
|
10461
|
+
_proto.determineAllIntrinsicSizes = /*#__PURE__*/
|
|
10462
|
+
function () {
|
|
10736
10463
|
var _determineAllIntrinsicSizes = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2(rootNode) {
|
|
10737
10464
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
10738
10465
|
while (1) {
|
|
@@ -10744,31 +10471,25 @@
|
|
|
10744
10471
|
}
|
|
10745
10472
|
}, _callee2);
|
|
10746
10473
|
}));
|
|
10747
|
-
|
|
10748
10474
|
function determineAllIntrinsicSizes(_x3) {
|
|
10749
10475
|
return _determineAllIntrinsicSizes.apply(this, arguments);
|
|
10750
10476
|
}
|
|
10751
|
-
|
|
10752
10477
|
return determineAllIntrinsicSizes;
|
|
10753
10478
|
}();
|
|
10754
|
-
|
|
10755
10479
|
_proto.getLayoutDefinitionName = function getLayoutDefinitionName(node) {
|
|
10756
10480
|
var layoutStyle = node.getAllStyle().get(exports.PropertyName.LAYOUT);
|
|
10757
|
-
|
|
10758
10481
|
if (!layoutStyle) {
|
|
10759
10482
|
throw new Error('layout property not found');
|
|
10760
10483
|
}
|
|
10761
|
-
|
|
10762
10484
|
return layoutStyle.value;
|
|
10763
10485
|
}
|
|
10764
10486
|
/**
|
|
10765
10487
|
* calculate the min/max content size of node
|
|
10766
10488
|
* @param node current layout object
|
|
10767
10489
|
* @param childNodes children of the current node
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
_proto.determineIntrinsicSizes = /*#__PURE__*/function () {
|
|
10490
|
+
*/;
|
|
10491
|
+
_proto.determineIntrinsicSizes = /*#__PURE__*/
|
|
10492
|
+
function () {
|
|
10772
10493
|
var _determineIntrinsicSizes = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3(node, childNodes) {
|
|
10773
10494
|
var layoutName;
|
|
10774
10495
|
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
@@ -10778,7 +10499,6 @@
|
|
|
10778
10499
|
layoutName = this.getLayoutDefinitionName(node);
|
|
10779
10500
|
_context3.next = 3;
|
|
10780
10501
|
return this.invokeIntrinsicSizesCallback(layoutName, node, childNodes);
|
|
10781
|
-
|
|
10782
10502
|
case 3:
|
|
10783
10503
|
case "end":
|
|
10784
10504
|
return _context3.stop();
|
|
@@ -10786,18 +10506,14 @@
|
|
|
10786
10506
|
}
|
|
10787
10507
|
}, _callee3, this);
|
|
10788
10508
|
}));
|
|
10789
|
-
|
|
10790
10509
|
function determineIntrinsicSizes(_x4, _x5) {
|
|
10791
10510
|
return _determineIntrinsicSizes.apply(this, arguments);
|
|
10792
10511
|
}
|
|
10793
|
-
|
|
10794
10512
|
return determineIntrinsicSizes;
|
|
10795
10513
|
}();
|
|
10796
|
-
|
|
10797
10514
|
_proto.invokeIntrinsicSizesCallback = /*#__PURE__*/function () {
|
|
10798
10515
|
var _invokeIntrinsicSizesCallback = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4(layoutName, node, childNodes) {
|
|
10799
10516
|
var LayoutDef, layoutInstance, context, _LayoutDef$inputPrope, inputProperties, children, edges, styleMap, value, generator, intrinsicSizesValue;
|
|
10800
|
-
|
|
10801
10517
|
return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
|
|
10802
10518
|
while (1) {
|
|
10803
10519
|
switch (_context4.prev = _context4.next) {
|
|
@@ -10819,18 +10535,15 @@
|
|
|
10819
10535
|
node: node
|
|
10820
10536
|
});
|
|
10821
10537
|
styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children edges styleMap )
|
|
10822
|
-
|
|
10823
10538
|
value = layoutInstance.intrinsicSizes(children, edges, styleMap);
|
|
10824
10539
|
generator = this.runWorkQueue(value, context.workQueue);
|
|
10825
10540
|
generator.next();
|
|
10826
10541
|
_context4.next = 13;
|
|
10827
10542
|
return delay();
|
|
10828
|
-
|
|
10829
10543
|
case 13:
|
|
10830
10544
|
intrinsicSizesValue = generator.next().value;
|
|
10831
10545
|
context.clearWorkQueue();
|
|
10832
10546
|
node.setIntrisicSizes(intrinsicSizesValue);
|
|
10833
|
-
|
|
10834
10547
|
case 16:
|
|
10835
10548
|
case "end":
|
|
10836
10549
|
return _context4.stop();
|
|
@@ -10838,14 +10551,11 @@
|
|
|
10838
10551
|
}
|
|
10839
10552
|
}, _callee4, this);
|
|
10840
10553
|
}));
|
|
10841
|
-
|
|
10842
10554
|
function invokeIntrinsicSizesCallback(_x6, _x7, _x8) {
|
|
10843
10555
|
return _invokeIntrinsicSizesCallback.apply(this, arguments);
|
|
10844
10556
|
}
|
|
10845
|
-
|
|
10846
10557
|
return invokeIntrinsicSizesCallback;
|
|
10847
10558
|
}();
|
|
10848
|
-
|
|
10849
10559
|
_proto.calculateLayout = /*#__PURE__*/function () {
|
|
10850
10560
|
var _calculateLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(node, childNodes, layoutConstraints) {
|
|
10851
10561
|
var layoutName;
|
|
@@ -10856,7 +10566,6 @@
|
|
|
10856
10566
|
layoutName = this.getLayoutDefinitionName(node);
|
|
10857
10567
|
_context5.next = 3;
|
|
10858
10568
|
return this.invokeLayoutCallback(layoutName, node, childNodes, layoutConstraints);
|
|
10859
|
-
|
|
10860
10569
|
case 3:
|
|
10861
10570
|
case "end":
|
|
10862
10571
|
return _context5.stop();
|
|
@@ -10864,18 +10573,14 @@
|
|
|
10864
10573
|
}
|
|
10865
10574
|
}, _callee5, this);
|
|
10866
10575
|
}));
|
|
10867
|
-
|
|
10868
10576
|
function calculateLayout(_x9, _x10, _x11) {
|
|
10869
10577
|
return _calculateLayout.apply(this, arguments);
|
|
10870
10578
|
}
|
|
10871
|
-
|
|
10872
10579
|
return calculateLayout;
|
|
10873
10580
|
}();
|
|
10874
|
-
|
|
10875
10581
|
_proto.invokeLayoutCallback = /*#__PURE__*/function () {
|
|
10876
10582
|
var _invokeLayoutCallback = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6(layoutName, node, childNodes, layoutConstraints) {
|
|
10877
10583
|
var LayoutDef, layoutInstance, context, _LayoutDef$inputPrope2, inputProperties, children, edges, styleMap, value, generator, fragmentResultvalue, fragmentResult, layoutFragment;
|
|
10878
|
-
|
|
10879
10584
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10880
10585
|
while (1) {
|
|
10881
10586
|
switch (_context6.prev = _context6.next) {
|
|
@@ -10897,13 +10602,11 @@
|
|
|
10897
10602
|
node: node
|
|
10898
10603
|
});
|
|
10899
10604
|
styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children styleMap layoutConstraints )
|
|
10900
|
-
|
|
10901
10605
|
value = layoutInstance.layout(children, edges, layoutConstraints, styleMap);
|
|
10902
10606
|
generator = this.runWorkQueue(value, context.workQueue);
|
|
10903
10607
|
generator.next();
|
|
10904
10608
|
_context6.next = 13;
|
|
10905
10609
|
return delay();
|
|
10906
|
-
|
|
10907
10610
|
case 13:
|
|
10908
10611
|
fragmentResultvalue = generator.next().value;
|
|
10909
10612
|
context.clearWorkQueue();
|
|
@@ -10917,7 +10620,6 @@
|
|
|
10917
10620
|
childNodes.forEach(function (childNode, index) {
|
|
10918
10621
|
childNode.setComputedLayout(fragmentResult.childFragments[index]);
|
|
10919
10622
|
});
|
|
10920
|
-
|
|
10921
10623
|
case 19:
|
|
10922
10624
|
case "end":
|
|
10923
10625
|
return _context6.stop();
|
|
@@ -10925,62 +10627,49 @@
|
|
|
10925
10627
|
}
|
|
10926
10628
|
}, _callee6, this);
|
|
10927
10629
|
}));
|
|
10928
|
-
|
|
10929
10630
|
function invokeLayoutCallback(_x12, _x13, _x14, _x15) {
|
|
10930
10631
|
return _invokeLayoutCallback.apply(this, arguments);
|
|
10931
10632
|
}
|
|
10932
|
-
|
|
10933
10633
|
return invokeLayoutCallback;
|
|
10934
10634
|
}();
|
|
10935
|
-
|
|
10936
10635
|
_proto.runWorkQueue = /*#__PURE__*/_regeneratorRuntime$1().mark(function runWorkQueue(promise, workQueue) {
|
|
10937
10636
|
var _this = this;
|
|
10938
|
-
|
|
10939
10637
|
var querablePromise;
|
|
10940
10638
|
return _regeneratorRuntime$1().wrap(function runWorkQueue$(_context7) {
|
|
10941
10639
|
while (1) {
|
|
10942
10640
|
switch (_context7.prev = _context7.next) {
|
|
10943
10641
|
case 0:
|
|
10944
10642
|
querablePromise = makeQuerablePromise(promise);
|
|
10945
|
-
|
|
10946
10643
|
if (workQueue.length > 0 && querablePromise.isPending()) {
|
|
10947
10644
|
workQueue.forEach(function (workTask) {
|
|
10948
10645
|
if (workTask.taskType === exports.LayoutTaskType.IntrinsicSizes) {
|
|
10949
10646
|
var layoutChild = workTask.layoutChild,
|
|
10950
|
-
|
|
10647
|
+
deferred = workTask.deferred;
|
|
10951
10648
|
var node = layoutChild.node;
|
|
10952
10649
|
deferred.resolve(_this.getNodeIntrisicSizes(node));
|
|
10953
10650
|
}
|
|
10954
|
-
|
|
10955
10651
|
if (workTask.taskType === exports.LayoutTaskType.Layout) {
|
|
10956
10652
|
var _layoutChild = workTask.layoutChild,
|
|
10957
|
-
|
|
10958
|
-
|
|
10653
|
+
_deferred = workTask.deferred,
|
|
10654
|
+
layoutConstraints = workTask.layoutConstraints;
|
|
10959
10655
|
var _node = _layoutChild.node,
|
|
10960
|
-
|
|
10961
|
-
|
|
10656
|
+
layoutContext = _layoutChild.layoutContext;
|
|
10962
10657
|
var fragment = _this.getNodeFragment(_node, layoutConstraints);
|
|
10963
|
-
|
|
10964
10658
|
_deferred.resolve(layoutContext.layoutFragmentFactory(fragment));
|
|
10965
10659
|
}
|
|
10966
10660
|
});
|
|
10967
|
-
}
|
|
10968
|
-
|
|
10969
|
-
|
|
10661
|
+
}
|
|
10662
|
+
// wait promise to resolve
|
|
10970
10663
|
_context7.next = 4;
|
|
10971
10664
|
return;
|
|
10972
|
-
|
|
10973
10665
|
case 4:
|
|
10974
10666
|
if (querablePromise.isFulfilled()) {
|
|
10975
10667
|
_context7.next = 6;
|
|
10976
10668
|
break;
|
|
10977
10669
|
}
|
|
10978
|
-
|
|
10979
10670
|
throw new Error('promise not fullfilled!');
|
|
10980
|
-
|
|
10981
10671
|
case 6:
|
|
10982
10672
|
return _context7.abrupt("return", querablePromise.getFullFilledValue());
|
|
10983
|
-
|
|
10984
10673
|
case 7:
|
|
10985
10674
|
case "end":
|
|
10986
10675
|
return _context7.stop();
|
|
@@ -10988,11 +10677,9 @@
|
|
|
10988
10677
|
}
|
|
10989
10678
|
}, runWorkQueue);
|
|
10990
10679
|
});
|
|
10991
|
-
|
|
10992
10680
|
_proto.getNodeIntrisicSizes = function getNodeIntrisicSizes(node) {
|
|
10993
|
-
var _styleMap$get, _node$intrisicSizes, _styleMap$get2, _styleMap$get3, _node$intrisicSizes2, _styleMap$get4, _styleMap$get5, _node$intrisicSizes3, _styleMap$get6, _styleMap$get7, _node$intrisicSizes4, _styleMap$get8;
|
|
10994
|
-
|
|
10995
|
-
|
|
10681
|
+
var _styleMap$get, _node$intrisicSizes, _styleMap$get2, _styleMap$get3, _node$intrisicSizes2, _styleMap$get4, _styleMap$get5, _node$intrisicSizes3, _styleMap$get6, _styleMap$get7, _node$intrisicSizes4, _styleMap$get8;
|
|
10682
|
+
// calculate from border box, depend on writing mode of current layout
|
|
10996
10683
|
var styleMap = node.getAllStyle();
|
|
10997
10684
|
var minWidth = ((_styleMap$get = styleMap.get(exports.PropertyName.MIN_WIDTH)) === null || _styleMap$get === void 0 ? void 0 : _styleMap$get.value) || ((_node$intrisicSizes = node.intrisicSizes) === null || _node$intrisicSizes === void 0 ? void 0 : _node$intrisicSizes.minContentInlineSize) || ((_styleMap$get2 = styleMap.get(exports.PropertyName.WIDTH)) === null || _styleMap$get2 === void 0 ? void 0 : _styleMap$get2.value) || 0;
|
|
10998
10685
|
var maxWidth = ((_styleMap$get3 = styleMap.get(exports.PropertyName.MAX_WIDTH)) === null || _styleMap$get3 === void 0 ? void 0 : _styleMap$get3.value) || ((_node$intrisicSizes2 = node.intrisicSizes) === null || _node$intrisicSizes2 === void 0 ? void 0 : _node$intrisicSizes2.maxContentInlineSize) || ((_styleMap$get4 = styleMap.get(exports.PropertyName.WIDTH)) === null || _styleMap$get4 === void 0 ? void 0 : _styleMap$get4.value) || 0;
|
|
@@ -11005,11 +10692,9 @@
|
|
|
11005
10692
|
maxContentBlockSize: maxHeight
|
|
11006
10693
|
};
|
|
11007
10694
|
};
|
|
11008
|
-
|
|
11009
10695
|
_proto.getNodeFragment = function getNodeFragment(node, constraints) {
|
|
11010
|
-
var _node$getComputedLayo, _node$getAllStyle$get, _node$getAllStyle$get2, _node$getComputedLayo2, _node$getAllStyle$get3, _node$getAllStyle$get4;
|
|
11011
|
-
|
|
11012
|
-
|
|
10696
|
+
var _node$getComputedLayo, _node$getAllStyle$get, _node$getAllStyle$get2, _node$getComputedLayo2, _node$getAllStyle$get3, _node$getAllStyle$get4;
|
|
10697
|
+
// TODO
|
|
11013
10698
|
var width = ((_node$getComputedLayo = node.getComputedLayout()) === null || _node$getComputedLayo === void 0 ? void 0 : _node$getComputedLayo.inlineSize) || ((_node$getAllStyle$get = node.getAllStyle().get(exports.PropertyName.MIN_WIDTH)) === null || _node$getAllStyle$get === void 0 ? void 0 : _node$getAllStyle$get.value) || ((_node$getAllStyle$get2 = node.getAllStyle().get(exports.PropertyName.WIDTH)) === null || _node$getAllStyle$get2 === void 0 ? void 0 : _node$getAllStyle$get2.value) || 0;
|
|
11014
10699
|
var height = ((_node$getComputedLayo2 = node.getComputedLayout()) === null || _node$getComputedLayo2 === void 0 ? void 0 : _node$getComputedLayo2.blockSize) || ((_node$getAllStyle$get3 = node.getAllStyle().get(exports.PropertyName.MIN_HEIGHT)) === null || _node$getAllStyle$get3 === void 0 ? void 0 : _node$getAllStyle$get3.value) || ((_node$getAllStyle$get4 = node.getAllStyle().get(exports.PropertyName.HEIGHT)) === null || _node$getAllStyle$get4 === void 0 ? void 0 : _node$getAllStyle$get4.value) || 0;
|
|
11015
10700
|
return {
|
|
@@ -11018,14 +10703,12 @@
|
|
|
11018
10703
|
data: constraints.data
|
|
11019
10704
|
};
|
|
11020
10705
|
};
|
|
11021
|
-
|
|
11022
10706
|
return LayoutEngine;
|
|
11023
10707
|
}();
|
|
10708
|
+
|
|
11024
10709
|
/**
|
|
11025
10710
|
* 布局的结果
|
|
11026
10711
|
*/
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
10712
|
var LayoutFragment = function LayoutFragment(_layoutContext, options) {
|
|
11030
10713
|
this._layoutContext = void 0;
|
|
11031
10714
|
this.options = void 0;
|
|
@@ -11044,15 +10727,12 @@
|
|
|
11044
10727
|
this.blockOffset = 0;
|
|
11045
10728
|
this.data = options.data;
|
|
11046
10729
|
};
|
|
11047
|
-
|
|
11048
10730
|
var id$1 = 1;
|
|
11049
|
-
|
|
11050
10731
|
var LayoutObject = /*#__PURE__*/function () {
|
|
11051
10732
|
function LayoutObject(style) {
|
|
11052
10733
|
if (style === void 0) {
|
|
11053
10734
|
style = new Map();
|
|
11054
10735
|
}
|
|
11055
|
-
|
|
11056
10736
|
this.id = void 0;
|
|
11057
10737
|
this.style = void 0;
|
|
11058
10738
|
this.dirty = void 0;
|
|
@@ -11071,86 +10751,66 @@
|
|
|
11071
10751
|
* set the intrinsic size of leaf node, different basic shape has different size, compsed shape has
|
|
11072
10752
|
* @param measure measure function
|
|
11073
10753
|
*/
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
10754
|
var _proto = LayoutObject.prototype;
|
|
11077
|
-
|
|
11078
10755
|
_proto.setMeasure = function setMeasure(measure) {
|
|
11079
10756
|
this.measureFn = measure;
|
|
11080
10757
|
};
|
|
11081
|
-
|
|
11082
10758
|
_proto.setIntrisicSizes = function setIntrisicSizes(intrisicSizes) {
|
|
11083
10759
|
this.internalIntrisicSizes = intrisicSizes;
|
|
11084
10760
|
};
|
|
11085
|
-
|
|
11086
10761
|
_proto.addChild = function addChild(child) {
|
|
11087
10762
|
var _this$children;
|
|
11088
|
-
|
|
11089
10763
|
(_this$children = this.children) === null || _this$children === void 0 ? void 0 : _this$children.push(child);
|
|
11090
10764
|
};
|
|
11091
|
-
|
|
11092
10765
|
_proto.insertChild = function insertChild(index, child) {
|
|
11093
10766
|
this.children.splice(index, 0, child);
|
|
11094
10767
|
};
|
|
11095
|
-
|
|
11096
10768
|
_proto.removeChild = function removeChild(child) {
|
|
11097
10769
|
var _this$children2;
|
|
11098
|
-
|
|
11099
10770
|
var index = (_this$children2 = this.children) === null || _this$children2 === void 0 ? void 0 : _this$children2.findIndex(function (node) {
|
|
11100
10771
|
return node.id === child.id;
|
|
11101
10772
|
});
|
|
11102
10773
|
this.removeChildAtIndex(index);
|
|
11103
10774
|
};
|
|
11104
|
-
|
|
11105
10775
|
_proto.removeChildAtIndex = function removeChildAtIndex(index) {
|
|
11106
10776
|
this.children.splice(index, 1);
|
|
11107
10777
|
};
|
|
11108
|
-
|
|
11109
10778
|
_proto.replaceChildAtIndex = function replaceChildAtIndex(index, child) {
|
|
11110
10779
|
this.children.splice(index, 1, child);
|
|
11111
10780
|
};
|
|
11112
|
-
|
|
11113
10781
|
_proto.setStyle = function setStyle(property, value) {
|
|
11114
10782
|
this.style.set(property, value);
|
|
11115
|
-
}
|
|
10783
|
+
}
|
|
10784
|
+
// setStyles(styles: Record<StyleProperty, StyleInputValue>) {
|
|
11116
10785
|
// this.style = StylePropertyMap.create({ styles }).styles;
|
|
11117
10786
|
// }
|
|
11118
10787
|
;
|
|
11119
10788
|
|
|
11120
10789
|
_proto.getStyle = function getStyle() {
|
|
11121
10790
|
var _this = this;
|
|
11122
|
-
|
|
11123
10791
|
var returnStyle = new Map();
|
|
11124
|
-
|
|
11125
10792
|
for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11126
10793
|
properties[_key] = arguments[_key];
|
|
11127
10794
|
}
|
|
11128
|
-
|
|
11129
10795
|
properties.forEach(function (prop) {
|
|
11130
10796
|
var propertyValue = _this.style.get(prop);
|
|
11131
|
-
|
|
11132
10797
|
if (propertyValue) {
|
|
11133
10798
|
returnStyle.set(prop, propertyValue);
|
|
11134
10799
|
}
|
|
11135
10800
|
});
|
|
11136
10801
|
return returnStyle;
|
|
11137
10802
|
};
|
|
11138
|
-
|
|
11139
10803
|
_proto.getAllStyle = function getAllStyle() {
|
|
11140
10804
|
return this.style;
|
|
11141
10805
|
};
|
|
11142
|
-
|
|
11143
10806
|
_proto.markDirty = function markDirty() {
|
|
11144
10807
|
this.dirty = true;
|
|
11145
10808
|
};
|
|
11146
|
-
|
|
11147
10809
|
_proto.idDirty = function idDirty() {
|
|
11148
10810
|
return this.dirty;
|
|
11149
10811
|
};
|
|
11150
|
-
|
|
11151
10812
|
_proto.getSize = function getSize() {
|
|
11152
10813
|
var _this$style$get$value, _this$style$get, _this$style$get$value2, _this$style$get2;
|
|
11153
|
-
|
|
11154
10814
|
var width = (_this$style$get$value = (_this$style$get = this.style.get(exports.PropertyName.WIDTH)) === null || _this$style$get === void 0 ? void 0 : _this$style$get.value) !== null && _this$style$get$value !== void 0 ? _this$style$get$value : 0;
|
|
11155
10815
|
var height = (_this$style$get$value2 = (_this$style$get2 = this.style.get(exports.PropertyName.HEIGHT)) === null || _this$style$get2 === void 0 ? void 0 : _this$style$get2.value) !== null && _this$style$get$value2 !== void 0 ? _this$style$get$value2 : 0;
|
|
11156
10816
|
return {
|
|
@@ -11158,7 +10818,6 @@
|
|
|
11158
10818
|
height: height
|
|
11159
10819
|
};
|
|
11160
10820
|
};
|
|
11161
|
-
|
|
11162
10821
|
_proto.computeLayout = /*#__PURE__*/function () {
|
|
11163
10822
|
var _computeLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
11164
10823
|
var size;
|
|
@@ -11177,7 +10836,6 @@
|
|
|
11177
10836
|
percentageBlockSize: size.height,
|
|
11178
10837
|
data: undefined
|
|
11179
10838
|
});
|
|
11180
|
-
|
|
11181
10839
|
case 3:
|
|
11182
10840
|
case "end":
|
|
11183
10841
|
return _context.stop();
|
|
@@ -11185,28 +10843,21 @@
|
|
|
11185
10843
|
}
|
|
11186
10844
|
}, _callee, this);
|
|
11187
10845
|
}));
|
|
11188
|
-
|
|
11189
10846
|
function computeLayout() {
|
|
11190
10847
|
return _computeLayout.apply(this, arguments);
|
|
11191
10848
|
}
|
|
11192
|
-
|
|
11193
10849
|
return computeLayout;
|
|
11194
10850
|
}();
|
|
11195
|
-
|
|
11196
10851
|
_proto.setComputedLayout = function setComputedLayout(computedLayout) {
|
|
11197
10852
|
this.computedLayout = computedLayout;
|
|
11198
10853
|
};
|
|
11199
|
-
|
|
11200
10854
|
_proto.getComputedLayout = function getComputedLayout() {
|
|
11201
10855
|
return this.computedLayout;
|
|
11202
10856
|
};
|
|
11203
|
-
|
|
11204
10857
|
_proto.getAllComputedLayout = function getAllComputedLayout() {};
|
|
11205
|
-
|
|
11206
10858
|
_proto.toString = function toString() {
|
|
11207
10859
|
return "LayoutObject " + this.id;
|
|
11208
10860
|
};
|
|
11209
|
-
|
|
11210
10861
|
_createClass$1(LayoutObject, [{
|
|
11211
10862
|
key: "intrisicSizes",
|
|
11212
10863
|
get: function get() {
|
|
@@ -11218,17 +10869,13 @@
|
|
|
11218
10869
|
return this.children.length;
|
|
11219
10870
|
}
|
|
11220
10871
|
}]);
|
|
11221
|
-
|
|
11222
10872
|
return LayoutObject;
|
|
11223
10873
|
}();
|
|
11224
|
-
|
|
11225
10874
|
var DefaultLayoutRegistry = /*#__PURE__*/function () {
|
|
11226
10875
|
function DefaultLayoutRegistry() {
|
|
11227
10876
|
this.registry = new Map();
|
|
11228
10877
|
}
|
|
11229
|
-
|
|
11230
10878
|
var _proto = DefaultLayoutRegistry.prototype;
|
|
11231
|
-
|
|
11232
10879
|
_proto.hasLayout = function hasLayout(name) {
|
|
11233
10880
|
return this.registry.has(name);
|
|
11234
10881
|
}
|
|
@@ -11236,56 +10883,46 @@
|
|
|
11236
10883
|
*
|
|
11237
10884
|
* @param name layout name, default to 'absolute'
|
|
11238
10885
|
* @returns layout object
|
|
11239
|
-
|
|
11240
|
-
;
|
|
11241
|
-
|
|
10886
|
+
*/;
|
|
11242
10887
|
_proto.getLayout = function getLayout(name) {
|
|
11243
10888
|
if (name === void 0) {
|
|
11244
10889
|
name = 'absolute';
|
|
11245
10890
|
}
|
|
11246
|
-
|
|
11247
10891
|
if (!this.hasLayout(name)) {
|
|
11248
10892
|
throw new Error("invalid layout property: " + name);
|
|
11249
10893
|
}
|
|
11250
|
-
|
|
11251
10894
|
return this.registry.get(name);
|
|
11252
10895
|
};
|
|
11253
|
-
|
|
11254
10896
|
_proto.updateLayout = function updateLayout(name, layout) {
|
|
11255
10897
|
this.registry.set(name, layout);
|
|
11256
10898
|
};
|
|
11257
|
-
|
|
11258
10899
|
_proto.registerLayout = function registerLayout(name, layout) {
|
|
11259
10900
|
if (name === '') {
|
|
11260
10901
|
throw new TypeError("layout name cant't be empty");
|
|
11261
10902
|
}
|
|
11262
|
-
|
|
11263
10903
|
if (DefaultLayoutRegistry.reservedLayout.includes(name)) {
|
|
11264
10904
|
throw new Error("layout name '" + name + "' is a system reserved layout name, please use another name");
|
|
11265
10905
|
}
|
|
11266
|
-
|
|
11267
10906
|
if (this.hasLayout(name)) {
|
|
11268
10907
|
throw new Error("layout '" + name + "' already exist.");
|
|
11269
10908
|
}
|
|
11270
|
-
|
|
11271
10909
|
this.registry.set(name, layout);
|
|
11272
10910
|
};
|
|
11273
|
-
|
|
11274
10911
|
_proto.deleteLayout = function deleteLayout(name) {
|
|
11275
10912
|
this.registry.delete(name);
|
|
11276
10913
|
};
|
|
11277
|
-
|
|
11278
10914
|
_createClass$1(DefaultLayoutRegistry, [{
|
|
11279
10915
|
key: "size",
|
|
11280
10916
|
get: function get() {
|
|
11281
10917
|
return this.registry.size;
|
|
11282
10918
|
}
|
|
11283
10919
|
}]);
|
|
11284
|
-
|
|
11285
10920
|
return DefaultLayoutRegistry;
|
|
11286
10921
|
}();
|
|
10922
|
+
DefaultLayoutRegistry.reservedLayout = [];
|
|
11287
10923
|
|
|
11288
|
-
|
|
10924
|
+
// import { LayoutEdges, LayoutEdgesOptions } from './LayoutEdges';
|
|
10925
|
+
// const layoutRegistry = new DefaultLayoutRegistry();
|
|
11289
10926
|
// const layoutEdgesFactory = (options: LayoutEdgesOptions) => {
|
|
11290
10927
|
// return new LayoutEdges(options);
|
|
11291
10928
|
// };
|
|
@@ -11354,7 +10991,6 @@
|
|
|
11354
10991
|
// // return layoutContext;
|
|
11355
10992
|
// }
|
|
11356
10993
|
// export const layoutEngine = new LayoutEngine(layoutRegistry);
|
|
11357
|
-
|
|
11358
10994
|
var layoutEngine = null;
|
|
11359
10995
|
|
|
11360
10996
|
var MutationRecord = /*#__PURE__*/function () {
|
|
@@ -11369,7 +11005,6 @@
|
|
|
11369
11005
|
record.oldValue = original.oldValue;
|
|
11370
11006
|
return record;
|
|
11371
11007
|
};
|
|
11372
|
-
|
|
11373
11008
|
function MutationRecord(type, target) {
|
|
11374
11009
|
this.type = void 0;
|
|
11375
11010
|
this.target = void 0;
|
|
@@ -11383,13 +11018,10 @@
|
|
|
11383
11018
|
this.type = type;
|
|
11384
11019
|
this.target = target;
|
|
11385
11020
|
}
|
|
11386
|
-
|
|
11387
11021
|
return MutationRecord;
|
|
11388
11022
|
}();
|
|
11389
|
-
|
|
11390
11023
|
var uidCounter = 0;
|
|
11391
11024
|
var registrationsTable = new WeakMap();
|
|
11392
|
-
|
|
11393
11025
|
var Registration = /*#__PURE__*/function () {
|
|
11394
11026
|
function Registration(observer, target, options) {
|
|
11395
11027
|
this.observer = void 0;
|
|
@@ -11400,20 +11032,17 @@
|
|
|
11400
11032
|
this.target = target;
|
|
11401
11033
|
this.options = options;
|
|
11402
11034
|
}
|
|
11403
|
-
|
|
11404
11035
|
var _proto = Registration.prototype;
|
|
11405
|
-
|
|
11406
11036
|
_proto.enqueue = function enqueue(record) {
|
|
11407
11037
|
var records = this.observer.records;
|
|
11408
|
-
var length = records.length;
|
|
11038
|
+
var length = records.length;
|
|
11039
|
+
// There are cases where we replace the last record with the new record.
|
|
11409
11040
|
// For example if the record represents the same mutation we need to use
|
|
11410
11041
|
// the one with the oldValue. If we get same record (this can happen as we
|
|
11411
11042
|
// walk up the tree) we ignore the new record.
|
|
11412
|
-
|
|
11413
11043
|
if (records.length > 0) {
|
|
11414
11044
|
var lastRecord = records[length - 1];
|
|
11415
11045
|
var recordToReplaceLast = selectRecord(lastRecord, record);
|
|
11416
|
-
|
|
11417
11046
|
if (recordToReplaceLast) {
|
|
11418
11047
|
records[length - 1] = recordToReplaceLast;
|
|
11419
11048
|
return;
|
|
@@ -11421,30 +11050,25 @@
|
|
|
11421
11050
|
} else {
|
|
11422
11051
|
scheduleCallback(this.observer);
|
|
11423
11052
|
}
|
|
11424
|
-
|
|
11425
11053
|
records[length] = record;
|
|
11426
11054
|
};
|
|
11427
|
-
|
|
11428
11055
|
_proto.addListeners = function addListeners() {
|
|
11429
11056
|
this.addListeners_(this.target);
|
|
11430
11057
|
};
|
|
11431
|
-
|
|
11432
11058
|
_proto.addListeners_ = function addListeners_(node) {
|
|
11433
11059
|
var options = this.options;
|
|
11434
|
-
if (options.attributes) node.addEventListener(exports.ElementEvent.ATTR_MODIFIED, this, true);
|
|
11435
|
-
|
|
11060
|
+
if (options.attributes) node.addEventListener(exports.ElementEvent.ATTR_MODIFIED, this, true);
|
|
11061
|
+
// if (options.characterData) node.addEventListener('DOMCharacterDataModified', this, true);
|
|
11436
11062
|
if (options.childList) node.addEventListener(exports.ElementEvent.INSERTED, this, true);
|
|
11437
11063
|
if (options.childList || options.subtree) node.addEventListener(exports.ElementEvent.REMOVED, this, true);
|
|
11438
11064
|
};
|
|
11439
|
-
|
|
11440
11065
|
_proto.removeListeners = function removeListeners() {
|
|
11441
11066
|
this.removeListeners_(this.target);
|
|
11442
11067
|
};
|
|
11443
|
-
|
|
11444
11068
|
_proto.removeListeners_ = function removeListeners_(node) {
|
|
11445
11069
|
var options = this.options;
|
|
11446
|
-
if (options.attributes) node.removeEventListener(exports.ElementEvent.ATTR_MODIFIED, this, true);
|
|
11447
|
-
|
|
11070
|
+
if (options.attributes) node.removeEventListener(exports.ElementEvent.ATTR_MODIFIED, this, true);
|
|
11071
|
+
// if (options.characterData) node.removeEventListener('DOMCharacterDataModified', this, true);
|
|
11448
11072
|
if (options.childList) node.removeEventListener(exports.ElementEvent.INSERTED, this, true);
|
|
11449
11073
|
if (options.childList || options.subtree) node.removeEventListener(exports.ElementEvent.REMOVED, this, true);
|
|
11450
11074
|
}
|
|
@@ -11473,18 +11097,16 @@
|
|
|
11473
11097
|
// Transient observers are never added to the target.
|
|
11474
11098
|
this.removeListeners_(node);
|
|
11475
11099
|
var registrations = registrationsTable.get(node);
|
|
11476
|
-
|
|
11477
11100
|
for (var i = 0; i < registrations.length; i++) {
|
|
11478
11101
|
if (registrations[i] === this) {
|
|
11479
|
-
registrations.splice(i, 1);
|
|
11102
|
+
registrations.splice(i, 1);
|
|
11103
|
+
// Each node can only have one registered observer associated with
|
|
11480
11104
|
// this observer.
|
|
11481
|
-
|
|
11482
11105
|
break;
|
|
11483
11106
|
}
|
|
11484
11107
|
}
|
|
11485
11108
|
}, this);
|
|
11486
11109
|
};
|
|
11487
|
-
|
|
11488
11110
|
_proto.handleEvent = function handleEvent(e) {
|
|
11489
11111
|
// Stop propagation since we are managing the propagation manually.
|
|
11490
11112
|
// This means that other mutation events on the page will not work
|
|
@@ -11492,31 +11114,29 @@
|
|
|
11492
11114
|
e.stopImmediatePropagation();
|
|
11493
11115
|
var record;
|
|
11494
11116
|
var target;
|
|
11495
|
-
|
|
11496
11117
|
switch (e.type) {
|
|
11497
11118
|
case exports.ElementEvent.ATTR_MODIFIED:
|
|
11498
11119
|
// http://dom.spec.whatwg.org/#concept-mo-queue-attributes
|
|
11499
|
-
var name = e.attrName;
|
|
11500
|
-
|
|
11120
|
+
var name = e.attrName;
|
|
11121
|
+
// @ts-ignore
|
|
11501
11122
|
var namespace = e.relatedNode.namespaceURI;
|
|
11502
|
-
target = e.target;
|
|
11503
|
-
|
|
11123
|
+
target = e.target;
|
|
11124
|
+
// 1.
|
|
11504
11125
|
record = getRecord('attributes', target);
|
|
11505
11126
|
record.attributeName = name;
|
|
11506
|
-
record.attributeNamespace = namespace;
|
|
11507
|
-
|
|
11127
|
+
record.attributeNamespace = namespace;
|
|
11128
|
+
// 2.
|
|
11508
11129
|
var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
|
|
11509
11130
|
forEachAncestorAndObserverEnqueueRecord(target, function (options) {
|
|
11510
11131
|
// 3.1, 4.2
|
|
11511
|
-
if (!options.attributes) return;
|
|
11512
|
-
|
|
11132
|
+
if (!options.attributes) return;
|
|
11133
|
+
// 3.2, 4.3
|
|
11513
11134
|
if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
|
|
11514
11135
|
return;
|
|
11515
|
-
}
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11136
|
+
}
|
|
11137
|
+
// 3.3, 4.4
|
|
11138
|
+
if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
|
|
11139
|
+
// 3.4, 4.5
|
|
11520
11140
|
return record;
|
|
11521
11141
|
});
|
|
11522
11142
|
break;
|
|
@@ -11538,17 +11158,15 @@
|
|
|
11538
11158
|
// return record;
|
|
11539
11159
|
// });
|
|
11540
11160
|
// break;
|
|
11541
|
-
|
|
11542
|
-
|
|
11161
|
+
case exports.ElementEvent.REMOVED:
|
|
11162
|
+
// this.addTransientObserver(e.target as IElement);
|
|
11543
11163
|
// Fall through.
|
|
11544
|
-
|
|
11545
11164
|
case exports.ElementEvent.INSERTED:
|
|
11546
11165
|
// http://dom.spec.whatwg.org/#concept-mo-queue-childlist
|
|
11547
11166
|
target = e.relatedNode;
|
|
11548
11167
|
var changedNode = e.target;
|
|
11549
11168
|
var addedNodes;
|
|
11550
11169
|
var removedNodes;
|
|
11551
|
-
|
|
11552
11170
|
if (e.type === exports.ElementEvent.INSERTED) {
|
|
11553
11171
|
addedNodes = [changedNode];
|
|
11554
11172
|
removedNodes = [];
|
|
@@ -11556,10 +11174,9 @@
|
|
|
11556
11174
|
addedNodes = [];
|
|
11557
11175
|
removedNodes = [changedNode];
|
|
11558
11176
|
}
|
|
11559
|
-
|
|
11560
11177
|
var previousSibling = changedNode.previousSibling;
|
|
11561
|
-
var nextSibling = changedNode.nextSibling;
|
|
11562
|
-
|
|
11178
|
+
var nextSibling = changedNode.nextSibling;
|
|
11179
|
+
// 1.
|
|
11563
11180
|
record = getRecord('childList', target);
|
|
11564
11181
|
record.addedNodes = addedNodes;
|
|
11565
11182
|
record.removedNodes = removedNodes;
|
|
@@ -11567,23 +11184,19 @@
|
|
|
11567
11184
|
record.nextSibling = nextSibling;
|
|
11568
11185
|
forEachAncestorAndObserverEnqueueRecord(target, function (options) {
|
|
11569
11186
|
// 2.1, 3.2
|
|
11570
|
-
if (!options.childList) return;
|
|
11571
|
-
|
|
11187
|
+
if (!options.childList) return;
|
|
11188
|
+
// 2.2, 3.3
|
|
11572
11189
|
return record;
|
|
11573
11190
|
});
|
|
11574
11191
|
}
|
|
11575
|
-
|
|
11576
11192
|
clearRecords();
|
|
11577
11193
|
};
|
|
11578
|
-
|
|
11579
11194
|
return Registration;
|
|
11580
11195
|
}();
|
|
11581
11196
|
/**
|
|
11582
11197
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
|
|
11583
11198
|
* @see https://github.com/googlearchive/MutationObservers/blob/master/MutationObserver.js
|
|
11584
11199
|
*/
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
11200
|
var MutationObserver = /*#__PURE__*/function () {
|
|
11588
11201
|
function MutationObserver(callback) {
|
|
11589
11202
|
this.callback = void 0;
|
|
@@ -11592,26 +11205,25 @@
|
|
|
11592
11205
|
this.uid = uidCounter++;
|
|
11593
11206
|
this.callback = callback;
|
|
11594
11207
|
}
|
|
11595
|
-
|
|
11596
11208
|
var _proto2 = MutationObserver.prototype;
|
|
11597
|
-
|
|
11598
11209
|
_proto2.observe = function observe(target, options) {
|
|
11599
11210
|
// 1.1
|
|
11600
|
-
if (!options.childList && !options.attributes && !options.characterData ||
|
|
11601
|
-
|
|
11602
|
-
options.
|
|
11211
|
+
if (!options.childList && !options.attributes && !options.characterData ||
|
|
11212
|
+
// 1.2
|
|
11213
|
+
options.attributeOldValue && !options.attributes ||
|
|
11214
|
+
// 1.3
|
|
11215
|
+
options.attributeFilter && options.attributeFilter.length && !options.attributes ||
|
|
11216
|
+
// 1.4
|
|
11603
11217
|
options.characterDataOldValue && !options.characterData) {
|
|
11604
11218
|
throw new SyntaxError();
|
|
11605
11219
|
}
|
|
11606
|
-
|
|
11607
11220
|
var registrations = registrationsTable.get(target);
|
|
11608
|
-
if (!registrations) registrationsTable.set(target, registrations = []);
|
|
11221
|
+
if (!registrations) registrationsTable.set(target, registrations = []);
|
|
11222
|
+
// 2
|
|
11609
11223
|
// If target's list of registered observers already includes a registered
|
|
11610
11224
|
// observer associated with the context object, replace that registered
|
|
11611
11225
|
// observer's options with options.
|
|
11612
|
-
|
|
11613
11226
|
var registration;
|
|
11614
|
-
|
|
11615
11227
|
for (var i = 0; i < registrations.length; i++) {
|
|
11616
11228
|
if (registrations[i].observer === this) {
|
|
11617
11229
|
registration = registrations[i];
|
|
@@ -11619,75 +11231,62 @@
|
|
|
11619
11231
|
registration.options = options;
|
|
11620
11232
|
break;
|
|
11621
11233
|
}
|
|
11622
|
-
}
|
|
11234
|
+
}
|
|
11235
|
+
// 3.
|
|
11623
11236
|
// Otherwise, add a new registered observer to target's list of registered
|
|
11624
11237
|
// observers with the context object as the observer and options as the
|
|
11625
11238
|
// options, and add target to context object's list of nodes on which it
|
|
11626
11239
|
// is registered.
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
11240
|
if (!registration) {
|
|
11630
11241
|
registration = new Registration(this, target, options);
|
|
11631
11242
|
registrations.push(registration);
|
|
11632
11243
|
this.nodes.push(target);
|
|
11633
11244
|
}
|
|
11634
|
-
|
|
11635
11245
|
registration.addListeners();
|
|
11636
11246
|
};
|
|
11637
|
-
|
|
11638
11247
|
_proto2.disconnect = function disconnect() {
|
|
11639
11248
|
var _this = this;
|
|
11640
|
-
|
|
11641
11249
|
this.nodes.forEach(function (node) {
|
|
11642
11250
|
var registrations = registrationsTable.get(node);
|
|
11643
|
-
|
|
11644
11251
|
for (var i = 0; i < registrations.length; i++) {
|
|
11645
11252
|
var registration = registrations[i];
|
|
11646
|
-
|
|
11647
11253
|
if (registration.observer === _this) {
|
|
11648
11254
|
registration.removeListeners();
|
|
11649
|
-
registrations.splice(i, 1);
|
|
11255
|
+
registrations.splice(i, 1);
|
|
11256
|
+
// Each node can only have one registered observer associated with
|
|
11650
11257
|
// this observer.
|
|
11651
|
-
|
|
11652
11258
|
break;
|
|
11653
11259
|
}
|
|
11654
11260
|
}
|
|
11655
11261
|
}, this);
|
|
11656
11262
|
this.records = [];
|
|
11657
11263
|
};
|
|
11658
|
-
|
|
11659
11264
|
_proto2.takeRecords = function takeRecords() {
|
|
11660
11265
|
var copyOfRecords = this.records;
|
|
11661
11266
|
this.records = [];
|
|
11662
11267
|
return copyOfRecords;
|
|
11663
11268
|
};
|
|
11664
|
-
|
|
11665
11269
|
return MutationObserver;
|
|
11666
|
-
}();
|
|
11667
|
-
|
|
11668
|
-
|
|
11270
|
+
}();
|
|
11271
|
+
// We keep track of the two (possibly one) records used in a single mutation.
|
|
11669
11272
|
var currentRecord;
|
|
11670
11273
|
var recordWithOldValue;
|
|
11671
11274
|
/**
|
|
11672
11275
|
* Creates a record without |oldValue| and caches it as |currentRecord| for
|
|
11673
11276
|
* later use.
|
|
11674
11277
|
*/
|
|
11675
|
-
|
|
11676
11278
|
function getRecord(type, target) {
|
|
11677
11279
|
return currentRecord = new MutationRecord(type, target);
|
|
11678
11280
|
}
|
|
11679
11281
|
/**
|
|
11680
11282
|
* Gets or creates a record with |oldValue| based in the |currentRecord|
|
|
11681
11283
|
*/
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
11284
|
function getRecordWithOldValue(oldValue) {
|
|
11685
11285
|
if (recordWithOldValue) return recordWithOldValue;
|
|
11686
11286
|
recordWithOldValue = MutationRecord.copy(currentRecord);
|
|
11687
11287
|
recordWithOldValue.oldValue = oldValue;
|
|
11688
11288
|
return recordWithOldValue;
|
|
11689
11289
|
}
|
|
11690
|
-
|
|
11691
11290
|
function clearRecords() {
|
|
11692
11291
|
currentRecord = recordWithOldValue = undefined;
|
|
11693
11292
|
}
|
|
@@ -11695,8 +11294,6 @@
|
|
|
11695
11294
|
* Whether the record represents a record from the current
|
|
11696
11295
|
* mutation event.
|
|
11697
11296
|
*/
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
11297
|
function recordRepresentsCurrentMutation(record) {
|
|
11701
11298
|
return record === recordWithOldValue || record === currentRecord;
|
|
11702
11299
|
}
|
|
@@ -11704,16 +11301,13 @@
|
|
|
11704
11301
|
* Selects which record, if any, to replace the last record in the queue.
|
|
11705
11302
|
* This returns |null| if no record should be replaced.
|
|
11706
11303
|
*/
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
11304
|
function selectRecord(lastRecord, newRecord) {
|
|
11710
|
-
if (lastRecord === newRecord) return lastRecord;
|
|
11305
|
+
if (lastRecord === newRecord) return lastRecord;
|
|
11306
|
+
// Check if the the record we are adding represents the same record. If
|
|
11711
11307
|
// so, we keep the one with the oldValue in it.
|
|
11712
|
-
|
|
11713
11308
|
if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
|
|
11714
11309
|
return null;
|
|
11715
11310
|
}
|
|
11716
|
-
|
|
11717
11311
|
function removeTransientObserversFor(observer) {
|
|
11718
11312
|
observer.nodes.forEach(function (node) {
|
|
11719
11313
|
var registrations = registrationsTable.get(node);
|
|
@@ -11735,39 +11329,33 @@
|
|
|
11735
11329
|
* @param {Node} target
|
|
11736
11330
|
* @param {function(MutationObserverInit):MutationRecord} callback
|
|
11737
11331
|
*/
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
11332
|
function forEachAncestorAndObserverEnqueueRecord(target, callback) {
|
|
11741
11333
|
for (var node = target; node; node = node.parentNode) {
|
|
11742
11334
|
var registrations = registrationsTable.get(node);
|
|
11743
|
-
|
|
11744
11335
|
if (registrations) {
|
|
11745
11336
|
for (var j = 0; j < registrations.length; j++) {
|
|
11746
11337
|
var registration = registrations[j];
|
|
11747
|
-
var options = registration.options;
|
|
11748
|
-
|
|
11338
|
+
var options = registration.options;
|
|
11339
|
+
// Only target ignores subtree.
|
|
11749
11340
|
if (node !== target && !options.subtree) continue;
|
|
11750
11341
|
var record = callback(options);
|
|
11751
11342
|
if (record) registration.enqueue(record);
|
|
11752
11343
|
}
|
|
11753
11344
|
}
|
|
11754
11345
|
}
|
|
11755
|
-
}
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11346
|
+
}
|
|
11347
|
+
// This is used to ensure that we never schedule 2 callas to setImmediate
|
|
11348
|
+
var isScheduled = false;
|
|
11349
|
+
// Keep track of observers that needs to be notified next time.
|
|
11760
11350
|
var scheduledObservers = [];
|
|
11761
11351
|
/**
|
|
11762
11352
|
* Schedules |dispatchCallback| to be called in the future.
|
|
11763
11353
|
*/
|
|
11764
|
-
|
|
11765
11354
|
function scheduleCallback(observer) {
|
|
11766
11355
|
scheduledObservers.push(observer);
|
|
11767
|
-
|
|
11768
11356
|
if (!isScheduled) {
|
|
11769
|
-
isScheduled = true;
|
|
11770
|
-
|
|
11357
|
+
isScheduled = true;
|
|
11358
|
+
// setImmediate(dispatchCallbacks);
|
|
11771
11359
|
if (typeof globalThis !== 'undefined') {
|
|
11772
11360
|
globalThis.setTimeout(dispatchCallbacks);
|
|
11773
11361
|
} else {
|
|
@@ -11775,31 +11363,29 @@
|
|
|
11775
11363
|
}
|
|
11776
11364
|
}
|
|
11777
11365
|
}
|
|
11778
|
-
|
|
11779
11366
|
function dispatchCallbacks() {
|
|
11780
11367
|
// http://dom.spec.whatwg.org/#mutation-observers
|
|
11781
11368
|
isScheduled = false; // Used to allow a new setImmediate call above.
|
|
11782
|
-
|
|
11783
11369
|
var observers = scheduledObservers;
|
|
11784
|
-
scheduledObservers = [];
|
|
11785
|
-
|
|
11370
|
+
scheduledObservers = [];
|
|
11371
|
+
// Sort observers based on their creation UID (incremental).
|
|
11786
11372
|
observers.sort(function (o1, o2) {
|
|
11787
11373
|
return o1.uid - o2.uid;
|
|
11788
11374
|
});
|
|
11789
11375
|
var anyNonEmpty = false;
|
|
11790
11376
|
observers.forEach(function (observer) {
|
|
11791
11377
|
// 2.1, 2.2
|
|
11792
|
-
var queue = observer.takeRecords();
|
|
11793
|
-
|
|
11794
|
-
removeTransientObserversFor(observer);
|
|
11795
|
-
|
|
11378
|
+
var queue = observer.takeRecords();
|
|
11379
|
+
// 2.3. Remove all transient registered observers whose observer is mo.
|
|
11380
|
+
removeTransientObserversFor(observer);
|
|
11381
|
+
// 2.4
|
|
11796
11382
|
if (queue.length) {
|
|
11797
11383
|
// @ts-ignore
|
|
11798
11384
|
observer.callback(queue, observer);
|
|
11799
11385
|
anyNonEmpty = true;
|
|
11800
11386
|
}
|
|
11801
|
-
});
|
|
11802
|
-
|
|
11387
|
+
});
|
|
11388
|
+
// 3.
|
|
11803
11389
|
if (anyNonEmpty) dispatchCallbacks();
|
|
11804
11390
|
}
|
|
11805
11391
|
|
|
@@ -11812,7 +11398,6 @@
|
|
|
11812
11398
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
11813
11399
|
}
|
|
11814
11400
|
}
|
|
11815
|
-
|
|
11816
11401
|
function _createClass$2(Constructor, protoProps, staticProps) {
|
|
11817
11402
|
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
11818
11403
|
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
@@ -11821,14 +11406,11 @@
|
|
|
11821
11406
|
});
|
|
11822
11407
|
return Constructor;
|
|
11823
11408
|
}
|
|
11824
|
-
|
|
11825
11409
|
function _inheritsLoose$2(subClass, superClass) {
|
|
11826
11410
|
subClass.prototype = Object.create(superClass.prototype);
|
|
11827
11411
|
subClass.prototype.constructor = subClass;
|
|
11828
|
-
|
|
11829
11412
|
_setPrototypeOf$2(subClass, superClass);
|
|
11830
11413
|
}
|
|
11831
|
-
|
|
11832
11414
|
function _setPrototypeOf$2(o, p) {
|
|
11833
11415
|
_setPrototypeOf$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
11834
11416
|
o.__proto__ = p;
|
|
@@ -11836,27 +11418,24 @@
|
|
|
11836
11418
|
};
|
|
11837
11419
|
return _setPrototypeOf$2(o, p);
|
|
11838
11420
|
}
|
|
11421
|
+
|
|
11839
11422
|
/**
|
|
11840
11423
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationPlaybackEvent
|
|
11841
11424
|
*/
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
11425
|
var AnimationEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
11845
11426
|
_inheritsLoose$2(AnimationEvent, _FederatedEvent);
|
|
11846
|
-
|
|
11847
11427
|
function AnimationEvent(manager, target, currentTime, timelineTime) {
|
|
11848
11428
|
var _this;
|
|
11849
|
-
|
|
11850
11429
|
_this = _FederatedEvent.call(this, manager) || this;
|
|
11851
11430
|
_this.currentTime = void 0;
|
|
11852
11431
|
_this.timelineTime = void 0;
|
|
11853
11432
|
_this.currentTime = currentTime;
|
|
11854
|
-
_this.timelineTime = timelineTime;
|
|
11855
|
-
|
|
11433
|
+
_this.timelineTime = timelineTime;
|
|
11434
|
+
// @ts-ignore
|
|
11856
11435
|
_this.target = target;
|
|
11857
11436
|
_this.type = 'finish';
|
|
11858
|
-
_this.bubbles = false;
|
|
11859
|
-
|
|
11437
|
+
_this.bubbles = false;
|
|
11438
|
+
// @ts-ignore
|
|
11860
11439
|
_this.currentTarget = target;
|
|
11861
11440
|
_this.defaultPrevented = false;
|
|
11862
11441
|
_this.eventPhase = _this.AT_TARGET;
|
|
@@ -11865,19 +11444,15 @@
|
|
|
11865
11444
|
_this.timelineTime = timelineTime;
|
|
11866
11445
|
return _this;
|
|
11867
11446
|
}
|
|
11868
|
-
|
|
11869
11447
|
return AnimationEvent;
|
|
11870
11448
|
}(FederatedEvent);
|
|
11871
|
-
|
|
11872
11449
|
var sequenceNumber = 0;
|
|
11873
11450
|
/**
|
|
11874
11451
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/Animation
|
|
11875
11452
|
*/
|
|
11876
|
-
|
|
11877
11453
|
var Animation = /*#__PURE__*/function () {
|
|
11878
11454
|
function Animation(effect, timeline) {
|
|
11879
11455
|
var _this$effect;
|
|
11880
|
-
|
|
11881
11456
|
this.effect = void 0;
|
|
11882
11457
|
this.timeline = void 0;
|
|
11883
11458
|
this.id = void 0;
|
|
@@ -11918,14 +11493,10 @@
|
|
|
11918
11493
|
* state machine,
|
|
11919
11494
|
* resolve/reject ready/finished Promise according to current state
|
|
11920
11495
|
*/
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
11496
|
var _proto = Animation.prototype;
|
|
11924
|
-
|
|
11925
11497
|
_proto.updatePromises = function updatePromises() {
|
|
11926
11498
|
var oldPlayState = this.oldPlayState;
|
|
11927
11499
|
var newPlayState = this.pending ? 'pending' : this.playState;
|
|
11928
|
-
|
|
11929
11500
|
if (this.readyPromise && newPlayState !== oldPlayState) {
|
|
11930
11501
|
if (newPlayState === 'idle') {
|
|
11931
11502
|
this.rejectReadyPromise();
|
|
@@ -11936,7 +11507,6 @@
|
|
|
11936
11507
|
this.readyPromise = undefined;
|
|
11937
11508
|
}
|
|
11938
11509
|
}
|
|
11939
|
-
|
|
11940
11510
|
if (this.finishedPromise && newPlayState !== oldPlayState) {
|
|
11941
11511
|
if (newPlayState === 'idle') {
|
|
11942
11512
|
this.rejectFinishedPromise();
|
|
@@ -11947,51 +11517,40 @@
|
|
|
11947
11517
|
this.finishedPromise = undefined;
|
|
11948
11518
|
}
|
|
11949
11519
|
}
|
|
11950
|
-
|
|
11951
11520
|
this.oldPlayState = newPlayState;
|
|
11952
11521
|
return this.readyPromise || this.finishedPromise;
|
|
11953
11522
|
};
|
|
11954
|
-
|
|
11955
11523
|
_proto.play = function play() {
|
|
11956
11524
|
this.updatePromises();
|
|
11957
11525
|
this._paused = false;
|
|
11958
|
-
|
|
11959
11526
|
if (this._isFinished || this._idle) {
|
|
11960
11527
|
this.rewind();
|
|
11961
11528
|
this._startTime = null;
|
|
11962
11529
|
}
|
|
11963
|
-
|
|
11964
11530
|
this._finishedFlag = false;
|
|
11965
11531
|
this._idle = false;
|
|
11966
11532
|
this.ensureAlive();
|
|
11967
11533
|
this.timeline.applyDirtiedAnimation(this);
|
|
11968
|
-
|
|
11969
11534
|
if (this.timeline.animations.indexOf(this) === -1) {
|
|
11970
11535
|
this.timeline.animations.push(this);
|
|
11971
11536
|
}
|
|
11972
|
-
|
|
11973
11537
|
this.updatePromises();
|
|
11974
11538
|
};
|
|
11975
|
-
|
|
11976
11539
|
_proto.pause = function pause() {
|
|
11977
11540
|
this.updatePromises();
|
|
11978
|
-
|
|
11979
11541
|
if (this.currentTime) {
|
|
11980
11542
|
this._holdTime = this.currentTime;
|
|
11981
11543
|
}
|
|
11982
|
-
|
|
11983
11544
|
if (!this._isFinished && !this._paused && !this._idle) {
|
|
11984
11545
|
this.currentTimePending = true;
|
|
11985
11546
|
} else if (this._idle) {
|
|
11986
11547
|
this.rewind();
|
|
11987
11548
|
this._idle = false;
|
|
11988
11549
|
}
|
|
11989
|
-
|
|
11990
11550
|
this._startTime = null;
|
|
11991
11551
|
this._paused = true;
|
|
11992
11552
|
this.updatePromises();
|
|
11993
11553
|
};
|
|
11994
|
-
|
|
11995
11554
|
_proto.finish = function finish() {
|
|
11996
11555
|
this.updatePromises();
|
|
11997
11556
|
if (this._idle) return;
|
|
@@ -12001,7 +11560,6 @@
|
|
|
12001
11560
|
this.timeline.applyDirtiedAnimation(this);
|
|
12002
11561
|
this.updatePromises();
|
|
12003
11562
|
};
|
|
12004
|
-
|
|
12005
11563
|
_proto.cancel = function cancel() {
|
|
12006
11564
|
this.updatePromises();
|
|
12007
11565
|
if (!this._inEffect) return;
|
|
@@ -12011,58 +11569,46 @@
|
|
|
12011
11569
|
this._finishedFlag = true;
|
|
12012
11570
|
this._currentTime = 0;
|
|
12013
11571
|
this._startTime = null;
|
|
12014
|
-
this.effect.update(null);
|
|
11572
|
+
this.effect.update(null);
|
|
11573
|
+
// effects are invalid after cancellation as the animation state
|
|
12015
11574
|
// needs to un-apply.
|
|
12016
|
-
|
|
12017
11575
|
this.timeline.applyDirtiedAnimation(this);
|
|
12018
11576
|
this.updatePromises();
|
|
12019
11577
|
};
|
|
12020
|
-
|
|
12021
11578
|
_proto.reverse = function reverse() {
|
|
12022
11579
|
this.updatePromises();
|
|
12023
11580
|
var oldCurrentTime = this.currentTime;
|
|
12024
11581
|
this.playbackRate *= -1;
|
|
12025
11582
|
this.play();
|
|
12026
|
-
|
|
12027
11583
|
if (oldCurrentTime !== null) {
|
|
12028
11584
|
this.currentTime = oldCurrentTime;
|
|
12029
11585
|
}
|
|
12030
|
-
|
|
12031
11586
|
this.updatePromises();
|
|
12032
11587
|
}
|
|
12033
11588
|
/**
|
|
12034
11589
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/updatePlaybackRate
|
|
12035
|
-
|
|
12036
|
-
;
|
|
12037
|
-
|
|
11590
|
+
*/;
|
|
12038
11591
|
_proto.updatePlaybackRate = function updatePlaybackRate(playbackRate) {
|
|
12039
11592
|
this.playbackRate = playbackRate;
|
|
12040
11593
|
};
|
|
12041
|
-
|
|
12042
11594
|
_proto.targetAnimations = function targetAnimations() {
|
|
12043
11595
|
var _this$effect2;
|
|
12044
|
-
|
|
12045
11596
|
var target = (_this$effect2 = this.effect) === null || _this$effect2 === void 0 ? void 0 : _this$effect2.target;
|
|
12046
11597
|
return target.getAnimations();
|
|
12047
11598
|
};
|
|
12048
|
-
|
|
12049
11599
|
_proto.markTarget = function markTarget() {
|
|
12050
11600
|
var animations = this.targetAnimations();
|
|
12051
|
-
|
|
12052
11601
|
if (animations.indexOf(this) === -1) {
|
|
12053
11602
|
animations.push(this);
|
|
12054
11603
|
}
|
|
12055
11604
|
};
|
|
12056
|
-
|
|
12057
11605
|
_proto.unmarkTarget = function unmarkTarget() {
|
|
12058
11606
|
var animations = this.targetAnimations();
|
|
12059
11607
|
var index = animations.indexOf(this);
|
|
12060
|
-
|
|
12061
11608
|
if (index !== -1) {
|
|
12062
11609
|
animations.splice(index, 1);
|
|
12063
11610
|
}
|
|
12064
11611
|
};
|
|
12065
|
-
|
|
12066
11612
|
_proto.tick = function tick(timelineTime, isAnimationFrame) {
|
|
12067
11613
|
if (!this._idle && !this._paused) {
|
|
12068
11614
|
if (this._startTime === null) {
|
|
@@ -12073,13 +11619,11 @@
|
|
|
12073
11619
|
this.tickCurrentTime((timelineTime - this._startTime) * this.playbackRate);
|
|
12074
11620
|
}
|
|
12075
11621
|
}
|
|
12076
|
-
|
|
12077
11622
|
if (isAnimationFrame) {
|
|
12078
11623
|
this.currentTimePending = false;
|
|
12079
11624
|
this.fireEvents(timelineTime);
|
|
12080
11625
|
}
|
|
12081
11626
|
};
|
|
12082
|
-
|
|
12083
11627
|
_proto.rewind = function rewind() {
|
|
12084
11628
|
if (this.playbackRate >= 0) {
|
|
12085
11629
|
this.currentTime = 0;
|
|
@@ -12089,66 +11633,58 @@
|
|
|
12089
11633
|
throw new Error('Unable to rewind negative playback rate animation with infinite duration');
|
|
12090
11634
|
}
|
|
12091
11635
|
};
|
|
12092
|
-
|
|
12093
11636
|
_proto.persist = function persist() {
|
|
12094
11637
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
12095
|
-
}
|
|
11638
|
+
}
|
|
11639
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12096
11640
|
;
|
|
12097
11641
|
|
|
12098
11642
|
_proto.addEventListener = function addEventListener(type, listener, options) {
|
|
12099
11643
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
12100
|
-
}
|
|
11644
|
+
}
|
|
11645
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12101
11646
|
;
|
|
12102
11647
|
|
|
12103
11648
|
_proto.removeEventListener = function removeEventListener(type, listener, options) {
|
|
12104
11649
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
12105
|
-
}
|
|
11650
|
+
}
|
|
11651
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12106
11652
|
;
|
|
12107
11653
|
|
|
12108
11654
|
_proto.dispatchEvent = function dispatchEvent(event) {
|
|
12109
11655
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
12110
|
-
};
|
|
12111
|
-
|
|
12112
|
-
|
|
11656
|
+
};
|
|
11657
|
+
// replaceState: AnimationReplaceState;
|
|
12113
11658
|
_proto.commitStyles = function commitStyles() {
|
|
12114
11659
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
12115
11660
|
};
|
|
12116
|
-
|
|
12117
11661
|
_proto.ensureAlive = function ensureAlive() {
|
|
12118
11662
|
// If an animation is playing backwards and is not fill backwards/both
|
|
12119
11663
|
// then it should go out of effect when it reaches the start of its
|
|
12120
11664
|
// active interval (currentTime === 0).
|
|
12121
11665
|
if (this.playbackRate < 0 && this.currentTime === 0) {
|
|
12122
11666
|
var _this$effect3;
|
|
12123
|
-
|
|
12124
11667
|
this._inEffect = !!((_this$effect3 = this.effect) === null || _this$effect3 === void 0 ? void 0 : _this$effect3.update(-1));
|
|
12125
11668
|
} else {
|
|
12126
11669
|
var _this$effect4;
|
|
12127
|
-
|
|
12128
11670
|
this._inEffect = !!((_this$effect4 = this.effect) === null || _this$effect4 === void 0 ? void 0 : _this$effect4.update(this.currentTime));
|
|
12129
11671
|
}
|
|
12130
|
-
|
|
12131
11672
|
if (!this._inTimeline && (this._inEffect || !this._finishedFlag)) {
|
|
12132
11673
|
this._inTimeline = true;
|
|
12133
11674
|
this.timeline.animations.push(this);
|
|
12134
11675
|
}
|
|
12135
11676
|
};
|
|
12136
|
-
|
|
12137
11677
|
_proto.tickCurrentTime = function tickCurrentTime(newTime, ignoreLimit) {
|
|
12138
11678
|
if (newTime !== this._currentTime) {
|
|
12139
11679
|
this._currentTime = newTime;
|
|
12140
|
-
|
|
12141
11680
|
if (this._isFinished && !ignoreLimit) {
|
|
12142
11681
|
this._currentTime = this._playbackRate > 0 ? this._totalDuration : 0;
|
|
12143
11682
|
}
|
|
12144
|
-
|
|
12145
11683
|
this.ensureAlive();
|
|
12146
11684
|
}
|
|
12147
11685
|
};
|
|
12148
|
-
|
|
12149
11686
|
_proto.fireEvents = function fireEvents(baseTime) {
|
|
12150
11687
|
var _this = this;
|
|
12151
|
-
|
|
12152
11688
|
if (this._isFinished) {
|
|
12153
11689
|
if (!this._finishedFlag) {
|
|
12154
11690
|
if (this.onfinish) {
|
|
@@ -12159,20 +11695,16 @@
|
|
|
12159
11695
|
}
|
|
12160
11696
|
});
|
|
12161
11697
|
}
|
|
12162
|
-
|
|
12163
11698
|
this._finishedFlag = true;
|
|
12164
11699
|
}
|
|
12165
11700
|
} else {
|
|
12166
11701
|
if (this.onframe && this.playState === 'running') {
|
|
12167
11702
|
var _event = new AnimationEvent(null, this, this.currentTime, baseTime);
|
|
12168
|
-
|
|
12169
11703
|
this.onframe(_event);
|
|
12170
11704
|
}
|
|
12171
|
-
|
|
12172
11705
|
this._finishedFlag = false;
|
|
12173
11706
|
}
|
|
12174
11707
|
};
|
|
12175
|
-
|
|
12176
11708
|
_createClass$2(Animation, [{
|
|
12177
11709
|
key: "pending",
|
|
12178
11710
|
get:
|
|
@@ -12187,8 +11719,8 @@
|
|
|
12187
11719
|
/**
|
|
12188
11720
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/id
|
|
12189
11721
|
*/
|
|
12190
|
-
// animation: InternalAnimation | null;
|
|
12191
11722
|
|
|
11723
|
+
// animation: InternalAnimation | null;
|
|
12192
11724
|
/**
|
|
12193
11725
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/pending
|
|
12194
11726
|
*/
|
|
@@ -12206,7 +11738,6 @@
|
|
|
12206
11738
|
/**
|
|
12207
11739
|
* record previos state
|
|
12208
11740
|
*/
|
|
12209
|
-
|
|
12210
11741
|
}, {
|
|
12211
11742
|
key: "ready",
|
|
12212
11743
|
get:
|
|
@@ -12222,27 +11753,22 @@
|
|
|
12222
11753
|
*/
|
|
12223
11754
|
function get() {
|
|
12224
11755
|
var _this2 = this;
|
|
12225
|
-
|
|
12226
11756
|
if (!this.readyPromise) {
|
|
12227
11757
|
if (this.timeline.animationsWithPromises.indexOf(this) === -1) {
|
|
12228
11758
|
this.timeline.animationsWithPromises.push(this);
|
|
12229
11759
|
}
|
|
12230
|
-
|
|
12231
11760
|
this.readyPromise = new Promise(function (resolve, reject) {
|
|
12232
11761
|
_this2.resolveReadyPromise = function () {
|
|
12233
11762
|
resolve(_this2);
|
|
12234
11763
|
};
|
|
12235
|
-
|
|
12236
11764
|
_this2.rejectReadyPromise = function () {
|
|
12237
11765
|
reject(new Error());
|
|
12238
11766
|
};
|
|
12239
11767
|
});
|
|
12240
|
-
|
|
12241
11768
|
if (!this.pending) {
|
|
12242
11769
|
this.resolveReadyPromise();
|
|
12243
11770
|
}
|
|
12244
11771
|
}
|
|
12245
|
-
|
|
12246
11772
|
return this.readyPromise;
|
|
12247
11773
|
}
|
|
12248
11774
|
/**
|
|
@@ -12260,38 +11786,31 @@
|
|
|
12260
11786
|
}
|
|
12261
11787
|
);
|
|
12262
11788
|
*/
|
|
12263
|
-
|
|
12264
11789
|
}, {
|
|
12265
11790
|
key: "finished",
|
|
12266
11791
|
get: function get() {
|
|
12267
11792
|
var _this3 = this;
|
|
12268
|
-
|
|
12269
11793
|
if (!this.finishedPromise) {
|
|
12270
11794
|
if (this.timeline.animationsWithPromises.indexOf(this) === -1) {
|
|
12271
11795
|
this.timeline.animationsWithPromises.push(this);
|
|
12272
11796
|
}
|
|
12273
|
-
|
|
12274
11797
|
this.finishedPromise = new Promise(function (resolve, reject) {
|
|
12275
11798
|
_this3.resolveFinishedPromise = function () {
|
|
12276
11799
|
resolve(_this3);
|
|
12277
11800
|
};
|
|
12278
|
-
|
|
12279
11801
|
_this3.rejectFinishedPromise = function () {
|
|
12280
11802
|
reject(new Error());
|
|
12281
11803
|
};
|
|
12282
11804
|
});
|
|
12283
|
-
|
|
12284
11805
|
if (this.playState === 'finished') {
|
|
12285
11806
|
this.resolveFinishedPromise();
|
|
12286
11807
|
}
|
|
12287
11808
|
}
|
|
12288
|
-
|
|
12289
11809
|
return this.finishedPromise;
|
|
12290
11810
|
}
|
|
12291
11811
|
/**
|
|
12292
11812
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/onfinish
|
|
12293
11813
|
*/
|
|
12294
|
-
|
|
12295
11814
|
}, {
|
|
12296
11815
|
key: "currentTime",
|
|
12297
11816
|
get:
|
|
@@ -12306,31 +11825,24 @@
|
|
|
12306
11825
|
newTime = Number(newTime);
|
|
12307
11826
|
if (isNaN(newTime)) return;
|
|
12308
11827
|
this.timeline.restart();
|
|
12309
|
-
|
|
12310
11828
|
if (!this._paused && this._startTime !== null) {
|
|
12311
11829
|
var _this$timeline;
|
|
12312
|
-
|
|
12313
11830
|
this._startTime = Number((_this$timeline = this.timeline) === null || _this$timeline === void 0 ? void 0 : _this$timeline.currentTime) - newTime / this.playbackRate;
|
|
12314
11831
|
}
|
|
12315
|
-
|
|
12316
11832
|
this.currentTimePending = false;
|
|
12317
|
-
|
|
12318
11833
|
if (this._currentTime === newTime) {
|
|
12319
11834
|
return;
|
|
12320
11835
|
}
|
|
12321
|
-
|
|
12322
11836
|
if (this._idle) {
|
|
12323
11837
|
this._idle = false;
|
|
12324
11838
|
this._paused = true;
|
|
12325
11839
|
}
|
|
12326
|
-
|
|
12327
11840
|
this.tickCurrentTime(newTime, true);
|
|
12328
11841
|
this.timeline.applyDirtiedAnimation(this);
|
|
12329
11842
|
}
|
|
12330
11843
|
/**
|
|
12331
11844
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Animation/startTime
|
|
12332
11845
|
*/
|
|
12333
|
-
|
|
12334
11846
|
}, {
|
|
12335
11847
|
key: "startTime",
|
|
12336
11848
|
get: function get() {
|
|
@@ -12357,23 +11869,19 @@
|
|
|
12357
11869
|
if (value === this._playbackRate) {
|
|
12358
11870
|
return;
|
|
12359
11871
|
}
|
|
12360
|
-
|
|
12361
11872
|
this.updatePromises();
|
|
12362
11873
|
var oldCurrentTime = this.currentTime;
|
|
12363
11874
|
this._playbackRate = value;
|
|
12364
11875
|
this.startTime = null;
|
|
12365
|
-
|
|
12366
11876
|
if (this.playState !== 'paused' && this.playState !== 'idle') {
|
|
12367
11877
|
this._finishedFlag = false;
|
|
12368
11878
|
this._idle = false;
|
|
12369
11879
|
this.ensureAlive();
|
|
12370
11880
|
this.timeline.applyDirtiedAnimation(this);
|
|
12371
11881
|
}
|
|
12372
|
-
|
|
12373
11882
|
if (oldCurrentTime !== null) {
|
|
12374
11883
|
this.currentTime = oldCurrentTime;
|
|
12375
11884
|
}
|
|
12376
|
-
|
|
12377
11885
|
this.updatePromises();
|
|
12378
11886
|
}
|
|
12379
11887
|
}, {
|
|
@@ -12392,17 +11900,15 @@
|
|
|
12392
11900
|
return this.pending || this.playState === 'running' || !this._finishedFlag;
|
|
12393
11901
|
}
|
|
12394
11902
|
}]);
|
|
12395
|
-
|
|
12396
11903
|
return Animation;
|
|
12397
11904
|
}();
|
|
11905
|
+
|
|
12398
11906
|
/**
|
|
12399
11907
|
* https://github.com/gre/bezier-easing
|
|
12400
11908
|
* BezierEasing - use bezier curve for transition easing function
|
|
12401
11909
|
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
|
12402
11910
|
*/
|
|
12403
11911
|
// These values are established by empiricism with tests (tradeoff: performance VS precision)
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
11912
|
var NEWTON_ITERATIONS = 4;
|
|
12407
11913
|
var NEWTON_MIN_SLOPE = 0.001;
|
|
12408
11914
|
var SUBDIVISION_PRECISION = 0.0000001;
|
|
@@ -12410,43 +11916,34 @@
|
|
|
12410
11916
|
var kSplineTableSize = 11;
|
|
12411
11917
|
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
|
12412
11918
|
var float32ArraySupported = typeof Float32Array === 'function';
|
|
12413
|
-
|
|
12414
11919
|
var A = function A(aA1, aA2) {
|
|
12415
11920
|
return 1.0 - 3.0 * aA2 + 3.0 * aA1;
|
|
12416
11921
|
};
|
|
12417
|
-
|
|
12418
11922
|
var B = function B(aA1, aA2) {
|
|
12419
11923
|
return 3.0 * aA2 - 6.0 * aA1;
|
|
12420
11924
|
};
|
|
12421
|
-
|
|
12422
11925
|
var C = function C(aA1) {
|
|
12423
11926
|
return 3.0 * aA1;
|
|
12424
|
-
};
|
|
12425
|
-
|
|
12426
|
-
|
|
11927
|
+
};
|
|
11928
|
+
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
|
12427
11929
|
var calcBezier = function calcBezier(aT, aA1, aA2) {
|
|
12428
11930
|
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
|
|
12429
|
-
};
|
|
12430
|
-
|
|
12431
|
-
|
|
11931
|
+
};
|
|
11932
|
+
// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
|
12432
11933
|
var getSlope = function getSlope(aT, aA1, aA2) {
|
|
12433
11934
|
return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
|
|
12434
11935
|
};
|
|
12435
|
-
|
|
12436
11936
|
var binarySubdivide = function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
|
12437
11937
|
var currentX,
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
11938
|
+
currentT,
|
|
11939
|
+
i = 0;
|
|
12441
11940
|
do {
|
|
12442
11941
|
currentT = aA + (aB - aA) / 2.0;
|
|
12443
11942
|
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
12444
11943
|
if (currentX > 0.0) aB = currentT;else aA = currentT;
|
|
12445
11944
|
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
12446
|
-
|
|
12447
11945
|
return currentT;
|
|
12448
11946
|
};
|
|
12449
|
-
|
|
12450
11947
|
var newtonRaphsonIterate = function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
|
12451
11948
|
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
|
12452
11949
|
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
@@ -12454,33 +11951,27 @@
|
|
|
12454
11951
|
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
12455
11952
|
aGuessT -= currentX / currentSlope;
|
|
12456
11953
|
}
|
|
12457
|
-
|
|
12458
11954
|
return aGuessT;
|
|
12459
11955
|
};
|
|
12460
|
-
|
|
12461
11956
|
var bezier = function bezier(mX1, mY1, mX2, mY2) {
|
|
12462
11957
|
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) throw new Error('bezier x values must be in [0, 1] range');
|
|
12463
11958
|
if (mX1 === mY1 && mX2 === mY2) return function (t) {
|
|
12464
11959
|
return t;
|
|
12465
|
-
};
|
|
12466
|
-
|
|
11960
|
+
};
|
|
11961
|
+
// Precompute samples table
|
|
12467
11962
|
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
|
12468
|
-
|
|
12469
11963
|
for (var i = 0; i < kSplineTableSize; ++i) {
|
|
12470
11964
|
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
12471
11965
|
}
|
|
12472
|
-
|
|
12473
11966
|
var getTForX = function getTForX(aX) {
|
|
12474
11967
|
var intervalStart = 0.0;
|
|
12475
11968
|
var currentSample = 1;
|
|
12476
11969
|
var lastSample = kSplineTableSize - 1;
|
|
12477
|
-
|
|
12478
11970
|
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
|
12479
11971
|
intervalStart += kSampleStepSize;
|
|
12480
11972
|
}
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
|
|
11973
|
+
--currentSample;
|
|
11974
|
+
// Interpolate to provide an initial guess for t
|
|
12484
11975
|
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
12485
11976
|
var guessForT = intervalStart + dist * kSampleStepSize;
|
|
12486
11977
|
var initialSlope = getSlope(guessForT, mX1, mX2);
|
|
@@ -12488,97 +11979,79 @@
|
|
|
12488
11979
|
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
|
12489
11980
|
}
|
|
12490
11981
|
};
|
|
12491
|
-
|
|
12492
11982
|
return function (t) {
|
|
12493
11983
|
// Because JavaScript number are imprecise, we should guarantee the extremes are right.
|
|
12494
11984
|
if (t === 0 || t === 1) return t;
|
|
12495
11985
|
return calcBezier(getTForX(t), mY1, mY2);
|
|
12496
11986
|
};
|
|
12497
11987
|
};
|
|
12498
|
-
|
|
12499
11988
|
var convertToDash = function convertToDash(str) {
|
|
12500
11989
|
str = str.replace(/([A-Z])/g, function (letter) {
|
|
12501
11990
|
return "-" + letter.toLowerCase();
|
|
12502
|
-
});
|
|
12503
|
-
|
|
11991
|
+
});
|
|
11992
|
+
// Remove first dash
|
|
12504
11993
|
return str.charAt(0) === '-' ? str.substring(1) : str;
|
|
12505
11994
|
};
|
|
12506
11995
|
/**
|
|
12507
11996
|
Easing Functions from anime.js, they are tried and true, so, its better to use them instead of other alternatives
|
|
12508
11997
|
*/
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
11998
|
var Quad = function Quad(t) {
|
|
12512
11999
|
return Math.pow(t, 2);
|
|
12513
12000
|
};
|
|
12514
|
-
|
|
12515
12001
|
var Cubic = function Cubic(t) {
|
|
12516
12002
|
return Math.pow(t, 3);
|
|
12517
12003
|
};
|
|
12518
|
-
|
|
12519
12004
|
var Quart = function Quart(t) {
|
|
12520
12005
|
return Math.pow(t, 4);
|
|
12521
12006
|
};
|
|
12522
|
-
|
|
12523
12007
|
var Quint = function Quint(t) {
|
|
12524
12008
|
return Math.pow(t, 5);
|
|
12525
12009
|
};
|
|
12526
|
-
|
|
12527
12010
|
var Expo = function Expo(t) {
|
|
12528
12011
|
return Math.pow(t, 6);
|
|
12529
12012
|
};
|
|
12530
|
-
|
|
12531
12013
|
var Sine = function Sine(t) {
|
|
12532
12014
|
return 1 - Math.cos(t * Math.PI / 2);
|
|
12533
12015
|
};
|
|
12534
|
-
|
|
12535
12016
|
var Circ = function Circ(t) {
|
|
12536
12017
|
return 1 - Math.sqrt(1 - t * t);
|
|
12537
12018
|
};
|
|
12538
|
-
|
|
12539
12019
|
var Back = function Back(t) {
|
|
12540
12020
|
return t * t * (3 * t - 2);
|
|
12541
12021
|
};
|
|
12542
|
-
|
|
12543
12022
|
var Bounce = function Bounce(t) {
|
|
12544
12023
|
var pow2,
|
|
12545
|
-
|
|
12546
|
-
|
|
12024
|
+
b = 4;
|
|
12547
12025
|
while (t < ((pow2 = Math.pow(2, --b)) - 1) / 11) {}
|
|
12548
|
-
|
|
12549
12026
|
return 1 / Math.pow(4, 3 - b) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - t, 2);
|
|
12550
12027
|
};
|
|
12551
|
-
|
|
12552
12028
|
var Elastic = function Elastic(t, params) {
|
|
12553
12029
|
if (params === void 0) {
|
|
12554
12030
|
params = [];
|
|
12555
12031
|
}
|
|
12556
|
-
|
|
12557
12032
|
var _params = params,
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12033
|
+
_params$ = _params[0],
|
|
12034
|
+
amplitude = _params$ === void 0 ? 1 : _params$,
|
|
12035
|
+
_params$2 = _params[1],
|
|
12036
|
+
period = _params$2 === void 0 ? 0.5 : _params$2;
|
|
12562
12037
|
var a = clamp(Number(amplitude), 1, 10);
|
|
12563
12038
|
var p = clamp(Number(period), 0.1, 2);
|
|
12564
12039
|
if (t === 0 || t === 1) return t;
|
|
12565
12040
|
return -a * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1 - p / (Math.PI * 2) * Math.asin(1 / a)) * (Math.PI * 2) / p);
|
|
12566
12041
|
};
|
|
12567
|
-
|
|
12568
12042
|
var Spring = function Spring(t, params, duration) {
|
|
12569
12043
|
if (params === void 0) {
|
|
12570
12044
|
params = [];
|
|
12571
12045
|
}
|
|
12572
|
-
|
|
12573
12046
|
var _params2 = params,
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12047
|
+
_params2$ = _params2[0],
|
|
12048
|
+
mass = _params2$ === void 0 ? 1 : _params2$,
|
|
12049
|
+
_params2$2 = _params2[1],
|
|
12050
|
+
stiffness = _params2$2 === void 0 ? 100 : _params2$2,
|
|
12051
|
+
_params2$3 = _params2[2],
|
|
12052
|
+
damping = _params2$3 === void 0 ? 10 : _params2$3,
|
|
12053
|
+
_params2$4 = _params2[3],
|
|
12054
|
+
velocity = _params2$4 === void 0 ? 0 : _params2$4;
|
|
12582
12055
|
mass = clamp(mass, 0.1, 1000);
|
|
12583
12056
|
stiffness = clamp(stiffness, 0.1, 1000);
|
|
12584
12057
|
damping = clamp(damping, 0.1, 1000);
|
|
@@ -12589,13 +12062,11 @@
|
|
|
12589
12062
|
var a = 1;
|
|
12590
12063
|
var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0;
|
|
12591
12064
|
var progress = duration ? duration * t / 1000 : t;
|
|
12592
|
-
|
|
12593
12065
|
if (zeta < 1) {
|
|
12594
12066
|
progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress));
|
|
12595
12067
|
} else {
|
|
12596
12068
|
progress = (a + b * progress) * Math.exp(-progress * w0);
|
|
12597
12069
|
}
|
|
12598
|
-
|
|
12599
12070
|
if (t === 0 || t === 1) return t;
|
|
12600
12071
|
return 1 - progress;
|
|
12601
12072
|
};
|
|
@@ -12603,12 +12074,10 @@
|
|
|
12603
12074
|
* Cache the durations at set easing parameters
|
|
12604
12075
|
*/
|
|
12605
12076
|
// export const EasingDurationCache: Map<string | TypeEasingFunction, number> = new Map();
|
|
12606
|
-
|
|
12607
12077
|
/**
|
|
12608
12078
|
* The threshold for an infinite loop
|
|
12609
12079
|
*/
|
|
12610
12080
|
// const INTINITE_LOOP_LIMIT = 10000;
|
|
12611
|
-
|
|
12612
12081
|
/** Convert easing parameters to Array of numbers, e.g. "spring(2, 500)" to [2, 500] */
|
|
12613
12082
|
// export const parseEasingParameters = (str: string) => {
|
|
12614
12083
|
// const match = /(\(|\s)([^)]+)\)?/.exec(str);
|
|
@@ -12619,7 +12088,6 @@
|
|
|
12619
12088
|
// })
|
|
12620
12089
|
// : [];
|
|
12621
12090
|
// };
|
|
12622
|
-
|
|
12623
12091
|
/**
|
|
12624
12092
|
* The spring easing function will only look smooth at certain durations, with certain parameters.
|
|
12625
12093
|
* This functions returns the optimal duration to create a smooth springy animation based on physics
|
|
@@ -12650,79 +12118,62 @@
|
|
|
12650
12118
|
// EasingDurationCache.set(easing, duration);
|
|
12651
12119
|
// return duration;
|
|
12652
12120
|
// };
|
|
12653
|
-
|
|
12654
12121
|
/**
|
|
12655
12122
|
These Easing Functions are based off of the Sozi Project's easing functions
|
|
12656
12123
|
https://github.com/sozi-projects/Sozi/blob/d72e44ebd580dc7579d1e177406ad41e632f961d/src/js/player/Timing.js
|
|
12657
12124
|
*/
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
12125
|
var Steps = function Steps(t, params) {
|
|
12661
12126
|
if (params === void 0) {
|
|
12662
12127
|
params = [];
|
|
12663
12128
|
}
|
|
12664
|
-
|
|
12665
12129
|
var _params3 = params,
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12130
|
+
_params3$ = _params3[0],
|
|
12131
|
+
steps = _params3$ === void 0 ? 10 : _params3$,
|
|
12132
|
+
type = _params3[1];
|
|
12669
12133
|
var trunc = type == 'start' ? Math.ceil : Math.floor;
|
|
12670
12134
|
return trunc(clamp(t, 0, 1) * steps) / steps;
|
|
12671
|
-
};
|
|
12672
|
-
|
|
12673
|
-
|
|
12135
|
+
};
|
|
12136
|
+
// @ts-ignore
|
|
12674
12137
|
var Bezier = function Bezier(t, params) {
|
|
12675
12138
|
if (params === void 0) {
|
|
12676
12139
|
params = [];
|
|
12677
12140
|
}
|
|
12678
|
-
|
|
12679
12141
|
var _params4 = params,
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12142
|
+
mX1 = _params4[0],
|
|
12143
|
+
mY1 = _params4[1],
|
|
12144
|
+
mX2 = _params4[2],
|
|
12145
|
+
mY2 = _params4[3];
|
|
12684
12146
|
return bezier(mX1, mY1, mX2, mY2)(t);
|
|
12685
12147
|
};
|
|
12686
12148
|
/** The default `ease-in` easing function */
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
12149
|
var easein = bezier(0.42, 0.0, 1.0, 1.0);
|
|
12690
12150
|
/** Converts easing functions to their `out`counter parts */
|
|
12691
|
-
|
|
12692
12151
|
var EaseOut = function EaseOut(ease) {
|
|
12693
12152
|
return function (t, params, duration) {
|
|
12694
12153
|
if (params === void 0) {
|
|
12695
12154
|
params = [];
|
|
12696
12155
|
}
|
|
12697
|
-
|
|
12698
12156
|
return 1 - ease(1 - t, params, duration);
|
|
12699
12157
|
};
|
|
12700
12158
|
};
|
|
12701
12159
|
/** Converts easing functions to their `in-out` counter parts */
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
12160
|
var EaseInOut = function EaseInOut(ease) {
|
|
12705
12161
|
return function (t, params, duration) {
|
|
12706
12162
|
if (params === void 0) {
|
|
12707
12163
|
params = [];
|
|
12708
12164
|
}
|
|
12709
|
-
|
|
12710
12165
|
return t < 0.5 ? ease(t * 2, params, duration) / 2 : 1 - ease(t * -2 + 2, params, duration) / 2;
|
|
12711
12166
|
};
|
|
12712
12167
|
};
|
|
12713
12168
|
/** Converts easing functions to their `out-in` counter parts */
|
|
12714
|
-
|
|
12715
|
-
|
|
12716
12169
|
var EaseOutIn = function EaseOutIn(ease) {
|
|
12717
12170
|
return function (t, params, duration) {
|
|
12718
12171
|
if (params === void 0) {
|
|
12719
12172
|
params = [];
|
|
12720
12173
|
}
|
|
12721
|
-
|
|
12722
12174
|
return t < 0.5 ? (1 - ease(1 - t * 2, params, duration)) / 2 : (ease(t * 2 - 1, params, duration) + 1) / 2;
|
|
12723
12175
|
};
|
|
12724
12176
|
};
|
|
12725
|
-
|
|
12726
12177
|
var EasingFunctions = {
|
|
12727
12178
|
steps: Steps,
|
|
12728
12179
|
'step-start': function stepStart(t) {
|
|
@@ -12791,18 +12242,16 @@
|
|
|
12791
12242
|
/**
|
|
12792
12243
|
* Convert string easing to their proper form
|
|
12793
12244
|
*/
|
|
12794
|
-
|
|
12795
12245
|
var complexEasingSyntax = function complexEasingSyntax(ease) {
|
|
12796
12246
|
return convertToDash(ease).replace(/^ease-/, '') // Remove the "ease-" keyword
|
|
12797
12247
|
.replace(/(\(|\s).+/, '') // Remove the function brackets and parameters
|
|
12798
12248
|
.toLowerCase().trim();
|
|
12799
12249
|
};
|
|
12800
12250
|
/** Re-maps a number from one range to another. Numbers outside the range are not clamped to 0 and 1, because out-of-range values are often intentional and useful. */
|
|
12801
|
-
|
|
12802
|
-
|
|
12803
12251
|
var getEasingFunction = function getEasingFunction(ease) {
|
|
12804
12252
|
return EasingFunctions[complexEasingSyntax(ease)] || EasingFunctions.linear;
|
|
12805
|
-
};
|
|
12253
|
+
};
|
|
12254
|
+
// /**
|
|
12806
12255
|
// * Allows you to register new easing functions
|
|
12807
12256
|
// */
|
|
12808
12257
|
// export const registerEasingFunction = (key: string, fn: TypeEasingFunction) => {
|
|
@@ -12817,48 +12266,37 @@
|
|
|
12817
12266
|
// Object.assign(EasingFunctions, ...obj);
|
|
12818
12267
|
// };
|
|
12819
12268
|
|
|
12820
|
-
|
|
12821
12269
|
var linear = function linear(x) {
|
|
12822
12270
|
return x;
|
|
12823
12271
|
};
|
|
12824
|
-
|
|
12825
12272
|
var Start = 1;
|
|
12826
12273
|
var Middle = 0.5;
|
|
12827
12274
|
var End = 0;
|
|
12828
|
-
|
|
12829
12275
|
function step(count, pos) {
|
|
12830
12276
|
return function (x) {
|
|
12831
12277
|
if (x >= 1) {
|
|
12832
12278
|
return 1;
|
|
12833
12279
|
}
|
|
12834
|
-
|
|
12835
12280
|
var stepSize = 1 / count;
|
|
12836
12281
|
x += pos * stepSize;
|
|
12837
12282
|
return x - x % stepSize;
|
|
12838
12283
|
};
|
|
12839
12284
|
}
|
|
12840
|
-
|
|
12841
12285
|
var numberString = '\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*';
|
|
12842
12286
|
var cubicBezierRe = new RegExp('cubic-bezier\\(' + numberString + ',' + numberString + ',' + numberString + ',' + numberString + '\\)');
|
|
12843
12287
|
var step1Re = /steps\(\s*(\d+)\s*\)/;
|
|
12844
12288
|
var step2Re = /steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;
|
|
12845
|
-
|
|
12846
12289
|
function parseEasingFunction(normalizedEasing) {
|
|
12847
12290
|
var cubicData = cubicBezierRe.exec(normalizedEasing);
|
|
12848
|
-
|
|
12849
12291
|
if (cubicData) {
|
|
12850
12292
|
// @ts-ignore
|
|
12851
12293
|
return bezier.apply(void 0, cubicData.slice(1).map(Number));
|
|
12852
12294
|
}
|
|
12853
|
-
|
|
12854
12295
|
var step1Data = step1Re.exec(normalizedEasing);
|
|
12855
|
-
|
|
12856
12296
|
if (step1Data) {
|
|
12857
12297
|
return step(Number(step1Data[1]), End);
|
|
12858
12298
|
}
|
|
12859
|
-
|
|
12860
12299
|
var step2Data = step2Re.exec(normalizedEasing);
|
|
12861
|
-
|
|
12862
12300
|
if (step2Data) {
|
|
12863
12301
|
// @ts-ignore
|
|
12864
12302
|
return step(Number(step2Data[1]), {
|
|
@@ -12867,77 +12305,60 @@
|
|
|
12867
12305
|
end: End
|
|
12868
12306
|
}[step2Data[2]]);
|
|
12869
12307
|
}
|
|
12870
|
-
|
|
12871
12308
|
return getEasingFunction(normalizedEasing);
|
|
12872
12309
|
}
|
|
12873
|
-
|
|
12874
12310
|
function calculateActiveDuration(timing) {
|
|
12875
12311
|
// @ts-ignore
|
|
12876
12312
|
return Math.abs(repeatedDuration(timing) / (timing.playbackRate || 1));
|
|
12877
12313
|
}
|
|
12878
|
-
|
|
12879
12314
|
function repeatedDuration(timing) {
|
|
12880
|
-
var _timing$iterations;
|
|
12881
|
-
|
|
12882
|
-
|
|
12315
|
+
var _timing$iterations;
|
|
12316
|
+
// https://drafts.csswg.org/web-animations/#calculating-the-active-duration
|
|
12883
12317
|
if (timing.duration === 0 || timing.iterations === 0) {
|
|
12884
12318
|
return 0;
|
|
12885
|
-
}
|
|
12319
|
+
}
|
|
12320
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/duration#value
|
|
12886
12321
|
// if (timing.duration === 'auto') {
|
|
12887
12322
|
// timing.duration = 0;
|
|
12888
12323
|
// }
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
12324
|
return (timing.duration === 'auto' ? 0 : Number(timing.duration)) * ((_timing$iterations = timing.iterations) !== null && _timing$iterations !== void 0 ? _timing$iterations : 1);
|
|
12892
12325
|
}
|
|
12893
|
-
|
|
12894
12326
|
var PhaseNone = 0;
|
|
12895
12327
|
var PhaseBefore = 1;
|
|
12896
12328
|
var PhaseAfter = 2;
|
|
12897
12329
|
var PhaseActive = 3;
|
|
12898
|
-
|
|
12899
12330
|
function calculatePhase(activeDuration, localTime, timing) {
|
|
12900
12331
|
// https://drafts.csswg.org/web-animations/#animation-effect-phases-and-states
|
|
12901
12332
|
if (localTime === null) {
|
|
12902
12333
|
return PhaseNone;
|
|
12903
12334
|
}
|
|
12904
|
-
|
|
12905
12335
|
var endTime = timing.endTime;
|
|
12906
|
-
|
|
12907
12336
|
if (localTime < Math.min(timing.delay, endTime)) {
|
|
12908
12337
|
return PhaseBefore;
|
|
12909
12338
|
}
|
|
12910
|
-
|
|
12911
12339
|
if (localTime >= Math.min(timing.delay + activeDuration + timing.endDelay, endTime)) {
|
|
12912
12340
|
return PhaseAfter;
|
|
12913
12341
|
}
|
|
12914
|
-
|
|
12915
12342
|
return PhaseActive;
|
|
12916
12343
|
}
|
|
12917
|
-
|
|
12918
12344
|
function calculateActiveTime(activeDuration, fillMode, localTime, phase, delay) {
|
|
12919
12345
|
// https://drafts.csswg.org/web-animations/#calculating-the-active-time
|
|
12920
12346
|
switch (phase) {
|
|
12921
12347
|
case PhaseBefore:
|
|
12922
12348
|
if (fillMode === 'backwards' || fillMode === 'both') return 0;
|
|
12923
12349
|
return null;
|
|
12924
|
-
|
|
12925
12350
|
case PhaseActive:
|
|
12926
12351
|
return localTime - delay;
|
|
12927
|
-
|
|
12928
12352
|
case PhaseAfter:
|
|
12929
12353
|
if (fillMode === 'forwards' || fillMode === 'both') return activeDuration;
|
|
12930
12354
|
return null;
|
|
12931
|
-
|
|
12932
12355
|
case PhaseNone:
|
|
12933
12356
|
return null;
|
|
12934
12357
|
}
|
|
12935
12358
|
}
|
|
12936
|
-
|
|
12937
12359
|
function calculateOverallProgress(iterationDuration, phase, iterations, activeTime, iterationStart) {
|
|
12938
12360
|
// https://drafts.csswg.org/web-animations/#calculating-the-overall-progress
|
|
12939
12361
|
var overallProgress = iterationStart;
|
|
12940
|
-
|
|
12941
12362
|
if (iterationDuration === 0) {
|
|
12942
12363
|
if (phase !== PhaseBefore) {
|
|
12943
12364
|
overallProgress += iterations;
|
|
@@ -12945,59 +12366,44 @@
|
|
|
12945
12366
|
} else {
|
|
12946
12367
|
overallProgress += activeTime / iterationDuration;
|
|
12947
12368
|
}
|
|
12948
|
-
|
|
12949
12369
|
return overallProgress;
|
|
12950
12370
|
}
|
|
12951
|
-
|
|
12952
12371
|
function calculateSimpleIterationProgress(overallProgress, iterationStart, phase, iterations, activeTime, iterationDuration) {
|
|
12953
12372
|
// https://drafts.csswg.org/web-animations/#calculating-the-simple-iteration-progress
|
|
12954
12373
|
var simpleIterationProgress = overallProgress === Infinity ? iterationStart % 1 : overallProgress % 1;
|
|
12955
|
-
|
|
12956
12374
|
if (simpleIterationProgress === 0 && phase === PhaseAfter && iterations !== 0 && (activeTime !== 0 || iterationDuration === 0)) {
|
|
12957
12375
|
simpleIterationProgress = 1;
|
|
12958
12376
|
}
|
|
12959
|
-
|
|
12960
12377
|
return simpleIterationProgress;
|
|
12961
12378
|
}
|
|
12962
|
-
|
|
12963
12379
|
function calculateCurrentIteration(phase, iterations, simpleIterationProgress, overallProgress) {
|
|
12964
12380
|
// https://drafts.csswg.org/web-animations/#calculating-the-current-iteration
|
|
12965
12381
|
if (phase === PhaseAfter && iterations === Infinity) {
|
|
12966
12382
|
return Infinity;
|
|
12967
12383
|
}
|
|
12968
|
-
|
|
12969
12384
|
if (simpleIterationProgress === 1) {
|
|
12970
12385
|
return Math.floor(overallProgress) - 1;
|
|
12971
12386
|
}
|
|
12972
|
-
|
|
12973
12387
|
return Math.floor(overallProgress);
|
|
12974
12388
|
}
|
|
12975
|
-
|
|
12976
12389
|
function calculateDirectedProgress(playbackDirection, currentIteration, simpleIterationProgress) {
|
|
12977
12390
|
// https://drafts.csswg.org/web-animations/#calculating-the-directed-progress
|
|
12978
12391
|
var currentDirection = playbackDirection;
|
|
12979
|
-
|
|
12980
12392
|
if (playbackDirection !== 'normal' && playbackDirection !== 'reverse') {
|
|
12981
12393
|
var d = currentIteration;
|
|
12982
|
-
|
|
12983
12394
|
if (playbackDirection === 'alternate-reverse') {
|
|
12984
12395
|
d += 1;
|
|
12985
12396
|
}
|
|
12986
|
-
|
|
12987
12397
|
currentDirection = 'normal';
|
|
12988
|
-
|
|
12989
12398
|
if (d !== Infinity && d % 2 !== 0) {
|
|
12990
12399
|
currentDirection = 'reverse';
|
|
12991
12400
|
}
|
|
12992
12401
|
}
|
|
12993
|
-
|
|
12994
12402
|
if (currentDirection === 'normal') {
|
|
12995
12403
|
return simpleIterationProgress;
|
|
12996
12404
|
}
|
|
12997
|
-
|
|
12998
12405
|
return 1 - simpleIterationProgress;
|
|
12999
12406
|
}
|
|
13000
|
-
|
|
13001
12407
|
function calculateIterationProgress(activeDuration, localTime, timing) {
|
|
13002
12408
|
var phase = calculatePhase(activeDuration, localTime, timing);
|
|
13003
12409
|
var activeTime = calculateActiveTime(activeDuration, timing.fill, localTime, phase, timing.delay);
|
|
@@ -13008,12 +12414,11 @@
|
|
|
13008
12414
|
var currentIteration = calculateCurrentIteration(phase, timing.iterations, simpleIterationProgress, overallProgress);
|
|
13009
12415
|
var directedProgress = calculateDirectedProgress(timing.direction, currentIteration, simpleIterationProgress);
|
|
13010
12416
|
timing.currentIteration = currentIteration;
|
|
13011
|
-
timing.progress = directedProgress;
|
|
12417
|
+
timing.progress = directedProgress;
|
|
12418
|
+
// https://drafts.csswg.org/web-animations/#calculating-the-transformed-progress
|
|
13012
12419
|
// https://drafts.csswg.org/web-animations/#calculating-the-iteration-progress
|
|
13013
|
-
|
|
13014
12420
|
return timing.easingFunction(directedProgress);
|
|
13015
12421
|
}
|
|
13016
|
-
|
|
13017
12422
|
function convertEffectInput(keyframes, timing, target) {
|
|
13018
12423
|
var propertySpecificKeyframeGroups = makePropertySpecificKeyframeGroups(keyframes, timing);
|
|
13019
12424
|
var interpolations = makeInterpolations(propertySpecificKeyframeGroups, target);
|
|
@@ -13024,8 +12429,8 @@
|
|
|
13024
12429
|
}).forEach(function (interpolation) {
|
|
13025
12430
|
var offsetFraction = fraction - interpolation.startOffset;
|
|
13026
12431
|
var localDuration = interpolation.endOffset - interpolation.startOffset;
|
|
13027
|
-
var scaledLocalTime = localDuration === 0 ? 0 : interpolation.easingFunction(offsetFraction / localDuration);
|
|
13028
|
-
|
|
12432
|
+
var scaledLocalTime = localDuration === 0 ? 0 : interpolation.easingFunction(offsetFraction / localDuration);
|
|
12433
|
+
// apply updated attribute
|
|
13029
12434
|
target.style[interpolation.property] = interpolation.interpolation(scaledLocalTime);
|
|
13030
12435
|
});
|
|
13031
12436
|
} else {
|
|
@@ -13038,14 +12443,11 @@
|
|
|
13038
12443
|
}
|
|
13039
12444
|
};
|
|
13040
12445
|
}
|
|
13041
|
-
|
|
13042
12446
|
function isNotReservedWord(member) {
|
|
13043
12447
|
return member !== 'offset' && member !== 'easing' && member !== 'composite' && member !== 'computedOffset';
|
|
13044
12448
|
}
|
|
13045
|
-
|
|
13046
12449
|
function makePropertySpecificKeyframeGroups(keyframes, timing) {
|
|
13047
12450
|
var propertySpecificKeyframeGroups = {};
|
|
13048
|
-
|
|
13049
12451
|
for (var i = 0; i < keyframes.length; i++) {
|
|
13050
12452
|
for (var member in keyframes[i]) {
|
|
13051
12453
|
if (isNotReservedWord(member)) {
|
|
@@ -13061,16 +12463,12 @@
|
|
|
13061
12463
|
}
|
|
13062
12464
|
}
|
|
13063
12465
|
}
|
|
13064
|
-
|
|
13065
12466
|
return propertySpecificKeyframeGroups;
|
|
13066
12467
|
}
|
|
13067
|
-
|
|
13068
12468
|
function makeInterpolations(propertySpecificKeyframeGroups, target) {
|
|
13069
12469
|
var interpolations = [];
|
|
13070
|
-
|
|
13071
12470
|
for (var groupName in propertySpecificKeyframeGroups) {
|
|
13072
12471
|
var keyframes = propertySpecificKeyframeGroups[groupName];
|
|
13073
|
-
|
|
13074
12472
|
for (var i = 0; i < keyframes.length - 1; i++) {
|
|
13075
12473
|
var startIndex = i;
|
|
13076
12474
|
var endIndex = i + 1;
|
|
@@ -13078,23 +12476,18 @@
|
|
|
13078
12476
|
var endOffset = keyframes[endIndex].computedOffset;
|
|
13079
12477
|
var applyFrom = startOffset;
|
|
13080
12478
|
var applyTo = endOffset;
|
|
13081
|
-
|
|
13082
12479
|
if (i === 0) {
|
|
13083
12480
|
applyFrom = -Infinity;
|
|
13084
|
-
|
|
13085
12481
|
if (endOffset === 0) {
|
|
13086
12482
|
endIndex = startIndex;
|
|
13087
12483
|
}
|
|
13088
12484
|
}
|
|
13089
|
-
|
|
13090
12485
|
if (i === keyframes.length - 2) {
|
|
13091
12486
|
applyTo = Infinity;
|
|
13092
|
-
|
|
13093
12487
|
if (startOffset === 1) {
|
|
13094
12488
|
startIndex = endIndex;
|
|
13095
12489
|
}
|
|
13096
12490
|
}
|
|
13097
|
-
|
|
13098
12491
|
interpolations.push({
|
|
13099
12492
|
applyFrom: applyFrom,
|
|
13100
12493
|
applyTo: applyTo,
|
|
@@ -13106,31 +12499,28 @@
|
|
|
13106
12499
|
});
|
|
13107
12500
|
}
|
|
13108
12501
|
}
|
|
13109
|
-
|
|
13110
12502
|
interpolations.sort(function (leftInterpolation, rightInterpolation) {
|
|
13111
12503
|
return leftInterpolation.startOffset - rightInterpolation.startOffset;
|
|
13112
12504
|
});
|
|
13113
12505
|
return interpolations;
|
|
13114
12506
|
}
|
|
13115
|
-
|
|
13116
|
-
|
|
12507
|
+
var InterpolationFactory = function InterpolationFactory(from, to,
|
|
12508
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
13117
12509
|
convertToString) {
|
|
13118
12510
|
return function (f) {
|
|
13119
12511
|
return convertToString(interpolate(from, to, f));
|
|
13120
12512
|
};
|
|
13121
12513
|
};
|
|
13122
|
-
|
|
13123
12514
|
function propertyInterpolation(property, left, right, target) {
|
|
13124
12515
|
var metadata = propertyMetadataCache[property];
|
|
13125
|
-
|
|
13126
12516
|
if (metadata && metadata.syntax && metadata.int) {
|
|
13127
12517
|
var propertyHandler = runtime.styleValueRegistry.getPropertySyntax(metadata.syntax);
|
|
13128
|
-
|
|
13129
12518
|
if (propertyHandler) {
|
|
13130
12519
|
var computedLeft = runtime.styleValueRegistry.parseProperty(property, left, target);
|
|
13131
12520
|
var computedRight = runtime.styleValueRegistry.parseProperty(property, right, target);
|
|
13132
12521
|
var usedLeft = runtime.styleValueRegistry.computeProperty(property, computedLeft, target);
|
|
13133
|
-
var usedRight = runtime.styleValueRegistry.computeProperty(property, computedRight, target);
|
|
12522
|
+
var usedRight = runtime.styleValueRegistry.computeProperty(property, computedRight, target);
|
|
12523
|
+
// use defaultValue
|
|
13134
12524
|
// const parsedDefaultLeft = parseDefaultValue(metadata, target, property, left);
|
|
13135
12525
|
// const parsedDefaultRight = parseDefaultValue(metadata, target, property, right);
|
|
13136
12526
|
// if (!isNil(parsedDefaultLeft)) {
|
|
@@ -13156,9 +12546,7 @@
|
|
|
13156
12546
|
// // parsedLeft = handler.calculator
|
|
13157
12547
|
// }
|
|
13158
12548
|
// merger [left, right, n2string()]
|
|
13159
|
-
|
|
13160
12549
|
var interpolationArgs = propertyHandler.mixer(usedLeft, usedRight, target);
|
|
13161
|
-
|
|
13162
12550
|
if (interpolationArgs) {
|
|
13163
12551
|
// @ts-ignore
|
|
13164
12552
|
var interp = InterpolationFactory.apply(void 0, interpolationArgs);
|
|
@@ -13169,9 +12557,8 @@
|
|
|
13169
12557
|
};
|
|
13170
12558
|
}
|
|
13171
12559
|
}
|
|
13172
|
-
}
|
|
13173
|
-
|
|
13174
|
-
|
|
12560
|
+
}
|
|
12561
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
13175
12562
|
return InterpolationFactory(false, true, function (bool) {
|
|
13176
12563
|
return bool ? right : left;
|
|
13177
12564
|
});
|
|
@@ -13179,38 +12566,30 @@
|
|
|
13179
12566
|
/**
|
|
13180
12567
|
* interpolate with number, boolean, number[], boolean[]
|
|
13181
12568
|
*/
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
12569
|
function interpolate(from, to, f) {
|
|
13185
12570
|
if (typeof from === 'number' && typeof to === 'number') {
|
|
13186
12571
|
return from * (1 - f) + to * f;
|
|
13187
12572
|
}
|
|
13188
|
-
|
|
13189
12573
|
if (typeof from === 'boolean' && typeof to === 'boolean' || typeof from === 'string' && typeof to === 'string' // skip string, eg. path ['M', 10, 10]
|
|
13190
12574
|
) {
|
|
13191
12575
|
return f < 0.5 ? from : to;
|
|
13192
12576
|
}
|
|
13193
|
-
|
|
13194
12577
|
if (Array.isArray(from) && Array.isArray(to)) {
|
|
13195
12578
|
// interpolate arrays/matrix
|
|
13196
12579
|
if (from.length === to.length) {
|
|
13197
12580
|
var r = [];
|
|
13198
|
-
|
|
13199
12581
|
for (var i = 0; i < from.length; i++) {
|
|
13200
12582
|
r.push(interpolate(from[i], to[i], f));
|
|
13201
12583
|
}
|
|
13202
|
-
|
|
13203
12584
|
return r;
|
|
13204
12585
|
}
|
|
13205
12586
|
}
|
|
13206
|
-
|
|
13207
12587
|
throw new Error('Mismatched interpolation arguments ' + from + ':' + to);
|
|
13208
12588
|
}
|
|
12589
|
+
|
|
13209
12590
|
/**
|
|
13210
12591
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming
|
|
13211
12592
|
*/
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
12593
|
var AnimationEffectTiming = /*#__PURE__*/function () {
|
|
13215
12594
|
function AnimationEffectTiming() {
|
|
13216
12595
|
this.delay = 0;
|
|
@@ -13230,7 +12609,6 @@
|
|
|
13230
12609
|
this.currentIteration = null;
|
|
13231
12610
|
this.progress = null;
|
|
13232
12611
|
}
|
|
13233
|
-
|
|
13234
12612
|
_createClass$2(AnimationEffectTiming, [{
|
|
13235
12613
|
key: "easing",
|
|
13236
12614
|
get: function get() {
|
|
@@ -13243,11 +12621,11 @@
|
|
|
13243
12621
|
/**
|
|
13244
12622
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/endDelay
|
|
13245
12623
|
*/
|
|
13246
|
-
|
|
13247
12624
|
}]);
|
|
13248
12625
|
|
|
13249
12626
|
return AnimationEffectTiming;
|
|
13250
12627
|
}();
|
|
12628
|
+
|
|
13251
12629
|
/**
|
|
13252
12630
|
* @example
|
|
13253
12631
|
{
|
|
@@ -13262,80 +12640,61 @@
|
|
|
13262
12640
|
scale: [1, 10],
|
|
13263
12641
|
}
|
|
13264
12642
|
*/
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
12643
|
function convertToArrayForm(effectInput) {
|
|
13268
12644
|
var normalizedEffectInput = [];
|
|
13269
|
-
|
|
13270
12645
|
for (var property in effectInput) {
|
|
13271
12646
|
// skip reserved props
|
|
13272
12647
|
if (property in ['easing', 'offset', 'composite']) {
|
|
13273
12648
|
continue;
|
|
13274
|
-
}
|
|
13275
|
-
|
|
13276
|
-
|
|
12649
|
+
}
|
|
12650
|
+
// @ts-ignore
|
|
13277
12651
|
var values = effectInput[property];
|
|
13278
|
-
|
|
13279
12652
|
if (!Array.isArray(values)) {
|
|
13280
12653
|
values = [values];
|
|
13281
12654
|
}
|
|
13282
|
-
|
|
13283
12655
|
var numKeyframes = values.length;
|
|
13284
|
-
|
|
13285
12656
|
for (var i = 0; i < numKeyframes; i++) {
|
|
13286
12657
|
if (!normalizedEffectInput[i]) {
|
|
13287
12658
|
var keyframe = {};
|
|
13288
|
-
|
|
13289
12659
|
if ('offset' in effectInput) {
|
|
13290
12660
|
keyframe.offset = Number(effectInput.offset);
|
|
13291
12661
|
}
|
|
13292
|
-
|
|
13293
12662
|
if ('easing' in effectInput) {
|
|
13294
12663
|
// @ts-ignore
|
|
13295
12664
|
keyframe.easing = effectInput.easing;
|
|
13296
12665
|
}
|
|
13297
|
-
|
|
13298
12666
|
if ('composite' in effectInput) {
|
|
13299
12667
|
// @ts-ignore
|
|
13300
12668
|
keyframe.composite = effectInput.composite;
|
|
13301
12669
|
}
|
|
13302
|
-
|
|
13303
12670
|
normalizedEffectInput[i] = keyframe;
|
|
13304
12671
|
}
|
|
13305
|
-
|
|
13306
12672
|
if (values[i] !== undefined && values[i] !== null) {
|
|
13307
12673
|
normalizedEffectInput[i][property] = values[i];
|
|
13308
12674
|
}
|
|
13309
12675
|
}
|
|
13310
12676
|
}
|
|
13311
|
-
|
|
13312
12677
|
normalizedEffectInput.sort(function (a, b) {
|
|
13313
12678
|
return (a.computedOffset || 0) - (b.computedOffset || 0);
|
|
13314
12679
|
});
|
|
13315
12680
|
return normalizedEffectInput;
|
|
13316
12681
|
}
|
|
13317
|
-
|
|
13318
12682
|
function normalizeKeyframes(effectInput, timing) {
|
|
13319
12683
|
if (effectInput === null) {
|
|
13320
12684
|
return [];
|
|
13321
12685
|
}
|
|
13322
|
-
|
|
13323
12686
|
if (!Array.isArray(effectInput)) {
|
|
13324
12687
|
effectInput = convertToArrayForm(effectInput);
|
|
13325
12688
|
}
|
|
13326
|
-
|
|
13327
12689
|
var keyframes = effectInput.map(function (originalKeyframe) {
|
|
13328
12690
|
var keyframe = {};
|
|
13329
|
-
|
|
13330
12691
|
if (timing === null || timing === void 0 ? void 0 : timing.composite) {
|
|
13331
12692
|
// This will be auto if the composite operation specified on the effect is being used.
|
|
13332
12693
|
// @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
13333
12694
|
keyframe.composite = 'auto';
|
|
13334
12695
|
}
|
|
13335
|
-
|
|
13336
12696
|
for (var member in originalKeyframe) {
|
|
13337
12697
|
var memberValue = originalKeyframe[member];
|
|
13338
|
-
|
|
13339
12698
|
if (member === 'offset') {
|
|
13340
12699
|
if (memberValue !== null) {
|
|
13341
12700
|
memberValue = Number(memberValue);
|
|
@@ -13349,92 +12708,70 @@
|
|
|
13349
12708
|
if (['replace', 'add', 'accumulate', 'auto'].indexOf(memberValue) === -1) {
|
|
13350
12709
|
throw new Error(memberValue + " compositing is not supported");
|
|
13351
12710
|
}
|
|
13352
|
-
} else ;
|
|
13353
|
-
|
|
13354
|
-
|
|
12711
|
+
} else ;
|
|
12712
|
+
// assign to keyframe, no need to parse shorthand value
|
|
13355
12713
|
keyframe[member] = memberValue;
|
|
13356
12714
|
}
|
|
13357
|
-
|
|
13358
12715
|
if (keyframe.offset === undefined) {
|
|
13359
12716
|
keyframe.offset = null;
|
|
13360
12717
|
}
|
|
13361
|
-
|
|
13362
12718
|
if (keyframe.easing === undefined) {
|
|
13363
12719
|
// override with timing.easing
|
|
13364
12720
|
keyframe.easing = (timing === null || timing === void 0 ? void 0 : timing.easing) || 'linear';
|
|
13365
12721
|
}
|
|
13366
|
-
|
|
13367
12722
|
if (keyframe.composite === undefined) {
|
|
13368
12723
|
keyframe.composite = 'auto';
|
|
13369
12724
|
}
|
|
13370
|
-
|
|
13371
12725
|
return keyframe;
|
|
13372
12726
|
});
|
|
13373
12727
|
var everyFrameHasOffset = true;
|
|
13374
12728
|
var previousOffset = -Infinity;
|
|
13375
|
-
|
|
13376
12729
|
for (var i = 0; i < keyframes.length; i++) {
|
|
13377
12730
|
var offset = keyframes[i].offset;
|
|
13378
|
-
|
|
13379
12731
|
if (!isNil(offset)) {
|
|
13380
12732
|
if (offset < previousOffset) {
|
|
13381
12733
|
throw new TypeError('Keyframes are not loosely sorted by offset. Sort or specify offsets.');
|
|
13382
12734
|
}
|
|
13383
|
-
|
|
13384
12735
|
previousOffset = offset;
|
|
13385
12736
|
} else {
|
|
13386
12737
|
everyFrameHasOffset = false;
|
|
13387
12738
|
}
|
|
13388
12739
|
}
|
|
13389
|
-
|
|
13390
12740
|
keyframes = keyframes.filter(function (keyframe) {
|
|
13391
12741
|
return Number(keyframe.offset) >= 0 && Number(keyframe.offset) <= 1;
|
|
13392
12742
|
});
|
|
13393
|
-
|
|
13394
12743
|
function spaceKeyframes() {
|
|
13395
12744
|
var _keyframes$offset;
|
|
13396
|
-
|
|
13397
12745
|
var length = keyframes.length;
|
|
13398
12746
|
keyframes[length - 1].computedOffset = Number((_keyframes$offset = keyframes[length - 1].offset) !== null && _keyframes$offset !== void 0 ? _keyframes$offset : 1);
|
|
13399
|
-
|
|
13400
12747
|
if (length > 1) {
|
|
13401
12748
|
var _keyframes$0$offset;
|
|
13402
|
-
|
|
13403
12749
|
keyframes[0].computedOffset = Number((_keyframes$0$offset = keyframes[0].offset) !== null && _keyframes$0$offset !== void 0 ? _keyframes$0$offset : 0);
|
|
13404
12750
|
}
|
|
13405
|
-
|
|
13406
12751
|
var previousIndex = 0;
|
|
13407
12752
|
var previousOffset = Number(keyframes[0].computedOffset);
|
|
13408
|
-
|
|
13409
12753
|
for (var _i = 1; _i < length; _i++) {
|
|
13410
12754
|
var _offset = keyframes[_i].computedOffset;
|
|
13411
|
-
|
|
13412
12755
|
if (!isNil(_offset) && !isNil(previousOffset)) {
|
|
13413
12756
|
for (var j = 1; j < _i - previousIndex; j++) {
|
|
13414
12757
|
keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
|
|
13415
12758
|
}
|
|
13416
|
-
|
|
13417
12759
|
previousIndex = _i;
|
|
13418
12760
|
previousOffset = Number(_offset);
|
|
13419
12761
|
}
|
|
13420
12762
|
}
|
|
13421
12763
|
}
|
|
13422
|
-
|
|
13423
12764
|
if (!everyFrameHasOffset) spaceKeyframes();
|
|
13424
12765
|
return keyframes;
|
|
13425
12766
|
}
|
|
13426
|
-
|
|
13427
12767
|
var fills = 'backwards|forwards|both|none'.split('|');
|
|
13428
12768
|
var directions = 'reverse|alternate|alternate-reverse'.split('|');
|
|
13429
|
-
|
|
13430
12769
|
function makeTiming(timingInput, forGroup) {
|
|
13431
12770
|
var timing = new AnimationEffectTiming();
|
|
13432
|
-
|
|
13433
12771
|
if (forGroup) {
|
|
13434
12772
|
timing.fill = 'both';
|
|
13435
12773
|
timing.duration = 'auto';
|
|
13436
12774
|
}
|
|
13437
|
-
|
|
13438
12775
|
if (typeof timingInput === 'number' && !isNaN(timingInput)) {
|
|
13439
12776
|
timing.duration = timingInput;
|
|
13440
12777
|
} else if (timingInput !== undefined) {
|
|
@@ -13445,33 +12782,26 @@
|
|
|
13445
12782
|
return;
|
|
13446
12783
|
}
|
|
13447
12784
|
}
|
|
13448
|
-
|
|
13449
12785
|
if (property === 'fill' && fills.indexOf(timingInput[property]) === -1) {
|
|
13450
12786
|
return;
|
|
13451
12787
|
}
|
|
13452
|
-
|
|
13453
12788
|
if (property === 'direction' && directions.indexOf(timingInput[property]) === -1) {
|
|
13454
12789
|
return;
|
|
13455
|
-
}
|
|
13456
|
-
|
|
13457
|
-
|
|
12790
|
+
}
|
|
12791
|
+
// @ts-ignore
|
|
13458
12792
|
timing[property] = timingInput[property];
|
|
13459
12793
|
}
|
|
13460
12794
|
});
|
|
13461
12795
|
}
|
|
13462
|
-
|
|
13463
12796
|
return timing;
|
|
13464
12797
|
}
|
|
13465
|
-
|
|
13466
12798
|
function normalizeTimingInput(timingInput, forGroup) {
|
|
13467
12799
|
var _timingInput;
|
|
13468
|
-
|
|
13469
12800
|
timingInput = numericTimingToObject((_timingInput = timingInput) !== null && _timingInput !== void 0 ? _timingInput : {
|
|
13470
12801
|
duration: 'auto'
|
|
13471
12802
|
});
|
|
13472
12803
|
return makeTiming(timingInput, forGroup);
|
|
13473
12804
|
}
|
|
13474
|
-
|
|
13475
12805
|
function numericTimingToObject(timingInput) {
|
|
13476
12806
|
if (typeof timingInput === 'number') {
|
|
13477
12807
|
if (isNaN(timingInput)) {
|
|
@@ -13484,7 +12814,6 @@
|
|
|
13484
12814
|
};
|
|
13485
12815
|
}
|
|
13486
12816
|
}
|
|
13487
|
-
|
|
13488
12817
|
return timingInput;
|
|
13489
12818
|
}
|
|
13490
12819
|
/**
|
|
@@ -13500,13 +12829,11 @@
|
|
|
13500
12829
|
);
|
|
13501
12830
|
*
|
|
13502
12831
|
*/
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
12832
|
var KeyframeEffect = /*#__PURE__*/function () {
|
|
13506
12833
|
// pseudoElement: string | null;
|
|
12834
|
+
|
|
13507
12835
|
function KeyframeEffect(target, effectInput, timingInput) {
|
|
13508
12836
|
var _this = this;
|
|
13509
|
-
|
|
13510
12837
|
this.composite = 'replace';
|
|
13511
12838
|
this.iterationComposite = 'replace';
|
|
13512
12839
|
this.target = void 0;
|
|
@@ -13535,16 +12862,13 @@
|
|
|
13535
12862
|
if (!_this.animation || _this.animation.playState !== 'running') {
|
|
13536
12863
|
return null;
|
|
13537
12864
|
}
|
|
13538
|
-
|
|
13539
12865
|
return target.currentIteration || 0;
|
|
13540
12866
|
} else if (prop === 'progress') {
|
|
13541
12867
|
if (!_this.animation || _this.animation.playState !== 'running') {
|
|
13542
12868
|
return null;
|
|
13543
12869
|
}
|
|
13544
|
-
|
|
13545
12870
|
return target.progress || 0;
|
|
13546
12871
|
}
|
|
13547
|
-
|
|
13548
12872
|
return target[prop];
|
|
13549
12873
|
},
|
|
13550
12874
|
set: function set() {
|
|
@@ -13552,76 +12876,59 @@
|
|
|
13552
12876
|
}
|
|
13553
12877
|
});
|
|
13554
12878
|
}
|
|
13555
|
-
|
|
13556
12879
|
var _proto = KeyframeEffect.prototype;
|
|
13557
|
-
|
|
13558
12880
|
_proto.applyInterpolations = function applyInterpolations() {
|
|
13559
12881
|
this.interpolations(this.target, Number(this.timeFraction));
|
|
13560
12882
|
};
|
|
13561
|
-
|
|
13562
12883
|
_proto.update = function update(localTime) {
|
|
13563
12884
|
if (localTime === null) {
|
|
13564
12885
|
return false;
|
|
13565
12886
|
}
|
|
13566
|
-
|
|
13567
12887
|
this.timeFraction = calculateIterationProgress(this.timing.activeDuration, localTime, this.timing);
|
|
13568
12888
|
return this.timeFraction !== null;
|
|
13569
12889
|
};
|
|
13570
|
-
|
|
13571
12890
|
_proto.getKeyframes = function getKeyframes() {
|
|
13572
12891
|
return this.normalizedKeyframes;
|
|
13573
12892
|
};
|
|
13574
|
-
|
|
13575
12893
|
_proto.setKeyframes = function setKeyframes(keyframes) {
|
|
13576
12894
|
this.normalizedKeyframes = normalizeKeyframes(keyframes);
|
|
13577
12895
|
}
|
|
13578
12896
|
/**
|
|
13579
12897
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/getComputedTiming
|
|
13580
|
-
|
|
13581
|
-
;
|
|
13582
|
-
|
|
12898
|
+
*/;
|
|
13583
12899
|
_proto.getComputedTiming = function getComputedTiming() {
|
|
13584
12900
|
return this.computedTiming;
|
|
13585
12901
|
}
|
|
13586
12902
|
/**
|
|
13587
12903
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/getTiming
|
|
13588
|
-
|
|
13589
|
-
;
|
|
13590
|
-
|
|
12904
|
+
*/;
|
|
13591
12905
|
_proto.getTiming = function getTiming() {
|
|
13592
12906
|
return this.timing;
|
|
13593
12907
|
}
|
|
13594
12908
|
/**
|
|
13595
12909
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/updateTiming
|
|
13596
|
-
|
|
13597
|
-
;
|
|
13598
|
-
|
|
12910
|
+
*/;
|
|
13599
12911
|
_proto.updateTiming = function updateTiming(timing) {
|
|
13600
12912
|
var _this2 = this;
|
|
13601
|
-
|
|
13602
12913
|
Object.keys(timing || {}).forEach(function (name) {
|
|
13603
12914
|
_this2.timing = timing[name];
|
|
13604
12915
|
});
|
|
13605
12916
|
};
|
|
13606
|
-
|
|
13607
12917
|
return KeyframeEffect;
|
|
13608
12918
|
}();
|
|
13609
|
-
|
|
13610
12919
|
function compareAnimations(leftAnimation, rightAnimation) {
|
|
13611
12920
|
return Number(leftAnimation.id) - Number(rightAnimation.id);
|
|
13612
12921
|
}
|
|
13613
12922
|
/**
|
|
13614
12923
|
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/web-animations-js/index.d.ts
|
|
13615
12924
|
*/
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
12925
|
var AnimationTimeline = /*#__PURE__*/function () {
|
|
13619
12926
|
/**
|
|
13620
12927
|
* all active animations
|
|
13621
12928
|
*/
|
|
12929
|
+
|
|
13622
12930
|
function AnimationTimeline(document) {
|
|
13623
12931
|
var _this = this;
|
|
13624
|
-
|
|
13625
12932
|
this.document = void 0;
|
|
13626
12933
|
this.animations = [];
|
|
13627
12934
|
this.ticking = false;
|
|
@@ -13634,48 +12941,36 @@
|
|
|
13634
12941
|
this.rafId = 0;
|
|
13635
12942
|
this.rafCallbacks = [];
|
|
13636
12943
|
this.frameId = void 0;
|
|
13637
|
-
|
|
13638
12944
|
this.webAnimationsNextTick = function (t) {
|
|
13639
12945
|
_this.currentTime = t;
|
|
13640
|
-
|
|
13641
12946
|
_this.discardAnimations();
|
|
13642
|
-
|
|
13643
12947
|
if (_this.animations.length === 0) {
|
|
13644
12948
|
_this.timelineTicking = false;
|
|
13645
12949
|
} else {
|
|
13646
12950
|
_this.requestAnimationFrame(_this.webAnimationsNextTick);
|
|
13647
12951
|
}
|
|
13648
12952
|
};
|
|
13649
|
-
|
|
13650
12953
|
this.processRafCallbacks = function (t) {
|
|
13651
12954
|
var processing = _this.rafCallbacks;
|
|
13652
12955
|
_this.rafCallbacks = [];
|
|
13653
12956
|
if (t < Number(_this.currentTime)) t = Number(_this.currentTime);
|
|
13654
|
-
|
|
13655
12957
|
_this.animations.sort(compareAnimations);
|
|
13656
|
-
|
|
13657
12958
|
_this.animations = _this.tick(t, true, _this.animations)[0];
|
|
13658
12959
|
processing.forEach(function (entry) {
|
|
13659
12960
|
entry[1](t);
|
|
13660
12961
|
});
|
|
13661
|
-
|
|
13662
12962
|
_this.applyPendingEffects();
|
|
13663
12963
|
};
|
|
13664
|
-
|
|
13665
12964
|
this.document = document;
|
|
13666
12965
|
}
|
|
13667
|
-
|
|
13668
12966
|
var _proto = AnimationTimeline.prototype;
|
|
13669
|
-
|
|
13670
12967
|
_proto.getAnimations = function getAnimations() {
|
|
13671
12968
|
this.discardAnimations();
|
|
13672
12969
|
return this.animations.slice();
|
|
13673
12970
|
};
|
|
13674
|
-
|
|
13675
12971
|
_proto.isTicking = function isTicking() {
|
|
13676
12972
|
return this.inTick;
|
|
13677
12973
|
};
|
|
13678
|
-
|
|
13679
12974
|
_proto.play = function play(target, keyframes, options) {
|
|
13680
12975
|
var effect = new KeyframeEffect(target, keyframes, options);
|
|
13681
12976
|
var animation = new Animation(effect, this);
|
|
@@ -13685,7 +12980,8 @@
|
|
|
13685
12980
|
animation.play();
|
|
13686
12981
|
animation.updatePromises();
|
|
13687
12982
|
return animation;
|
|
13688
|
-
}
|
|
12983
|
+
}
|
|
12984
|
+
// RAF is supposed to be the last script to occur before frame rendering but not
|
|
13689
12985
|
// all browsers behave like this. This function is for synchonously updating an
|
|
13690
12986
|
// animation's effects whenever its state is mutated by script to work around
|
|
13691
12987
|
// incorrect script execution ordering by the browser.
|
|
@@ -13693,96 +12989,77 @@
|
|
|
13693
12989
|
|
|
13694
12990
|
_proto.applyDirtiedAnimation = function applyDirtiedAnimation(animation) {
|
|
13695
12991
|
var _this2 = this;
|
|
13696
|
-
|
|
13697
12992
|
if (this.inTick) {
|
|
13698
12993
|
return;
|
|
13699
|
-
}
|
|
13700
|
-
|
|
13701
|
-
|
|
12994
|
+
}
|
|
12995
|
+
// update active animations in displayobject
|
|
13702
12996
|
animation.markTarget();
|
|
13703
12997
|
var animations = animation.targetAnimations();
|
|
13704
|
-
animations.sort(compareAnimations);
|
|
13705
|
-
|
|
12998
|
+
animations.sort(compareAnimations);
|
|
12999
|
+
// clear inactive animations
|
|
13706
13000
|
var inactiveAnimations = this.tick(Number(this.currentTime), false, animations.slice())[1];
|
|
13707
13001
|
inactiveAnimations.forEach(function (animation) {
|
|
13708
13002
|
var index = _this2.animations.indexOf(animation);
|
|
13709
|
-
|
|
13710
13003
|
if (index !== -1) {
|
|
13711
13004
|
_this2.animations.splice(index, 1);
|
|
13712
13005
|
}
|
|
13713
13006
|
});
|
|
13714
13007
|
this.applyPendingEffects();
|
|
13715
13008
|
};
|
|
13716
|
-
|
|
13717
13009
|
_proto.restart = function restart() {
|
|
13718
13010
|
if (!this.ticking) {
|
|
13719
13011
|
this.ticking = true;
|
|
13720
13012
|
this.requestAnimationFrame(function () {});
|
|
13721
13013
|
this.hasRestartedThisFrame = true;
|
|
13722
13014
|
}
|
|
13723
|
-
|
|
13724
13015
|
return this.hasRestartedThisFrame;
|
|
13725
13016
|
};
|
|
13726
|
-
|
|
13727
13017
|
_proto.destroy = function destroy() {
|
|
13728
13018
|
this.document.defaultView.cancelAnimationFrame(this.frameId);
|
|
13729
13019
|
};
|
|
13730
|
-
|
|
13731
13020
|
_proto.applyPendingEffects = function applyPendingEffects() {
|
|
13732
13021
|
this.pendingEffects.forEach(function (effect) {
|
|
13733
13022
|
effect === null || effect === void 0 ? void 0 : effect.applyInterpolations();
|
|
13734
13023
|
});
|
|
13735
13024
|
this.pendingEffects = [];
|
|
13736
13025
|
};
|
|
13737
|
-
|
|
13738
13026
|
_proto.updateAnimationsPromises = function updateAnimationsPromises() {
|
|
13739
13027
|
this.animationsWithPromises = this.animationsWithPromises.filter(function (animation) {
|
|
13740
13028
|
return animation.updatePromises();
|
|
13741
13029
|
});
|
|
13742
13030
|
};
|
|
13743
|
-
|
|
13744
13031
|
_proto.discardAnimations = function discardAnimations() {
|
|
13745
13032
|
this.updateAnimationsPromises();
|
|
13746
13033
|
this.animations = this.animations.filter(function (animation) {
|
|
13747
13034
|
return animation.playState !== 'finished' && animation.playState !== 'idle';
|
|
13748
13035
|
});
|
|
13749
13036
|
};
|
|
13750
|
-
|
|
13751
13037
|
_proto.restartWebAnimationsNextTick = function restartWebAnimationsNextTick() {
|
|
13752
13038
|
if (!this.timelineTicking) {
|
|
13753
13039
|
this.timelineTicking = true;
|
|
13754
13040
|
this.requestAnimationFrame(this.webAnimationsNextTick);
|
|
13755
13041
|
}
|
|
13756
13042
|
};
|
|
13757
|
-
|
|
13758
13043
|
_proto.rAF = function rAF(f) {
|
|
13759
13044
|
var id = this.rafId++;
|
|
13760
|
-
|
|
13761
13045
|
if (this.rafCallbacks.length === 0) {
|
|
13762
13046
|
this.frameId = this.document.defaultView.requestAnimationFrame(this.processRafCallbacks);
|
|
13763
13047
|
}
|
|
13764
|
-
|
|
13765
13048
|
this.rafCallbacks.push([id, f]);
|
|
13766
13049
|
return id;
|
|
13767
13050
|
};
|
|
13768
|
-
|
|
13769
13051
|
_proto.requestAnimationFrame = function requestAnimationFrame(f) {
|
|
13770
13052
|
var _this3 = this;
|
|
13771
|
-
|
|
13772
13053
|
return this.rAF(function (x) {
|
|
13773
13054
|
_this3.updateAnimationsPromises();
|
|
13774
|
-
|
|
13775
13055
|
f(x);
|
|
13776
|
-
|
|
13777
13056
|
_this3.updateAnimationsPromises();
|
|
13778
13057
|
});
|
|
13779
13058
|
};
|
|
13780
|
-
|
|
13781
13059
|
_proto.tick = function tick(t, isAnimationFrame, updatingAnimations) {
|
|
13782
13060
|
var _this4 = this,
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
|
|
13061
|
+
_this$pendingEffects,
|
|
13062
|
+
_this$pendingEffects2;
|
|
13786
13063
|
this.inTick = true;
|
|
13787
13064
|
this.hasRestartedThisFrame = false;
|
|
13788
13065
|
this.currentTime = t;
|
|
@@ -13793,7 +13070,6 @@
|
|
|
13793
13070
|
var inactiveAnimations = [];
|
|
13794
13071
|
updatingAnimations.forEach(function (animation) {
|
|
13795
13072
|
animation.tick(t, isAnimationFrame);
|
|
13796
|
-
|
|
13797
13073
|
if (!animation._inEffect) {
|
|
13798
13074
|
newPendingClears.push(animation.effect);
|
|
13799
13075
|
animation.unmarkTarget();
|
|
@@ -13801,30 +13077,23 @@
|
|
|
13801
13077
|
newPendingEffects.push(animation.effect);
|
|
13802
13078
|
animation.markTarget();
|
|
13803
13079
|
}
|
|
13804
|
-
|
|
13805
13080
|
if (animation._needsTick) _this4.ticking = true;
|
|
13806
13081
|
var alive = animation._inEffect || animation._needsTick;
|
|
13807
13082
|
animation._inTimeline = alive;
|
|
13808
|
-
|
|
13809
13083
|
if (alive) {
|
|
13810
13084
|
activeAnimations.push(animation);
|
|
13811
13085
|
} else {
|
|
13812
13086
|
inactiveAnimations.push(animation);
|
|
13813
13087
|
}
|
|
13814
13088
|
});
|
|
13815
|
-
|
|
13816
13089
|
(_this$pendingEffects = this.pendingEffects).push.apply(_this$pendingEffects, newPendingClears);
|
|
13817
|
-
|
|
13818
13090
|
(_this$pendingEffects2 = this.pendingEffects).push.apply(_this$pendingEffects2, newPendingEffects);
|
|
13819
|
-
|
|
13820
13091
|
if (this.ticking) this.requestAnimationFrame(function () {});
|
|
13821
13092
|
this.inTick = false;
|
|
13822
13093
|
return [activeAnimations, inactiveAnimations];
|
|
13823
13094
|
};
|
|
13824
|
-
|
|
13825
13095
|
return AnimationTimeline;
|
|
13826
13096
|
}();
|
|
13827
|
-
|
|
13828
13097
|
runtime.EasingFunction = parseEasingFunction;
|
|
13829
13098
|
runtime.AnimationTimeline = AnimationTimeline;
|
|
13830
13099
|
|