@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.js
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
|
'use strict';
|
|
@@ -23125,10 +23125,10 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23125
23125
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23126
23126
|
this.currentBatchType = "colored";
|
|
23127
23127
|
this.currentBatchTexture = null;
|
|
23128
|
-
// 创建从屏幕坐标到 NDC
|
|
23128
|
+
// 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
|
|
23129
23129
|
var _this_engine_canvas_getBoundingClientRect = this.engine.canvas.getBoundingClientRect(), width = _this_engine_canvas_getBoundingClientRect.width, height = _this_engine_canvas_getBoundingClientRect.height;
|
|
23130
23130
|
// 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
|
|
23131
|
-
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, -1, 0, -1,
|
|
23131
|
+
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
|
|
23132
23132
|
);
|
|
23133
23133
|
this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23134
23134
|
this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
@@ -23293,8 +23293,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23293
23293
|
};
|
|
23294
23294
|
/**
|
|
23295
23295
|
* 绘制矩形边框
|
|
23296
|
-
* @param x -
|
|
23297
|
-
* @param y -
|
|
23296
|
+
* @param x - 矩形左上角 X 坐标
|
|
23297
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23298
23298
|
* @param width - 矩形宽度
|
|
23299
23299
|
* @param height - 矩形高度
|
|
23300
23300
|
* @param color - 边框颜色,默认白色,范围 0-1
|
|
@@ -23337,8 +23337,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23337
23337
|
};
|
|
23338
23338
|
/**
|
|
23339
23339
|
* 绘制填充矩形
|
|
23340
|
-
* @param x -
|
|
23341
|
-
* @param y -
|
|
23340
|
+
* @param x - 矩形左上角 X 坐标
|
|
23341
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23342
23342
|
* @param width - 矩形宽度
|
|
23343
23343
|
* @param height - 矩形高度
|
|
23344
23344
|
* @param color - 填充颜色,默认白色,范围 0-1
|
|
@@ -23364,9 +23364,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23364
23364
|
this.buildShape(this.circleShape, color);
|
|
23365
23365
|
};
|
|
23366
23366
|
/**
|
|
23367
|
-
* 绘制纹理矩形(本地坐标,Y
|
|
23368
|
-
* @param x -
|
|
23369
|
-
* @param y -
|
|
23367
|
+
* 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
|
|
23368
|
+
* @param x - 矩形左上角 X 坐标
|
|
23369
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23370
23370
|
* @param width - 矩形宽度
|
|
23371
23371
|
* @param height - 矩形高度
|
|
23372
23372
|
* @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
|
|
@@ -23379,14 +23379,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23379
23379
|
this.pushQuad(x, y, width, height, color, region);
|
|
23380
23380
|
};
|
|
23381
23381
|
/**
|
|
23382
|
-
* 绘制文本(本地坐标,Y
|
|
23382
|
+
* 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
|
|
23383
23383
|
*
|
|
23384
23384
|
* 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
|
|
23385
23385
|
* `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
|
|
23386
23386
|
*
|
|
23387
23387
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
23388
|
-
* @param x -
|
|
23389
|
-
* @param y -
|
|
23388
|
+
* @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
23389
|
+
* @param y - 文本 cell 顶部 Y 坐标
|
|
23390
23390
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
23391
23391
|
* @param fontSize - 字号(逻辑像素)
|
|
23392
23392
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -23501,7 +23501,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23501
23501
|
* 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
|
|
23502
23502
|
*/ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
|
|
23503
23503
|
var vertexOffset = this.vertices.length / 2;
|
|
23504
|
-
// 4
|
|
23504
|
+
// 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
|
|
23505
23505
|
var corners = [
|
|
23506
23506
|
[
|
|
23507
23507
|
x,
|
|
@@ -23527,19 +23527,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23527
23527
|
var cornerUVs = [
|
|
23528
23528
|
[
|
|
23529
23529
|
u0,
|
|
23530
|
-
|
|
23530
|
+
v1
|
|
23531
23531
|
],
|
|
23532
23532
|
[
|
|
23533
23533
|
u1,
|
|
23534
|
-
|
|
23534
|
+
v1
|
|
23535
23535
|
],
|
|
23536
23536
|
[
|
|
23537
23537
|
u0,
|
|
23538
|
-
|
|
23538
|
+
v0
|
|
23539
23539
|
],
|
|
23540
23540
|
[
|
|
23541
23541
|
u1,
|
|
23542
|
-
|
|
23542
|
+
v0
|
|
23543
23543
|
]
|
|
23544
23544
|
];
|
|
23545
23545
|
for(var i = 0; i < 4; i++){
|
|
@@ -24633,8 +24633,18 @@ var InputEvent = /*#__PURE__*/ function() {
|
|
|
24633
24633
|
this.device = 0;
|
|
24634
24634
|
this.pressed = false;
|
|
24635
24635
|
this.canceled = false;
|
|
24636
|
+
this._accepted = false;
|
|
24636
24637
|
}
|
|
24637
24638
|
var _proto = InputEvent.prototype;
|
|
24639
|
+
_proto.accept = function accept() {
|
|
24640
|
+
this._accepted = true;
|
|
24641
|
+
};
|
|
24642
|
+
_proto.clearAccepted = function clearAccepted() {
|
|
24643
|
+
this._accepted = false;
|
|
24644
|
+
};
|
|
24645
|
+
_proto.isAccepted = function isAccepted() {
|
|
24646
|
+
return this._accepted;
|
|
24647
|
+
};
|
|
24638
24648
|
_proto.isPressed = function isPressed() {
|
|
24639
24649
|
return this.pressed && !this.canceled;
|
|
24640
24650
|
};
|
|
@@ -24648,11 +24658,7 @@ var InputEvent = /*#__PURE__*/ function() {
|
|
|
24648
24658
|
return false;
|
|
24649
24659
|
};
|
|
24650
24660
|
_proto.xformedBy = function xformedBy(transform) {
|
|
24651
|
-
|
|
24652
|
-
event.device = this.device;
|
|
24653
|
-
event.pressed = this.pressed;
|
|
24654
|
-
event.canceled = this.canceled;
|
|
24655
|
-
return event;
|
|
24661
|
+
return this;
|
|
24656
24662
|
};
|
|
24657
24663
|
return InputEvent;
|
|
24658
24664
|
}();
|
|
@@ -24683,11 +24689,6 @@ var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
|
24683
24689
|
event.metaPressed = this.metaPressed;
|
|
24684
24690
|
event.ctrlPressed = this.ctrlPressed;
|
|
24685
24691
|
};
|
|
24686
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24687
|
-
var event = new InputEventWithModifiers();
|
|
24688
|
-
this.copyModifiersTo(event);
|
|
24689
|
-
return event;
|
|
24690
|
-
};
|
|
24691
24692
|
return InputEventWithModifiers;
|
|
24692
24693
|
}(_wrap_native_super(InputEvent));
|
|
24693
24694
|
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
@@ -24707,17 +24708,6 @@ var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
|
24707
24708
|
_proto.isEcho = function isEcho() {
|
|
24708
24709
|
return this.echo;
|
|
24709
24710
|
};
|
|
24710
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24711
|
-
var event = new InputEventKey();
|
|
24712
|
-
this.copyModifiersTo(event);
|
|
24713
|
-
event.keycode = this.keycode;
|
|
24714
|
-
event.physicalKeycode = this.physicalKeycode;
|
|
24715
|
-
event.keyLabel = this.keyLabel;
|
|
24716
|
-
event.unicode = this.unicode;
|
|
24717
|
-
event.location = this.location;
|
|
24718
|
-
event.echo = this.echo;
|
|
24719
|
-
return event;
|
|
24720
|
-
};
|
|
24721
24711
|
return InputEventKey;
|
|
24722
24712
|
}(InputEventWithModifiers);
|
|
24723
24713
|
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
@@ -24737,12 +24727,6 @@ var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
|
24737
24727
|
event.position.copyFrom(this.position);
|
|
24738
24728
|
event.globalPosition.copyFrom(this.globalPosition);
|
|
24739
24729
|
};
|
|
24740
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24741
|
-
var event = new InputEventMouse();
|
|
24742
|
-
this.copyMouseTo(event);
|
|
24743
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24744
|
-
return event;
|
|
24745
|
-
};
|
|
24746
24730
|
return InputEventMouse;
|
|
24747
24731
|
}(InputEventWithModifiers);
|
|
24748
24732
|
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
@@ -24859,27 +24843,27 @@ var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
|
24859
24843
|
var ANCHOR_PRESET_TABLE = {
|
|
24860
24844
|
topLeft: [
|
|
24861
24845
|
0,
|
|
24862
|
-
1,
|
|
24863
24846
|
0,
|
|
24864
|
-
|
|
24847
|
+
0,
|
|
24848
|
+
0
|
|
24865
24849
|
],
|
|
24866
24850
|
topRight: [
|
|
24867
24851
|
1,
|
|
24852
|
+
0,
|
|
24868
24853
|
1,
|
|
24869
|
-
|
|
24870
|
-
1
|
|
24854
|
+
0
|
|
24871
24855
|
],
|
|
24872
24856
|
bottomLeft: [
|
|
24873
24857
|
0,
|
|
24858
|
+
1,
|
|
24874
24859
|
0,
|
|
24875
|
-
|
|
24876
|
-
0
|
|
24860
|
+
1
|
|
24877
24861
|
],
|
|
24878
24862
|
bottomRight: [
|
|
24879
24863
|
1,
|
|
24880
|
-
0,
|
|
24881
24864
|
1,
|
|
24882
|
-
|
|
24865
|
+
1,
|
|
24866
|
+
1
|
|
24883
24867
|
],
|
|
24884
24868
|
centerLeft: [
|
|
24885
24869
|
0,
|
|
@@ -24889,9 +24873,9 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24889
24873
|
],
|
|
24890
24874
|
centerTop: [
|
|
24891
24875
|
0.5,
|
|
24892
|
-
|
|
24876
|
+
0,
|
|
24893
24877
|
0.5,
|
|
24894
|
-
|
|
24878
|
+
0
|
|
24895
24879
|
],
|
|
24896
24880
|
centerRight: [
|
|
24897
24881
|
1,
|
|
@@ -24901,9 +24885,9 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24901
24885
|
],
|
|
24902
24886
|
centerBottom: [
|
|
24903
24887
|
0.5,
|
|
24904
|
-
|
|
24888
|
+
1,
|
|
24905
24889
|
0.5,
|
|
24906
|
-
|
|
24890
|
+
1
|
|
24907
24891
|
],
|
|
24908
24892
|
center: [
|
|
24909
24893
|
0.5,
|
|
@@ -24918,10 +24902,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24918
24902
|
1
|
|
24919
24903
|
],
|
|
24920
24904
|
topWide: [
|
|
24905
|
+
0,
|
|
24921
24906
|
0,
|
|
24922
24907
|
1,
|
|
24923
|
-
|
|
24924
|
-
1
|
|
24908
|
+
0
|
|
24925
24909
|
],
|
|
24926
24910
|
rightWide: [
|
|
24927
24911
|
1,
|
|
@@ -24930,10 +24914,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24930
24914
|
1
|
|
24931
24915
|
],
|
|
24932
24916
|
bottomWide: [
|
|
24933
|
-
0,
|
|
24934
24917
|
0,
|
|
24935
24918
|
1,
|
|
24936
|
-
|
|
24919
|
+
1,
|
|
24920
|
+
1
|
|
24937
24921
|
],
|
|
24938
24922
|
vcenterWide: [
|
|
24939
24923
|
0.5,
|
|
@@ -25119,6 +25103,7 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25119
25103
|
var a = this.anchorMin;
|
|
25120
25104
|
var b = this.anchorMax;
|
|
25121
25105
|
var minX = 0, maxX = 0, minY = 0, maxY = 0;
|
|
25106
|
+
// Left edge.
|
|
25122
25107
|
switch(preset){
|
|
25123
25108
|
case "topLeft":
|
|
25124
25109
|
case "bottomLeft":
|
|
@@ -25129,41 +25114,71 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25129
25114
|
case "hcenterWide":
|
|
25130
25115
|
case "fullRect":
|
|
25131
25116
|
minX = margin - a.x * parentSize.x;
|
|
25132
|
-
maxX = margin + width - b.x * parentSize.x;
|
|
25133
25117
|
break;
|
|
25134
25118
|
case "centerTop":
|
|
25135
25119
|
case "centerBottom":
|
|
25136
25120
|
case "center":
|
|
25137
25121
|
case "vcenterWide":
|
|
25138
25122
|
minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
|
|
25139
|
-
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25140
25123
|
break;
|
|
25141
25124
|
default:
|
|
25142
25125
|
minX = parentSize.x - margin - width - a.x * parentSize.x;
|
|
25143
|
-
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25144
25126
|
break;
|
|
25145
25127
|
}
|
|
25146
25128
|
switch(preset){
|
|
25129
|
+
case "topLeft":
|
|
25147
25130
|
case "bottomLeft":
|
|
25148
|
-
case "
|
|
25131
|
+
case "centerLeft":
|
|
25132
|
+
case "leftWide":
|
|
25133
|
+
maxX = margin + width - b.x * parentSize.x;
|
|
25134
|
+
break;
|
|
25135
|
+
case "centerTop":
|
|
25149
25136
|
case "centerBottom":
|
|
25137
|
+
case "center":
|
|
25138
|
+
case "vcenterWide":
|
|
25139
|
+
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25140
|
+
break;
|
|
25141
|
+
default:
|
|
25142
|
+
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25143
|
+
break;
|
|
25144
|
+
}
|
|
25145
|
+
// Top edge.
|
|
25146
|
+
switch(preset){
|
|
25147
|
+
case "topLeft":
|
|
25148
|
+
case "topRight":
|
|
25149
|
+
case "centerTop":
|
|
25150
25150
|
case "leftWide":
|
|
25151
25151
|
case "rightWide":
|
|
25152
|
-
case "
|
|
25152
|
+
case "topWide":
|
|
25153
25153
|
case "vcenterWide":
|
|
25154
25154
|
case "fullRect":
|
|
25155
25155
|
minY = margin - a.y * parentSize.y;
|
|
25156
|
-
maxY = margin + height - b.y * parentSize.y;
|
|
25157
25156
|
break;
|
|
25158
25157
|
case "centerLeft":
|
|
25159
25158
|
case "centerRight":
|
|
25160
25159
|
case "center":
|
|
25161
25160
|
case "hcenterWide":
|
|
25162
25161
|
minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
|
|
25163
|
-
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25164
25162
|
break;
|
|
25165
25163
|
default:
|
|
25166
25164
|
minY = parentSize.y - margin - height - a.y * parentSize.y;
|
|
25165
|
+
break;
|
|
25166
|
+
}
|
|
25167
|
+
// Bottom edge.
|
|
25168
|
+
switch(preset){
|
|
25169
|
+
case "topLeft":
|
|
25170
|
+
case "topRight":
|
|
25171
|
+
case "centerTop":
|
|
25172
|
+
case "topWide":
|
|
25173
|
+
maxY = margin + height - b.y * parentSize.y;
|
|
25174
|
+
break;
|
|
25175
|
+
case "centerLeft":
|
|
25176
|
+
case "centerRight":
|
|
25177
|
+
case "center":
|
|
25178
|
+
case "hcenterWide":
|
|
25179
|
+
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25180
|
+
break;
|
|
25181
|
+
default:
|
|
25167
25182
|
maxY = parentSize.y - margin - b.y * parentSize.y;
|
|
25168
25183
|
break;
|
|
25169
25184
|
}
|
|
@@ -25192,10 +25207,6 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25192
25207
|
_proto.getCursorShape = function getCursorShape(position) {
|
|
25193
25208
|
return this.defaultCursorShape;
|
|
25194
25209
|
};
|
|
25195
|
-
_proto.acceptEvent = function acceptEvent() {
|
|
25196
|
-
var _this_root;
|
|
25197
|
-
(_this_root = this.root) == null ? void 0 : _this_root.acceptControlEvent(this);
|
|
25198
|
-
};
|
|
25199
25210
|
_proto.focus = function focus() {
|
|
25200
25211
|
var _this_root;
|
|
25201
25212
|
(_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
|
|
@@ -25276,14 +25287,14 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25276
25287
|
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
25277
25288
|
};
|
|
25278
25289
|
_proto.onMouseEnter = function onMouseEnter(location) {};
|
|
25279
|
-
_proto.onMouseMove = function onMouseMove(
|
|
25290
|
+
_proto.onMouseMove = function onMouseMove(event) {};
|
|
25280
25291
|
_proto.onMouseLeave = function onMouseLeave() {};
|
|
25281
|
-
_proto.onMouseWheel = function onMouseWheel(
|
|
25282
|
-
_proto.onMouseDown = function onMouseDown(
|
|
25283
|
-
_proto.onMouseUp = function onMouseUp(
|
|
25284
|
-
_proto.onTouchDown = function onTouchDown(
|
|
25285
|
-
_proto.onTouchMove = function onTouchMove(
|
|
25286
|
-
_proto.onTouchUp = function onTouchUp(
|
|
25292
|
+
_proto.onMouseWheel = function onMouseWheel(event) {};
|
|
25293
|
+
_proto.onMouseDown = function onMouseDown(event) {};
|
|
25294
|
+
_proto.onMouseUp = function onMouseUp(event) {};
|
|
25295
|
+
_proto.onTouchDown = function onTouchDown(event) {};
|
|
25296
|
+
_proto.onTouchMove = function onTouchMove(event) {};
|
|
25297
|
+
_proto.onTouchUp = function onTouchUp(event) {};
|
|
25287
25298
|
_proto.onKeyDown = function onKeyDown(event) {};
|
|
25288
25299
|
_proto.onKeyUp = function onKeyUp(event) {};
|
|
25289
25300
|
_proto.onGotFocus = function onGotFocus() {};
|
|
@@ -25318,10 +25329,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25318
25329
|
var _this_parent_size;
|
|
25319
25330
|
var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
|
|
25320
25331
|
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25321
|
-
var
|
|
25332
|
+
var top = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25322
25333
|
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25323
|
-
var
|
|
25324
|
-
this.applyBounds(left,
|
|
25334
|
+
var bottom = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25335
|
+
this.applyBounds(left, top, right - left, bottom - top);
|
|
25325
25336
|
};
|
|
25326
25337
|
_proto.applyBounds = function applyBounds(x, y, width, height) {
|
|
25327
25338
|
var locationChanged = this.position.x !== x || this.position.y !== y;
|
|
@@ -25532,7 +25543,12 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25532
25543
|
return this._defaultCursorShape;
|
|
25533
25544
|
},
|
|
25534
25545
|
set: function set(value) {
|
|
25546
|
+
var _this_root;
|
|
25547
|
+
if (this._defaultCursorShape === value) {
|
|
25548
|
+
return;
|
|
25549
|
+
}
|
|
25535
25550
|
this._defaultCursorShape = value;
|
|
25551
|
+
(_this_root = this.root) == null ? void 0 : _this_root.updateMouseCursorState();
|
|
25536
25552
|
}
|
|
25537
25553
|
},
|
|
25538
25554
|
{
|
|
@@ -25716,9 +25732,6 @@ function getButtonMask(button) {
|
|
|
25716
25732
|
function isWheelButton(button) {
|
|
25717
25733
|
return button >= exports.MouseButton.WheelUp && button <= exports.MouseButton.WheelRight;
|
|
25718
25734
|
}
|
|
25719
|
-
function getWheelDelta(event) {
|
|
25720
|
-
return event.buttonIndex === exports.MouseButton.WheelUp || event.buttonIndex === exports.MouseButton.WheelLeft ? event.factor : -event.factor;
|
|
25721
|
-
}
|
|
25722
25735
|
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25723
25736
|
_inherits(CanvasRootControl, ContainerControl);
|
|
25724
25737
|
function CanvasRootControl(engine, canvas) {
|
|
@@ -25777,7 +25790,7 @@ function getWheelDelta(event) {
|
|
|
25777
25790
|
var _this;
|
|
25778
25791
|
_this = RootControl.call(this, engine) || this;
|
|
25779
25792
|
_this.dragThreshold = 10;
|
|
25780
|
-
_this.
|
|
25793
|
+
_this.lastInput = null;
|
|
25781
25794
|
_this.gui = {
|
|
25782
25795
|
mouseFocus: null,
|
|
25783
25796
|
mouseClickGrabber: null,
|
|
@@ -25804,13 +25817,16 @@ function getWheelDelta(event) {
|
|
|
25804
25817
|
}
|
|
25805
25818
|
var _proto = WindowRootControl.prototype;
|
|
25806
25819
|
_proto.pushInput = function pushInput(event) {
|
|
25807
|
-
|
|
25820
|
+
event.clearAccepted();
|
|
25821
|
+
this.lastInput = event;
|
|
25808
25822
|
this.cleanupInternalState();
|
|
25809
25823
|
this.processGUIInput(event);
|
|
25810
25824
|
this.postGrabClickFocus();
|
|
25811
25825
|
};
|
|
25812
25826
|
_proto.isInputHandled = function isInputHandled() {
|
|
25813
|
-
|
|
25827
|
+
var _this_lastInput;
|
|
25828
|
+
var _this_lastInput_isAccepted;
|
|
25829
|
+
return (_this_lastInput_isAccepted = (_this_lastInput = this.lastInput) == null ? void 0 : _this_lastInput.isAccepted()) != null ? _this_lastInput_isAccepted : false;
|
|
25814
25830
|
};
|
|
25815
25831
|
_proto.getMousePosition = function getMousePosition() {
|
|
25816
25832
|
return this.gui.lastMousePosition.clone();
|
|
@@ -25833,11 +25849,6 @@ function getWheelDelta(event) {
|
|
|
25833
25849
|
_proto.guiCancelDrag = function guiCancelDrag() {
|
|
25834
25850
|
this.endDragging(false);
|
|
25835
25851
|
};
|
|
25836
|
-
_proto.acceptControlEvent = function acceptControlEvent(control) {
|
|
25837
|
-
if (this.isControlUsable(control)) {
|
|
25838
|
-
this.inputHandled = true;
|
|
25839
|
-
}
|
|
25840
|
-
};
|
|
25841
25852
|
_proto.grabControlFocus = function grabControlFocus(control) {
|
|
25842
25853
|
if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
|
|
25843
25854
|
return;
|
|
@@ -25871,6 +25882,12 @@ function getWheelDelta(event) {
|
|
|
25871
25882
|
_proto.warpControlMouse = function warpControlMouse(position) {
|
|
25872
25883
|
this.gui.lastMousePosition.copyFrom(position);
|
|
25873
25884
|
this.updateMouseOver(position);
|
|
25885
|
+
this.updateMouseCursorState();
|
|
25886
|
+
};
|
|
25887
|
+
_proto.updateMouseCursorState = function updateMouseCursorState() {
|
|
25888
|
+
var position = this.gui.lastMousePosition;
|
|
25889
|
+
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.isControlUsable(this.gui.mouseOver) ? this.gui.mouseOver : null;
|
|
25890
|
+
this.updateCursor(target, position);
|
|
25874
25891
|
};
|
|
25875
25892
|
_proto.controlStateChanged = function controlStateChanged(control) {
|
|
25876
25893
|
if (!this.isControlUsable(control)) {
|
|
@@ -26023,11 +26040,15 @@ function getWheelDelta(event) {
|
|
|
26023
26040
|
while(current && current !== this && this.isControlUsable(current)){
|
|
26024
26041
|
var filter = current.getEffectiveMouseFilter();
|
|
26025
26042
|
if (filter !== exports.MouseFilter.Ignore) {
|
|
26026
|
-
|
|
26043
|
+
var localEvent = event.xformedBy(this.getGlobalInverse(current));
|
|
26044
|
+
this.callControlInput(current, localEvent);
|
|
26045
|
+
if (localEvent.isAccepted()) {
|
|
26046
|
+
event.accept();
|
|
26047
|
+
}
|
|
26027
26048
|
}
|
|
26028
26049
|
var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
|
|
26029
|
-
if (
|
|
26030
|
-
|
|
26050
|
+
if (event.isAccepted() || filter === exports.MouseFilter.Stop && pointerEvent && !forcePassWheel) {
|
|
26051
|
+
event.accept();
|
|
26031
26052
|
return;
|
|
26032
26053
|
}
|
|
26033
26054
|
current = current.parent;
|
|
@@ -26036,22 +26057,22 @@ function getWheelDelta(event) {
|
|
|
26036
26057
|
_proto.callControlInput = function callControlInput(control, event) {
|
|
26037
26058
|
if (_instanceof1(event, InputEventMouseButton)) {
|
|
26038
26059
|
if (isWheelButton(event.buttonIndex)) {
|
|
26039
|
-
control.onMouseWheel(event
|
|
26060
|
+
control.onMouseWheel(event);
|
|
26040
26061
|
} else if (event.isPressed()) {
|
|
26041
|
-
control.onMouseDown(event
|
|
26062
|
+
control.onMouseDown(event);
|
|
26042
26063
|
} else {
|
|
26043
|
-
control.onMouseUp(event
|
|
26064
|
+
control.onMouseUp(event);
|
|
26044
26065
|
}
|
|
26045
26066
|
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
26046
|
-
control.onMouseMove(event
|
|
26067
|
+
control.onMouseMove(event);
|
|
26047
26068
|
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
26048
26069
|
if (event.isPressed()) {
|
|
26049
|
-
control.onTouchDown(event
|
|
26070
|
+
control.onTouchDown(event);
|
|
26050
26071
|
} else {
|
|
26051
|
-
control.onTouchUp(event
|
|
26072
|
+
control.onTouchUp(event);
|
|
26052
26073
|
}
|
|
26053
26074
|
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
26054
|
-
control.onTouchMove(event
|
|
26075
|
+
control.onTouchMove(event);
|
|
26055
26076
|
} else if (_instanceof1(event, InputEventKey)) {
|
|
26056
26077
|
if (event.isPressed()) {
|
|
26057
26078
|
control.onKeyDown(event);
|
|
@@ -26202,11 +26223,11 @@ function getWheelDelta(event) {
|
|
|
26202
26223
|
};
|
|
26203
26224
|
_proto.updateCursor = function updateCursor(target, position) {
|
|
26204
26225
|
var current = target;
|
|
26205
|
-
var
|
|
26226
|
+
var cursor = exports.CursorShape.Arrow;
|
|
26206
26227
|
while(current && current !== this){
|
|
26207
26228
|
var candidate = current.getCursorShape(this.toLocal(current, position));
|
|
26208
26229
|
if (candidate !== exports.CursorShape.Arrow) {
|
|
26209
|
-
|
|
26230
|
+
cursor = candidate;
|
|
26210
26231
|
break;
|
|
26211
26232
|
}
|
|
26212
26233
|
if (current.getEffectiveMouseFilter() === exports.MouseFilter.Stop) {
|
|
@@ -26214,7 +26235,7 @@ function getWheelDelta(event) {
|
|
|
26214
26235
|
}
|
|
26215
26236
|
current = current.parent;
|
|
26216
26237
|
}
|
|
26217
|
-
this.engine.canvas.style.cursor = cursorNames[
|
|
26238
|
+
this.engine.canvas.style.cursor = typeof cursor === "string" ? cursor : cursorNames[cursor];
|
|
26218
26239
|
};
|
|
26219
26240
|
_proto.postGrabClickFocus = function postGrabClickFocus() {
|
|
26220
26241
|
var target = this.gui.mouseClickGrabber;
|
|
@@ -26866,8 +26887,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26866
26887
|
if (!this.enabled || !this.target) {
|
|
26867
26888
|
return;
|
|
26868
26889
|
}
|
|
26869
|
-
this.focusTarget();
|
|
26870
26890
|
var position = this.getCanvasPosition(event.clientX, event.clientY);
|
|
26891
|
+
this.focusTarget();
|
|
26871
26892
|
var state = this.createPointerState(position);
|
|
26872
26893
|
this.mouseState = state;
|
|
26873
26894
|
state.pressed = true;
|
|
@@ -27159,12 +27180,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27159
27180
|
var _target_width, _target_height;
|
|
27160
27181
|
return {
|
|
27161
27182
|
x: position.x / cssWidth * 2 - 1,
|
|
27162
|
-
|
|
27183
|
+
// Legacy composition picking uses bottom-left, Y-up NDC even though GUI
|
|
27184
|
+
// input follows the DOM convention of top-left, Y-down pixels.
|
|
27185
|
+
y: 1 - position.y / cssHeight * 2,
|
|
27163
27186
|
vx: velocity.x / cssWidth * 2,
|
|
27164
|
-
vy: velocity.y / cssHeight * 2,
|
|
27187
|
+
vy: -velocity.y / cssHeight * 2,
|
|
27165
27188
|
ts: performance.now(),
|
|
27166
27189
|
dx: (position.x - state.start.x) / cssWidth * 2,
|
|
27167
|
-
dy: (position.y - state.start.y) / cssHeight * 2,
|
|
27190
|
+
dy: -(position.y - state.start.y) / cssHeight * 2,
|
|
27168
27191
|
width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
|
|
27169
27192
|
height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
|
|
27170
27193
|
origin: origin
|
|
@@ -27176,7 +27199,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27176
27199
|
if (!rect) {
|
|
27177
27200
|
return new Vector2();
|
|
27178
27201
|
}
|
|
27179
|
-
return new Vector2(clientX - rect.left,
|
|
27202
|
+
return new Vector2(clientX - rect.left, clientY - rect.top);
|
|
27180
27203
|
};
|
|
27181
27204
|
_proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
|
|
27182
27205
|
if (handled && !this.allowPropagation) {
|
|
@@ -27192,9 +27215,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27192
27215
|
}
|
|
27193
27216
|
};
|
|
27194
27217
|
_proto.focusTarget = function focusTarget() {
|
|
27195
|
-
|
|
27196
|
-
|
|
27197
|
-
}
|
|
27218
|
+
var _this_target;
|
|
27219
|
+
(_this_target = this.target) == null ? void 0 : _this_target.focus();
|
|
27198
27220
|
};
|
|
27199
27221
|
_proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
|
|
27200
27222
|
target.addEventListener(name, handler, options);
|
|
@@ -39331,7 +39353,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
39331
39353
|
return ret;
|
|
39332
39354
|
}
|
|
39333
39355
|
|
|
39334
|
-
var version$1 = "2.10.0-alpha.
|
|
39356
|
+
var version$1 = "2.10.0-alpha.4";
|
|
39335
39357
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
39336
39358
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
39337
39359
|
var reverseParticle = false;
|
|
@@ -44561,7 +44583,7 @@ registerPlugin("text", TextLoader);
|
|
|
44561
44583
|
registerPlugin("sprite", SpriteLoader);
|
|
44562
44584
|
registerPlugin("particle", ParticleLoader);
|
|
44563
44585
|
registerPlugin("interact", InteractLoader);
|
|
44564
|
-
var version = "2.10.0-alpha.
|
|
44586
|
+
var version = "2.10.0-alpha.4";
|
|
44565
44587
|
logger.info("Core version: " + version + ".");
|
|
44566
44588
|
|
|
44567
44589
|
exports.ATLAS_SIZE = ATLAS_SIZE;
|