@galacean/effects-core 2.3.0-alpha.1 → 2.3.0-alpha.2
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/components/shape-component.d.ts +4 -3
- package/dist/fallback/migration.d.ts +1 -1
- package/dist/index.js +393 -386
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +393 -386
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/shape/build-line.d.ts +6 -4
- package/dist/plugins/shape/graphics-path.d.ts +1 -1
- package/dist/plugins/shape/polygon.d.ts +4 -0
- package/dist/plugins/shape/rectangle.d.ts +21 -88
- package/dist/plugins/shape/shape-path.d.ts +1 -1
- package/dist/plugins/text/text-item.d.ts +15 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.3.0-alpha.
|
|
6
|
+
* Version: v2.3.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -1035,7 +1035,8 @@ function _inherits(subClass, superClass) {
|
|
|
1035
1035
|
JSONSceneVersion["2_4"] = "2.4";
|
|
1036
1036
|
JSONSceneVersion["3_0"] = "3.0";
|
|
1037
1037
|
JSONSceneVersion["3_1"] = "3.1";
|
|
1038
|
-
JSONSceneVersion["
|
|
1038
|
+
JSONSceneVersion["3_2"] = "3.2";
|
|
1039
|
+
JSONSceneVersion["LATEST"] = "3.2";
|
|
1039
1040
|
})(JSONSceneVersion || (JSONSceneVersion = {}));
|
|
1040
1041
|
|
|
1041
1042
|
/*********************************************/ /* 元素属性参数类型 */ /*********************************************/ /**
|
|
@@ -1573,7 +1574,7 @@ var MaterialBlending;
|
|
|
1573
1574
|
var TextOverflow;
|
|
1574
1575
|
(function(TextOverflow) {
|
|
1575
1576
|
/**
|
|
1576
|
-
* display
|
|
1577
|
+
* display 模式下,会显示所有文本,文本大小会根据边界框调整。
|
|
1577
1578
|
*/ TextOverflow[TextOverflow["display"] = 0] = "display";
|
|
1578
1579
|
/**
|
|
1579
1580
|
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
@@ -1666,12 +1667,18 @@ var BuiltinObjectGUID = {
|
|
|
1666
1667
|
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
1667
1668
|
})(ShapePrimitiveType || (ShapePrimitiveType = {}));
|
|
1668
1669
|
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1670
|
+
var LineCap;
|
|
1671
|
+
(function(LineCap) {
|
|
1672
|
+
/** 默认值。向线条的每个末端添加平直的边缘 */ LineCap[LineCap["Butt"] = 0] = "Butt";
|
|
1673
|
+
/** 向线条的每个末端添加圆形线帽 */ LineCap[LineCap["Round"] = 1] = "Round";
|
|
1674
|
+
/** 向线条的每个末端添加正方形线帽 */ LineCap[LineCap["Square"] = 2] = "Square";
|
|
1675
|
+
})(LineCap || (LineCap = {}));
|
|
1676
|
+
var LineJoin;
|
|
1677
|
+
(function(LineJoin) {
|
|
1678
|
+
/** 创建圆角 */ LineJoin[LineJoin["Round"] = 0] = "Round";
|
|
1679
|
+
/** 创建斜角 */ LineJoin[LineJoin["Bevel"] = 1] = "Bevel";
|
|
1680
|
+
/** 创建尖角 */ LineJoin[LineJoin["Miter"] = 2] = "Miter";
|
|
1681
|
+
})(LineJoin || (LineJoin = {}));
|
|
1675
1682
|
|
|
1676
1683
|
/**
|
|
1677
1684
|
* 动态换图类型
|
|
@@ -1880,8 +1887,8 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1880
1887
|
get FontStyle () { return FontStyle; },
|
|
1881
1888
|
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1882
1889
|
get ShapePrimitiveType () { return ShapePrimitiveType; },
|
|
1883
|
-
get
|
|
1884
|
-
get
|
|
1890
|
+
get LineCap () { return LineCap; },
|
|
1891
|
+
get LineJoin () { return LineJoin; },
|
|
1885
1892
|
get BackgroundType () { return BackgroundType; },
|
|
1886
1893
|
get MultimediaType () { return MultimediaType; },
|
|
1887
1894
|
get DataType () { return DataType; },
|
|
@@ -3800,7 +3807,9 @@ Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
|
3800
3807
|
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
3801
3808
|
renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
|
|
3802
3809
|
}
|
|
3803
|
-
|
|
3810
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
3811
|
+
renderer.drawGeometry(this.geometry, this.materials[i], i);
|
|
3812
|
+
}
|
|
3804
3813
|
};
|
|
3805
3814
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
3806
3815
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
@@ -7335,7 +7344,15 @@ var BYTES_TYPE_MAP = (_obj$5 = {}, _obj$5[glContext.FLOAT] = Float32Array.BYTES_
|
|
|
7335
7344
|
*/ var Geometry = /*#__PURE__*/ function(EffectsObject) {
|
|
7336
7345
|
_inherits(Geometry, EffectsObject);
|
|
7337
7346
|
function Geometry() {
|
|
7338
|
-
|
|
7347
|
+
var _this;
|
|
7348
|
+
_this = EffectsObject.apply(this, arguments) || this;
|
|
7349
|
+
/**
|
|
7350
|
+
* Geometry 的名称
|
|
7351
|
+
*/ _this.name = "";
|
|
7352
|
+
/**
|
|
7353
|
+
* 子网格数据
|
|
7354
|
+
*/ _this.subMeshes = [];
|
|
7355
|
+
return _this;
|
|
7339
7356
|
}
|
|
7340
7357
|
var _proto = Geometry.prototype;
|
|
7341
7358
|
/**
|
|
@@ -12701,18 +12718,12 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
12701
12718
|
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
12702
12719
|
var keyTimeEnd = this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
|
|
12703
12720
|
if (time <= keyTimeStart) {
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12707
|
-
}
|
|
12708
|
-
return this.getCurveValue(keyTimeData[0], keyTimeStart);
|
|
12721
|
+
keyframeInfo.getPointIndexInCurve(this.startKeyframe, keyframeInfo.pointIndexCache);
|
|
12722
|
+
return this.startKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12709
12723
|
}
|
|
12710
12724
|
if (time >= keyTimeEnd) {
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12714
|
-
}
|
|
12715
|
-
return this.getCurveValue(keyTimeData[keyTimeData.length - 1], keyTimeEnd);
|
|
12725
|
+
keyframeInfo.getPointIndexInCurve(this.endKeyframe, keyframeInfo.pointIndexCache);
|
|
12726
|
+
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12716
12727
|
}
|
|
12717
12728
|
for(var i = 0; i < keyTimeData.length; i++){
|
|
12718
12729
|
var xMin = this.curveMap[keyTimeData[i]].timeStart;
|
|
@@ -14858,6 +14869,10 @@ function triangulate(contours) {
|
|
|
14858
14869
|
points
|
|
14859
14870
|
]);
|
|
14860
14871
|
var indexStart = vertices.length / 2;
|
|
14872
|
+
// 当所有 points 在一条直线时, gluTess 三角化 triangles 会返回空数组,这边做一下额外处理返回线段左右端点组成的三角形,确保拿到的包围盒是正确的。
|
|
14873
|
+
if (triangles.length === 0) {
|
|
14874
|
+
this.getLineEndPointsTriangle(points, triangles);
|
|
14875
|
+
}
|
|
14861
14876
|
for(var i = 0; i < triangles.length; i++){
|
|
14862
14877
|
vertices[verticesOffset * 2 + i] = triangles[i];
|
|
14863
14878
|
}
|
|
@@ -14866,6 +14881,57 @@ function triangulate(contours) {
|
|
|
14866
14881
|
indices[indicesOffset + i1] = indexStart + i1;
|
|
14867
14882
|
}
|
|
14868
14883
|
};
|
|
14884
|
+
/**
|
|
14885
|
+
* 获取直线上最远的两个端点坐标组成的三角形
|
|
14886
|
+
*/ _proto.getLineEndPointsTriangle = function getLineEndPointsTriangle(points, triangles) {
|
|
14887
|
+
// 参数检查
|
|
14888
|
+
if (!points || points.length < 2 || points.length % 2 !== 0) {
|
|
14889
|
+
throw new Error("Invalid points array");
|
|
14890
|
+
}
|
|
14891
|
+
if (points.length === 2) {
|
|
14892
|
+
triangles.push(points[0], points[1], points[0], points[1], points[0], points[1]);
|
|
14893
|
+
return;
|
|
14894
|
+
}
|
|
14895
|
+
// 取第一个线段计算斜率
|
|
14896
|
+
var dx = points[2] - points[0];
|
|
14897
|
+
var dy = points[3] - points[1];
|
|
14898
|
+
// 存放结果坐标
|
|
14899
|
+
var startX = points[0];
|
|
14900
|
+
var startY = points[1];
|
|
14901
|
+
var endX = points[0];
|
|
14902
|
+
var endY = points[1];
|
|
14903
|
+
// 根据斜率决定比较x还是y
|
|
14904
|
+
if (Math.abs(dx) >= Math.abs(dy)) {
|
|
14905
|
+
// 水平方向为主,比较x坐标
|
|
14906
|
+
for(var i = 0; i < points.length; i += 2){
|
|
14907
|
+
var x = points[i];
|
|
14908
|
+
var y = points[i + 1];
|
|
14909
|
+
if (x < startX) {
|
|
14910
|
+
startX = x;
|
|
14911
|
+
startY = y;
|
|
14912
|
+
}
|
|
14913
|
+
if (x > endX) {
|
|
14914
|
+
endX = x;
|
|
14915
|
+
endY = y;
|
|
14916
|
+
}
|
|
14917
|
+
}
|
|
14918
|
+
} else {
|
|
14919
|
+
// 垂直方向为主,比较y坐标
|
|
14920
|
+
for(var i1 = 0; i1 < points.length; i1 += 2){
|
|
14921
|
+
var x1 = points[i1];
|
|
14922
|
+
var y1 = points[i1 + 1];
|
|
14923
|
+
if (y1 < startY) {
|
|
14924
|
+
startX = x1;
|
|
14925
|
+
startY = y1;
|
|
14926
|
+
}
|
|
14927
|
+
if (y1 > endY) {
|
|
14928
|
+
endX = x1;
|
|
14929
|
+
endY = y1;
|
|
14930
|
+
}
|
|
14931
|
+
}
|
|
14932
|
+
}
|
|
14933
|
+
triangles.push(startX, startY, endX, endY, endX, endY);
|
|
14934
|
+
};
|
|
14869
14935
|
_create_class(Polygon, [
|
|
14870
14936
|
{
|
|
14871
14937
|
key: "lastX",
|
|
@@ -15339,47 +15405,48 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15339
15405
|
}(ShapePrimitive);
|
|
15340
15406
|
|
|
15341
15407
|
// Based on:
|
|
15342
|
-
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15343
15408
|
/**
|
|
15344
|
-
* The `Rectangle` object is an area defined by its position, as indicated by its
|
|
15345
|
-
* point (`x`, `y`) and by its `width` and its `height
|
|
15409
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
|
15410
|
+
* point (`x`, `y`) and by its `width` and its `height`, including a `roundness` property that
|
|
15411
|
+
* defines the roundness of the rounded corners.
|
|
15412
|
+
* @memberof maths
|
|
15346
15413
|
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15347
15414
|
_inherits(Rectangle, ShapePrimitive);
|
|
15348
|
-
function Rectangle(x, y, width, height) {
|
|
15415
|
+
function Rectangle(x, y, width, height, roundness) {
|
|
15349
15416
|
if (x === void 0) x = 0;
|
|
15350
15417
|
if (y === void 0) y = 0;
|
|
15351
15418
|
if (width === void 0) width = 0;
|
|
15352
15419
|
if (height === void 0) height = 0;
|
|
15420
|
+
if (roundness === void 0) roundness = 20;
|
|
15353
15421
|
var _this;
|
|
15354
15422
|
_this = ShapePrimitive.call(this) || this;
|
|
15355
|
-
_this.x =
|
|
15356
|
-
_this.y =
|
|
15357
|
-
_this.width =
|
|
15358
|
-
_this.height =
|
|
15423
|
+
_this.x = x;
|
|
15424
|
+
_this.y = y;
|
|
15425
|
+
_this.width = width;
|
|
15426
|
+
_this.height = height;
|
|
15427
|
+
_this.roundness = roundness;
|
|
15359
15428
|
return _this;
|
|
15360
15429
|
}
|
|
15361
15430
|
var _proto = Rectangle.prototype;
|
|
15362
|
-
/**
|
|
15363
|
-
|
|
15431
|
+
/**
|
|
15432
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15433
|
+
* @param out - optional rectangle to store the result
|
|
15434
|
+
* @returns The framing rectangle
|
|
15435
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15436
|
+
out = out || new Rectangle();
|
|
15437
|
+
out.x = this.x;
|
|
15438
|
+
out.y = this.y;
|
|
15439
|
+
out.width = this.width;
|
|
15440
|
+
out.height = this.height;
|
|
15441
|
+
return out;
|
|
15364
15442
|
};
|
|
15365
15443
|
/**
|
|
15366
|
-
* Creates a clone of this
|
|
15367
|
-
* @returns
|
|
15444
|
+
* Creates a clone of this rectangle.
|
|
15445
|
+
* @returns - A copy of the rectangle.
|
|
15368
15446
|
*/ _proto.clone = function clone() {
|
|
15369
|
-
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15447
|
+
return new Rectangle(this.x, this.y, this.width, this.height, this.roundness);
|
|
15370
15448
|
};
|
|
15371
15449
|
/**
|
|
15372
|
-
* Converts a Bounds object to a Rectangle object.
|
|
15373
|
-
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15374
|
-
* @returns Returns itself.
|
|
15375
|
-
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15376
|
-
// this.x = bounds.minX;
|
|
15377
|
-
// this.y = bounds.minY;
|
|
15378
|
-
// this.width = bounds.maxX - bounds.minX;
|
|
15379
|
-
// this.height = bounds.maxY - bounds.minY;
|
|
15380
|
-
// return this;
|
|
15381
|
-
// }
|
|
15382
|
-
/**
|
|
15383
15450
|
* Copies another rectangle to this one.
|
|
15384
15451
|
* @param rectangle - The rectangle to copy from.
|
|
15385
15452
|
* @returns Returns itself.
|
|
@@ -15388,6 +15455,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15388
15455
|
this.y = rectangle.y;
|
|
15389
15456
|
this.width = rectangle.width;
|
|
15390
15457
|
this.height = rectangle.height;
|
|
15458
|
+
this.roundness = rectangle.roundness;
|
|
15391
15459
|
return this;
|
|
15392
15460
|
};
|
|
15393
15461
|
/**
|
|
@@ -15398,267 +15466,121 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15398
15466
|
rectangle.copyFrom(this);
|
|
15399
15467
|
return rectangle;
|
|
15400
15468
|
};
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15469
|
+
_proto.build = function build(points) {
|
|
15470
|
+
var ry;
|
|
15471
|
+
var halfWidth = this.width / 2;
|
|
15472
|
+
var halfHeight = this.height / 2;
|
|
15473
|
+
var x = this.x + halfWidth;
|
|
15474
|
+
var y = this.y + halfHeight;
|
|
15475
|
+
var rx = ry = Math.max(0, Math.min(this.roundness / 100, 1) * Math.min(halfWidth, halfHeight));
|
|
15476
|
+
var dx = halfWidth - rx;
|
|
15477
|
+
var dy = halfHeight - ry;
|
|
15478
|
+
if (!(rx >= 0 && ry >= 0 && dx >= 0 && dy >= 0)) {
|
|
15479
|
+
return;
|
|
15409
15480
|
}
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15481
|
+
// 控制边缘的平滑程度
|
|
15482
|
+
var densityScale = 5;
|
|
15483
|
+
// Choose a number of segments such that the maximum absolute deviation from the circle is approximately 0.029
|
|
15484
|
+
var n = densityScale * Math.ceil(2.3 * Math.sqrt(rx + ry));
|
|
15485
|
+
var m = n * 8 + (dx ? 4 : 0) + (dy ? 4 : 0);
|
|
15486
|
+
if (m === 0) {
|
|
15487
|
+
return;
|
|
15414
15488
|
}
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
* @param strokeWidth - The width of the line to check
|
|
15422
|
-
* @returns Whether the x/y coordinates are within this rectangle
|
|
15423
|
-
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15424
|
-
var _this = this, width = _this.width, height = _this.height;
|
|
15425
|
-
if (width <= 0 || height <= 0) {
|
|
15426
|
-
return false;
|
|
15489
|
+
if (n === 0) {
|
|
15490
|
+
points[0] = points[6] = x + dx;
|
|
15491
|
+
points[1] = points[3] = y + dy;
|
|
15492
|
+
points[2] = points[4] = x - dx;
|
|
15493
|
+
points[5] = points[7] = y - dy;
|
|
15494
|
+
return;
|
|
15427
15495
|
}
|
|
15428
|
-
var
|
|
15429
|
-
var
|
|
15430
|
-
var
|
|
15431
|
-
var
|
|
15432
|
-
var
|
|
15433
|
-
var
|
|
15434
|
-
var
|
|
15435
|
-
var
|
|
15436
|
-
var
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
|
|
15466
|
-
|
|
15467
|
-
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
// transform.apply(rb, rb);
|
|
15481
|
-
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15482
|
-
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15483
|
-
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15484
|
-
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15485
|
-
// return false;
|
|
15486
|
-
// }
|
|
15487
|
-
// const nx = s * (lb.y - lt.y);
|
|
15488
|
-
// const ny = s * (lt.x - lb.x);
|
|
15489
|
-
// const n00 = (nx * x0) + (ny * y0);
|
|
15490
|
-
// const n10 = (nx * x1) + (ny * y0);
|
|
15491
|
-
// const n01 = (nx * x0) + (ny * y1);
|
|
15492
|
-
// const n11 = (nx * x1) + (ny * y1);
|
|
15493
|
-
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15494
|
-
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15495
|
-
// return false;
|
|
15496
|
-
// }
|
|
15497
|
-
// const mx = s * (lt.y - rt.y);
|
|
15498
|
-
// const my = s * (rt.x - lt.x);
|
|
15499
|
-
// const m00 = (mx * x0) + (my * y0);
|
|
15500
|
-
// const m10 = (mx * x1) + (my * y0);
|
|
15501
|
-
// const m01 = (mx * x0) + (my * y1);
|
|
15502
|
-
// const m11 = (mx * x1) + (my * y1);
|
|
15503
|
-
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15504
|
-
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15505
|
-
// return false;
|
|
15506
|
-
// }
|
|
15507
|
-
// return true;
|
|
15508
|
-
// }
|
|
15509
|
-
/**
|
|
15510
|
-
* Pads the rectangle making it grow in all directions.
|
|
15511
|
-
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15512
|
-
* @param paddingX - The horizontal padding amount.
|
|
15513
|
-
* @param paddingY - The vertical padding amount.
|
|
15514
|
-
* @returns Returns itself.
|
|
15515
|
-
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15516
|
-
if (paddingX === void 0) paddingX = 0;
|
|
15517
|
-
if (paddingY === void 0) paddingY = paddingX;
|
|
15518
|
-
this.x -= paddingX;
|
|
15519
|
-
this.y -= paddingY;
|
|
15520
|
-
this.width += paddingX * 2;
|
|
15521
|
-
this.height += paddingY * 2;
|
|
15522
|
-
return this;
|
|
15523
|
-
};
|
|
15524
|
-
/**
|
|
15525
|
-
* Fits this rectangle around the passed one.
|
|
15526
|
-
* @param rectangle - The rectangle to fit.
|
|
15527
|
-
* @returns Returns itself.
|
|
15528
|
-
*/ _proto.fit = function fit(rectangle) {
|
|
15529
|
-
var x1 = Math.max(this.x, rectangle.x);
|
|
15530
|
-
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15531
|
-
var y1 = Math.max(this.y, rectangle.y);
|
|
15532
|
-
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15533
|
-
this.x = x1;
|
|
15534
|
-
this.width = Math.max(x2 - x1, 0);
|
|
15535
|
-
this.y = y1;
|
|
15536
|
-
this.height = Math.max(y2 - y1, 0);
|
|
15537
|
-
return this;
|
|
15538
|
-
};
|
|
15539
|
-
/**
|
|
15540
|
-
* Enlarges rectangle that way its corners lie on grid
|
|
15541
|
-
* @param resolution - resolution
|
|
15542
|
-
* @param eps - precision
|
|
15543
|
-
* @returns Returns itself.
|
|
15544
|
-
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15545
|
-
if (resolution === void 0) resolution = 1;
|
|
15546
|
-
if (eps === void 0) eps = 0.001;
|
|
15547
|
-
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15548
|
-
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15549
|
-
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15550
|
-
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15551
|
-
this.width = x2 - this.x;
|
|
15552
|
-
this.height = y2 - this.y;
|
|
15553
|
-
return this;
|
|
15554
|
-
};
|
|
15555
|
-
/**
|
|
15556
|
-
* Enlarges this rectangle to include the passed rectangle.
|
|
15557
|
-
* @param rectangle - The rectangle to include.
|
|
15558
|
-
* @returns Returns itself.
|
|
15559
|
-
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15560
|
-
var x1 = Math.min(this.x, rectangle.x);
|
|
15561
|
-
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15562
|
-
var y1 = Math.min(this.y, rectangle.y);
|
|
15563
|
-
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15564
|
-
this.x = x1;
|
|
15565
|
-
this.width = x2 - x1;
|
|
15566
|
-
this.y = y1;
|
|
15567
|
-
this.height = y2 - y1;
|
|
15568
|
-
return this;
|
|
15569
|
-
};
|
|
15570
|
-
/**
|
|
15571
|
-
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15572
|
-
* @param out - optional rectangle to store the result
|
|
15573
|
-
* @returns The framing rectangle
|
|
15574
|
-
*/ _proto.getBounds = function getBounds(out) {
|
|
15575
|
-
out = out || new Rectangle();
|
|
15576
|
-
out.copyFrom(this);
|
|
15577
|
-
return out;
|
|
15578
|
-
};
|
|
15579
|
-
_proto.getX = function getX() {
|
|
15580
|
-
return this.x;
|
|
15581
|
-
};
|
|
15582
|
-
_proto.getY = function getY() {
|
|
15583
|
-
return this.y;
|
|
15584
|
-
};
|
|
15585
|
-
_proto.build = function build(points) {
|
|
15586
|
-
var x = this.x;
|
|
15587
|
-
var y = this.y;
|
|
15588
|
-
var width = this.width;
|
|
15589
|
-
var height = this.height;
|
|
15590
|
-
if (!(width >= 0 && height >= 0)) {
|
|
15591
|
-
return points;
|
|
15496
|
+
var j1 = 0;
|
|
15497
|
+
var j2 = n * 4 + (dx ? 2 : 0) + 2;
|
|
15498
|
+
var j3 = j2;
|
|
15499
|
+
var j4 = m;
|
|
15500
|
+
var x0 = dx + rx;
|
|
15501
|
+
var y0 = dy;
|
|
15502
|
+
var x1 = x + x0;
|
|
15503
|
+
var x2 = x - x0;
|
|
15504
|
+
var y1 = y + y0;
|
|
15505
|
+
points[j1++] = x1;
|
|
15506
|
+
points[j1++] = y1;
|
|
15507
|
+
points[--j2] = y1;
|
|
15508
|
+
points[--j2] = x2;
|
|
15509
|
+
if (dy) {
|
|
15510
|
+
var y2 = y - y0;
|
|
15511
|
+
points[j3++] = x2;
|
|
15512
|
+
points[j3++] = y2;
|
|
15513
|
+
points[--j4] = y2;
|
|
15514
|
+
points[--j4] = x1;
|
|
15515
|
+
}
|
|
15516
|
+
for(var i = 1; i < n; i++){
|
|
15517
|
+
var a = Math.PI / 2 * (i / n);
|
|
15518
|
+
var x01 = dx + Math.cos(a) * rx;
|
|
15519
|
+
var y01 = dy + Math.sin(a) * ry;
|
|
15520
|
+
var x11 = x + x01;
|
|
15521
|
+
var x21 = x - x01;
|
|
15522
|
+
var y11 = y + y01;
|
|
15523
|
+
var y21 = y - y01;
|
|
15524
|
+
points[j1++] = x11;
|
|
15525
|
+
points[j1++] = y11;
|
|
15526
|
+
points[--j2] = y11;
|
|
15527
|
+
points[--j2] = x21;
|
|
15528
|
+
points[j3++] = x21;
|
|
15529
|
+
points[j3++] = y21;
|
|
15530
|
+
points[--j4] = y21;
|
|
15531
|
+
points[--j4] = x11;
|
|
15532
|
+
}
|
|
15533
|
+
x0 = dx;
|
|
15534
|
+
y0 = dy + ry;
|
|
15535
|
+
x1 = x + x0;
|
|
15536
|
+
x2 = x - x0;
|
|
15537
|
+
y1 = y + y0;
|
|
15538
|
+
var y22 = y - y0;
|
|
15539
|
+
points[j1++] = x1;
|
|
15540
|
+
points[j1++] = y1;
|
|
15541
|
+
points[--j4] = y22;
|
|
15542
|
+
points[--j4] = x1;
|
|
15543
|
+
if (dx) {
|
|
15544
|
+
points[j1++] = x2;
|
|
15545
|
+
points[j1++] = y1;
|
|
15546
|
+
points[--j4] = y22;
|
|
15547
|
+
points[--j4] = x2;
|
|
15592
15548
|
}
|
|
15593
|
-
points[0] = x;
|
|
15594
|
-
points[1] = y;
|
|
15595
|
-
points[2] = x + width;
|
|
15596
|
-
points[3] = y;
|
|
15597
|
-
points[4] = x + width;
|
|
15598
|
-
points[5] = y + height;
|
|
15599
|
-
points[6] = x;
|
|
15600
|
-
points[7] = y + height;
|
|
15601
|
-
return points;
|
|
15602
15549
|
};
|
|
15603
15550
|
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15604
|
-
|
|
15605
|
-
|
|
15606
|
-
verticesOffset *= verticesStride;
|
|
15607
|
-
vertices[verticesOffset + count] = points[0];
|
|
15608
|
-
vertices[verticesOffset + count + 1] = points[1];
|
|
15609
|
-
count += verticesStride;
|
|
15610
|
-
vertices[verticesOffset + count] = points[2];
|
|
15611
|
-
vertices[verticesOffset + count + 1] = points[3];
|
|
15612
|
-
count += verticesStride;
|
|
15613
|
-
vertices[verticesOffset + count] = points[6];
|
|
15614
|
-
vertices[verticesOffset + count + 1] = points[7];
|
|
15615
|
-
count += verticesStride;
|
|
15616
|
-
vertices[verticesOffset + count] = points[4];
|
|
15617
|
-
vertices[verticesOffset + count + 1] = points[5];
|
|
15618
|
-
count += verticesStride;
|
|
15619
|
-
var verticesIndex = verticesOffset / verticesStride;
|
|
15620
|
-
// triangle 1
|
|
15621
|
-
indices[indicesOffset++] = verticesIndex;
|
|
15622
|
-
indices[indicesOffset++] = verticesIndex + 1;
|
|
15623
|
-
indices[indicesOffset++] = verticesIndex + 2;
|
|
15624
|
-
// triangle 2
|
|
15625
|
-
indices[indicesOffset++] = verticesIndex + 1;
|
|
15626
|
-
indices[indicesOffset++] = verticesIndex + 3;
|
|
15627
|
-
indices[indicesOffset++] = verticesIndex + 2;
|
|
15628
|
-
};
|
|
15629
|
-
_create_class(Rectangle, [
|
|
15630
|
-
{
|
|
15631
|
-
key: "left",
|
|
15632
|
-
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15633
|
-
return this.x;
|
|
15634
|
-
}
|
|
15635
|
-
},
|
|
15636
|
-
{
|
|
15637
|
-
key: "right",
|
|
15638
|
-
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15639
|
-
return this.x + this.width;
|
|
15640
|
-
}
|
|
15641
|
-
},
|
|
15642
|
-
{
|
|
15643
|
-
key: "top",
|
|
15644
|
-
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15645
|
-
return this.y;
|
|
15646
|
-
}
|
|
15647
|
-
},
|
|
15648
|
-
{
|
|
15649
|
-
key: "bottom",
|
|
15650
|
-
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15651
|
-
return this.y + this.height;
|
|
15652
|
-
}
|
|
15551
|
+
if (points.length === 0) {
|
|
15552
|
+
return;
|
|
15653
15553
|
}
|
|
15654
|
-
|
|
15655
|
-
|
|
15656
|
-
|
|
15657
|
-
|
|
15658
|
-
|
|
15554
|
+
// Compute center (average of all points)
|
|
15555
|
+
var centerX = 0;
|
|
15556
|
+
var centerY = 0;
|
|
15557
|
+
for(var i = 0; i < points.length; i += 2){
|
|
15558
|
+
centerX += points[i];
|
|
15559
|
+
centerY += points[i + 1];
|
|
15560
|
+
}
|
|
15561
|
+
centerX /= points.length / 2;
|
|
15562
|
+
centerY /= points.length / 2;
|
|
15563
|
+
// Set center vertex
|
|
15564
|
+
var count = verticesOffset;
|
|
15565
|
+
vertices[count * 2] = centerX;
|
|
15566
|
+
vertices[count * 2 + 1] = centerY;
|
|
15567
|
+
var centerIndex = count++;
|
|
15568
|
+
// Set edge vertices and indices
|
|
15569
|
+
for(var i1 = 0; i1 < points.length; i1 += 2){
|
|
15570
|
+
vertices[count * 2] = points[i1];
|
|
15571
|
+
vertices[count * 2 + 1] = points[i1 + 1];
|
|
15572
|
+
if (i1 > 0) {
|
|
15573
|
+
indices[indicesOffset++] = count;
|
|
15574
|
+
indices[indicesOffset++] = centerIndex;
|
|
15575
|
+
indices[indicesOffset++] = count - 1;
|
|
15659
15576
|
}
|
|
15577
|
+
count++;
|
|
15660
15578
|
}
|
|
15661
|
-
|
|
15579
|
+
// Connect last point to the first edge point
|
|
15580
|
+
indices[indicesOffset++] = centerIndex + 1;
|
|
15581
|
+
indices[indicesOffset++] = centerIndex;
|
|
15582
|
+
indices[indicesOffset++] = count - 1;
|
|
15583
|
+
};
|
|
15662
15584
|
return Rectangle;
|
|
15663
15585
|
}(ShapePrimitive);
|
|
15664
15586
|
|
|
@@ -15756,8 +15678,8 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15756
15678
|
* @param h - The height of the rectangle.
|
|
15757
15679
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15758
15680
|
* @returns The instance of the current object for chaining.
|
|
15759
|
-
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15760
|
-
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15681
|
+
*/ _proto.rect = function rect(x, y, w, h, roundness, transform) {
|
|
15682
|
+
this.drawShape(new Rectangle$1(x, y, w, h, roundness), transform);
|
|
15761
15683
|
return this;
|
|
15762
15684
|
};
|
|
15763
15685
|
/**
|
|
@@ -15903,7 +15825,7 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15903
15825
|
* @param h - The height of the rectangle.
|
|
15904
15826
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15905
15827
|
* @returns The instance of the current object for chaining.
|
|
15906
|
-
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15828
|
+
*/ _proto.rect = function rect(x, y, w, h, roundness, transform) {
|
|
15907
15829
|
this.instructions.push({
|
|
15908
15830
|
action: "rect",
|
|
15909
15831
|
data: [
|
|
@@ -15911,6 +15833,7 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15911
15833
|
y,
|
|
15912
15834
|
w,
|
|
15913
15835
|
h,
|
|
15836
|
+
roundness,
|
|
15914
15837
|
transform
|
|
15915
15838
|
]
|
|
15916
15839
|
});
|
|
@@ -16220,9 +16143,9 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
|
|
16220
16143
|
var innerWeight = (1 - ratio) * 2;
|
|
16221
16144
|
var outerWeight = ratio * 2;
|
|
16222
16145
|
if (!closedShape) {
|
|
16223
|
-
if (style.cap ===
|
|
16146
|
+
if (style.cap === LineCap.Round) {
|
|
16224
16147
|
indexCount += round(x0 - perpX * (innerWeight - outerWeight) * 0.5, y0 - perpY * (innerWeight - outerWeight) * 0.5, x0 - perpX * innerWeight, y0 - perpY * innerWeight, x0 + perpX * outerWeight, y0 + perpY * outerWeight, verts, true) + 2;
|
|
16225
|
-
} else if (style.cap ===
|
|
16148
|
+
} else if (style.cap === LineCap.Square) {
|
|
16226
16149
|
indexCount += square(x0, y0, perpX, perpY, innerWeight, outerWeight, true, verts);
|
|
16227
16150
|
}
|
|
16228
16151
|
}
|
|
@@ -16261,7 +16184,7 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
|
|
16261
16184
|
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
|
16262
16185
|
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
16263
16186
|
/* 180 degree corner? */ if (dot >= 0) {
|
|
16264
|
-
if (style.join ===
|
|
16187
|
+
if (style.join === LineJoin.Round) {
|
|
16265
16188
|
indexCount += round(x1, y1, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
|
|
16266
16189
|
} else {
|
|
16267
16190
|
indexCount += 2;
|
|
@@ -16285,7 +16208,7 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
|
|
16285
16208
|
var smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
|
|
16286
16209
|
var insideMiterOk = pDist <= smallerInsideDiagonalSq;
|
|
16287
16210
|
if (insideMiterOk) {
|
|
16288
|
-
if (style.join ===
|
|
16211
|
+
if (style.join === LineJoin.Bevel || pDist / widthSquared > miterLimitSquared) {
|
|
16289
16212
|
if (clockwise) /* rotating at inner angle */ {
|
|
16290
16213
|
verts.push(imx, imy); // inner miter point
|
|
16291
16214
|
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight); // first segment's outer vertex
|
|
@@ -16298,7 +16221,7 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
|
|
16298
16221
|
verts.push(omx, omy); // outer miter point
|
|
16299
16222
|
}
|
|
16300
16223
|
indexCount += 2;
|
|
16301
|
-
} else if (style.join ===
|
|
16224
|
+
} else if (style.join === LineJoin.Round) {
|
|
16302
16225
|
if (clockwise) /* arc is outside */ {
|
|
16303
16226
|
verts.push(imx, imy);
|
|
16304
16227
|
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
@@ -16319,13 +16242,13 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
|
|
16319
16242
|
} else {
|
|
16320
16243
|
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight); // first segment's inner vertex
|
|
16321
16244
|
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight); // first segment's outer vertex
|
|
16322
|
-
if (style.join ===
|
|
16245
|
+
if (style.join === LineJoin.Round) {
|
|
16323
16246
|
if (clockwise) /* arc is outside */ {
|
|
16324
16247
|
indexCount += round(x1, y1, x1 + perpX * outerWeight, y1 + perpY * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
|
|
16325
16248
|
} else /* arc is inside */ {
|
|
16326
16249
|
indexCount += round(x1, y1, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2;
|
|
16327
16250
|
}
|
|
16328
|
-
} else if (style.join ===
|
|
16251
|
+
} else if (style.join === LineJoin.Miter && pDist / widthSquared <= miterLimitSquared) {
|
|
16329
16252
|
if (clockwise) {
|
|
16330
16253
|
verts.push(omx, omy); // inner miter point
|
|
16331
16254
|
verts.push(omx, omy); // inner miter point
|
|
@@ -16354,9 +16277,9 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
|
|
16354
16277
|
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
|
16355
16278
|
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
16356
16279
|
if (!closedShape) {
|
|
16357
|
-
if (style.cap ===
|
|
16280
|
+
if (style.cap === LineCap.Round) {
|
|
16358
16281
|
indexCount += round(x1 - perpX * (innerWeight - outerWeight) * 0.5, y1 - perpY * (innerWeight - outerWeight) * 0.5, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 + perpX * outerWeight, y1 + perpY * outerWeight, verts, false) + 2;
|
|
16359
|
-
} else if (style.cap ===
|
|
16282
|
+
} else if (style.cap === LineCap.Square) {
|
|
16360
16283
|
indexCount += square(x1, y1, perpX, perpY, innerWeight, outerWeight, false, verts);
|
|
16361
16284
|
}
|
|
16362
16285
|
}
|
|
@@ -16383,9 +16306,10 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16383
16306
|
var _this;
|
|
16384
16307
|
_this = MeshComponent.call(this, engine) || this;
|
|
16385
16308
|
_this.isStroke = false;
|
|
16309
|
+
_this.isFill = false;
|
|
16310
|
+
_this.shapeDirty = true;
|
|
16386
16311
|
_this.graphicsPath = new GraphicsPath();
|
|
16387
16312
|
_this.curveValues = [];
|
|
16388
|
-
_this.shapeDirty = true;
|
|
16389
16313
|
_this.vert = "\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n";
|
|
16390
16314
|
_this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n";
|
|
16391
16315
|
if (!_this.geometry) {
|
|
@@ -16418,6 +16342,15 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16418
16342
|
mode: glContext.TRIANGLES,
|
|
16419
16343
|
drawCount: 4
|
|
16420
16344
|
});
|
|
16345
|
+
_this.geometry.subMeshes.push({
|
|
16346
|
+
offset: 0,
|
|
16347
|
+
indexCount: 0,
|
|
16348
|
+
vertexCount: 0
|
|
16349
|
+
}, {
|
|
16350
|
+
offset: 0,
|
|
16351
|
+
indexCount: 0,
|
|
16352
|
+
vertexCount: 0
|
|
16353
|
+
});
|
|
16421
16354
|
}
|
|
16422
16355
|
if (!_this.material) {
|
|
16423
16356
|
var materialProps = {
|
|
@@ -16427,18 +16360,29 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16427
16360
|
glslVersion: GLSLVersion.GLSL1
|
|
16428
16361
|
}
|
|
16429
16362
|
};
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16363
|
+
var fillMaterial = Material.create(engine, materialProps);
|
|
16364
|
+
fillMaterial.setColor("_Color", new Color(1, 1, 1, 1));
|
|
16365
|
+
fillMaterial.depthMask = false;
|
|
16366
|
+
fillMaterial.depthTest = true;
|
|
16367
|
+
fillMaterial.blending = true;
|
|
16368
|
+
_this.material = fillMaterial;
|
|
16369
|
+
var strokeMaterial = Material.create(engine, materialProps);
|
|
16370
|
+
strokeMaterial.setColor("_Color", new Color(0.25, 0.25, 0.25, 1));
|
|
16371
|
+
strokeMaterial.depthMask = false;
|
|
16372
|
+
strokeMaterial.depthTest = true;
|
|
16373
|
+
strokeMaterial.blending = true;
|
|
16374
|
+
_this.materials[1] = strokeMaterial;
|
|
16435
16375
|
}
|
|
16436
16376
|
_this.strokeAttributes = {
|
|
16437
16377
|
width: 1,
|
|
16438
16378
|
alignment: 0.5,
|
|
16439
|
-
cap:
|
|
16440
|
-
join:
|
|
16441
|
-
miterLimit: 10
|
|
16379
|
+
cap: LineCap.Butt,
|
|
16380
|
+
join: LineJoin.Miter,
|
|
16381
|
+
miterLimit: 10,
|
|
16382
|
+
color: new Color(1, 1, 1, 1)
|
|
16383
|
+
};
|
|
16384
|
+
_this.fillAttribute = {
|
|
16385
|
+
color: new Color(1, 1, 1, 1)
|
|
16442
16386
|
};
|
|
16443
16387
|
_this.shapeAttribute = {
|
|
16444
16388
|
type: ShapePrimitiveType.Custom,
|
|
@@ -16454,6 +16398,8 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16454
16398
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
16455
16399
|
};
|
|
16456
16400
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16401
|
+
this.material.color = this.fillAttribute.color;
|
|
16402
|
+
this.materials[1].color = this.strokeAttributes.color;
|
|
16457
16403
|
if (this.shapeDirty) {
|
|
16458
16404
|
this.buildPath(this.shapeAttribute);
|
|
16459
16405
|
this.buildGeometryFromPath(this.graphicsPath.shapePath);
|
|
@@ -16464,22 +16410,34 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16464
16410
|
var shapePrimitives = shapePath.shapePrimitives;
|
|
16465
16411
|
var vertices = [];
|
|
16466
16412
|
var indices = [];
|
|
16467
|
-
//
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
var
|
|
16471
|
-
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16413
|
+
// Triangulate shapePrimitive
|
|
16414
|
+
//---------------------------------------------------
|
|
16415
|
+
if (this.isFill) {
|
|
16416
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(shapePrimitives), _step; !(_step = _iterator()).done;){
|
|
16417
|
+
var shapePrimitive = _step.value;
|
|
16418
|
+
var shape = shapePrimitive.shape;
|
|
16419
|
+
var points = [];
|
|
16420
|
+
var indexOffset = indices.length;
|
|
16421
|
+
var vertOffset = vertices.length / 2;
|
|
16422
|
+
shape.build(points);
|
|
16476
16423
|
shape.triangulate(points, vertices, vertOffset, indices, indexOffset);
|
|
16477
|
-
}
|
|
16424
|
+
}
|
|
16425
|
+
}
|
|
16426
|
+
var fillIndexCount = indices.length;
|
|
16427
|
+
if (this.isStroke) {
|
|
16428
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(shapePrimitives), _step1; !(_step1 = _iterator1()).done;){
|
|
16429
|
+
var shapePrimitive1 = _step1.value;
|
|
16430
|
+
var shape1 = shapePrimitive1.shape;
|
|
16431
|
+
var points1 = [];
|
|
16432
|
+
indices.length;
|
|
16433
|
+
var vertOffset1 = vertices.length / 2;
|
|
16478
16434
|
var close = true;
|
|
16479
16435
|
var lineStyle = this.strokeAttributes;
|
|
16480
|
-
|
|
16436
|
+
shape1.build(points1);
|
|
16437
|
+
buildLine(points1, lineStyle, false, close, vertices, 2, vertOffset1, indices);
|
|
16481
16438
|
}
|
|
16482
16439
|
}
|
|
16440
|
+
var strokeIndexCount = indices.length - fillIndexCount;
|
|
16483
16441
|
var vertexCount = vertices.length / 2;
|
|
16484
16442
|
// get the current attribute and index arrays from the geometry, avoiding re-creation
|
|
16485
16443
|
var positionArray = this.geometry.getAttributeData("aPos");
|
|
@@ -16512,6 +16470,12 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16512
16470
|
this.geometry.setAttributeData("aUV", uvArray);
|
|
16513
16471
|
this.geometry.setIndexData(indexArray);
|
|
16514
16472
|
this.geometry.setDrawCount(indices.length);
|
|
16473
|
+
var u16Size = 2;
|
|
16474
|
+
var fillSubMesh = this.geometry.subMeshes[0];
|
|
16475
|
+
var strokeSubMesh = this.geometry.subMeshes[1];
|
|
16476
|
+
fillSubMesh.indexCount = fillIndexCount;
|
|
16477
|
+
strokeSubMesh.offset = fillIndexCount * u16Size;
|
|
16478
|
+
strokeSubMesh.indexCount = strokeIndexCount;
|
|
16515
16479
|
};
|
|
16516
16480
|
_proto.buildPath = function buildPath(shapeAttribute) {
|
|
16517
16481
|
this.graphicsPath.clear();
|
|
@@ -16525,7 +16489,6 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16525
16489
|
for(var _iterator = _create_for_of_iterator_helper_loose(customShapeAtribute.shapes), _step; !(_step = _iterator()).done;){
|
|
16526
16490
|
var shape = _step.value;
|
|
16527
16491
|
this.curveValues = [];
|
|
16528
|
-
this.setFillColor(shape.fill);
|
|
16529
16492
|
var indices = shape.indexes;
|
|
16530
16493
|
for(var i = 1; i < indices.length; i++){
|
|
16531
16494
|
var pointIndex = indices[i];
|
|
@@ -16557,38 +16520,28 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16557
16520
|
{
|
|
16558
16521
|
var ellipseData = shapeAttribute;
|
|
16559
16522
|
this.graphicsPath.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16560
|
-
this.setFillColor(ellipseData.fill);
|
|
16561
16523
|
break;
|
|
16562
16524
|
}
|
|
16563
16525
|
case ShapePrimitiveType.Rectangle:
|
|
16564
16526
|
{
|
|
16565
16527
|
var rectangleData = shapeAttribute;
|
|
16566
|
-
this.graphicsPath.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16567
|
-
this.setFillColor(rectangleData.fill);
|
|
16528
|
+
this.graphicsPath.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height, rectangleData.roundness);
|
|
16568
16529
|
break;
|
|
16569
16530
|
}
|
|
16570
16531
|
case ShapePrimitiveType.Star:
|
|
16571
16532
|
{
|
|
16572
16533
|
var starData = shapeAttribute;
|
|
16573
16534
|
this.graphicsPath.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16574
|
-
this.setFillColor(starData.fill);
|
|
16575
16535
|
break;
|
|
16576
16536
|
}
|
|
16577
16537
|
case ShapePrimitiveType.Polygon:
|
|
16578
16538
|
{
|
|
16579
16539
|
var polygonData = shapeAttribute;
|
|
16580
16540
|
this.graphicsPath.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16581
|
-
this.setFillColor(polygonData.fill);
|
|
16582
16541
|
break;
|
|
16583
16542
|
}
|
|
16584
16543
|
}
|
|
16585
16544
|
};
|
|
16586
|
-
_proto.setFillColor = function setFillColor(fill) {
|
|
16587
|
-
if (fill) {
|
|
16588
|
-
var color = fill.color;
|
|
16589
|
-
this.material.setColor("_Color", new Color(color.r, color.g, color.b, color.a));
|
|
16590
|
-
}
|
|
16591
|
-
};
|
|
16592
16545
|
_proto.fromData = function fromData(data) {
|
|
16593
16546
|
MeshComponent.prototype.fromData.call(this, data);
|
|
16594
16547
|
this.shapeDirty = true;
|
|
@@ -16596,19 +16549,27 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16596
16549
|
if (strokeParam) {
|
|
16597
16550
|
this.isStroke = true;
|
|
16598
16551
|
this.strokeAttributes.width = strokeParam.width;
|
|
16552
|
+
this.strokeAttributes.color.copyFrom(strokeParam.color);
|
|
16553
|
+
this.strokeAttributes.cap = strokeParam.cap;
|
|
16554
|
+
this.strokeAttributes.join = strokeParam.join;
|
|
16555
|
+
}
|
|
16556
|
+
var fillParam = data.fill;
|
|
16557
|
+
if (fillParam) {
|
|
16558
|
+
this.isFill = true;
|
|
16559
|
+
this.fillAttribute.color.copyFrom(fillParam.color);
|
|
16599
16560
|
}
|
|
16600
16561
|
switch(data.type){
|
|
16601
16562
|
case ShapePrimitiveType.Custom:
|
|
16602
16563
|
{
|
|
16603
|
-
|
|
16564
|
+
var customShapeData = data;
|
|
16565
|
+
var customShapeAttribute = {
|
|
16604
16566
|
type: ShapePrimitiveType.Custom,
|
|
16605
16567
|
points: [],
|
|
16606
16568
|
easingIns: [],
|
|
16607
16569
|
easingOuts: [],
|
|
16608
|
-
shapes: []
|
|
16570
|
+
shapes: [],
|
|
16571
|
+
fill: customShapeData.fill
|
|
16609
16572
|
};
|
|
16610
|
-
var customShapeData = data;
|
|
16611
|
-
var customShapeAttribute = this.shapeAttribute;
|
|
16612
16573
|
for(var _iterator = _create_for_of_iterator_helper_loose(customShapeData.points), _step; !(_step = _iterator()).done;){
|
|
16613
16574
|
var point = _step.value;
|
|
16614
16575
|
customShapeAttribute.points.push(new Vector2(point.x, point.y));
|
|
@@ -16622,6 +16583,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16622
16583
|
customShapeAttribute.easingOuts.push(new Vector2(easingOut.x, easingOut.y));
|
|
16623
16584
|
}
|
|
16624
16585
|
customShapeAttribute.shapes = customShapeData.shapes;
|
|
16586
|
+
this.shapeAttribute = customShapeAttribute;
|
|
16625
16587
|
break;
|
|
16626
16588
|
}
|
|
16627
16589
|
case ShapePrimitiveType.Ellipse:
|
|
@@ -17512,10 +17474,8 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
17512
17474
|
};
|
|
17513
17475
|
};
|
|
17514
17476
|
_proto.setGeometry = function setGeometry(geometry, worldMatrix) {
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
this.geometry = geometry;
|
|
17518
|
-
}
|
|
17477
|
+
this.triangles = this.geometryToTriangles(geometry);
|
|
17478
|
+
this.geometry = geometry;
|
|
17519
17479
|
var area = [];
|
|
17520
17480
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.triangles), _step; !(_step = _iterator()).done;){
|
|
17521
17481
|
var triangle = _step.value;
|
|
@@ -17536,10 +17496,11 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
17536
17496
|
_proto.geometryToTriangles = function geometryToTriangles(geometry) {
|
|
17537
17497
|
var _geometry_getIndexData;
|
|
17538
17498
|
var indices = (_geometry_getIndexData = geometry.getIndexData()) != null ? _geometry_getIndexData : [];
|
|
17499
|
+
var drawCount = geometry.getDrawCount();
|
|
17539
17500
|
var _geometry_getAttributeData;
|
|
17540
17501
|
var vertices = (_geometry_getAttributeData = geometry.getAttributeData("aPos")) != null ? _geometry_getAttributeData : [];
|
|
17541
17502
|
var res = [];
|
|
17542
|
-
for(var i = 0; i <
|
|
17503
|
+
for(var i = 0; i < drawCount; i += 3){
|
|
17543
17504
|
var index0 = indices[i] * 3;
|
|
17544
17505
|
var index1 = indices[i + 1] * 3;
|
|
17545
17506
|
var index2 = indices[i + 2] * 3;
|
|
@@ -25522,6 +25483,9 @@ var TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
25522
25483
|
/**
|
|
25523
25484
|
* 文本行数
|
|
25524
25485
|
*/ _this.lineCount = 0;
|
|
25486
|
+
/**
|
|
25487
|
+
* 每一行文本的最大宽度
|
|
25488
|
+
*/ _this.maxLineWidth = 0;
|
|
25525
25489
|
_this.SCALE_FACTOR = 0.1;
|
|
25526
25490
|
_this.ALPHA_FIX_VALUE = 1 / 255;
|
|
25527
25491
|
_this.name = "MText" + seed$1++;
|
|
@@ -25605,12 +25569,9 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25605
25569
|
this.textStyle = new TextStyle(options);
|
|
25606
25570
|
this.textLayout = new TextLayout(options);
|
|
25607
25571
|
this.text = options.text.toString();
|
|
25608
|
-
this.lineCount = this.getLineCount(options.text, true);
|
|
25609
25572
|
};
|
|
25610
|
-
_proto.getLineCount = function getLineCount(text,
|
|
25611
|
-
var
|
|
25612
|
-
var letterSpace = this.textLayout.letterSpace;
|
|
25613
|
-
var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
25573
|
+
_proto.getLineCount = function getLineCount(text, context) {
|
|
25574
|
+
var _this_textLayout = this.textLayout, letterSpace = _this_textLayout.letterSpace, overflow = _this_textLayout.overflow;
|
|
25614
25575
|
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
25615
25576
|
var lineCount = 1;
|
|
25616
25577
|
var x = 0;
|
|
@@ -25618,15 +25579,27 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25618
25579
|
var _context_measureText;
|
|
25619
25580
|
var str = text[i];
|
|
25620
25581
|
var _context_measureText_width;
|
|
25621
|
-
var textMetrics = (
|
|
25582
|
+
var textMetrics = (_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0;
|
|
25622
25583
|
// 和浏览器行为保持一致
|
|
25623
25584
|
x += letterSpace;
|
|
25624
|
-
|
|
25625
|
-
|
|
25626
|
-
|
|
25627
|
-
|
|
25628
|
-
|
|
25629
|
-
|
|
25585
|
+
// 处理文本结束行为
|
|
25586
|
+
if (overflow === TextOverflow.display) {
|
|
25587
|
+
if (str === "\n") {
|
|
25588
|
+
lineCount++;
|
|
25589
|
+
x = 0;
|
|
25590
|
+
} else {
|
|
25591
|
+
x += textMetrics;
|
|
25592
|
+
this.maxLineWidth = Math.max(this.maxLineWidth, x);
|
|
25593
|
+
}
|
|
25594
|
+
} else {
|
|
25595
|
+
if (x + textMetrics > width && i > 0 || str === "\n") {
|
|
25596
|
+
lineCount++;
|
|
25597
|
+
this.maxLineWidth = Math.max(this.maxLineWidth, x);
|
|
25598
|
+
x = 0;
|
|
25599
|
+
}
|
|
25600
|
+
if (str !== "\n") {
|
|
25601
|
+
x += textMetrics;
|
|
25602
|
+
}
|
|
25630
25603
|
}
|
|
25631
25604
|
}
|
|
25632
25605
|
return lineCount;
|
|
@@ -25676,7 +25649,6 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25676
25649
|
return;
|
|
25677
25650
|
}
|
|
25678
25651
|
this.text = value.toString();
|
|
25679
|
-
this.lineCount = this.getLineCount(value, false);
|
|
25680
25652
|
this.isDirty = true;
|
|
25681
25653
|
};
|
|
25682
25654
|
/**
|
|
@@ -25758,6 +25730,18 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25758
25730
|
this.isDirty = true;
|
|
25759
25731
|
};
|
|
25760
25732
|
/**
|
|
25733
|
+
* 设置文本溢出模式
|
|
25734
|
+
*
|
|
25735
|
+
* - clip: 当文本内容超出边界框时,多余的会被截断。
|
|
25736
|
+
* - display: 该模式下会显示所有文本,会自动调整文本字号以保证显示完整。
|
|
25737
|
+
* > 当存在多行时,部分行内文本可能存在文本字号变小的情况,其他行为正常情况
|
|
25738
|
+
*
|
|
25739
|
+
* @param overflow - 文本溢出模式
|
|
25740
|
+
*/ _proto.setOverflow = function setOverflow(overflow) {
|
|
25741
|
+
this.textLayout.overflow = overflow;
|
|
25742
|
+
this.isDirty = true;
|
|
25743
|
+
};
|
|
25744
|
+
/**
|
|
25761
25745
|
* 设置阴影颜色
|
|
25762
25746
|
* @param value - 阴影颜色
|
|
25763
25747
|
* @returns
|
|
@@ -25825,28 +25809,35 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25825
25809
|
var layout = this.textLayout;
|
|
25826
25810
|
var fontScale = style.fontScale;
|
|
25827
25811
|
var width = (layout.width + style.fontOffset) * fontScale;
|
|
25828
|
-
var finalHeight = layout.lineHeight * this.lineCount;
|
|
25829
25812
|
var fontSize = style.fontSize * fontScale;
|
|
25830
25813
|
var lineHeight = layout.lineHeight * fontScale;
|
|
25814
|
+
style.fontDesc = this.getFontDesc(fontSize);
|
|
25831
25815
|
this.char = (this.text || "").split("");
|
|
25832
25816
|
this.canvas.width = width;
|
|
25817
|
+
var height = this.canvas.height;
|
|
25818
|
+
context.font = style.fontDesc;
|
|
25819
|
+
this.lineCount = this.getLineCount(this.text, context);
|
|
25820
|
+
var finalHeight = layout.lineHeight * this.lineCount;
|
|
25833
25821
|
if (layout.autoWidth) {
|
|
25834
25822
|
this.canvas.height = finalHeight * fontScale;
|
|
25835
25823
|
this.item.transform.size.set(1, finalHeight / layout.height);
|
|
25836
25824
|
} else {
|
|
25837
25825
|
this.canvas.height = layout.height * fontScale;
|
|
25838
25826
|
}
|
|
25839
|
-
|
|
25840
|
-
|
|
25827
|
+
// canvas size 变化后重新刷新 context
|
|
25828
|
+
if (this.maxLineWidth > width && layout.overflow === TextOverflow.display) {
|
|
25829
|
+
context.font = this.getFontDesc(fontSize * width / this.maxLineWidth);
|
|
25830
|
+
} else {
|
|
25831
|
+
context.font = style.fontDesc;
|
|
25832
|
+
}
|
|
25841
25833
|
// fix bug 1/255
|
|
25842
25834
|
context.fillStyle = "rgba(255, 255, 255, 0.0039)";
|
|
25835
|
+
context.clearRect(0, 0, width, height);
|
|
25843
25836
|
if (!flipY) {
|
|
25844
25837
|
context.translate(0, height);
|
|
25845
25838
|
context.scale(1, -1);
|
|
25846
25839
|
}
|
|
25847
25840
|
context.fillRect(0, 0, width, height);
|
|
25848
|
-
style.fontDesc = this.getFontDesc();
|
|
25849
|
-
context.font = style.fontDesc;
|
|
25850
25841
|
if (style.hasShadow) {
|
|
25851
25842
|
this.setupShadow();
|
|
25852
25843
|
}
|
|
@@ -25918,9 +25909,9 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25918
25909
|
this.material.setTexture("_MainTex", texture);
|
|
25919
25910
|
this.isDirty = false;
|
|
25920
25911
|
};
|
|
25921
|
-
_proto.getFontDesc = function getFontDesc() {
|
|
25922
|
-
var _this_textStyle = this.textStyle,
|
|
25923
|
-
var fontDesc = "" +
|
|
25912
|
+
_proto.getFontDesc = function getFontDesc(fontSize) {
|
|
25913
|
+
var _this_textStyle = this.textStyle, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
|
|
25914
|
+
var fontDesc = "" + fontSize.toString() + "px ";
|
|
25924
25915
|
if (!DEFAULT_FONTS.includes(fontFamily)) {
|
|
25925
25916
|
fontDesc += '"' + fontFamily + '"';
|
|
25926
25917
|
} else {
|
|
@@ -26690,12 +26681,29 @@ function getStandardInteractContent(ui) {
|
|
|
26690
26681
|
* 3.1 版本数据适配
|
|
26691
26682
|
* - 富文本插件名称的适配
|
|
26692
26683
|
*/ function version31Migration(json) {
|
|
26693
|
-
var
|
|
26684
|
+
var // 修正老版本数据中,富文本插件名称的问题
|
|
26685
|
+
_json_plugins;
|
|
26694
26686
|
(_json_plugins = json.plugins) == null ? void 0 : _json_plugins.forEach(function(plugin, index) {
|
|
26695
26687
|
if (plugin === "richtext") {
|
|
26696
26688
|
json.plugins[index] = "rich-text";
|
|
26697
26689
|
}
|
|
26698
26690
|
});
|
|
26691
|
+
// Custom shape fill 属性位置迁移
|
|
26692
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.components), _step; !(_step = _iterator()).done;){
|
|
26693
|
+
var component = _step.value;
|
|
26694
|
+
if (component.dataType === DataType.ShapeComponent) {
|
|
26695
|
+
var shapeComponent = component;
|
|
26696
|
+
if (shapeComponent.type === ShapePrimitiveType.Custom) {
|
|
26697
|
+
var _customShapeComponent_shapes;
|
|
26698
|
+
var customShapeComponent = shapeComponent;
|
|
26699
|
+
//@ts-expect-error
|
|
26700
|
+
if (((_customShapeComponent_shapes = customShapeComponent.shapes) == null ? void 0 : _customShapeComponent_shapes.length) > 0 && customShapeComponent.shapes[0].fill) {
|
|
26701
|
+
// @ts-expect-error
|
|
26702
|
+
customShapeComponent.fill = customShapeComponent.shapes[0].fill;
|
|
26703
|
+
}
|
|
26704
|
+
}
|
|
26705
|
+
}
|
|
26706
|
+
}
|
|
26699
26707
|
return json;
|
|
26700
26708
|
}
|
|
26701
26709
|
/**
|
|
@@ -27525,8 +27533,6 @@ function getStandardJSON(json) {
|
|
|
27525
27533
|
}
|
|
27526
27534
|
// 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
|
|
27527
27535
|
version22Migration(json);
|
|
27528
|
-
// 修正老版本数据中,富文本插件名称的问题
|
|
27529
|
-
version31Migration(json);
|
|
27530
27536
|
if (v0.test(json.version)) {
|
|
27531
27537
|
var _exec;
|
|
27532
27538
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
@@ -27541,7 +27547,13 @@ function getStandardJSON(json) {
|
|
|
27541
27547
|
json = version24Migration(json);
|
|
27542
27548
|
}
|
|
27543
27549
|
if (mainVersion < 3) {
|
|
27544
|
-
|
|
27550
|
+
json = version30Migration(version21Migration(json));
|
|
27551
|
+
}
|
|
27552
|
+
// 3.x 版本格式转换
|
|
27553
|
+
if (mainVersion < 4) {
|
|
27554
|
+
if (minorVersion < 2) {
|
|
27555
|
+
json = version31Migration(json);
|
|
27556
|
+
}
|
|
27545
27557
|
}
|
|
27546
27558
|
return json;
|
|
27547
27559
|
}
|
|
@@ -27597,13 +27609,11 @@ function getStandardJSONFromV0(json) {
|
|
|
27597
27609
|
}
|
|
27598
27610
|
function getStandardImage(image, index, imageTags) {
|
|
27599
27611
|
var renderLevel = imageTags[index];
|
|
27600
|
-
var oriY = image.oriY;
|
|
27601
27612
|
if (typeof image === "string") {
|
|
27602
27613
|
return {
|
|
27603
27614
|
id: generateGUID(),
|
|
27604
27615
|
renderLevel: renderLevel,
|
|
27605
|
-
url: image
|
|
27606
|
-
oriY: oriY
|
|
27616
|
+
url: image
|
|
27607
27617
|
};
|
|
27608
27618
|
} else if (image.template) {
|
|
27609
27619
|
return {
|
|
@@ -27611,14 +27621,12 @@ function getStandardImage(image, index, imageTags) {
|
|
|
27611
27621
|
url: image.url,
|
|
27612
27622
|
template: image.template,
|
|
27613
27623
|
webp: image.webp,
|
|
27614
|
-
renderLevel: renderLevel
|
|
27615
|
-
oriY: oriY
|
|
27624
|
+
renderLevel: renderLevel
|
|
27616
27625
|
};
|
|
27617
27626
|
} else if (image.compressed) {
|
|
27618
27627
|
return {
|
|
27619
27628
|
id: generateGUID(),
|
|
27620
27629
|
url: image.url,
|
|
27621
|
-
oriY: oriY,
|
|
27622
27630
|
compressed: {
|
|
27623
27631
|
astc: image.compressed.android,
|
|
27624
27632
|
pvrtc: image.compressed.iOS
|
|
@@ -27631,8 +27639,7 @@ function getStandardImage(image, index, imageTags) {
|
|
|
27631
27639
|
id: generateGUID(),
|
|
27632
27640
|
url: image.url,
|
|
27633
27641
|
webp: image.webp,
|
|
27634
|
-
renderLevel: renderLevel
|
|
27635
|
-
oriY: oriY
|
|
27642
|
+
renderLevel: renderLevel
|
|
27636
27643
|
};
|
|
27637
27644
|
} else if (image && image.sourceType) {
|
|
27638
27645
|
return image;
|
|
@@ -32074,7 +32081,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
32074
32081
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
32075
32082
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
32076
32083
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
32077
|
-
var version = "2.3.0-alpha.
|
|
32084
|
+
var version = "2.3.0-alpha.2";
|
|
32078
32085
|
logger.info("Core version: " + version + ".");
|
|
32079
32086
|
|
|
32080
32087
|
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|