@galacean/effects-threejs 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/index.js +139 -117
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +139 -117
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin 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';
|
|
@@ -23152,10 +23152,10 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23152
23152
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23153
23153
|
this.currentBatchType = "colored";
|
|
23154
23154
|
this.currentBatchTexture = null;
|
|
23155
|
-
// 创建从屏幕坐标到 NDC
|
|
23155
|
+
// 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
|
|
23156
23156
|
var _this_engine_canvas_getBoundingClientRect = this.engine.canvas.getBoundingClientRect(), width = _this_engine_canvas_getBoundingClientRect.width, height = _this_engine_canvas_getBoundingClientRect.height;
|
|
23157
23157
|
// 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
|
|
23158
|
-
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, -1, 0, -1,
|
|
23158
|
+
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
|
|
23159
23159
|
);
|
|
23160
23160
|
this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23161
23161
|
this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
@@ -23320,8 +23320,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23320
23320
|
};
|
|
23321
23321
|
/**
|
|
23322
23322
|
* 绘制矩形边框
|
|
23323
|
-
* @param x -
|
|
23324
|
-
* @param y -
|
|
23323
|
+
* @param x - 矩形左上角 X 坐标
|
|
23324
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23325
23325
|
* @param width - 矩形宽度
|
|
23326
23326
|
* @param height - 矩形高度
|
|
23327
23327
|
* @param color - 边框颜色,默认白色,范围 0-1
|
|
@@ -23364,8 +23364,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23364
23364
|
};
|
|
23365
23365
|
/**
|
|
23366
23366
|
* 绘制填充矩形
|
|
23367
|
-
* @param x -
|
|
23368
|
-
* @param y -
|
|
23367
|
+
* @param x - 矩形左上角 X 坐标
|
|
23368
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23369
23369
|
* @param width - 矩形宽度
|
|
23370
23370
|
* @param height - 矩形高度
|
|
23371
23371
|
* @param color - 填充颜色,默认白色,范围 0-1
|
|
@@ -23391,9 +23391,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23391
23391
|
this.buildShape(this.circleShape, color);
|
|
23392
23392
|
};
|
|
23393
23393
|
/**
|
|
23394
|
-
* 绘制纹理矩形(本地坐标,Y
|
|
23395
|
-
* @param x -
|
|
23396
|
-
* @param y -
|
|
23394
|
+
* 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
|
|
23395
|
+
* @param x - 矩形左上角 X 坐标
|
|
23396
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23397
23397
|
* @param width - 矩形宽度
|
|
23398
23398
|
* @param height - 矩形高度
|
|
23399
23399
|
* @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
|
|
@@ -23406,14 +23406,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23406
23406
|
this.pushQuad(x, y, width, height, color, region);
|
|
23407
23407
|
};
|
|
23408
23408
|
/**
|
|
23409
|
-
* 绘制文本(本地坐标,Y
|
|
23409
|
+
* 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
|
|
23410
23410
|
*
|
|
23411
23411
|
* 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
|
|
23412
23412
|
* `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
|
|
23413
23413
|
*
|
|
23414
23414
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
23415
|
-
* @param x -
|
|
23416
|
-
* @param y -
|
|
23415
|
+
* @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
23416
|
+
* @param y - 文本 cell 顶部 Y 坐标
|
|
23417
23417
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
23418
23418
|
* @param fontSize - 字号(逻辑像素)
|
|
23419
23419
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -23528,7 +23528,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23528
23528
|
* 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
|
|
23529
23529
|
*/ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
|
|
23530
23530
|
var vertexOffset = this.vertices.length / 2;
|
|
23531
|
-
// 4
|
|
23531
|
+
// 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
|
|
23532
23532
|
var corners = [
|
|
23533
23533
|
[
|
|
23534
23534
|
x,
|
|
@@ -23554,19 +23554,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23554
23554
|
var cornerUVs = [
|
|
23555
23555
|
[
|
|
23556
23556
|
u0,
|
|
23557
|
-
|
|
23557
|
+
v1
|
|
23558
23558
|
],
|
|
23559
23559
|
[
|
|
23560
23560
|
u1,
|
|
23561
|
-
|
|
23561
|
+
v1
|
|
23562
23562
|
],
|
|
23563
23563
|
[
|
|
23564
23564
|
u0,
|
|
23565
|
-
|
|
23565
|
+
v0
|
|
23566
23566
|
],
|
|
23567
23567
|
[
|
|
23568
23568
|
u1,
|
|
23569
|
-
|
|
23569
|
+
v0
|
|
23570
23570
|
]
|
|
23571
23571
|
];
|
|
23572
23572
|
for(var i = 0; i < 4; i++){
|
|
@@ -24660,8 +24660,18 @@ var InputEvent = /*#__PURE__*/ function() {
|
|
|
24660
24660
|
this.device = 0;
|
|
24661
24661
|
this.pressed = false;
|
|
24662
24662
|
this.canceled = false;
|
|
24663
|
+
this._accepted = false;
|
|
24663
24664
|
}
|
|
24664
24665
|
var _proto = InputEvent.prototype;
|
|
24666
|
+
_proto.accept = function accept() {
|
|
24667
|
+
this._accepted = true;
|
|
24668
|
+
};
|
|
24669
|
+
_proto.clearAccepted = function clearAccepted() {
|
|
24670
|
+
this._accepted = false;
|
|
24671
|
+
};
|
|
24672
|
+
_proto.isAccepted = function isAccepted() {
|
|
24673
|
+
return this._accepted;
|
|
24674
|
+
};
|
|
24665
24675
|
_proto.isPressed = function isPressed() {
|
|
24666
24676
|
return this.pressed && !this.canceled;
|
|
24667
24677
|
};
|
|
@@ -24675,11 +24685,7 @@ var InputEvent = /*#__PURE__*/ function() {
|
|
|
24675
24685
|
return false;
|
|
24676
24686
|
};
|
|
24677
24687
|
_proto.xformedBy = function xformedBy(transform) {
|
|
24678
|
-
|
|
24679
|
-
event.device = this.device;
|
|
24680
|
-
event.pressed = this.pressed;
|
|
24681
|
-
event.canceled = this.canceled;
|
|
24682
|
-
return event;
|
|
24688
|
+
return this;
|
|
24683
24689
|
};
|
|
24684
24690
|
return InputEvent;
|
|
24685
24691
|
}();
|
|
@@ -24710,11 +24716,6 @@ var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
|
24710
24716
|
event.metaPressed = this.metaPressed;
|
|
24711
24717
|
event.ctrlPressed = this.ctrlPressed;
|
|
24712
24718
|
};
|
|
24713
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24714
|
-
var event = new InputEventWithModifiers();
|
|
24715
|
-
this.copyModifiersTo(event);
|
|
24716
|
-
return event;
|
|
24717
|
-
};
|
|
24718
24719
|
return InputEventWithModifiers;
|
|
24719
24720
|
}(_wrap_native_super(InputEvent));
|
|
24720
24721
|
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
@@ -24734,17 +24735,6 @@ var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
|
24734
24735
|
_proto.isEcho = function isEcho() {
|
|
24735
24736
|
return this.echo;
|
|
24736
24737
|
};
|
|
24737
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24738
|
-
var event = new InputEventKey();
|
|
24739
|
-
this.copyModifiersTo(event);
|
|
24740
|
-
event.keycode = this.keycode;
|
|
24741
|
-
event.physicalKeycode = this.physicalKeycode;
|
|
24742
|
-
event.keyLabel = this.keyLabel;
|
|
24743
|
-
event.unicode = this.unicode;
|
|
24744
|
-
event.location = this.location;
|
|
24745
|
-
event.echo = this.echo;
|
|
24746
|
-
return event;
|
|
24747
|
-
};
|
|
24748
24738
|
return InputEventKey;
|
|
24749
24739
|
}(InputEventWithModifiers);
|
|
24750
24740
|
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
@@ -24764,12 +24754,6 @@ var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
|
24764
24754
|
event.position.copyFrom(this.position);
|
|
24765
24755
|
event.globalPosition.copyFrom(this.globalPosition);
|
|
24766
24756
|
};
|
|
24767
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24768
|
-
var event = new InputEventMouse();
|
|
24769
|
-
this.copyMouseTo(event);
|
|
24770
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24771
|
-
return event;
|
|
24772
|
-
};
|
|
24773
24757
|
return InputEventMouse;
|
|
24774
24758
|
}(InputEventWithModifiers);
|
|
24775
24759
|
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
@@ -24886,27 +24870,27 @@ var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
|
24886
24870
|
var ANCHOR_PRESET_TABLE = {
|
|
24887
24871
|
topLeft: [
|
|
24888
24872
|
0,
|
|
24889
|
-
1,
|
|
24890
24873
|
0,
|
|
24891
|
-
|
|
24874
|
+
0,
|
|
24875
|
+
0
|
|
24892
24876
|
],
|
|
24893
24877
|
topRight: [
|
|
24894
24878
|
1,
|
|
24879
|
+
0,
|
|
24895
24880
|
1,
|
|
24896
|
-
|
|
24897
|
-
1
|
|
24881
|
+
0
|
|
24898
24882
|
],
|
|
24899
24883
|
bottomLeft: [
|
|
24900
24884
|
0,
|
|
24885
|
+
1,
|
|
24901
24886
|
0,
|
|
24902
|
-
|
|
24903
|
-
0
|
|
24887
|
+
1
|
|
24904
24888
|
],
|
|
24905
24889
|
bottomRight: [
|
|
24906
24890
|
1,
|
|
24907
|
-
0,
|
|
24908
24891
|
1,
|
|
24909
|
-
|
|
24892
|
+
1,
|
|
24893
|
+
1
|
|
24910
24894
|
],
|
|
24911
24895
|
centerLeft: [
|
|
24912
24896
|
0,
|
|
@@ -24916,9 +24900,9 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24916
24900
|
],
|
|
24917
24901
|
centerTop: [
|
|
24918
24902
|
0.5,
|
|
24919
|
-
|
|
24903
|
+
0,
|
|
24920
24904
|
0.5,
|
|
24921
|
-
|
|
24905
|
+
0
|
|
24922
24906
|
],
|
|
24923
24907
|
centerRight: [
|
|
24924
24908
|
1,
|
|
@@ -24928,9 +24912,9 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24928
24912
|
],
|
|
24929
24913
|
centerBottom: [
|
|
24930
24914
|
0.5,
|
|
24931
|
-
|
|
24915
|
+
1,
|
|
24932
24916
|
0.5,
|
|
24933
|
-
|
|
24917
|
+
1
|
|
24934
24918
|
],
|
|
24935
24919
|
center: [
|
|
24936
24920
|
0.5,
|
|
@@ -24945,10 +24929,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24945
24929
|
1
|
|
24946
24930
|
],
|
|
24947
24931
|
topWide: [
|
|
24932
|
+
0,
|
|
24948
24933
|
0,
|
|
24949
24934
|
1,
|
|
24950
|
-
|
|
24951
|
-
1
|
|
24935
|
+
0
|
|
24952
24936
|
],
|
|
24953
24937
|
rightWide: [
|
|
24954
24938
|
1,
|
|
@@ -24957,10 +24941,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
24957
24941
|
1
|
|
24958
24942
|
],
|
|
24959
24943
|
bottomWide: [
|
|
24960
|
-
0,
|
|
24961
24944
|
0,
|
|
24962
24945
|
1,
|
|
24963
|
-
|
|
24946
|
+
1,
|
|
24947
|
+
1
|
|
24964
24948
|
],
|
|
24965
24949
|
vcenterWide: [
|
|
24966
24950
|
0.5,
|
|
@@ -25146,6 +25130,7 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25146
25130
|
var a = this.anchorMin;
|
|
25147
25131
|
var b = this.anchorMax;
|
|
25148
25132
|
var minX = 0, maxX = 0, minY = 0, maxY = 0;
|
|
25133
|
+
// Left edge.
|
|
25149
25134
|
switch(preset){
|
|
25150
25135
|
case "topLeft":
|
|
25151
25136
|
case "bottomLeft":
|
|
@@ -25156,41 +25141,71 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25156
25141
|
case "hcenterWide":
|
|
25157
25142
|
case "fullRect":
|
|
25158
25143
|
minX = margin - a.x * parentSize.x;
|
|
25159
|
-
maxX = margin + width - b.x * parentSize.x;
|
|
25160
25144
|
break;
|
|
25161
25145
|
case "centerTop":
|
|
25162
25146
|
case "centerBottom":
|
|
25163
25147
|
case "center":
|
|
25164
25148
|
case "vcenterWide":
|
|
25165
25149
|
minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
|
|
25166
|
-
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25167
25150
|
break;
|
|
25168
25151
|
default:
|
|
25169
25152
|
minX = parentSize.x - margin - width - a.x * parentSize.x;
|
|
25170
|
-
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25171
25153
|
break;
|
|
25172
25154
|
}
|
|
25173
25155
|
switch(preset){
|
|
25156
|
+
case "topLeft":
|
|
25174
25157
|
case "bottomLeft":
|
|
25175
|
-
case "
|
|
25158
|
+
case "centerLeft":
|
|
25159
|
+
case "leftWide":
|
|
25160
|
+
maxX = margin + width - b.x * parentSize.x;
|
|
25161
|
+
break;
|
|
25162
|
+
case "centerTop":
|
|
25176
25163
|
case "centerBottom":
|
|
25164
|
+
case "center":
|
|
25165
|
+
case "vcenterWide":
|
|
25166
|
+
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25167
|
+
break;
|
|
25168
|
+
default:
|
|
25169
|
+
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25170
|
+
break;
|
|
25171
|
+
}
|
|
25172
|
+
// Top edge.
|
|
25173
|
+
switch(preset){
|
|
25174
|
+
case "topLeft":
|
|
25175
|
+
case "topRight":
|
|
25176
|
+
case "centerTop":
|
|
25177
25177
|
case "leftWide":
|
|
25178
25178
|
case "rightWide":
|
|
25179
|
-
case "
|
|
25179
|
+
case "topWide":
|
|
25180
25180
|
case "vcenterWide":
|
|
25181
25181
|
case "fullRect":
|
|
25182
25182
|
minY = margin - a.y * parentSize.y;
|
|
25183
|
-
maxY = margin + height - b.y * parentSize.y;
|
|
25184
25183
|
break;
|
|
25185
25184
|
case "centerLeft":
|
|
25186
25185
|
case "centerRight":
|
|
25187
25186
|
case "center":
|
|
25188
25187
|
case "hcenterWide":
|
|
25189
25188
|
minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
|
|
25190
|
-
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25191
25189
|
break;
|
|
25192
25190
|
default:
|
|
25193
25191
|
minY = parentSize.y - margin - height - a.y * parentSize.y;
|
|
25192
|
+
break;
|
|
25193
|
+
}
|
|
25194
|
+
// Bottom edge.
|
|
25195
|
+
switch(preset){
|
|
25196
|
+
case "topLeft":
|
|
25197
|
+
case "topRight":
|
|
25198
|
+
case "centerTop":
|
|
25199
|
+
case "topWide":
|
|
25200
|
+
maxY = margin + height - b.y * parentSize.y;
|
|
25201
|
+
break;
|
|
25202
|
+
case "centerLeft":
|
|
25203
|
+
case "centerRight":
|
|
25204
|
+
case "center":
|
|
25205
|
+
case "hcenterWide":
|
|
25206
|
+
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25207
|
+
break;
|
|
25208
|
+
default:
|
|
25194
25209
|
maxY = parentSize.y - margin - b.y * parentSize.y;
|
|
25195
25210
|
break;
|
|
25196
25211
|
}
|
|
@@ -25219,10 +25234,6 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25219
25234
|
_proto.getCursorShape = function getCursorShape(position) {
|
|
25220
25235
|
return this.defaultCursorShape;
|
|
25221
25236
|
};
|
|
25222
|
-
_proto.acceptEvent = function acceptEvent() {
|
|
25223
|
-
var _this_root;
|
|
25224
|
-
(_this_root = this.root) == null ? void 0 : _this_root.acceptControlEvent(this);
|
|
25225
|
-
};
|
|
25226
25237
|
_proto.focus = function focus() {
|
|
25227
25238
|
var _this_root;
|
|
25228
25239
|
(_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
|
|
@@ -25303,14 +25314,14 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25303
25314
|
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
25304
25315
|
};
|
|
25305
25316
|
_proto.onMouseEnter = function onMouseEnter(location) {};
|
|
25306
|
-
_proto.onMouseMove = function onMouseMove(
|
|
25317
|
+
_proto.onMouseMove = function onMouseMove(event) {};
|
|
25307
25318
|
_proto.onMouseLeave = function onMouseLeave() {};
|
|
25308
|
-
_proto.onMouseWheel = function onMouseWheel(
|
|
25309
|
-
_proto.onMouseDown = function onMouseDown(
|
|
25310
|
-
_proto.onMouseUp = function onMouseUp(
|
|
25311
|
-
_proto.onTouchDown = function onTouchDown(
|
|
25312
|
-
_proto.onTouchMove = function onTouchMove(
|
|
25313
|
-
_proto.onTouchUp = function onTouchUp(
|
|
25319
|
+
_proto.onMouseWheel = function onMouseWheel(event) {};
|
|
25320
|
+
_proto.onMouseDown = function onMouseDown(event) {};
|
|
25321
|
+
_proto.onMouseUp = function onMouseUp(event) {};
|
|
25322
|
+
_proto.onTouchDown = function onTouchDown(event) {};
|
|
25323
|
+
_proto.onTouchMove = function onTouchMove(event) {};
|
|
25324
|
+
_proto.onTouchUp = function onTouchUp(event) {};
|
|
25314
25325
|
_proto.onKeyDown = function onKeyDown(event) {};
|
|
25315
25326
|
_proto.onKeyUp = function onKeyUp(event) {};
|
|
25316
25327
|
_proto.onGotFocus = function onGotFocus() {};
|
|
@@ -25345,10 +25356,10 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25345
25356
|
var _this_parent_size;
|
|
25346
25357
|
var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
|
|
25347
25358
|
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25348
|
-
var
|
|
25359
|
+
var top = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25349
25360
|
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25350
|
-
var
|
|
25351
|
-
this.applyBounds(left,
|
|
25361
|
+
var bottom = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25362
|
+
this.applyBounds(left, top, right - left, bottom - top);
|
|
25352
25363
|
};
|
|
25353
25364
|
_proto.applyBounds = function applyBounds(x, y, width, height) {
|
|
25354
25365
|
var locationChanged = this.position.x !== x || this.position.y !== y;
|
|
@@ -25559,7 +25570,12 @@ var ANCHOR_PRESET_TABLE = {
|
|
|
25559
25570
|
return this._defaultCursorShape;
|
|
25560
25571
|
},
|
|
25561
25572
|
set: function set(value) {
|
|
25573
|
+
var _this_root;
|
|
25574
|
+
if (this._defaultCursorShape === value) {
|
|
25575
|
+
return;
|
|
25576
|
+
}
|
|
25562
25577
|
this._defaultCursorShape = value;
|
|
25578
|
+
(_this_root = this.root) == null ? void 0 : _this_root.updateMouseCursorState();
|
|
25563
25579
|
}
|
|
25564
25580
|
},
|
|
25565
25581
|
{
|
|
@@ -25743,9 +25759,6 @@ function getButtonMask(button) {
|
|
|
25743
25759
|
function isWheelButton(button) {
|
|
25744
25760
|
return button >= exports.MouseButton.WheelUp && button <= exports.MouseButton.WheelRight;
|
|
25745
25761
|
}
|
|
25746
|
-
function getWheelDelta(event) {
|
|
25747
|
-
return event.buttonIndex === exports.MouseButton.WheelUp || event.buttonIndex === exports.MouseButton.WheelLeft ? event.factor : -event.factor;
|
|
25748
|
-
}
|
|
25749
25762
|
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25750
25763
|
_inherits(CanvasRootControl, ContainerControl);
|
|
25751
25764
|
function CanvasRootControl(engine, canvas) {
|
|
@@ -25804,7 +25817,7 @@ function getWheelDelta(event) {
|
|
|
25804
25817
|
var _this;
|
|
25805
25818
|
_this = RootControl.call(this, engine) || this;
|
|
25806
25819
|
_this.dragThreshold = 10;
|
|
25807
|
-
_this.
|
|
25820
|
+
_this.lastInput = null;
|
|
25808
25821
|
_this.gui = {
|
|
25809
25822
|
mouseFocus: null,
|
|
25810
25823
|
mouseClickGrabber: null,
|
|
@@ -25831,13 +25844,16 @@ function getWheelDelta(event) {
|
|
|
25831
25844
|
}
|
|
25832
25845
|
var _proto = WindowRootControl.prototype;
|
|
25833
25846
|
_proto.pushInput = function pushInput(event) {
|
|
25834
|
-
|
|
25847
|
+
event.clearAccepted();
|
|
25848
|
+
this.lastInput = event;
|
|
25835
25849
|
this.cleanupInternalState();
|
|
25836
25850
|
this.processGUIInput(event);
|
|
25837
25851
|
this.postGrabClickFocus();
|
|
25838
25852
|
};
|
|
25839
25853
|
_proto.isInputHandled = function isInputHandled() {
|
|
25840
|
-
|
|
25854
|
+
var _this_lastInput;
|
|
25855
|
+
var _this_lastInput_isAccepted;
|
|
25856
|
+
return (_this_lastInput_isAccepted = (_this_lastInput = this.lastInput) == null ? void 0 : _this_lastInput.isAccepted()) != null ? _this_lastInput_isAccepted : false;
|
|
25841
25857
|
};
|
|
25842
25858
|
_proto.getMousePosition = function getMousePosition() {
|
|
25843
25859
|
return this.gui.lastMousePosition.clone();
|
|
@@ -25860,11 +25876,6 @@ function getWheelDelta(event) {
|
|
|
25860
25876
|
_proto.guiCancelDrag = function guiCancelDrag() {
|
|
25861
25877
|
this.endDragging(false);
|
|
25862
25878
|
};
|
|
25863
|
-
_proto.acceptControlEvent = function acceptControlEvent(control) {
|
|
25864
|
-
if (this.isControlUsable(control)) {
|
|
25865
|
-
this.inputHandled = true;
|
|
25866
|
-
}
|
|
25867
|
-
};
|
|
25868
25879
|
_proto.grabControlFocus = function grabControlFocus(control) {
|
|
25869
25880
|
if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
|
|
25870
25881
|
return;
|
|
@@ -25898,6 +25909,12 @@ function getWheelDelta(event) {
|
|
|
25898
25909
|
_proto.warpControlMouse = function warpControlMouse(position) {
|
|
25899
25910
|
this.gui.lastMousePosition.copyFrom(position);
|
|
25900
25911
|
this.updateMouseOver(position);
|
|
25912
|
+
this.updateMouseCursorState();
|
|
25913
|
+
};
|
|
25914
|
+
_proto.updateMouseCursorState = function updateMouseCursorState() {
|
|
25915
|
+
var position = this.gui.lastMousePosition;
|
|
25916
|
+
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.isControlUsable(this.gui.mouseOver) ? this.gui.mouseOver : null;
|
|
25917
|
+
this.updateCursor(target, position);
|
|
25901
25918
|
};
|
|
25902
25919
|
_proto.controlStateChanged = function controlStateChanged(control) {
|
|
25903
25920
|
if (!this.isControlUsable(control)) {
|
|
@@ -26050,11 +26067,15 @@ function getWheelDelta(event) {
|
|
|
26050
26067
|
while(current && current !== this && this.isControlUsable(current)){
|
|
26051
26068
|
var filter = current.getEffectiveMouseFilter();
|
|
26052
26069
|
if (filter !== exports.MouseFilter.Ignore) {
|
|
26053
|
-
|
|
26070
|
+
var localEvent = event.xformedBy(this.getGlobalInverse(current));
|
|
26071
|
+
this.callControlInput(current, localEvent);
|
|
26072
|
+
if (localEvent.isAccepted()) {
|
|
26073
|
+
event.accept();
|
|
26074
|
+
}
|
|
26054
26075
|
}
|
|
26055
26076
|
var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
|
|
26056
|
-
if (
|
|
26057
|
-
|
|
26077
|
+
if (event.isAccepted() || filter === exports.MouseFilter.Stop && pointerEvent && !forcePassWheel) {
|
|
26078
|
+
event.accept();
|
|
26058
26079
|
return;
|
|
26059
26080
|
}
|
|
26060
26081
|
current = current.parent;
|
|
@@ -26063,22 +26084,22 @@ function getWheelDelta(event) {
|
|
|
26063
26084
|
_proto.callControlInput = function callControlInput(control, event) {
|
|
26064
26085
|
if (_instanceof1(event, InputEventMouseButton)) {
|
|
26065
26086
|
if (isWheelButton(event.buttonIndex)) {
|
|
26066
|
-
control.onMouseWheel(event
|
|
26087
|
+
control.onMouseWheel(event);
|
|
26067
26088
|
} else if (event.isPressed()) {
|
|
26068
|
-
control.onMouseDown(event
|
|
26089
|
+
control.onMouseDown(event);
|
|
26069
26090
|
} else {
|
|
26070
|
-
control.onMouseUp(event
|
|
26091
|
+
control.onMouseUp(event);
|
|
26071
26092
|
}
|
|
26072
26093
|
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
26073
|
-
control.onMouseMove(event
|
|
26094
|
+
control.onMouseMove(event);
|
|
26074
26095
|
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
26075
26096
|
if (event.isPressed()) {
|
|
26076
|
-
control.onTouchDown(event
|
|
26097
|
+
control.onTouchDown(event);
|
|
26077
26098
|
} else {
|
|
26078
|
-
control.onTouchUp(event
|
|
26099
|
+
control.onTouchUp(event);
|
|
26079
26100
|
}
|
|
26080
26101
|
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
26081
|
-
control.onTouchMove(event
|
|
26102
|
+
control.onTouchMove(event);
|
|
26082
26103
|
} else if (_instanceof1(event, InputEventKey)) {
|
|
26083
26104
|
if (event.isPressed()) {
|
|
26084
26105
|
control.onKeyDown(event);
|
|
@@ -26229,11 +26250,11 @@ function getWheelDelta(event) {
|
|
|
26229
26250
|
};
|
|
26230
26251
|
_proto.updateCursor = function updateCursor(target, position) {
|
|
26231
26252
|
var current = target;
|
|
26232
|
-
var
|
|
26253
|
+
var cursor = exports.CursorShape.Arrow;
|
|
26233
26254
|
while(current && current !== this){
|
|
26234
26255
|
var candidate = current.getCursorShape(this.toLocal(current, position));
|
|
26235
26256
|
if (candidate !== exports.CursorShape.Arrow) {
|
|
26236
|
-
|
|
26257
|
+
cursor = candidate;
|
|
26237
26258
|
break;
|
|
26238
26259
|
}
|
|
26239
26260
|
if (current.getEffectiveMouseFilter() === exports.MouseFilter.Stop) {
|
|
@@ -26241,7 +26262,7 @@ function getWheelDelta(event) {
|
|
|
26241
26262
|
}
|
|
26242
26263
|
current = current.parent;
|
|
26243
26264
|
}
|
|
26244
|
-
this.engine.canvas.style.cursor = cursorNames[
|
|
26265
|
+
this.engine.canvas.style.cursor = typeof cursor === "string" ? cursor : cursorNames[cursor];
|
|
26245
26266
|
};
|
|
26246
26267
|
_proto.postGrabClickFocus = function postGrabClickFocus() {
|
|
26247
26268
|
var target = this.gui.mouseClickGrabber;
|
|
@@ -26893,8 +26914,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26893
26914
|
if (!this.enabled || !this.target) {
|
|
26894
26915
|
return;
|
|
26895
26916
|
}
|
|
26896
|
-
this.focusTarget();
|
|
26897
26917
|
var position = this.getCanvasPosition(event.clientX, event.clientY);
|
|
26918
|
+
this.focusTarget();
|
|
26898
26919
|
var state = this.createPointerState(position);
|
|
26899
26920
|
this.mouseState = state;
|
|
26900
26921
|
state.pressed = true;
|
|
@@ -27186,12 +27207,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27186
27207
|
var _target_width, _target_height;
|
|
27187
27208
|
return {
|
|
27188
27209
|
x: position.x / cssWidth * 2 - 1,
|
|
27189
|
-
|
|
27210
|
+
// Legacy composition picking uses bottom-left, Y-up NDC even though GUI
|
|
27211
|
+
// input follows the DOM convention of top-left, Y-down pixels.
|
|
27212
|
+
y: 1 - position.y / cssHeight * 2,
|
|
27190
27213
|
vx: velocity.x / cssWidth * 2,
|
|
27191
|
-
vy: velocity.y / cssHeight * 2,
|
|
27214
|
+
vy: -velocity.y / cssHeight * 2,
|
|
27192
27215
|
ts: performance.now(),
|
|
27193
27216
|
dx: (position.x - state.start.x) / cssWidth * 2,
|
|
27194
|
-
dy: (position.y - state.start.y) / cssHeight * 2,
|
|
27217
|
+
dy: -(position.y - state.start.y) / cssHeight * 2,
|
|
27195
27218
|
width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
|
|
27196
27219
|
height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
|
|
27197
27220
|
origin: origin
|
|
@@ -27203,7 +27226,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27203
27226
|
if (!rect) {
|
|
27204
27227
|
return new Vector2();
|
|
27205
27228
|
}
|
|
27206
|
-
return new Vector2(clientX - rect.left,
|
|
27229
|
+
return new Vector2(clientX - rect.left, clientY - rect.top);
|
|
27207
27230
|
};
|
|
27208
27231
|
_proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
|
|
27209
27232
|
if (handled && !this.allowPropagation) {
|
|
@@ -27219,9 +27242,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27219
27242
|
}
|
|
27220
27243
|
};
|
|
27221
27244
|
_proto.focusTarget = function focusTarget() {
|
|
27222
|
-
|
|
27223
|
-
|
|
27224
|
-
}
|
|
27245
|
+
var _this_target;
|
|
27246
|
+
(_this_target = this.target) == null ? void 0 : _this_target.focus();
|
|
27225
27247
|
};
|
|
27226
27248
|
_proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
|
|
27227
27249
|
target.addEventListener(name, handler, options);
|
|
@@ -39358,7 +39380,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
39358
39380
|
return ret;
|
|
39359
39381
|
}
|
|
39360
39382
|
|
|
39361
|
-
var version$2 = "2.10.0-alpha.
|
|
39383
|
+
var version$2 = "2.10.0-alpha.4";
|
|
39362
39384
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
39363
39385
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
39364
39386
|
var reverseParticle = false;
|
|
@@ -44588,7 +44610,7 @@ registerPlugin("text", TextLoader);
|
|
|
44588
44610
|
registerPlugin("sprite", SpriteLoader);
|
|
44589
44611
|
registerPlugin("particle", ParticleLoader);
|
|
44590
44612
|
registerPlugin("interact", InteractLoader);
|
|
44591
|
-
var version$1 = "2.10.0-alpha.
|
|
44613
|
+
var version$1 = "2.10.0-alpha.4";
|
|
44592
44614
|
logger.info("Core version: " + version$1 + ".");
|
|
44593
44615
|
|
|
44594
44616
|
var _obj;
|
|
@@ -46081,7 +46103,7 @@ applyMixins(exports.ThreeTextComponent, [
|
|
|
46081
46103
|
*/ Mesh.create = function(engine, props) {
|
|
46082
46104
|
return new ThreeMesh(engine, props);
|
|
46083
46105
|
};
|
|
46084
|
-
var version = "2.10.0-alpha.
|
|
46106
|
+
var version = "2.10.0-alpha.4";
|
|
46085
46107
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
46086
46108
|
|
|
46087
46109
|
exports.ATLAS_SIZE = ATLAS_SIZE;
|