@galacean/effects-core 2.10.0-alpha.3 → 2.10.0-alpha.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/gui/control.d.ts +13 -14
- package/dist/gui/roots.d.ts +2 -2
- package/dist/index.js +138 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +138 -116
- package/dist/index.mjs.map +1 -1
- package/dist/input/enums.d.ts +2 -0
- package/dist/input/input-event.d.ts +4 -3
- package/dist/render/graphics.d.ts +10 -10
- package/package.json +1 -1
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.10.0-alpha.
|
|
6
|
+
* Version: v2.10.0-alpha.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -23121,10 +23121,10 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23121
23121
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23122
23122
|
this.currentBatchType = "colored";
|
|
23123
23123
|
this.currentBatchTexture = null;
|
|
23124
|
-
// 创建从屏幕坐标到 NDC
|
|
23124
|
+
// 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
|
|
23125
23125
|
var _this_engine_canvas_getBoundingClientRect = this.engine.canvas.getBoundingClientRect(), width = _this_engine_canvas_getBoundingClientRect.width, height = _this_engine_canvas_getBoundingClientRect.height;
|
|
23126
23126
|
// 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
|
|
23127
|
-
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, -1, 0, -1,
|
|
23127
|
+
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
|
|
23128
23128
|
);
|
|
23129
23129
|
this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23130
23130
|
this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
@@ -23289,8 +23289,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23289
23289
|
};
|
|
23290
23290
|
/**
|
|
23291
23291
|
* 绘制矩形边框
|
|
23292
|
-
* @param x -
|
|
23293
|
-
* @param y -
|
|
23292
|
+
* @param x - 矩形左上角 X 坐标
|
|
23293
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23294
23294
|
* @param width - 矩形宽度
|
|
23295
23295
|
* @param height - 矩形高度
|
|
23296
23296
|
* @param color - 边框颜色,默认白色,范围 0-1
|
|
@@ -23333,8 +23333,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23333
23333
|
};
|
|
23334
23334
|
/**
|
|
23335
23335
|
* 绘制填充矩形
|
|
23336
|
-
* @param x -
|
|
23337
|
-
* @param y -
|
|
23336
|
+
* @param x - 矩形左上角 X 坐标
|
|
23337
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23338
23338
|
* @param width - 矩形宽度
|
|
23339
23339
|
* @param height - 矩形高度
|
|
23340
23340
|
* @param color - 填充颜色,默认白色,范围 0-1
|
|
@@ -23360,9 +23360,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23360
23360
|
this.buildShape(this.circleShape, color);
|
|
23361
23361
|
};
|
|
23362
23362
|
/**
|
|
23363
|
-
* 绘制纹理矩形(本地坐标,Y
|
|
23364
|
-
* @param x -
|
|
23365
|
-
* @param y -
|
|
23363
|
+
* 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
|
|
23364
|
+
* @param x - 矩形左上角 X 坐标
|
|
23365
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23366
23366
|
* @param width - 矩形宽度
|
|
23367
23367
|
* @param height - 矩形高度
|
|
23368
23368
|
* @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
|
|
@@ -23375,14 +23375,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23375
23375
|
this.pushQuad(x, y, width, height, color, region);
|
|
23376
23376
|
};
|
|
23377
23377
|
/**
|
|
23378
|
-
* 绘制文本(本地坐标,Y
|
|
23378
|
+
* 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
|
|
23379
23379
|
*
|
|
23380
23380
|
* 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
|
|
23381
23381
|
* `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
|
|
23382
23382
|
*
|
|
23383
23383
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
23384
|
-
* @param x -
|
|
23385
|
-
* @param y -
|
|
23384
|
+
* @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
23385
|
+
* @param y - 文本 cell 顶部 Y 坐标
|
|
23386
23386
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
23387
23387
|
* @param fontSize - 字号(逻辑像素)
|
|
23388
23388
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -23497,7 +23497,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23497
23497
|
* 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
|
|
23498
23498
|
*/ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
|
|
23499
23499
|
var vertexOffset = this.vertices.length / 2;
|
|
23500
|
-
// 4
|
|
23500
|
+
// 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
|
|
23501
23501
|
var corners = [
|
|
23502
23502
|
[
|
|
23503
23503
|
x,
|
|
@@ -23523,19 +23523,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23523
23523
|
var cornerUVs = [
|
|
23524
23524
|
[
|
|
23525
23525
|
u0,
|
|
23526
|
-
|
|
23526
|
+
v1
|
|
23527
23527
|
],
|
|
23528
23528
|
[
|
|
23529
23529
|
u1,
|
|
23530
|
-
|
|
23530
|
+
v1
|
|
23531
23531
|
],
|
|
23532
23532
|
[
|
|
23533
23533
|
u0,
|
|
23534
|
-
|
|
23534
|
+
v0
|
|
23535
23535
|
],
|
|
23536
23536
|
[
|
|
23537
23537
|
u1,
|
|
23538
|
-
|
|
23538
|
+
v0
|
|
23539
23539
|
]
|
|
23540
23540
|
];
|
|
23541
23541
|
for(var i = 0; i < 4; i++){
|
|
@@ -24629,8 +24629,18 @@ var InputEvent = /*#__PURE__*/ function() {
|
|
|
24629
24629
|
this.device = 0;
|
|
24630
24630
|
this.pressed = false;
|
|
24631
24631
|
this.canceled = false;
|
|
24632
|
+
this._accepted = false;
|
|
24632
24633
|
}
|
|
24633
24634
|
var _proto = InputEvent.prototype;
|
|
24635
|
+
_proto.accept = function accept() {
|
|
24636
|
+
this._accepted = true;
|
|
24637
|
+
};
|
|
24638
|
+
_proto.clearAccepted = function clearAccepted() {
|
|
24639
|
+
this._accepted = false;
|
|
24640
|
+
};
|
|
24641
|
+
_proto.isAccepted = function isAccepted() {
|
|
24642
|
+
return this._accepted;
|
|
24643
|
+
};
|
|
24634
24644
|
_proto.isPressed = function isPressed() {
|
|
24635
24645
|
return this.pressed && !this.canceled;
|
|
24636
24646
|
};
|
|
@@ -24644,11 +24654,7 @@ var InputEvent = /*#__PURE__*/ function() {
|
|
|
24644
24654
|
return false;
|
|
24645
24655
|
};
|
|
24646
24656
|
_proto.xformedBy = function xformedBy(transform) {
|
|
24647
|
-
|
|
24648
|
-
event.device = this.device;
|
|
24649
|
-
event.pressed = this.pressed;
|
|
24650
|
-
event.canceled = this.canceled;
|
|
24651
|
-
return event;
|
|
24657
|
+
return this;
|
|
24652
24658
|
};
|
|
24653
24659
|
return InputEvent;
|
|
24654
24660
|
}();
|
|
@@ -24679,11 +24685,6 @@ var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
|
24679
24685
|
event.metaPressed = this.metaPressed;
|
|
24680
24686
|
event.ctrlPressed = this.ctrlPressed;
|
|
24681
24687
|
};
|
|
24682
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24683
|
-
var event = new InputEventWithModifiers();
|
|
24684
|
-
this.copyModifiersTo(event);
|
|
24685
|
-
return event;
|
|
24686
|
-
};
|
|
24687
24688
|
return InputEventWithModifiers;
|
|
24688
24689
|
}(_wrap_native_super(InputEvent));
|
|
24689
24690
|
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
@@ -24703,17 +24704,6 @@ var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
|
24703
24704
|
_proto.isEcho = function isEcho() {
|
|
24704
24705
|
return this.echo;
|
|
24705
24706
|
};
|
|
24706
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24707
|
-
var event = new InputEventKey();
|
|
24708
|
-
this.copyModifiersTo(event);
|
|
24709
|
-
event.keycode = this.keycode;
|
|
24710
|
-
event.physicalKeycode = this.physicalKeycode;
|
|
24711
|
-
event.keyLabel = this.keyLabel;
|
|
24712
|
-
event.unicode = this.unicode;
|
|
24713
|
-
event.location = this.location;
|
|
24714
|
-
event.echo = this.echo;
|
|
24715
|
-
return event;
|
|
24716
|
-
};
|
|
24717
24707
|
return InputEventKey;
|
|
24718
24708
|
}(InputEventWithModifiers);
|
|
24719
24709
|
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
@@ -24733,12 +24723,6 @@ var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
|
24733
24723
|
event.position.copyFrom(this.position);
|
|
24734
24724
|
event.globalPosition.copyFrom(this.globalPosition);
|
|
24735
24725
|
};
|
|
24736
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24737
|
-
var event = new InputEventMouse();
|
|
24738
|
-
this.copyMouseTo(event);
|
|
24739
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24740
|
-
return event;
|
|
24741
|
-
};
|
|
24742
24726
|
return InputEventMouse;
|
|
24743
24727
|
}(InputEventWithModifiers);
|
|
24744
24728
|
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
@@ -24855,27 +24839,27 @@ var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
|
24855
24839
|
var ANCHOR_PRESET_TABLE = {
|
|
24856
24840
|
topLeft: [
|
|
24857
24841
|
0,
|
|
24858
|
-
1,
|
|
24859
24842
|
0,
|
|
24860
|
-
|
|
24843
|
+
0,
|
|
24844
|
+
0
|
|
24861
24845
|
],
|
|
24862
24846
|
topRight: [
|
|
24863
24847
|
1,
|
|
24848
|
+
0,
|
|
24864
24849
|
1,
|
|
24865
|
-
|
|
24866
|
-
1
|
|
24850
|
+
0
|
|
24867
24851
|
],
|
|
24868
24852
|
bottomLeft: [
|
|
24869
24853
|
0,
|
|
24854
|
+
1,
|
|
24870
24855
|
0,
|
|
24871
|
-
|
|
24872
|
-
0
|
|
24856
|
+
1
|
|
24873
24857
|
],
|
|
24874
24858
|
bottomRight: [
|
|
24875
24859
|
1,
|
|
24876
|
-
0,
|
|
24877
24860
|
1,
|
|
24878
|
-
|
|
24861
|
+
1,
|
|
24862
|
+
1
|
|
24879
24863
|
],
|
|
24880
24864
|
centerLeft: [
|
|
24881
24865
|
0,
|
|
@@ -24885,9 +24869,9 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24885
24869
|
],
|
|
24886
24870
|
centerTop: [
|
|
24887
24871
|
0.5,
|
|
24888
|
-
|
|
24872
|
+
0,
|
|
24889
24873
|
0.5,
|
|
24890
|
-
|
|
24874
|
+
0
|
|
24891
24875
|
],
|
|
24892
24876
|
centerRight: [
|
|
24893
24877
|
1,
|
|
@@ -24897,9 +24881,9 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24897
24881
|
],
|
|
24898
24882
|
centerBottom: [
|
|
24899
24883
|
0.5,
|
|
24900
|
-
|
|
24884
|
+
1,
|
|
24901
24885
|
0.5,
|
|
24902
|
-
|
|
24886
|
+
1
|
|
24903
24887
|
],
|
|
24904
24888
|
center: [
|
|
24905
24889
|
0.5,
|
|
@@ -24914,10 +24898,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24914
24898
|
1
|
|
24915
24899
|
],
|
|
24916
24900
|
topWide: [
|
|
24901
|
+
0,
|
|
24917
24902
|
0,
|
|
24918
24903
|
1,
|
|
24919
|
-
|
|
24920
|
-
1
|
|
24904
|
+
0
|
|
24921
24905
|
],
|
|
24922
24906
|
rightWide: [
|
|
24923
24907
|
1,
|
|
@@ -24926,10 +24910,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24926
24910
|
1
|
|
24927
24911
|
],
|
|
24928
24912
|
bottomWide: [
|
|
24929
|
-
0,
|
|
24930
24913
|
0,
|
|
24931
24914
|
1,
|
|
24932
|
-
|
|
24915
|
+
1,
|
|
24916
|
+
1
|
|
24933
24917
|
],
|
|
24934
24918
|
vcenterWide: [
|
|
24935
24919
|
0.5,
|
|
@@ -25115,6 +25099,7 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25115
25099
|
var a = this.anchorMin;
|
|
25116
25100
|
var b = this.anchorMax;
|
|
25117
25101
|
var minX = 0, maxX = 0, minY = 0, maxY = 0;
|
|
25102
|
+
// Left edge.
|
|
25118
25103
|
switch(preset){
|
|
25119
25104
|
case "topLeft":
|
|
25120
25105
|
case "bottomLeft":
|
|
@@ -25125,41 +25110,71 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25125
25110
|
case "hcenterWide":
|
|
25126
25111
|
case "fullRect":
|
|
25127
25112
|
minX = margin - a.x * parentSize.x;
|
|
25128
|
-
maxX = margin + width - b.x * parentSize.x;
|
|
25129
25113
|
break;
|
|
25130
25114
|
case "centerTop":
|
|
25131
25115
|
case "centerBottom":
|
|
25132
25116
|
case "center":
|
|
25133
25117
|
case "vcenterWide":
|
|
25134
25118
|
minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
|
|
25135
|
-
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25136
25119
|
break;
|
|
25137
25120
|
default:
|
|
25138
25121
|
minX = parentSize.x - margin - width - a.x * parentSize.x;
|
|
25139
|
-
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25140
25122
|
break;
|
|
25141
25123
|
}
|
|
25142
25124
|
switch(preset){
|
|
25125
|
+
case "topLeft":
|
|
25143
25126
|
case "bottomLeft":
|
|
25144
|
-
case "
|
|
25127
|
+
case "centerLeft":
|
|
25128
|
+
case "leftWide":
|
|
25129
|
+
maxX = margin + width - b.x * parentSize.x;
|
|
25130
|
+
break;
|
|
25131
|
+
case "centerTop":
|
|
25145
25132
|
case "centerBottom":
|
|
25133
|
+
case "center":
|
|
25134
|
+
case "vcenterWide":
|
|
25135
|
+
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25136
|
+
break;
|
|
25137
|
+
default:
|
|
25138
|
+
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25139
|
+
break;
|
|
25140
|
+
}
|
|
25141
|
+
// Top edge.
|
|
25142
|
+
switch(preset){
|
|
25143
|
+
case "topLeft":
|
|
25144
|
+
case "topRight":
|
|
25145
|
+
case "centerTop":
|
|
25146
25146
|
case "leftWide":
|
|
25147
25147
|
case "rightWide":
|
|
25148
|
-
case "
|
|
25148
|
+
case "topWide":
|
|
25149
25149
|
case "vcenterWide":
|
|
25150
25150
|
case "fullRect":
|
|
25151
25151
|
minY = margin - a.y * parentSize.y;
|
|
25152
|
-
maxY = margin + height - b.y * parentSize.y;
|
|
25153
25152
|
break;
|
|
25154
25153
|
case "centerLeft":
|
|
25155
25154
|
case "centerRight":
|
|
25156
25155
|
case "center":
|
|
25157
25156
|
case "hcenterWide":
|
|
25158
25157
|
minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
|
|
25159
|
-
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25160
25158
|
break;
|
|
25161
25159
|
default:
|
|
25162
25160
|
minY = parentSize.y - margin - height - a.y * parentSize.y;
|
|
25161
|
+
break;
|
|
25162
|
+
}
|
|
25163
|
+
// Bottom edge.
|
|
25164
|
+
switch(preset){
|
|
25165
|
+
case "topLeft":
|
|
25166
|
+
case "topRight":
|
|
25167
|
+
case "centerTop":
|
|
25168
|
+
case "topWide":
|
|
25169
|
+
maxY = margin + height - b.y * parentSize.y;
|
|
25170
|
+
break;
|
|
25171
|
+
case "centerLeft":
|
|
25172
|
+
case "centerRight":
|
|
25173
|
+
case "center":
|
|
25174
|
+
case "hcenterWide":
|
|
25175
|
+
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25176
|
+
break;
|
|
25177
|
+
default:
|
|
25163
25178
|
maxY = parentSize.y - margin - b.y * parentSize.y;
|
|
25164
25179
|
break;
|
|
25165
25180
|
}
|
|
@@ -25188,10 +25203,6 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25188
25203
|
_proto.getCursorShape = function getCursorShape(position) {
|
|
25189
25204
|
return this.defaultCursorShape;
|
|
25190
25205
|
};
|
|
25191
|
-
_proto.acceptEvent = function acceptEvent() {
|
|
25192
|
-
var _this_root;
|
|
25193
|
-
(_this_root = this.root) == null ? void 0 : _this_root.acceptControlEvent(this);
|
|
25194
|
-
};
|
|
25195
25206
|
_proto.focus = function focus() {
|
|
25196
25207
|
var _this_root;
|
|
25197
25208
|
(_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
|
|
@@ -25272,14 +25283,14 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25272
25283
|
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
25273
25284
|
};
|
|
25274
25285
|
_proto.onMouseEnter = function onMouseEnter(location) {};
|
|
25275
|
-
_proto.onMouseMove = function onMouseMove(
|
|
25286
|
+
_proto.onMouseMove = function onMouseMove(event) {};
|
|
25276
25287
|
_proto.onMouseLeave = function onMouseLeave() {};
|
|
25277
|
-
_proto.onMouseWheel = function onMouseWheel(
|
|
25278
|
-
_proto.onMouseDown = function onMouseDown(
|
|
25279
|
-
_proto.onMouseUp = function onMouseUp(
|
|
25280
|
-
_proto.onTouchDown = function onTouchDown(
|
|
25281
|
-
_proto.onTouchMove = function onTouchMove(
|
|
25282
|
-
_proto.onTouchUp = function onTouchUp(
|
|
25288
|
+
_proto.onMouseWheel = function onMouseWheel(event) {};
|
|
25289
|
+
_proto.onMouseDown = function onMouseDown(event) {};
|
|
25290
|
+
_proto.onMouseUp = function onMouseUp(event) {};
|
|
25291
|
+
_proto.onTouchDown = function onTouchDown(event) {};
|
|
25292
|
+
_proto.onTouchMove = function onTouchMove(event) {};
|
|
25293
|
+
_proto.onTouchUp = function onTouchUp(event) {};
|
|
25283
25294
|
_proto.onKeyDown = function onKeyDown(event) {};
|
|
25284
25295
|
_proto.onKeyUp = function onKeyUp(event) {};
|
|
25285
25296
|
_proto.onGotFocus = function onGotFocus() {};
|
|
@@ -25314,10 +25325,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25314
25325
|
var _this_parent_size;
|
|
25315
25326
|
var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
|
|
25316
25327
|
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25317
|
-
var
|
|
25328
|
+
var top = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25318
25329
|
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25319
|
-
var
|
|
25320
|
-
this.applyBounds(left,
|
|
25330
|
+
var bottom = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25331
|
+
this.applyBounds(left, top, right - left, bottom - top);
|
|
25321
25332
|
};
|
|
25322
25333
|
_proto.applyBounds = function applyBounds(x, y, width, height) {
|
|
25323
25334
|
var locationChanged = this.position.x !== x || this.position.y !== y;
|
|
@@ -25528,7 +25539,12 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25528
25539
|
return this._defaultCursorShape;
|
|
25529
25540
|
},
|
|
25530
25541
|
set: function set(value) {
|
|
25542
|
+
var _this_root;
|
|
25543
|
+
if (this._defaultCursorShape === value) {
|
|
25544
|
+
return;
|
|
25545
|
+
}
|
|
25531
25546
|
this._defaultCursorShape = value;
|
|
25547
|
+
(_this_root = this.root) == null ? void 0 : _this_root.updateMouseCursorState();
|
|
25532
25548
|
}
|
|
25533
25549
|
},
|
|
25534
25550
|
{
|
|
@@ -25712,9 +25728,6 @@ function getButtonMask(button) {
|
|
|
25712
25728
|
function isWheelButton(button) {
|
|
25713
25729
|
return button >= MouseButton.WheelUp && button <= MouseButton.WheelRight;
|
|
25714
25730
|
}
|
|
25715
|
-
function getWheelDelta(event) {
|
|
25716
|
-
return event.buttonIndex === MouseButton.WheelUp || event.buttonIndex === MouseButton.WheelLeft ? event.factor : -event.factor;
|
|
25717
|
-
}
|
|
25718
25731
|
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25719
25732
|
_inherits(CanvasRootControl, ContainerControl);
|
|
25720
25733
|
function CanvasRootControl(engine, canvas) {
|
|
@@ -25773,7 +25786,7 @@ function getWheelDelta(event) {
|
|
|
25773
25786
|
var _this;
|
|
25774
25787
|
_this = RootControl.call(this, engine) || this;
|
|
25775
25788
|
_this.dragThreshold = 10;
|
|
25776
|
-
_this.
|
|
25789
|
+
_this.lastInput = null;
|
|
25777
25790
|
_this.gui = {
|
|
25778
25791
|
mouseFocus: null,
|
|
25779
25792
|
mouseClickGrabber: null,
|
|
@@ -25800,13 +25813,16 @@ function getWheelDelta(event) {
|
|
|
25800
25813
|
}
|
|
25801
25814
|
var _proto = WindowRootControl.prototype;
|
|
25802
25815
|
_proto.pushInput = function pushInput(event) {
|
|
25803
|
-
|
|
25816
|
+
event.clearAccepted();
|
|
25817
|
+
this.lastInput = event;
|
|
25804
25818
|
this.cleanupInternalState();
|
|
25805
25819
|
this.processGUIInput(event);
|
|
25806
25820
|
this.postGrabClickFocus();
|
|
25807
25821
|
};
|
|
25808
25822
|
_proto.isInputHandled = function isInputHandled() {
|
|
25809
|
-
|
|
25823
|
+
var _this_lastInput;
|
|
25824
|
+
var _this_lastInput_isAccepted;
|
|
25825
|
+
return (_this_lastInput_isAccepted = (_this_lastInput = this.lastInput) == null ? void 0 : _this_lastInput.isAccepted()) != null ? _this_lastInput_isAccepted : false;
|
|
25810
25826
|
};
|
|
25811
25827
|
_proto.getMousePosition = function getMousePosition() {
|
|
25812
25828
|
return this.gui.lastMousePosition.clone();
|
|
@@ -25829,11 +25845,6 @@ function getWheelDelta(event) {
|
|
|
25829
25845
|
_proto.guiCancelDrag = function guiCancelDrag() {
|
|
25830
25846
|
this.endDragging(false);
|
|
25831
25847
|
};
|
|
25832
|
-
_proto.acceptControlEvent = function acceptControlEvent(control) {
|
|
25833
|
-
if (this.isControlUsable(control)) {
|
|
25834
|
-
this.inputHandled = true;
|
|
25835
|
-
}
|
|
25836
|
-
};
|
|
25837
25848
|
_proto.grabControlFocus = function grabControlFocus(control) {
|
|
25838
25849
|
if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
|
|
25839
25850
|
return;
|
|
@@ -25867,6 +25878,12 @@ function getWheelDelta(event) {
|
|
|
25867
25878
|
_proto.warpControlMouse = function warpControlMouse(position) {
|
|
25868
25879
|
this.gui.lastMousePosition.copyFrom(position);
|
|
25869
25880
|
this.updateMouseOver(position);
|
|
25881
|
+
this.updateMouseCursorState();
|
|
25882
|
+
};
|
|
25883
|
+
_proto.updateMouseCursorState = function updateMouseCursorState() {
|
|
25884
|
+
var position = this.gui.lastMousePosition;
|
|
25885
|
+
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.isControlUsable(this.gui.mouseOver) ? this.gui.mouseOver : null;
|
|
25886
|
+
this.updateCursor(target, position);
|
|
25870
25887
|
};
|
|
25871
25888
|
_proto.controlStateChanged = function controlStateChanged(control) {
|
|
25872
25889
|
if (!this.isControlUsable(control)) {
|
|
@@ -26019,11 +26036,15 @@ function getWheelDelta(event) {
|
|
|
26019
26036
|
while(current && current !== this && this.isControlUsable(current)){
|
|
26020
26037
|
var filter = current.getEffectiveMouseFilter();
|
|
26021
26038
|
if (filter !== MouseFilter.Ignore) {
|
|
26022
|
-
|
|
26039
|
+
var localEvent = event.xformedBy(this.getGlobalInverse(current));
|
|
26040
|
+
this.callControlInput(current, localEvent);
|
|
26041
|
+
if (localEvent.isAccepted()) {
|
|
26042
|
+
event.accept();
|
|
26043
|
+
}
|
|
26023
26044
|
}
|
|
26024
26045
|
var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
|
|
26025
|
-
if (
|
|
26026
|
-
|
|
26046
|
+
if (event.isAccepted() || filter === MouseFilter.Stop && pointerEvent && !forcePassWheel) {
|
|
26047
|
+
event.accept();
|
|
26027
26048
|
return;
|
|
26028
26049
|
}
|
|
26029
26050
|
current = current.parent;
|
|
@@ -26032,22 +26053,22 @@ function getWheelDelta(event) {
|
|
|
26032
26053
|
_proto.callControlInput = function callControlInput(control, event) {
|
|
26033
26054
|
if (_instanceof1(event, InputEventMouseButton)) {
|
|
26034
26055
|
if (isWheelButton(event.buttonIndex)) {
|
|
26035
|
-
control.onMouseWheel(event
|
|
26056
|
+
control.onMouseWheel(event);
|
|
26036
26057
|
} else if (event.isPressed()) {
|
|
26037
|
-
control.onMouseDown(event
|
|
26058
|
+
control.onMouseDown(event);
|
|
26038
26059
|
} else {
|
|
26039
|
-
control.onMouseUp(event
|
|
26060
|
+
control.onMouseUp(event);
|
|
26040
26061
|
}
|
|
26041
26062
|
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
26042
|
-
control.onMouseMove(event
|
|
26063
|
+
control.onMouseMove(event);
|
|
26043
26064
|
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
26044
26065
|
if (event.isPressed()) {
|
|
26045
|
-
control.onTouchDown(event
|
|
26066
|
+
control.onTouchDown(event);
|
|
26046
26067
|
} else {
|
|
26047
|
-
control.onTouchUp(event
|
|
26068
|
+
control.onTouchUp(event);
|
|
26048
26069
|
}
|
|
26049
26070
|
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
26050
|
-
control.onTouchMove(event
|
|
26071
|
+
control.onTouchMove(event);
|
|
26051
26072
|
} else if (_instanceof1(event, InputEventKey)) {
|
|
26052
26073
|
if (event.isPressed()) {
|
|
26053
26074
|
control.onKeyDown(event);
|
|
@@ -26198,11 +26219,11 @@ function getWheelDelta(event) {
|
|
|
26198
26219
|
};
|
|
26199
26220
|
_proto.updateCursor = function updateCursor(target, position) {
|
|
26200
26221
|
var current = target;
|
|
26201
|
-
var
|
|
26222
|
+
var cursor = CursorShape.Arrow;
|
|
26202
26223
|
while(current && current !== this){
|
|
26203
26224
|
var candidate = current.getCursorShape(this.toLocal(current, position));
|
|
26204
26225
|
if (candidate !== CursorShape.Arrow) {
|
|
26205
|
-
|
|
26226
|
+
cursor = candidate;
|
|
26206
26227
|
break;
|
|
26207
26228
|
}
|
|
26208
26229
|
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
@@ -26210,7 +26231,7 @@ function getWheelDelta(event) {
|
|
|
26210
26231
|
}
|
|
26211
26232
|
current = current.parent;
|
|
26212
26233
|
}
|
|
26213
|
-
this.engine.canvas.style.cursor = cursorNames[
|
|
26234
|
+
this.engine.canvas.style.cursor = typeof cursor === "string" ? cursor : cursorNames[cursor];
|
|
26214
26235
|
};
|
|
26215
26236
|
_proto.postGrabClickFocus = function postGrabClickFocus() {
|
|
26216
26237
|
var target = this.gui.mouseClickGrabber;
|
|
@@ -26862,8 +26883,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26862
26883
|
if (!this.enabled || !this.target) {
|
|
26863
26884
|
return;
|
|
26864
26885
|
}
|
|
26865
|
-
this.focusTarget();
|
|
26866
26886
|
var position = this.getCanvasPosition(event.clientX, event.clientY);
|
|
26887
|
+
this.focusTarget();
|
|
26867
26888
|
var state = this.createPointerState(position);
|
|
26868
26889
|
this.mouseState = state;
|
|
26869
26890
|
state.pressed = true;
|
|
@@ -27155,12 +27176,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27155
27176
|
var _target_width, _target_height;
|
|
27156
27177
|
return {
|
|
27157
27178
|
x: position.x / cssWidth * 2 - 1,
|
|
27158
|
-
|
|
27179
|
+
// Legacy composition picking uses bottom-left, Y-up NDC even though GUI
|
|
27180
|
+
// input follows the DOM convention of top-left, Y-down pixels.
|
|
27181
|
+
y: 1 - position.y / cssHeight * 2,
|
|
27159
27182
|
vx: velocity.x / cssWidth * 2,
|
|
27160
|
-
vy: velocity.y / cssHeight * 2,
|
|
27183
|
+
vy: -velocity.y / cssHeight * 2,
|
|
27161
27184
|
ts: performance.now(),
|
|
27162
27185
|
dx: (position.x - state.start.x) / cssWidth * 2,
|
|
27163
|
-
dy: (position.y - state.start.y) / cssHeight * 2,
|
|
27186
|
+
dy: -(position.y - state.start.y) / cssHeight * 2,
|
|
27164
27187
|
width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
|
|
27165
27188
|
height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
|
|
27166
27189
|
origin: origin
|
|
@@ -27172,7 +27195,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27172
27195
|
if (!rect) {
|
|
27173
27196
|
return new Vector2();
|
|
27174
27197
|
}
|
|
27175
|
-
return new Vector2(clientX - rect.left,
|
|
27198
|
+
return new Vector2(clientX - rect.left, clientY - rect.top);
|
|
27176
27199
|
};
|
|
27177
27200
|
_proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
|
|
27178
27201
|
if (handled && !this.allowPropagation) {
|
|
@@ -27188,9 +27211,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27188
27211
|
}
|
|
27189
27212
|
};
|
|
27190
27213
|
_proto.focusTarget = function focusTarget() {
|
|
27191
|
-
|
|
27192
|
-
|
|
27193
|
-
}
|
|
27214
|
+
var _this_target;
|
|
27215
|
+
(_this_target = this.target) == null ? void 0 : _this_target.focus();
|
|
27194
27216
|
};
|
|
27195
27217
|
_proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
|
|
27196
27218
|
target.addEventListener(name, handler, options);
|
|
@@ -39327,7 +39349,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
39327
39349
|
return ret;
|
|
39328
39350
|
}
|
|
39329
39351
|
|
|
39330
|
-
var version$1 = "2.10.0-alpha.
|
|
39352
|
+
var version$1 = "2.10.0-alpha.4";
|
|
39331
39353
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
39332
39354
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
39333
39355
|
var reverseParticle = false;
|
|
@@ -44557,7 +44579,7 @@ registerPlugin("text", TextLoader);
|
|
|
44557
44579
|
registerPlugin("sprite", SpriteLoader);
|
|
44558
44580
|
registerPlugin("particle", ParticleLoader);
|
|
44559
44581
|
registerPlugin("interact", InteractLoader);
|
|
44560
|
-
var version = "2.10.0-alpha.
|
|
44582
|
+
var version = "2.10.0-alpha.4";
|
|
44561
44583
|
logger.info("Core version: " + version + ".");
|
|
44562
44584
|
|
|
44563
44585
|
export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader, CanvasContainer, CanvasRenderMode, CanvasRootControl, Circle$1 as Circle, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ContainerControl, Control, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, CursorShape, DEFAULT_FONTS, DEFAULT_FPS, DataBuffer, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, FocusBehaviorRecursive, FocusMode, FrameComponent, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GlyphAtlas, GradientValue, GraphInstance, GraphNode, GraphNodeData, Graphics, GreaterNodeData, HELP_LINK, HitTestType, InputEvent, InputEventKey, InputEventMouse, InputEventMouseButton, InputEventMouseMotion, InputEventScreenDrag, InputEventScreenTouch, InputEventWithModifiers, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, KeyLocation, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialState, MaterialTrack, Mesh, MouseBehaviorRecursive, MouseButton, MouseButtonMask, MouseFilter, NodeTransform, NotNode, NotNodeData, NotifyEvent, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, Plugin, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, Precomposition, PrecompositionManager, PropertyClipPlayable, PropertyTrack, REFERENCE_CURVE, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, Rectangle$1 as Rectangle, ReferenceCurve, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RootControl, 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, SceneLoader, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SourceType, Sprite, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, SpritePropertyMixerPlayable, SpritePropertyPlayableAsset, SpritePropertyTrack, SpriteRotation, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TangentMode, TextCache, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, Triangle, TrimPath, TrimPathMode, UICanvas, UIControl, UpdateModes, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, VertexBuffer, WeightedMode, WindowRootControl, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, breakOpportunityAfter, buildBezierData, buildEasingCurve, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createTypedArray, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, extractMinAndMax, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTexture, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateWhiteTexture, getBackgroundImage, getBytesPerElement, getClass, getColorFromGradientStops, getConfig, getControlPoints, getDataByteLength, getDataType, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isBreakChar, isCJKLike, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSafeFontFamily, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, toBufferView, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|