@galacean/effects-threejs 2.10.0-alpha.2 → 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 +2816 -1085
- 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 +2802 -1082
- package/dist/index.mjs.map +1 -1
- package/dist/three-composition.d.ts +1 -1
- package/dist/three-renderer.d.ts +2 -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';
|
|
@@ -7083,6 +7083,11 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
7083
7083
|
// OVERRIDE
|
|
7084
7084
|
};
|
|
7085
7085
|
/**
|
|
7086
|
+
* Called when the owning item's sibling order changes.
|
|
7087
|
+
*/ _proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
7088
|
+
// OVERRIDE
|
|
7089
|
+
};
|
|
7090
|
+
/**
|
|
7086
7091
|
* @internal
|
|
7087
7092
|
*/ _proto.enable = function enable() {
|
|
7088
7093
|
if (this.item.composition) {
|
|
@@ -14040,6 +14045,7 @@ var seed$7 = 1;
|
|
|
14040
14045
|
quat: new Quaternion(0, 0, 0, 1),
|
|
14041
14046
|
scale: new Vector3(1, 1, 1)
|
|
14042
14047
|
};
|
|
14048
|
+
this.eventEmitter = new EventEmitter();
|
|
14043
14049
|
this.name = "transform_" + seed$7++;
|
|
14044
14050
|
if (props) {
|
|
14045
14051
|
this.setTransform(props);
|
|
@@ -14052,6 +14058,12 @@ var seed$7 = 1;
|
|
|
14052
14058
|
}
|
|
14053
14059
|
}
|
|
14054
14060
|
var _proto = Transform.prototype;
|
|
14061
|
+
_proto.on = function on(eventName, listener, options) {
|
|
14062
|
+
this.eventEmitter.on(eventName, listener, options);
|
|
14063
|
+
};
|
|
14064
|
+
_proto.off = function off(eventName, listener) {
|
|
14065
|
+
this.eventEmitter.off(eventName, listener);
|
|
14066
|
+
};
|
|
14055
14067
|
/**
|
|
14056
14068
|
* 父 transform 切换时的 hook。子类可重写以接管订阅 / 解算等逻辑
|
|
14057
14069
|
* @param oldParent - 切换前的父 transform(若没有则为 null)
|
|
@@ -14470,6 +14482,7 @@ var seed$7 = 1;
|
|
|
14470
14482
|
this.children.forEach(function(c) {
|
|
14471
14483
|
c.worldMatrixDirty = true;
|
|
14472
14484
|
});
|
|
14485
|
+
this.eventEmitter.emit("changed", this);
|
|
14473
14486
|
};
|
|
14474
14487
|
/**
|
|
14475
14488
|
* 转换右手坐标系左手螺旋对应的四元数到对应的旋转角
|
|
@@ -14488,14 +14501,16 @@ var seed$7 = 1;
|
|
|
14488
14501
|
return this.parent;
|
|
14489
14502
|
},
|
|
14490
14503
|
set: function set(transform) {
|
|
14491
|
-
if (
|
|
14504
|
+
if (this.parent === transform || this === transform) {
|
|
14492
14505
|
return;
|
|
14493
14506
|
}
|
|
14494
14507
|
var oldParent = this.parent;
|
|
14495
14508
|
if (this.parent) {
|
|
14496
14509
|
this.parent.removeChild(this);
|
|
14497
14510
|
}
|
|
14498
|
-
transform
|
|
14511
|
+
if (transform) {
|
|
14512
|
+
transform.addChild(this);
|
|
14513
|
+
}
|
|
14499
14514
|
this.parent = transform;
|
|
14500
14515
|
this.worldMatrixDirty = true;
|
|
14501
14516
|
this.onParentTransformChanged(oldParent, transform);
|
|
@@ -14678,7 +14693,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
14678
14693
|
return results;
|
|
14679
14694
|
};
|
|
14680
14695
|
_proto.setParent = function setParent(vfxItem) {
|
|
14681
|
-
if (vfxItem === this
|
|
14696
|
+
if (vfxItem === this || this.parent === vfxItem) {
|
|
14682
14697
|
return;
|
|
14683
14698
|
}
|
|
14684
14699
|
if (this.parent) {
|
|
@@ -15065,6 +15080,12 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15065
15080
|
child.onParentChanged();
|
|
15066
15081
|
}
|
|
15067
15082
|
};
|
|
15083
|
+
_proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
15084
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
15085
|
+
var component = _step.value;
|
|
15086
|
+
component.onOrderInParentChanged();
|
|
15087
|
+
}
|
|
15088
|
+
};
|
|
15068
15089
|
/**
|
|
15069
15090
|
* @internal
|
|
15070
15091
|
*/ _proto.setRendererComponentOrder = function setRendererComponentOrder(renderOrder) {
|
|
@@ -15149,15 +15170,16 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15149
15170
|
*/ _proto.dispose = function dispose() {
|
|
15150
15171
|
if (this.composition) {
|
|
15151
15172
|
this.composition.destroyItem(this);
|
|
15152
|
-
// component 调用 dispose() 会将自身从 this.components 数组删除,slice() 避免迭代错误
|
|
15153
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.components.slice()), _step; !(_step = _iterator()).done;){
|
|
15154
|
-
var component = _step.value;
|
|
15155
|
-
component.dispose();
|
|
15156
|
-
}
|
|
15157
|
-
this.components = [];
|
|
15158
|
-
this._composition = null;
|
|
15159
|
-
this.transform.setValid(false);
|
|
15160
15173
|
}
|
|
15174
|
+
// component.dispose() removes itself from this.components. Use a snapshot
|
|
15175
|
+
// so Engine.root components are also disposed even without a Composition.
|
|
15176
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components.slice()), _step; !(_step = _iterator()).done;){
|
|
15177
|
+
var component = _step.value;
|
|
15178
|
+
component.dispose();
|
|
15179
|
+
}
|
|
15180
|
+
this.components = [];
|
|
15181
|
+
this._composition = null;
|
|
15182
|
+
this.transform.setValid(false);
|
|
15161
15183
|
this.resetChildrenParent();
|
|
15162
15184
|
EffectsObject.prototype.dispose.call(this);
|
|
15163
15185
|
};
|
|
@@ -15353,6 +15375,33 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15353
15375
|
this.setRendererComponentOrder(value);
|
|
15354
15376
|
}
|
|
15355
15377
|
},
|
|
15378
|
+
{
|
|
15379
|
+
key: "orderInParent",
|
|
15380
|
+
get: /** Zero-based sibling order within the parent item. */ function get() {
|
|
15381
|
+
var _this_parent;
|
|
15382
|
+
var _this_parent_children_indexOf;
|
|
15383
|
+
return (_this_parent_children_indexOf = (_this_parent = this.parent) == null ? void 0 : _this_parent.children.indexOf(this)) != null ? _this_parent_children_indexOf : -1;
|
|
15384
|
+
},
|
|
15385
|
+
set: function set(value) {
|
|
15386
|
+
var _this_parent;
|
|
15387
|
+
var siblings = (_this_parent = this.parent) == null ? void 0 : _this_parent.children;
|
|
15388
|
+
var _siblings_indexOf;
|
|
15389
|
+
var oldIndex = (_siblings_indexOf = siblings == null ? void 0 : siblings.indexOf(this)) != null ? _siblings_indexOf : -1;
|
|
15390
|
+
if (!siblings || oldIndex === -1) {
|
|
15391
|
+
return;
|
|
15392
|
+
}
|
|
15393
|
+
var newIndex = Math.max(0, Math.min(Math.trunc(value), siblings.length - 1));
|
|
15394
|
+
if (oldIndex === newIndex) {
|
|
15395
|
+
return;
|
|
15396
|
+
}
|
|
15397
|
+
siblings.splice(oldIndex, 1);
|
|
15398
|
+
siblings.splice(newIndex, 0, this);
|
|
15399
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(siblings), _step; !(_step = _iterator()).done;){
|
|
15400
|
+
var sibling = _step.value;
|
|
15401
|
+
sibling.onOrderInParentChanged();
|
|
15402
|
+
}
|
|
15403
|
+
}
|
|
15404
|
+
},
|
|
15356
15405
|
{
|
|
15357
15406
|
key: "isActive",
|
|
15358
15407
|
get: /**
|
|
@@ -15609,35 +15658,35 @@ function vecMulCombine(out, a, b) {
|
|
|
15609
15658
|
}
|
|
15610
15659
|
return out;
|
|
15611
15660
|
}
|
|
15612
|
-
var _obj$
|
|
15613
|
-
var particleOriginTranslateMap$1 = (_obj$
|
|
15661
|
+
var _obj$7;
|
|
15662
|
+
var particleOriginTranslateMap$1 = (_obj$7 = {}, _obj$7[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
15614
15663
|
0,
|
|
15615
15664
|
0
|
|
15616
|
-
], _obj$
|
|
15665
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
15617
15666
|
0,
|
|
15618
15667
|
-0.5
|
|
15619
|
-
], _obj$
|
|
15668
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
15620
15669
|
0,
|
|
15621
15670
|
0.5
|
|
15622
|
-
], _obj$
|
|
15671
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
15623
15672
|
-0.5,
|
|
15624
15673
|
0.5
|
|
15625
|
-
], _obj$
|
|
15674
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
15626
15675
|
-0.5,
|
|
15627
15676
|
0
|
|
15628
|
-
], _obj$
|
|
15677
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
15629
15678
|
-0.5,
|
|
15630
15679
|
-0.5
|
|
15631
|
-
], _obj$
|
|
15680
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
15632
15681
|
0.5,
|
|
15633
15682
|
0
|
|
15634
|
-
], _obj$
|
|
15683
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
15635
15684
|
0.5,
|
|
15636
15685
|
-0.5
|
|
15637
|
-
], _obj$
|
|
15686
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
15638
15687
|
0.5,
|
|
15639
15688
|
0.5
|
|
15640
|
-
], _obj$
|
|
15689
|
+
], _obj$7);
|
|
15641
15690
|
function nearestPowerOfTwo(value) {
|
|
15642
15691
|
return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
|
|
15643
15692
|
}
|
|
@@ -17375,27 +17424,27 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
17375
17424
|
* 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
|
|
17376
17425
|
* props 为 [[time, value], ...],value 为已解析的对象引用实例。
|
|
17377
17426
|
*/ var REFERENCE_CURVE = 28;
|
|
17378
|
-
var _obj$
|
|
17379
|
-
var map$1 = (_obj$
|
|
17427
|
+
var _obj$6;
|
|
17428
|
+
var map$1 = (_obj$6 = {}, _obj$6[ValueType.RANDOM] = function(props) {
|
|
17380
17429
|
if (_instanceof1(props[0], Array)) {
|
|
17381
17430
|
return new RandomVectorValue(props);
|
|
17382
17431
|
}
|
|
17383
17432
|
return new RandomValue(props);
|
|
17384
|
-
}, _obj$
|
|
17433
|
+
}, _obj$6[ValueType.CONSTANT] = function(props) {
|
|
17385
17434
|
return new StaticValue(props);
|
|
17386
|
-
}, _obj$
|
|
17435
|
+
}, _obj$6[ValueType.CONSTANT_VEC2] = function(props) {
|
|
17387
17436
|
return new StaticValue(props);
|
|
17388
|
-
}, _obj$
|
|
17437
|
+
}, _obj$6[ValueType.CONSTANT_VEC3] = function(props) {
|
|
17389
17438
|
return new StaticValue(props);
|
|
17390
|
-
}, _obj$
|
|
17439
|
+
}, _obj$6[ValueType.CONSTANT_VEC4] = function(props) {
|
|
17391
17440
|
return new StaticValue(props);
|
|
17392
|
-
}, _obj$
|
|
17441
|
+
}, _obj$6[ValueType.RGBA_COLOR] = function(props) {
|
|
17393
17442
|
return new StaticValue(props);
|
|
17394
|
-
}, _obj$
|
|
17443
|
+
}, _obj$6[ValueType.COLORS] = function(props) {
|
|
17395
17444
|
return new RandomSetValue(props.map(function(c) {
|
|
17396
17445
|
return colorToArr$1(c, false);
|
|
17397
17446
|
}));
|
|
17398
|
-
}, _obj$
|
|
17447
|
+
}, _obj$6[ValueType.LINE] = function(props) {
|
|
17399
17448
|
if (props.length === 2 && props[0][0] === 0 && props[1][0] === 1) {
|
|
17400
17449
|
return new LinearValue([
|
|
17401
17450
|
props[0][1],
|
|
@@ -17403,38 +17452,38 @@ var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
|
|
|
17403
17452
|
]);
|
|
17404
17453
|
}
|
|
17405
17454
|
return new LineSegments(props);
|
|
17406
|
-
}, _obj$
|
|
17455
|
+
}, _obj$6[ValueType.GRADIENT_COLOR] = function(props) {
|
|
17407
17456
|
return new GradientValue(props);
|
|
17408
|
-
}, _obj$
|
|
17457
|
+
}, _obj$6[ValueType.LINEAR_PATH] = function(pros) {
|
|
17409
17458
|
return new PathSegments(pros);
|
|
17410
|
-
}, _obj$
|
|
17459
|
+
}, _obj$6[ValueType.BEZIER_CURVE] = function(props) {
|
|
17411
17460
|
if (props.length === 1) {
|
|
17412
17461
|
return new StaticValue(props[0][1][1]);
|
|
17413
17462
|
}
|
|
17414
17463
|
return new BezierCurve(props);
|
|
17415
|
-
}, _obj$
|
|
17464
|
+
}, _obj$6[ValueType.BEZIER_CURVE_PATH] = function(props) {
|
|
17416
17465
|
if (props[0].length === 1) {
|
|
17417
17466
|
return new StaticValue(_construct(Vector3, [].concat(props[1][0])));
|
|
17418
17467
|
}
|
|
17419
17468
|
return new BezierCurvePath(props);
|
|
17420
|
-
}, _obj$
|
|
17469
|
+
}, _obj$6[ValueType.BEZIER_CURVE_QUAT] = function(props) {
|
|
17421
17470
|
if (props[0].length === 1) {
|
|
17422
17471
|
return new StaticValue(_construct(Quaternion, [].concat(props[1][0])));
|
|
17423
17472
|
}
|
|
17424
17473
|
return new BezierCurveQuat(props);
|
|
17425
|
-
}, _obj$
|
|
17474
|
+
}, _obj$6[ValueType.COLOR_CURVE] = function(props) {
|
|
17426
17475
|
return new ColorCurve(props);
|
|
17427
|
-
}, _obj$
|
|
17476
|
+
}, _obj$6[ValueType.VECTOR4_CURVE] = function(props) {
|
|
17428
17477
|
return new Vector4Curve(props);
|
|
17429
|
-
}, _obj$
|
|
17478
|
+
}, _obj$6[ValueType.VECTOR2_CURVE] = function(props) {
|
|
17430
17479
|
return new Vector2Curve(props);
|
|
17431
17480
|
}, // TODO: add spec
|
|
17432
|
-
_obj$
|
|
17481
|
+
_obj$6[VECTOR3_CURVE] = function(props) {
|
|
17433
17482
|
return new Vector3Curve(props);
|
|
17434
17483
|
}, // 对象引用阶梯曲线(不插值):props.data 为 [time, value][],value 已解析为 EffectsObject
|
|
17435
|
-
_obj$
|
|
17484
|
+
_obj$6[REFERENCE_CURVE] = function(props) {
|
|
17436
17485
|
return new ReferenceCurve(props);
|
|
17437
|
-
}, _obj$
|
|
17486
|
+
}, _obj$6);
|
|
17438
17487
|
function createValueGetter(args) {
|
|
17439
17488
|
if (!args || !isNaN(+args)) {
|
|
17440
17489
|
return new StaticValue(args || 0);
|
|
@@ -20951,20 +21000,24 @@ var geometryId = 1;
|
|
|
20951
21000
|
var vertexArrayObjects = this.vertexArrayObjects;
|
|
20952
21001
|
var engine = this.engine;
|
|
20953
21002
|
if (!vertexArrayObjects || !supportsVertexArrayObjects(engine)) {
|
|
20954
|
-
|
|
21003
|
+
var _this_indexBuffer;
|
|
21004
|
+
engine.bindBuffers(this.vertexBuffers, (_this_indexBuffer = this.indexBuffer) != null ? _this_indexBuffer : null, shader);
|
|
20955
21005
|
return;
|
|
20956
21006
|
}
|
|
20957
21007
|
var vertexArrayObject = vertexArrayObjects[shader.key];
|
|
20958
21008
|
if (!vertexArrayObject) {
|
|
20959
|
-
|
|
21009
|
+
var _this_indexBuffer1;
|
|
21010
|
+
vertexArrayObject = engine.recordVertexArrayObject(this.vertexBuffers, (_this_indexBuffer1 = this.indexBuffer) != null ? _this_indexBuffer1 : null, shader);
|
|
20960
21011
|
if (vertexArrayObject) {
|
|
20961
21012
|
vertexArrayObjects[shader.key] = vertexArrayObject;
|
|
20962
21013
|
}
|
|
20963
21014
|
}
|
|
20964
21015
|
if (vertexArrayObject) {
|
|
20965
|
-
|
|
21016
|
+
var _this_indexBuffer2;
|
|
21017
|
+
engine.bindVertexArrayObject(vertexArrayObject, (_this_indexBuffer2 = this.indexBuffer) != null ? _this_indexBuffer2 : null);
|
|
20966
21018
|
} else {
|
|
20967
|
-
|
|
21019
|
+
var _this_indexBuffer3;
|
|
21020
|
+
engine.bindBuffers(this.vertexBuffers, (_this_indexBuffer3 = this.indexBuffer) != null ? _this_indexBuffer3 : null, shader);
|
|
20968
21021
|
}
|
|
20969
21022
|
};
|
|
20970
21023
|
_proto.releaseVertexArrayObject = function releaseVertexArrayObject(key) {
|
|
@@ -21371,8 +21424,8 @@ var vertexBufferSemanticMap = {
|
|
|
21371
21424
|
TANGENT_BS2: "aTargetTangent2",
|
|
21372
21425
|
TANGENT_BS3: "aTargetTangent3"
|
|
21373
21426
|
};
|
|
21374
|
-
var _obj$
|
|
21375
|
-
var BYTES_TYPE_MAP = (_obj$
|
|
21427
|
+
var _obj$5;
|
|
21428
|
+
var BYTES_TYPE_MAP = (_obj$5 = {}, _obj$5[exports.BufferDataType.Float] = 4, _obj$5[exports.BufferDataType.Int] = 4, _obj$5[exports.BufferDataType.UnsignedInt] = 4, _obj$5[exports.BufferDataType.Short] = 2, _obj$5[exports.BufferDataType.UnsignedShort] = 2, _obj$5[exports.BufferDataType.Byte] = 1, _obj$5[exports.BufferDataType.UnsignedByte] = 1, _obj$5);
|
|
21376
21429
|
function generateEmptyTypedArray(type) {
|
|
21377
21430
|
return createTypedArray(type, 0);
|
|
21378
21431
|
}
|
|
@@ -22382,7 +22435,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
22382
22435
|
}
|
|
22383
22436
|
};
|
|
22384
22437
|
_proto.setViewport = function setViewport(x, y, width, height) {
|
|
22385
|
-
this.engine.
|
|
22438
|
+
this.engine.setViewport(x, y, width, height);
|
|
22386
22439
|
};
|
|
22387
22440
|
_proto.clear = function clear(action) {
|
|
22388
22441
|
this.engine.clear(action);
|
|
@@ -22445,7 +22498,40 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
22445
22498
|
};
|
|
22446
22499
|
_proto.drawGeometry = function drawGeometry(geometry, matrix, material, subMeshIndex) {
|
|
22447
22500
|
if (subMeshIndex === void 0) subMeshIndex = 0;
|
|
22448
|
-
|
|
22501
|
+
if (!geometry || !material) {
|
|
22502
|
+
return;
|
|
22503
|
+
}
|
|
22504
|
+
material.initialize();
|
|
22505
|
+
geometry.initialize();
|
|
22506
|
+
geometry.flush();
|
|
22507
|
+
material.setMatrix("effects_ObjectToWorld", matrix);
|
|
22508
|
+
try {
|
|
22509
|
+
material.use(this, this.renderingData.currentFrame.globalUniforms);
|
|
22510
|
+
} catch (e) {
|
|
22511
|
+
console.error(e);
|
|
22512
|
+
this.engine.renderErrors.add(e);
|
|
22513
|
+
return;
|
|
22514
|
+
}
|
|
22515
|
+
var indexBuffer = geometry.getIndexBuffer();
|
|
22516
|
+
var offset = geometry.getDrawStart();
|
|
22517
|
+
var count = geometry.getDrawCount();
|
|
22518
|
+
var subMeshes = geometry.subMeshes;
|
|
22519
|
+
if (subMeshes.length > 0) {
|
|
22520
|
+
var subMesh = subMeshes[subMeshIndex];
|
|
22521
|
+
offset = subMesh.offset;
|
|
22522
|
+
var _subMesh_indexCount;
|
|
22523
|
+
count = indexBuffer ? (_subMesh_indexCount = subMesh.indexCount) != null ? _subMesh_indexCount : 0 : subMesh.vertexCount;
|
|
22524
|
+
}
|
|
22525
|
+
if (count <= 0) {
|
|
22526
|
+
return;
|
|
22527
|
+
}
|
|
22528
|
+
geometry.bind(material.shaderVariant);
|
|
22529
|
+
var instanceCount = geometry.instanceCount || undefined;
|
|
22530
|
+
if (indexBuffer) {
|
|
22531
|
+
this.engine.drawElementsType(geometry.mode, offset, count, instanceCount);
|
|
22532
|
+
} else {
|
|
22533
|
+
this.engine.drawArraysType(geometry.mode, offset, count, instanceCount);
|
|
22534
|
+
}
|
|
22449
22535
|
};
|
|
22450
22536
|
_proto.getTemporaryRT = function getTemporaryRT(name, width, height, depthBuffer, filter, format) {
|
|
22451
22537
|
return this.engine.renderTargetPool.get(name, width, height, depthBuffer, filter, format);
|
|
@@ -22713,11 +22799,7 @@ var CanvasPool = /*#__PURE__*/ function() {
|
|
|
22713
22799
|
var canvasPool = new CanvasPool();
|
|
22714
22800
|
|
|
22715
22801
|
/**
|
|
22716
|
-
*
|
|
22717
|
-
* 但 quad 仍按 1x 逻辑尺寸绘制 — 双线性 downsample 后比原 1x 渲染清晰得多
|
|
22718
|
-
*/ var FONT_SCALE = 2;
|
|
22719
|
-
/**
|
|
22720
|
-
* 单张字符 atlas 的边长(像素,scale 后的实际像素,非逻辑尺寸)。
|
|
22802
|
+
* 单张字符 atlas 的逻辑边长。实际 canvas 像素尺寸会乘以渲染 resolution。
|
|
22721
22803
|
* 512×512 在 24px 字号下约可容纳 250+ 字形,常见 demo 文本足够
|
|
22722
22804
|
*/ var ATLAS_SIZE = 512;
|
|
22723
22805
|
/**
|
|
@@ -22739,7 +22821,7 @@ var canvasPool = new CanvasPool();
|
|
|
22739
22821
|
* canvas 内容变更后需要 `uploadIfDirty` 重新上传到纹理 — 由调用方在使用纹理前主动触发,
|
|
22740
22822
|
* 避免每加一字都 upload 一次造成的 GL 开销
|
|
22741
22823
|
*/ var GlyphAtlas = /*#__PURE__*/ function() {
|
|
22742
|
-
function GlyphAtlas(engine, scaledFontString, /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */ ascentPx, /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */ descentPx, fontStyle) {
|
|
22824
|
+
function GlyphAtlas(engine, scaledFontString, /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */ ascentPx, /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */ descentPx, fontStyle, resolution) {
|
|
22743
22825
|
this.engine = engine;
|
|
22744
22826
|
this.scaledFontString = scaledFontString;
|
|
22745
22827
|
this.glyphs = new Map();
|
|
@@ -22747,9 +22829,10 @@ var canvasPool = new CanvasPool();
|
|
|
22747
22829
|
this.currentY = 0;
|
|
22748
22830
|
this.full = false;
|
|
22749
22831
|
this.dirty = true;
|
|
22832
|
+
this.resolution = resolution;
|
|
22750
22833
|
this.canvas = document.createElement("canvas");
|
|
22751
|
-
this.canvas.width = ATLAS_SIZE;
|
|
22752
|
-
this.canvas.height = ATLAS_SIZE;
|
|
22834
|
+
this.canvas.width = Math.ceil(ATLAS_SIZE * resolution);
|
|
22835
|
+
this.canvas.height = Math.ceil(ATLAS_SIZE * resolution);
|
|
22753
22836
|
var ctx = this.canvas.getContext("2d", {
|
|
22754
22837
|
willReadFrequently: false
|
|
22755
22838
|
});
|
|
@@ -22760,14 +22843,14 @@ var canvasPool = new CanvasPool();
|
|
|
22760
22843
|
ctx.font = scaledFontString;
|
|
22761
22844
|
ctx.textBaseline = "alphabetic";
|
|
22762
22845
|
ctx.fillStyle = "#ffffff";
|
|
22763
|
-
this.paddingPx = GLYPH_PADDING *
|
|
22846
|
+
this.paddingPx = GLYPH_PADDING * resolution;
|
|
22764
22847
|
this.italicScale = fontStyle === "italic" ? 2 : 1;
|
|
22765
22848
|
// ascent/descent 由探针 '|ÉqÅM' 测得 actualBoundingBox(重音字已抬高 ink 顶),
|
|
22766
22849
|
// 两者内部保持浮点,仅 cell 高做一次外层 ceil — 与 padding 共同保证 cell 内不裁切
|
|
22767
22850
|
var fontHeightPx = ascentPx + descentPx;
|
|
22768
22851
|
this.baselinePx = this.paddingPx + ascentPx;
|
|
22769
22852
|
this.cellHPx = Math.ceil(fontHeightPx + this.paddingPx * 2);
|
|
22770
|
-
this.lineHeight = this.cellHPx /
|
|
22853
|
+
this.lineHeight = this.cellHPx / resolution;
|
|
22771
22854
|
this.texture = Texture.create(engine, {
|
|
22772
22855
|
sourceType: exports.TextureSourceType.image,
|
|
22773
22856
|
image: this.canvas,
|
|
@@ -22776,7 +22859,8 @@ var canvasPool = new CanvasPool();
|
|
|
22776
22859
|
magFilter: glContext.LINEAR,
|
|
22777
22860
|
minFilter: glContext.LINEAR,
|
|
22778
22861
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
22779
|
-
wrapT: glContext.CLAMP_TO_EDGE
|
|
22862
|
+
wrapT: glContext.CLAMP_TO_EDGE,
|
|
22863
|
+
premultiplyAlpha: true
|
|
22780
22864
|
});
|
|
22781
22865
|
this.texture.initialize();
|
|
22782
22866
|
}
|
|
@@ -22794,19 +22878,19 @@ var canvasPool = new CanvasPool();
|
|
|
22794
22878
|
var ctx = this.ctx;
|
|
22795
22879
|
// 每次重设字体,防御外部潜在污染(虽然 ctx 私有)
|
|
22796
22880
|
ctx.font = this.scaledFontString;
|
|
22797
|
-
// measureText 用的是 scaledFontString,advance 已经是
|
|
22881
|
+
// measureText 用的是 scaledFontString,advance 已经是 resolution 后的像素
|
|
22798
22882
|
var advancePx = ctx.measureText(char).width;
|
|
22799
22883
|
// italic 放大 cell 宽防斜体越界;ceil 对齐像素网格避免相邻字采样重叠
|
|
22800
22884
|
var widthPx = Math.max(1, Math.ceil(advancePx * this.italicScale));
|
|
22801
22885
|
var paddedWidthPx = widthPx + this.paddingPx * 2;
|
|
22802
22886
|
var cellH = this.cellHPx;
|
|
22803
22887
|
// 行尾换行
|
|
22804
|
-
if (this.currentX + paddedWidthPx >
|
|
22888
|
+
if (this.currentX + paddedWidthPx > this.canvas.width) {
|
|
22805
22889
|
this.currentX = 0;
|
|
22806
22890
|
this.currentY += cellH;
|
|
22807
22891
|
}
|
|
22808
22892
|
// atlas 满,后续不再尝试
|
|
22809
|
-
if (this.currentY + cellH >
|
|
22893
|
+
if (this.currentY + cellH > this.canvas.height) {
|
|
22810
22894
|
this.full = true;
|
|
22811
22895
|
console.warn('GlyphAtlas full, dropping char "' + char + '"');
|
|
22812
22896
|
return null;
|
|
@@ -22822,8 +22906,8 @@ var canvasPool = new CanvasPool();
|
|
|
22822
22906
|
py: py,
|
|
22823
22907
|
pw: paddedWidthPx,
|
|
22824
22908
|
ph: cellH,
|
|
22825
|
-
advance: advancePx /
|
|
22826
|
-
paddingLeft: this.paddingPx /
|
|
22909
|
+
advance: advancePx / this.resolution,
|
|
22910
|
+
paddingLeft: this.paddingPx / this.resolution
|
|
22827
22911
|
};
|
|
22828
22912
|
this.glyphs.set(char, info);
|
|
22829
22913
|
return info;
|
|
@@ -22842,7 +22926,8 @@ var canvasPool = new CanvasPool();
|
|
|
22842
22926
|
magFilter: glContext.LINEAR,
|
|
22843
22927
|
minFilter: glContext.LINEAR,
|
|
22844
22928
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
22845
|
-
wrapT: glContext.CLAMP_TO_EDGE
|
|
22929
|
+
wrapT: glContext.CLAMP_TO_EDGE,
|
|
22930
|
+
premultiplyAlpha: true
|
|
22846
22931
|
});
|
|
22847
22932
|
this.dirty = false;
|
|
22848
22933
|
};
|
|
@@ -22865,26 +22950,33 @@ var canvasPool = new CanvasPool();
|
|
|
22865
22950
|
function TextCache(engine) {
|
|
22866
22951
|
this.engine = engine;
|
|
22867
22952
|
this.atlases = new Map();
|
|
22953
|
+
this.resolution = engine.pixelRatio;
|
|
22868
22954
|
}
|
|
22869
22955
|
var _proto = TextCache.prototype;
|
|
22870
22956
|
/**
|
|
22871
22957
|
* 取(必要时新建)对应字体的字符 atlas
|
|
22872
22958
|
*/ _proto.getAtlas = function getAtlas(fontSize, fontFamily, fontWeight, fontStyle) {
|
|
22873
|
-
|
|
22959
|
+
// Pixi CanvasText 默认跟随 renderer.resolution;这里对应 Engine.pixelRatio。
|
|
22960
|
+
var resolution = this.engine.pixelRatio;
|
|
22961
|
+
if (resolution !== this.resolution) {
|
|
22962
|
+
this.clear();
|
|
22963
|
+
this.resolution = resolution;
|
|
22964
|
+
}
|
|
22965
|
+
var fontKey = fontStyle + "|" + fontWeight + "|" + fontSize + "|" + fontFamily + "|" + resolution;
|
|
22874
22966
|
var cached = this.atlases.get(fontKey);
|
|
22875
22967
|
if (cached) {
|
|
22876
22968
|
return cached;
|
|
22877
22969
|
}
|
|
22878
|
-
var scaledFontString = fontStyle + " " + fontWeight + " " + fontSize *
|
|
22970
|
+
var scaledFontString = fontStyle + " " + fontWeight + " " + fontSize * resolution + "px " + fontFamily;
|
|
22879
22971
|
// 探一次得到字体级 ascent/descent(整张 atlas 共享 cell 高与 baseline,各字对齐)。
|
|
22880
|
-
// 直接在 scaledFontString 下测,得到的就是
|
|
22972
|
+
// 直接在 scaledFontString 下测,得到的就是 resolution 后像素。
|
|
22881
22973
|
// 探针用 '|ÉqÅ' + 'M':带重音符的 ÉÅ 把 ink 顶推到接近字体真实 ascent,
|
|
22882
22974
|
// 单字 'M' 只有 cap height(~0.7em) 太矮,CJK / 带重音字顶部会越过 cell 上界被裁。
|
|
22883
22975
|
// 取 actualBoundingBoxAscent/Descent 度量 ink 边界,跨平台语义稳定
|
|
22884
22976
|
var probeCanvasAndContext = canvasPool.getCanvasAndContext(1, 1);
|
|
22885
22977
|
var probeCtx = probeCanvasAndContext.context;
|
|
22886
|
-
var ascentPx = fontSize * 0.8 *
|
|
22887
|
-
var descentPx = fontSize * 0.2 *
|
|
22978
|
+
var ascentPx = fontSize * 0.8 * resolution;
|
|
22979
|
+
var descentPx = fontSize * 0.2 * resolution;
|
|
22888
22980
|
try {
|
|
22889
22981
|
probeCtx.font = scaledFontString;
|
|
22890
22982
|
var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
|
|
@@ -22893,7 +22985,7 @@ var canvasPool = new CanvasPool();
|
|
|
22893
22985
|
} finally{
|
|
22894
22986
|
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22895
22987
|
}
|
|
22896
|
-
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle);
|
|
22988
|
+
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle, resolution);
|
|
22897
22989
|
this.atlases.set(fontKey, atlas);
|
|
22898
22990
|
return atlas;
|
|
22899
22991
|
};
|
|
@@ -22910,6 +23002,9 @@ var canvasPool = new CanvasPool();
|
|
|
22910
23002
|
/**
|
|
22911
23003
|
* 清空所有 atlas 并 dispose 对应纹理。Engine dispose 时调用
|
|
22912
23004
|
*/ _proto.dispose = function dispose() {
|
|
23005
|
+
this.clear();
|
|
23006
|
+
};
|
|
23007
|
+
_proto.clear = function clear() {
|
|
22913
23008
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.atlases.values()), _step; !(_step = _iterator()).done;){
|
|
22914
23009
|
var atlas = _step.value;
|
|
22915
23010
|
atlas.dispose();
|
|
@@ -23032,6 +23127,17 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23032
23127
|
this.texturedMaterial.depthTest = false;
|
|
23033
23128
|
this.texturedMaterial.depthMask = false;
|
|
23034
23129
|
this.texturedMaterial.blending = true;
|
|
23130
|
+
// 文本 atlas 按 Pixi 的方式在上传时预乘 alpha,因此采样后只需应用顶点色和顶点 alpha。
|
|
23131
|
+
// 单独使用 material,避免改变 drawTexture 对普通非预乘纹理的处理。
|
|
23132
|
+
this.textMaterial = Material.create(this.engine, {
|
|
23133
|
+
shader: {
|
|
23134
|
+
vertex: "precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n varying vec4 vColor;\n varying vec2 vUV;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",
|
|
23135
|
+
fragment: "precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n float alpha = texture2D(uMainTexture, vUV).a * vColor.a;\n gl_FragColor = vec4(vColor.rgb * alpha, alpha);\n }"
|
|
23136
|
+
}
|
|
23137
|
+
});
|
|
23138
|
+
this.textMaterial.depthTest = false;
|
|
23139
|
+
this.textMaterial.depthMask = false;
|
|
23140
|
+
this.textMaterial.blending = true;
|
|
23035
23141
|
this.textCache = new TextCache(engine);
|
|
23036
23142
|
}
|
|
23037
23143
|
var _proto = Graphics.prototype;
|
|
@@ -23046,13 +23152,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23046
23152
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23047
23153
|
this.currentBatchType = "colored";
|
|
23048
23154
|
this.currentBatchTexture = null;
|
|
23049
|
-
// 创建从屏幕坐标到 NDC
|
|
23155
|
+
// 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
|
|
23050
23156
|
var _this_engine_canvas_getBoundingClientRect = this.engine.canvas.getBoundingClientRect(), width = _this_engine_canvas_getBoundingClientRect.width, height = _this_engine_canvas_getBoundingClientRect.height;
|
|
23051
23157
|
// 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
|
|
23052
|
-
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 // 第四列
|
|
23053
23159
|
);
|
|
23054
23160
|
this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23055
23161
|
this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23162
|
+
this.textMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23056
23163
|
};
|
|
23057
23164
|
/**
|
|
23058
23165
|
* 将当前变换压入栈,并设置新的变换
|
|
@@ -23080,7 +23187,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23080
23187
|
* 切换到指定批次类型/纹理。若与当前批次不一致,先 flush 已累积顶点
|
|
23081
23188
|
*/ _proto.ensureBatch = function ensureBatch(type, texture) {
|
|
23082
23189
|
if (texture === void 0) texture = null;
|
|
23083
|
-
var sameBatch = this.currentBatchType === type && (type
|
|
23190
|
+
var sameBatch = this.currentBatchType === type && (type === "colored" || this.currentBatchTexture === texture);
|
|
23084
23191
|
if (!sameBatch && this.currentVertexCount > 0) {
|
|
23085
23192
|
this.flushBatch();
|
|
23086
23193
|
}
|
|
@@ -23106,8 +23213,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23106
23213
|
this.geometry.setIndexData(indicesArray);
|
|
23107
23214
|
this.geometry.setDrawCount(this.currentIndexCount);
|
|
23108
23215
|
var material;
|
|
23109
|
-
if (this.currentBatchType === "textured") {
|
|
23110
|
-
material = this.texturedMaterial;
|
|
23216
|
+
if (this.currentBatchType === "textured" || this.currentBatchType === "text") {
|
|
23217
|
+
material = this.currentBatchType === "text" ? this.textMaterial : this.texturedMaterial;
|
|
23111
23218
|
var _this_currentBatchTexture;
|
|
23112
23219
|
var tex = (_this_currentBatchTexture = this.currentBatchTexture) != null ? _this_currentBatchTexture : this.engine.whiteTexture;
|
|
23113
23220
|
material.setTexture("uMainTexture", tex);
|
|
@@ -23213,8 +23320,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23213
23320
|
};
|
|
23214
23321
|
/**
|
|
23215
23322
|
* 绘制矩形边框
|
|
23216
|
-
* @param x -
|
|
23217
|
-
* @param y -
|
|
23323
|
+
* @param x - 矩形左上角 X 坐标
|
|
23324
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23218
23325
|
* @param width - 矩形宽度
|
|
23219
23326
|
* @param height - 矩形高度
|
|
23220
23327
|
* @param color - 边框颜色,默认白色,范围 0-1
|
|
@@ -23257,8 +23364,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23257
23364
|
};
|
|
23258
23365
|
/**
|
|
23259
23366
|
* 绘制填充矩形
|
|
23260
|
-
* @param x -
|
|
23261
|
-
* @param y -
|
|
23367
|
+
* @param x - 矩形左上角 X 坐标
|
|
23368
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23262
23369
|
* @param width - 矩形宽度
|
|
23263
23370
|
* @param height - 矩形高度
|
|
23264
23371
|
* @param color - 填充颜色,默认白色,范围 0-1
|
|
@@ -23284,9 +23391,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23284
23391
|
this.buildShape(this.circleShape, color);
|
|
23285
23392
|
};
|
|
23286
23393
|
/**
|
|
23287
|
-
* 绘制纹理矩形(本地坐标,Y
|
|
23288
|
-
* @param x -
|
|
23289
|
-
* @param y -
|
|
23394
|
+
* 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
|
|
23395
|
+
* @param x - 矩形左上角 X 坐标
|
|
23396
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23290
23397
|
* @param width - 矩形宽度
|
|
23291
23398
|
* @param height - 矩形高度
|
|
23292
23399
|
* @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
|
|
@@ -23299,14 +23406,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23299
23406
|
this.pushQuad(x, y, width, height, color, region);
|
|
23300
23407
|
};
|
|
23301
23408
|
/**
|
|
23302
|
-
* 绘制文本(本地坐标,Y
|
|
23409
|
+
* 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
|
|
23303
23410
|
*
|
|
23304
23411
|
* 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
|
|
23305
23412
|
* `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
|
|
23306
23413
|
*
|
|
23307
23414
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
23308
|
-
* @param x -
|
|
23309
|
-
* @param y -
|
|
23415
|
+
* @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
23416
|
+
* @param y - 文本 cell 顶部 Y 坐标
|
|
23310
23417
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
23311
23418
|
* @param fontSize - 字号(逻辑像素)
|
|
23312
23419
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -23322,7 +23429,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23322
23429
|
return;
|
|
23323
23430
|
}
|
|
23324
23431
|
var atlas = this.textCache.getAtlas(fontSize, fontFamily, fontWeight, fontStyle);
|
|
23325
|
-
this.ensureBatch("
|
|
23432
|
+
this.ensureBatch("text", atlas.texture);
|
|
23326
23433
|
var lineHeight = atlas.lineHeight;
|
|
23327
23434
|
var cursorX = x;
|
|
23328
23435
|
// ensureChar 可能往 atlas canvas 写新字并打 dirty 标;实际 upload 推迟到
|
|
@@ -23333,13 +23440,15 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23333
23440
|
continue;
|
|
23334
23441
|
}
|
|
23335
23442
|
// atlas 像素坐标 → UV(纹理 flipY 后,canvas 顶 → v=1,canvas 底 → v=0)
|
|
23336
|
-
var
|
|
23337
|
-
var
|
|
23338
|
-
var
|
|
23339
|
-
var
|
|
23443
|
+
var atlasWidth = atlas.canvas.width;
|
|
23444
|
+
var atlasHeight = atlas.canvas.height;
|
|
23445
|
+
var u0 = info.px / atlasWidth;
|
|
23446
|
+
var u1 = (info.px + info.pw) / atlasWidth;
|
|
23447
|
+
var v0 = 1 - (info.py + info.ph) / atlasHeight;
|
|
23448
|
+
var v1 = 1 - info.py / atlasHeight;
|
|
23340
23449
|
// quad 宽与采样区都含四周 padding(cell 留白透明);但光标只按 advance 前进,
|
|
23341
23450
|
// quad 起点左偏 paddingLeft 使字形 ink 落在 cursorX — padding 区重叠无妨
|
|
23342
|
-
this.pushQuad(cursorX - info.paddingLeft, y, info.pw /
|
|
23451
|
+
this.pushQuad(cursorX - info.paddingLeft, y, info.pw / atlas.resolution, lineHeight, color, {
|
|
23343
23452
|
u0: u0,
|
|
23344
23453
|
v0: v0,
|
|
23345
23454
|
u1: u1,
|
|
@@ -23352,6 +23461,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23352
23461
|
this.geometry.dispose();
|
|
23353
23462
|
this.coloredMaterial.dispose();
|
|
23354
23463
|
this.texturedMaterial.dispose();
|
|
23464
|
+
this.textMaterial.dispose();
|
|
23355
23465
|
this.textCache.dispose();
|
|
23356
23466
|
};
|
|
23357
23467
|
_proto.buildShape = function buildShape(shape, color) {
|
|
@@ -23418,7 +23528,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23418
23528
|
* 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
|
|
23419
23529
|
*/ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
|
|
23420
23530
|
var vertexOffset = this.vertices.length / 2;
|
|
23421
|
-
// 4
|
|
23531
|
+
// 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
|
|
23422
23532
|
var corners = [
|
|
23423
23533
|
[
|
|
23424
23534
|
x,
|
|
@@ -23444,19 +23554,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23444
23554
|
var cornerUVs = [
|
|
23445
23555
|
[
|
|
23446
23556
|
u0,
|
|
23447
|
-
|
|
23557
|
+
v1
|
|
23448
23558
|
],
|
|
23449
23559
|
[
|
|
23450
23560
|
u1,
|
|
23451
|
-
|
|
23561
|
+
v1
|
|
23452
23562
|
],
|
|
23453
23563
|
[
|
|
23454
23564
|
u0,
|
|
23455
|
-
|
|
23565
|
+
v0
|
|
23456
23566
|
],
|
|
23457
23567
|
[
|
|
23458
23568
|
u1,
|
|
23459
|
-
|
|
23569
|
+
v0
|
|
23460
23570
|
]
|
|
23461
23571
|
];
|
|
23462
23572
|
for(var i = 0; i < 4; i++){
|
|
@@ -24422,433 +24532,365 @@ exports.FrameComponent = __decorate([
|
|
|
24422
24532
|
// 第四列 (位移) 乘 1,无需修改
|
|
24423
24533
|
}
|
|
24424
24534
|
|
|
24425
|
-
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
|
|
24434
|
-
|
|
24435
|
-
|
|
24436
|
-
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24445
|
-
|
|
24446
|
-
|
|
24447
|
-
|
|
24448
|
-
|
|
24449
|
-
|
|
24450
|
-
|
|
24451
|
-
|
|
24452
|
-
|
|
24453
|
-
|
|
24454
|
-
|
|
24455
|
-
|
|
24456
|
-
|
|
24457
|
-
|
|
24458
|
-
|
|
24459
|
-
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24468
|
-
|
|
24469
|
-
|
|
24535
|
+
function _assert_this_initialized(self) {
|
|
24536
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
24537
|
+
return self;
|
|
24538
|
+
}
|
|
24539
|
+
|
|
24540
|
+
exports.MouseFilter = void 0;
|
|
24541
|
+
(function(MouseFilter) {
|
|
24542
|
+
MouseFilter[MouseFilter["Stop"] = 0] = "Stop";
|
|
24543
|
+
MouseFilter[MouseFilter["Pass"] = 1] = "Pass";
|
|
24544
|
+
MouseFilter[MouseFilter["Ignore"] = 2] = "Ignore";
|
|
24545
|
+
})(exports.MouseFilter || (exports.MouseFilter = {}));
|
|
24546
|
+
exports.MouseBehaviorRecursive = void 0;
|
|
24547
|
+
(function(MouseBehaviorRecursive) {
|
|
24548
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Inherited"] = 0] = "Inherited";
|
|
24549
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Disabled"] = 1] = "Disabled";
|
|
24550
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Enabled"] = 2] = "Enabled";
|
|
24551
|
+
})(exports.MouseBehaviorRecursive || (exports.MouseBehaviorRecursive = {}));
|
|
24552
|
+
exports.MouseButton = void 0;
|
|
24553
|
+
(function(MouseButton) {
|
|
24554
|
+
MouseButton[MouseButton["None"] = 0] = "None";
|
|
24555
|
+
MouseButton[MouseButton["Left"] = 1] = "Left";
|
|
24556
|
+
MouseButton[MouseButton["Right"] = 2] = "Right";
|
|
24557
|
+
MouseButton[MouseButton["Middle"] = 3] = "Middle";
|
|
24558
|
+
MouseButton[MouseButton["WheelUp"] = 4] = "WheelUp";
|
|
24559
|
+
MouseButton[MouseButton["WheelDown"] = 5] = "WheelDown";
|
|
24560
|
+
MouseButton[MouseButton["WheelLeft"] = 6] = "WheelLeft";
|
|
24561
|
+
MouseButton[MouseButton["WheelRight"] = 7] = "WheelRight";
|
|
24562
|
+
MouseButton[MouseButton["Xbutton1"] = 8] = "Xbutton1";
|
|
24563
|
+
MouseButton[MouseButton["Xbutton2"] = 9] = "Xbutton2";
|
|
24564
|
+
})(exports.MouseButton || (exports.MouseButton = {}));
|
|
24565
|
+
exports.MouseButtonMask = void 0;
|
|
24566
|
+
(function(MouseButtonMask) {
|
|
24567
|
+
MouseButtonMask[MouseButtonMask["None"] = 0] = "None";
|
|
24568
|
+
MouseButtonMask[MouseButtonMask["Left"] = 1] = "Left";
|
|
24569
|
+
MouseButtonMask[MouseButtonMask["Right"] = 2] = "Right";
|
|
24570
|
+
MouseButtonMask[MouseButtonMask["Middle"] = 4] = "Middle";
|
|
24571
|
+
MouseButtonMask[MouseButtonMask["Xbutton1"] = 128] = "Xbutton1";
|
|
24572
|
+
MouseButtonMask[MouseButtonMask["Xbutton2"] = 256] = "Xbutton2";
|
|
24573
|
+
})(exports.MouseButtonMask || (exports.MouseButtonMask = {}));
|
|
24574
|
+
exports.FocusMode = void 0;
|
|
24575
|
+
(function(FocusMode) {
|
|
24576
|
+
FocusMode[FocusMode["None"] = 0] = "None";
|
|
24577
|
+
FocusMode[FocusMode["Click"] = 1] = "Click";
|
|
24578
|
+
FocusMode[FocusMode["All"] = 2] = "All";
|
|
24579
|
+
FocusMode[FocusMode["Accessibility"] = 3] = "Accessibility";
|
|
24580
|
+
})(exports.FocusMode || (exports.FocusMode = {}));
|
|
24581
|
+
exports.FocusBehaviorRecursive = void 0;
|
|
24582
|
+
(function(FocusBehaviorRecursive) {
|
|
24583
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Inherited"] = 0] = "Inherited";
|
|
24584
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Disabled"] = 1] = "Disabled";
|
|
24585
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Enabled"] = 2] = "Enabled";
|
|
24586
|
+
})(exports.FocusBehaviorRecursive || (exports.FocusBehaviorRecursive = {}));
|
|
24587
|
+
exports.KeyLocation = void 0;
|
|
24588
|
+
(function(KeyLocation) {
|
|
24589
|
+
KeyLocation[KeyLocation["Unspecified"] = 0] = "Unspecified";
|
|
24590
|
+
KeyLocation[KeyLocation["Left"] = 1] = "Left";
|
|
24591
|
+
KeyLocation[KeyLocation["Right"] = 2] = "Right";
|
|
24592
|
+
})(exports.KeyLocation || (exports.KeyLocation = {}));
|
|
24593
|
+
exports.CursorShape = void 0;
|
|
24594
|
+
(function(CursorShape) {
|
|
24595
|
+
CursorShape[CursorShape["Arrow"] = 0] = "Arrow";
|
|
24596
|
+
CursorShape[CursorShape["Ibeam"] = 1] = "Ibeam";
|
|
24597
|
+
CursorShape[CursorShape["PointingHand"] = 2] = "PointingHand";
|
|
24598
|
+
CursorShape[CursorShape["Cross"] = 3] = "Cross";
|
|
24599
|
+
CursorShape[CursorShape["Wait"] = 4] = "Wait";
|
|
24600
|
+
CursorShape[CursorShape["Busy"] = 5] = "Busy";
|
|
24601
|
+
CursorShape[CursorShape["Drag"] = 6] = "Drag";
|
|
24602
|
+
CursorShape[CursorShape["CanDrop"] = 7] = "CanDrop";
|
|
24603
|
+
CursorShape[CursorShape["Forbidden"] = 8] = "Forbidden";
|
|
24604
|
+
CursorShape[CursorShape["Vsize"] = 9] = "Vsize";
|
|
24605
|
+
CursorShape[CursorShape["Hsize"] = 10] = "Hsize";
|
|
24606
|
+
CursorShape[CursorShape["Bdiagsize"] = 11] = "Bdiagsize";
|
|
24607
|
+
CursorShape[CursorShape["Fdiagsize"] = 12] = "Fdiagsize";
|
|
24608
|
+
CursorShape[CursorShape["Move"] = 13] = "Move";
|
|
24609
|
+
CursorShape[CursorShape["Vsplit"] = 14] = "Vsplit";
|
|
24610
|
+
CursorShape[CursorShape["Hsplit"] = 15] = "Hsplit";
|
|
24611
|
+
CursorShape[CursorShape["Help"] = 16] = "Help";
|
|
24612
|
+
})(exports.CursorShape || (exports.CursorShape = {}));
|
|
24613
|
+
|
|
24614
|
+
function _get_prototype_of(o) {
|
|
24615
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
24616
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
24470
24617
|
};
|
|
24471
|
-
|
|
24472
|
-
|
|
24473
|
-
|
|
24474
|
-
|
|
24475
|
-
|
|
24618
|
+
return _get_prototype_of(o);
|
|
24619
|
+
}
|
|
24620
|
+
|
|
24621
|
+
function _is_native_function(fn) {
|
|
24622
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
24623
|
+
}
|
|
24624
|
+
|
|
24625
|
+
function _wrap_native_super(Class) {
|
|
24626
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
24627
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
24628
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
24629
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
24630
|
+
if (typeof _cache !== "undefined") {
|
|
24631
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
24632
|
+
_cache.set(Class, Wrapper);
|
|
24476
24633
|
}
|
|
24477
|
-
|
|
24478
|
-
|
|
24479
|
-
// CanvasLayer 失效时,让其下挂的 CanvasItem 重新查找归属层
|
|
24480
|
-
// 拷贝一份避免迭代过程中数组被修改
|
|
24481
|
-
var items = this.canvasItems.slice();
|
|
24482
|
-
this.canvasItems.length = 0;
|
|
24483
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
24484
|
-
var canvasItem = _step.value;
|
|
24485
|
-
canvasItem.updateCanvasLayer();
|
|
24634
|
+
function Wrapper() {
|
|
24635
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
24486
24636
|
}
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
*
|
|
24494
|
-
* 注:画布尺寸到 RectTransform.size 的同步目前未在此处处理(由 RectTransform 自身按需 resolve);
|
|
24495
|
-
* 后续若需要在每帧强制刷新顶层 size,可在此处补回写入与 sizeChanged 传播
|
|
24496
|
-
*
|
|
24497
|
-
* @internal
|
|
24498
|
-
*/ _proto.draw = function draw() {
|
|
24499
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvasItems), _step; !(_step = _iterator()).done;){
|
|
24500
|
-
var canvasItem = _step.value;
|
|
24501
|
-
if (!canvasItem.item.isActive) {
|
|
24502
|
-
continue;
|
|
24637
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
24638
|
+
constructor: {
|
|
24639
|
+
value: Wrapper,
|
|
24640
|
+
enumerable: false,
|
|
24641
|
+
writable: true,
|
|
24642
|
+
configurable: true
|
|
24503
24643
|
}
|
|
24504
|
-
|
|
24505
|
-
|
|
24644
|
+
});
|
|
24645
|
+
return _set_prototype_of(Wrapper, Class);
|
|
24506
24646
|
};
|
|
24507
|
-
return
|
|
24508
|
-
}
|
|
24647
|
+
return _wrap_native_super(Class);
|
|
24648
|
+
}
|
|
24509
24649
|
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
*
|
|
24513
|
-
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
|
|
24517
|
-
|
|
24518
|
-
|
|
24519
|
-
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
/**
|
|
24525
|
-
* 父 CanvasItem
|
|
24526
|
-
* 沿 VFXItem 父链向上查找到的最近的 CanvasItem(只看类型,不看 active/enabled — 拓扑跟激活状态解耦)。
|
|
24527
|
-
* 若不存在 CanvasItem 祖先(即直属于 CanvasLayer 或处于游离状态),该值为 null。
|
|
24528
|
-
*/ _this.parent = null;
|
|
24529
|
-
/**
|
|
24530
|
-
* 子 CanvasItem 列表(按注册顺序)
|
|
24531
|
-
* 由子节点在维护自身 parent 时反向写入,draw 时按数组顺序递归绘制
|
|
24532
|
-
*/ _this.children = [];
|
|
24533
|
-
/**
|
|
24534
|
-
* 当前所属的 CanvasLayer,未注册到任何 CanvasLayer 时为 null
|
|
24535
|
-
*/ _this.canvasLayerNode = null;
|
|
24536
|
-
return _this;
|
|
24650
|
+
function transformPoint(transform, value) {
|
|
24651
|
+
var elements = transform.elements;
|
|
24652
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y + elements[6], elements[1] * value.x + elements[4] * value.y + elements[7]);
|
|
24653
|
+
}
|
|
24654
|
+
function transformVector(transform, value) {
|
|
24655
|
+
var elements = transform.elements;
|
|
24656
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y, elements[1] * value.x + elements[4] * value.y);
|
|
24657
|
+
}
|
|
24658
|
+
var InputEvent = /*#__PURE__*/ function() {
|
|
24659
|
+
function InputEvent() {
|
|
24660
|
+
this.device = 0;
|
|
24661
|
+
this.pressed = false;
|
|
24662
|
+
this.canceled = false;
|
|
24663
|
+
this._accepted = false;
|
|
24537
24664
|
}
|
|
24538
|
-
var _proto =
|
|
24539
|
-
_proto.
|
|
24540
|
-
|
|
24541
|
-
// 注意 enable/disable 不再改变 CanvasItem 父子拓扑 — 拓扑由 VFXItem 父链(setParent / onParentChanged)维护,
|
|
24542
|
-
// enable 在这里只是兜底首次入树
|
|
24543
|
-
this.updateCanvasLayer();
|
|
24544
|
-
this.updateParentItem();
|
|
24545
|
-
};
|
|
24546
|
-
_proto.onDisable = function onDisable() {
|
|
24547
|
-
// 组件禁用 = 仅 self.draw 跳过,不应改父子拓扑(否则 enable 回来位置就乱了)。
|
|
24548
|
-
// 整棵子树的隐藏由 `vfxItem.setActive(false)` 配合 drawInternal 中的 `item.isActive` 检查处理
|
|
24549
|
-
};
|
|
24550
|
-
_proto.onParentChanged = function onParentChanged() {
|
|
24551
|
-
// VFXItem 的父级(或间接父级)发生变化时,CanvasLayer 与父 CanvasItem 都可能改变,需要联动刷新
|
|
24552
|
-
this.updateCanvasLayer();
|
|
24553
|
-
this.updateParentItem();
|
|
24554
|
-
};
|
|
24555
|
-
_proto.onDestroy = function onDestroy() {
|
|
24556
|
-
this.removeFromParent();
|
|
24557
|
-
this.removeFromCanvasLayer();
|
|
24558
|
-
// 防止子 canvasItem updateParentItem 的时候继续找到当前已销毁的 canvasItem
|
|
24559
|
-
this.enabled = false;
|
|
24560
|
-
this.updateChildrenParentItems();
|
|
24561
|
-
};
|
|
24562
|
-
/**
|
|
24563
|
-
* 重新计算并更新当前 CanvasItem 应归属的 CanvasLayer
|
|
24564
|
-
* 在父级变化、所在 CanvasLayer 失效等场景中调用
|
|
24565
|
-
*
|
|
24566
|
-
* 仅当自身是顶层 CanvasItem(parent 为 null)时才会登记到 CanvasLayer.canvasItems;
|
|
24567
|
-
* 嵌套的子 CanvasItem 仅记录 canvasLayerNode 引用,不进入 layer 的顶层列表。
|
|
24568
|
-
* @internal
|
|
24569
|
-
*/ _proto.updateCanvasLayer = function updateCanvasLayer() {
|
|
24570
|
-
// 拓扑跟 enabled/active 解耦,只看 item 是否还在
|
|
24571
|
-
if (!this.item) {
|
|
24572
|
-
this.removeFromCanvasLayer();
|
|
24573
|
-
return;
|
|
24574
|
-
}
|
|
24575
|
-
var newLayer = this.getCanvasLayerNode();
|
|
24576
|
-
if (newLayer === this.canvasLayerNode) {
|
|
24577
|
-
return;
|
|
24578
|
-
}
|
|
24579
|
-
// 仅当自身是顶层 CanvasItem 时,才需要在 layer 的 canvasItems 中迁移
|
|
24580
|
-
if (this.parent === null && this.canvasLayerNode) {
|
|
24581
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24582
|
-
}
|
|
24583
|
-
this.canvasLayerNode = newLayer;
|
|
24584
|
-
if (this.parent === null && newLayer) {
|
|
24585
|
-
newLayer.addCanvasItem(this);
|
|
24586
|
-
}
|
|
24587
|
-
};
|
|
24588
|
-
/**
|
|
24589
|
-
* 重新计算并更新当前 CanvasItem 的父 CanvasItem
|
|
24590
|
-
* 在 VFXItem 父级变化、自身启用/禁用、父 CanvasItem 失效等场景中调用
|
|
24591
|
-
*
|
|
24592
|
-
* parent 的变化会同步影响在 CanvasLayer.canvasItems 中的归属:
|
|
24593
|
-
* - 由有 parent 变成无 parent 且仍归属某 layer:加入 layer.canvasItems
|
|
24594
|
-
* - 由无 parent 变成有 parent:从 layer.canvasItems 中移除
|
|
24595
|
-
* @internal
|
|
24596
|
-
*/ _proto.updateParentItem = function updateParentItem() {
|
|
24597
|
-
// 拓扑跟 enabled/active 解耦,只看 item 是否还在
|
|
24598
|
-
if (!this.item) {
|
|
24599
|
-
this.removeFromParent();
|
|
24600
|
-
return;
|
|
24601
|
-
}
|
|
24602
|
-
var newParent = this.getParentItem();
|
|
24603
|
-
if (newParent === this.parent) {
|
|
24604
|
-
return;
|
|
24605
|
-
}
|
|
24606
|
-
var wasTopLevel = this.parent === null;
|
|
24607
|
-
this.removeFromParent();
|
|
24608
|
-
if (newParent) {
|
|
24609
|
-
this.parent = newParent;
|
|
24610
|
-
newParent.children.push(this);
|
|
24611
|
-
// 由顶层变成嵌套:从 layer 的顶层列表中移除
|
|
24612
|
-
if (wasTopLevel && this.canvasLayerNode) {
|
|
24613
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24614
|
-
}
|
|
24615
|
-
} else if (!wasTopLevel && this.canvasLayerNode) {
|
|
24616
|
-
// 由嵌套变成顶层:加入 layer 的顶层列表
|
|
24617
|
-
this.canvasLayerNode.addCanvasItem(this);
|
|
24618
|
-
}
|
|
24619
|
-
};
|
|
24620
|
-
/**
|
|
24621
|
-
* 绘制函数
|
|
24622
|
-
* 子类重写此方法以输出实际的绘制内容;调用时 graphics 的变换栈顶已经累积了从根到当前节点的所有父变换,
|
|
24623
|
-
* 子类直接使用 this.drawXxx / this.fillXxx 系列封装方法绘制即可,绘制坐标视为本地坐标。
|
|
24624
|
-
*/ _proto.draw = function draw() {
|
|
24625
|
-
// OVERRIDE
|
|
24626
|
-
};
|
|
24627
|
-
/**
|
|
24628
|
-
* 绘制单条线段
|
|
24629
|
-
* @param x1 - 起点 x
|
|
24630
|
-
* @param y1 - 起点 y
|
|
24631
|
-
* @param x2 - 终点 x
|
|
24632
|
-
* @param y2 - 终点 y
|
|
24633
|
-
* @param color - 线条颜色
|
|
24634
|
-
* @param thickness - 线宽
|
|
24635
|
-
*/ _proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
|
|
24636
|
-
this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
|
|
24637
|
-
};
|
|
24638
|
-
/**
|
|
24639
|
-
* 按顺序连接所有点绘制折线(首尾相同则视为闭合)
|
|
24640
|
-
* @param points - 点数组,格式 [x1,y1,x2,y2,...]
|
|
24641
|
-
* @param color - 线条颜色
|
|
24642
|
-
* @param thickness - 线宽
|
|
24643
|
-
*/ _proto.drawPolyline = function drawPolyline(points, color, thickness) {
|
|
24644
|
-
this.engine.graphics.drawLines(points, color, thickness);
|
|
24645
|
-
};
|
|
24646
|
-
/**
|
|
24647
|
-
* 绘制三次贝塞尔曲线
|
|
24648
|
-
*/ _proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
|
|
24649
|
-
this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
|
|
24650
|
-
};
|
|
24651
|
-
/**
|
|
24652
|
-
* 绘制三角形边框
|
|
24653
|
-
*/ _proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
|
|
24654
|
-
this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
|
|
24655
|
-
};
|
|
24656
|
-
/**
|
|
24657
|
-
* 绘制矩形边框
|
|
24658
|
-
* @param x - 矩形左下角 x 坐标
|
|
24659
|
-
* @param y - 矩形左下角 y 坐标
|
|
24660
|
-
*/ _proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
|
|
24661
|
-
this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
|
|
24662
|
-
};
|
|
24663
|
-
/**
|
|
24664
|
-
* 绘制圆形边框
|
|
24665
|
-
*/ _proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
|
|
24666
|
-
this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
|
|
24667
|
-
};
|
|
24668
|
-
/**
|
|
24669
|
-
* 绘制填充三角形
|
|
24670
|
-
*/ _proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
|
|
24671
|
-
this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
|
|
24672
|
-
};
|
|
24673
|
-
/**
|
|
24674
|
-
* 绘制填充矩形
|
|
24675
|
-
* @param x - 矩形左下角 x 坐标
|
|
24676
|
-
* @param y - 矩形左下角 y 坐标
|
|
24677
|
-
*/ _proto.fillRect = function fillRect(x, y, width, height, color) {
|
|
24678
|
-
this.engine.graphics.fillRectangle(x, y, width, height, color);
|
|
24665
|
+
var _proto = InputEvent.prototype;
|
|
24666
|
+
_proto.accept = function accept() {
|
|
24667
|
+
this._accepted = true;
|
|
24679
24668
|
};
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
*/ _proto.fillCircle = function fillCircle(cx, cy, radius, color) {
|
|
24683
|
-
this.engine.graphics.fillCircle(cx, cy, radius, color);
|
|
24684
|
-
};
|
|
24685
|
-
/**
|
|
24686
|
-
* 绘制纹理矩形(本地坐标,Y 向上,(x, y) 为左下角)
|
|
24687
|
-
* @param region - 纹理 UV 子矩形,默认全图。Y 向上,(u0, v0) 为左下角 UV
|
|
24688
|
-
* @param color - 乘色,默认白色
|
|
24689
|
-
*/ _proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
|
|
24690
|
-
this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
|
|
24669
|
+
_proto.clearAccepted = function clearAccepted() {
|
|
24670
|
+
this._accepted = false;
|
|
24691
24671
|
};
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
*
|
|
24695
|
-
* 同一段文本不同颜色不会重复 upload — 颜色由 `color` 参数透传作为乘色,纹理只缓存白色字形。
|
|
24696
|
-
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
24697
|
-
*/ _proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
|
|
24698
|
-
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
24672
|
+
_proto.isAccepted = function isAccepted() {
|
|
24673
|
+
return this._accepted;
|
|
24699
24674
|
};
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
* @internal
|
|
24703
|
-
*/ _proto.drawInternal = function drawInternal() {
|
|
24704
|
-
var graphics = this.engine.graphics;
|
|
24705
|
-
var localMatrix2D = this.transform.getMatrix2D();
|
|
24706
|
-
graphics.pushTransform(localMatrix2D);
|
|
24707
|
-
// self 是否绘制只看 component.enabled — 其它都不影响。
|
|
24708
|
-
// transform 始终被 push,children 始终被遍历,这样 component.enabled=false 时 self 隐藏
|
|
24709
|
-
// 但 children 的位置不受影响
|
|
24710
|
-
if (this.enabled) {
|
|
24711
|
-
this.draw();
|
|
24712
|
-
}
|
|
24713
|
-
// 子是否参与绘制看 VFXItem.isActive(整棵跳过的语义)。
|
|
24714
|
-
// 子自身的 component.enabled 在它自己的 drawInternal 里再判断
|
|
24715
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
24716
|
-
var child = _step.value;
|
|
24717
|
-
if (!child.item.isActive) {
|
|
24718
|
-
continue;
|
|
24719
|
-
}
|
|
24720
|
-
child.drawInternal();
|
|
24721
|
-
}
|
|
24722
|
-
graphics.popTransform();
|
|
24675
|
+
_proto.isPressed = function isPressed() {
|
|
24676
|
+
return this.pressed && !this.canceled;
|
|
24723
24677
|
};
|
|
24724
|
-
|
|
24725
|
-
|
|
24726
|
-
* 仅当自身是顶层 CanvasItem 时,才会触发 layer 顶层列表的移除
|
|
24727
|
-
*/ _proto.removeFromCanvasLayer = function removeFromCanvasLayer() {
|
|
24728
|
-
if (!this.canvasLayerNode) {
|
|
24729
|
-
return;
|
|
24730
|
-
}
|
|
24731
|
-
if (this.parent === null) {
|
|
24732
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24733
|
-
}
|
|
24734
|
-
this.canvasLayerNode = null;
|
|
24678
|
+
_proto.isReleased = function isReleased() {
|
|
24679
|
+
return !this.pressed && !this.canceled;
|
|
24735
24680
|
};
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
*/ _proto.removeFromParent = function removeFromParent() {
|
|
24739
|
-
if (!this.parent) {
|
|
24740
|
-
return;
|
|
24741
|
-
}
|
|
24742
|
-
removeItem(this.parent.children, this);
|
|
24743
|
-
this.parent = null;
|
|
24681
|
+
_proto.isCanceled = function isCanceled() {
|
|
24682
|
+
return this.canceled;
|
|
24744
24683
|
};
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
* 自身失效时调用,子节点会跳过自己向上找到新的父 CanvasItem(可能为 null)。
|
|
24748
|
-
*/ _proto.updateChildrenParentItems = function updateChildrenParentItems() {
|
|
24749
|
-
if (this.children.length === 0) {
|
|
24750
|
-
return;
|
|
24751
|
-
}
|
|
24752
|
-
// 拷贝避免迭代过程中数组被 removeFromParent 修改
|
|
24753
|
-
var snapshot = this.children.slice();
|
|
24754
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(snapshot), _step; !(_step = _iterator()).done;){
|
|
24755
|
-
var child = _step.value;
|
|
24756
|
-
child.updateParentItem();
|
|
24757
|
-
}
|
|
24684
|
+
_proto.isEcho = function isEcho() {
|
|
24685
|
+
return false;
|
|
24758
24686
|
};
|
|
24759
|
-
|
|
24760
|
-
|
|
24761
|
-
* 注意:自身所在 VFXItem 上的 CanvasLayer 也参与查找(同节点上可能并存 CanvasLayer 与 CanvasItem)
|
|
24762
|
-
*/ _proto.getCanvasLayerNode = function getCanvasLayerNode() {
|
|
24763
|
-
var current = this.item;
|
|
24764
|
-
while(current){
|
|
24765
|
-
var layer = getCanvasLayerFromItem(current);
|
|
24766
|
-
if (layer) {
|
|
24767
|
-
return layer;
|
|
24768
|
-
}
|
|
24769
|
-
var _current_parent;
|
|
24770
|
-
current = (_current_parent = current.parent) != null ? _current_parent : null;
|
|
24771
|
-
}
|
|
24772
|
-
return null;
|
|
24687
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24688
|
+
return this;
|
|
24773
24689
|
};
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
|
|
24778
|
-
|
|
24779
|
-
|
|
24780
|
-
|
|
24781
|
-
|
|
24782
|
-
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
|
|
24788
|
-
|
|
24690
|
+
return InputEvent;
|
|
24691
|
+
}();
|
|
24692
|
+
InputEvent.deviceIdEmulation = -1;
|
|
24693
|
+
InputEvent.deviceIdInternal = -2;
|
|
24694
|
+
InputEvent.deviceIdKeyboard = 16;
|
|
24695
|
+
InputEvent.deviceIdMouse = 32;
|
|
24696
|
+
var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
24697
|
+
_inherits(InputEventWithModifiers, InputEvent);
|
|
24698
|
+
function InputEventWithModifiers() {
|
|
24699
|
+
var _this;
|
|
24700
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24701
|
+
_this.commandOrControlAutoremap = false;
|
|
24702
|
+
_this.shiftPressed = false;
|
|
24703
|
+
_this.altPressed = false;
|
|
24704
|
+
_this.metaPressed = false;
|
|
24705
|
+
_this.ctrlPressed = false;
|
|
24706
|
+
return _this;
|
|
24707
|
+
}
|
|
24708
|
+
var _proto = InputEventWithModifiers.prototype;
|
|
24709
|
+
_proto.copyModifiersTo = function copyModifiersTo(event) {
|
|
24710
|
+
event.device = this.device;
|
|
24711
|
+
event.pressed = this.pressed;
|
|
24712
|
+
event.canceled = this.canceled;
|
|
24713
|
+
event.commandOrControlAutoremap = this.commandOrControlAutoremap;
|
|
24714
|
+
event.shiftPressed = this.shiftPressed;
|
|
24715
|
+
event.altPressed = this.altPressed;
|
|
24716
|
+
event.metaPressed = this.metaPressed;
|
|
24717
|
+
event.ctrlPressed = this.ctrlPressed;
|
|
24718
|
+
};
|
|
24719
|
+
return InputEventWithModifiers;
|
|
24720
|
+
}(_wrap_native_super(InputEvent));
|
|
24721
|
+
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24722
|
+
_inherits(InputEventKey, InputEventWithModifiers);
|
|
24723
|
+
function InputEventKey() {
|
|
24724
|
+
var _this;
|
|
24725
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24726
|
+
_this.keycode = "";
|
|
24727
|
+
_this.physicalKeycode = "";
|
|
24728
|
+
_this.keyLabel = "";
|
|
24729
|
+
_this.unicode = 0;
|
|
24730
|
+
_this.location = exports.KeyLocation.Unspecified;
|
|
24731
|
+
_this.echo = false;
|
|
24732
|
+
return _this;
|
|
24733
|
+
}
|
|
24734
|
+
var _proto = InputEventKey.prototype;
|
|
24735
|
+
_proto.isEcho = function isEcho() {
|
|
24736
|
+
return this.echo;
|
|
24789
24737
|
};
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
}(Component);
|
|
24802
|
-
/**
|
|
24803
|
-
* 在指定 VFXItem 上查找一个激活的 CanvasLayer 组件
|
|
24804
|
-
*/ function getCanvasLayerFromItem(item) {
|
|
24805
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
24806
|
-
var component = _step.value;
|
|
24807
|
-
if (_instanceof1(component, CanvasLayer) && component.isActiveAndEnabled) {
|
|
24808
|
-
return component;
|
|
24809
|
-
}
|
|
24738
|
+
return InputEventKey;
|
|
24739
|
+
}(InputEventWithModifiers);
|
|
24740
|
+
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24741
|
+
_inherits(InputEventMouse, InputEventWithModifiers);
|
|
24742
|
+
function InputEventMouse() {
|
|
24743
|
+
var _this;
|
|
24744
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24745
|
+
_this.buttonMask = exports.MouseButtonMask.None;
|
|
24746
|
+
_this.position = new Vector2();
|
|
24747
|
+
_this.globalPosition = new Vector2();
|
|
24748
|
+
return _this;
|
|
24810
24749
|
}
|
|
24811
|
-
|
|
24812
|
-
|
|
24813
|
-
|
|
24814
|
-
|
|
24815
|
-
|
|
24816
|
-
|
|
24817
|
-
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
-
|
|
24750
|
+
var _proto = InputEventMouse.prototype;
|
|
24751
|
+
_proto.copyMouseTo = function copyMouseTo(event) {
|
|
24752
|
+
this.copyModifiersTo(event);
|
|
24753
|
+
event.buttonMask = this.buttonMask;
|
|
24754
|
+
event.position.copyFrom(this.position);
|
|
24755
|
+
event.globalPosition.copyFrom(this.globalPosition);
|
|
24756
|
+
};
|
|
24757
|
+
return InputEventMouse;
|
|
24758
|
+
}(InputEventWithModifiers);
|
|
24759
|
+
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
24760
|
+
_inherits(InputEventMouseButton, InputEventMouse);
|
|
24761
|
+
function InputEventMouseButton() {
|
|
24762
|
+
var _this;
|
|
24763
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24764
|
+
_this.factor = 1;
|
|
24765
|
+
_this.buttonIndex = exports.MouseButton.None;
|
|
24766
|
+
_this.doubleClick = false;
|
|
24767
|
+
return _this;
|
|
24821
24768
|
}
|
|
24822
|
-
|
|
24823
|
-
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
|
|
24827
|
-
|
|
24828
|
-
|
|
24769
|
+
var _proto = InputEventMouseButton.prototype;
|
|
24770
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24771
|
+
var event = new InputEventMouseButton();
|
|
24772
|
+
this.copyMouseTo(event);
|
|
24773
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24774
|
+
event.factor = this.factor;
|
|
24775
|
+
event.buttonIndex = this.buttonIndex;
|
|
24776
|
+
event.doubleClick = this.doubleClick;
|
|
24777
|
+
return event;
|
|
24778
|
+
};
|
|
24779
|
+
return InputEventMouseButton;
|
|
24780
|
+
}(InputEventMouse);
|
|
24781
|
+
var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
|
|
24782
|
+
_inherits(InputEventMouseMotion, InputEventMouse);
|
|
24783
|
+
function InputEventMouseMotion() {
|
|
24784
|
+
var _this;
|
|
24785
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24786
|
+
_this.tilt = new Vector2();
|
|
24787
|
+
_this.pressure = 0;
|
|
24788
|
+
_this.relative = new Vector2();
|
|
24789
|
+
_this.screenRelative = new Vector2();
|
|
24790
|
+
_this.velocity = new Vector2();
|
|
24791
|
+
_this.screenVelocity = new Vector2();
|
|
24792
|
+
_this.penInverted = false;
|
|
24793
|
+
return _this;
|
|
24794
|
+
}
|
|
24795
|
+
var _proto = InputEventMouseMotion.prototype;
|
|
24796
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24797
|
+
var event = new InputEventMouseMotion();
|
|
24798
|
+
this.copyMouseTo(event);
|
|
24799
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24800
|
+
event.tilt.copyFrom(this.tilt);
|
|
24801
|
+
event.pressure = this.pressure;
|
|
24802
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24803
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
24804
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24805
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24806
|
+
event.penInverted = this.penInverted;
|
|
24807
|
+
return event;
|
|
24808
|
+
};
|
|
24809
|
+
return InputEventMouseMotion;
|
|
24810
|
+
}(InputEventMouse);
|
|
24811
|
+
var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
|
|
24812
|
+
_inherits(InputEventScreenTouch, InputEvent);
|
|
24813
|
+
function InputEventScreenTouch() {
|
|
24814
|
+
var _this;
|
|
24815
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24816
|
+
_this.index = 0;
|
|
24817
|
+
_this.position = new Vector2();
|
|
24818
|
+
_this.doubleTap = false;
|
|
24819
|
+
return _this;
|
|
24820
|
+
}
|
|
24821
|
+
var _proto = InputEventScreenTouch.prototype;
|
|
24822
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24823
|
+
var event = new InputEventScreenTouch();
|
|
24824
|
+
event.device = this.device;
|
|
24825
|
+
event.pressed = this.pressed;
|
|
24826
|
+
event.canceled = this.canceled;
|
|
24827
|
+
event.index = this.index;
|
|
24828
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24829
|
+
event.doubleTap = this.doubleTap;
|
|
24830
|
+
return event;
|
|
24831
|
+
};
|
|
24832
|
+
return InputEventScreenTouch;
|
|
24833
|
+
}(_wrap_native_super(InputEvent));
|
|
24834
|
+
var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
24835
|
+
_inherits(InputEventScreenDrag, InputEvent);
|
|
24836
|
+
function InputEventScreenDrag() {
|
|
24837
|
+
var _this;
|
|
24838
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24839
|
+
_this.index = 0;
|
|
24840
|
+
_this.position = new Vector2();
|
|
24841
|
+
_this.relative = new Vector2();
|
|
24842
|
+
_this.screenRelative = new Vector2();
|
|
24843
|
+
_this.velocity = new Vector2();
|
|
24844
|
+
_this.screenVelocity = new Vector2();
|
|
24845
|
+
_this.pressure = 0;
|
|
24846
|
+
_this.tilt = new Vector2();
|
|
24847
|
+
_this.penInverted = false;
|
|
24848
|
+
return _this;
|
|
24849
|
+
}
|
|
24850
|
+
var _proto = InputEventScreenDrag.prototype;
|
|
24851
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24852
|
+
var event = new InputEventScreenDrag();
|
|
24853
|
+
event.device = this.device;
|
|
24854
|
+
event.pressed = this.pressed;
|
|
24855
|
+
event.canceled = this.canceled;
|
|
24856
|
+
event.index = this.index;
|
|
24857
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24858
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24859
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
24860
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24861
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24862
|
+
event.pressure = this.pressure;
|
|
24863
|
+
event.tilt.copyFrom(this.tilt);
|
|
24864
|
+
event.penInverted = this.penInverted;
|
|
24865
|
+
return event;
|
|
24866
|
+
};
|
|
24867
|
+
return InputEventScreenDrag;
|
|
24868
|
+
}(_wrap_native_super(InputEvent));
|
|
24869
|
+
|
|
24870
|
+
var ANCHOR_PRESET_TABLE = {
|
|
24829
24871
|
topLeft: [
|
|
24830
24872
|
0,
|
|
24831
|
-
1,
|
|
24832
24873
|
0,
|
|
24833
|
-
|
|
24874
|
+
0,
|
|
24875
|
+
0
|
|
24834
24876
|
],
|
|
24835
24877
|
topRight: [
|
|
24836
24878
|
1,
|
|
24879
|
+
0,
|
|
24837
24880
|
1,
|
|
24838
|
-
|
|
24839
|
-
1
|
|
24881
|
+
0
|
|
24840
24882
|
],
|
|
24841
24883
|
bottomLeft: [
|
|
24842
24884
|
0,
|
|
24885
|
+
1,
|
|
24843
24886
|
0,
|
|
24844
|
-
|
|
24845
|
-
0
|
|
24887
|
+
1
|
|
24846
24888
|
],
|
|
24847
24889
|
bottomRight: [
|
|
24848
24890
|
1,
|
|
24849
|
-
0,
|
|
24850
24891
|
1,
|
|
24851
|
-
|
|
24892
|
+
1,
|
|
24893
|
+
1
|
|
24852
24894
|
],
|
|
24853
24895
|
centerLeft: [
|
|
24854
24896
|
0,
|
|
@@ -24858,9 +24900,9 @@ exports.FrameComponent = __decorate([
|
|
|
24858
24900
|
],
|
|
24859
24901
|
centerTop: [
|
|
24860
24902
|
0.5,
|
|
24861
|
-
|
|
24903
|
+
0,
|
|
24862
24904
|
0.5,
|
|
24863
|
-
|
|
24905
|
+
0
|
|
24864
24906
|
],
|
|
24865
24907
|
centerRight: [
|
|
24866
24908
|
1,
|
|
@@ -24870,9 +24912,9 @@ exports.FrameComponent = __decorate([
|
|
|
24870
24912
|
],
|
|
24871
24913
|
centerBottom: [
|
|
24872
24914
|
0.5,
|
|
24873
|
-
|
|
24915
|
+
1,
|
|
24874
24916
|
0.5,
|
|
24875
|
-
|
|
24917
|
+
1
|
|
24876
24918
|
],
|
|
24877
24919
|
center: [
|
|
24878
24920
|
0.5,
|
|
@@ -24887,10 +24929,10 @@ exports.FrameComponent = __decorate([
|
|
|
24887
24929
|
1
|
|
24888
24930
|
],
|
|
24889
24931
|
topWide: [
|
|
24932
|
+
0,
|
|
24890
24933
|
0,
|
|
24891
24934
|
1,
|
|
24892
|
-
|
|
24893
|
-
1
|
|
24935
|
+
0
|
|
24894
24936
|
],
|
|
24895
24937
|
rightWide: [
|
|
24896
24938
|
1,
|
|
@@ -24899,10 +24941,10 @@ exports.FrameComponent = __decorate([
|
|
|
24899
24941
|
1
|
|
24900
24942
|
],
|
|
24901
24943
|
bottomWide: [
|
|
24902
|
-
0,
|
|
24903
24944
|
0,
|
|
24904
24945
|
1,
|
|
24905
|
-
|
|
24946
|
+
1,
|
|
24947
|
+
1
|
|
24906
24948
|
],
|
|
24907
24949
|
vcenterWide: [
|
|
24908
24950
|
0.5,
|
|
@@ -24924,306 +24966,171 @@ exports.FrameComponent = __decorate([
|
|
|
24924
24966
|
]
|
|
24925
24967
|
};
|
|
24926
24968
|
/**
|
|
24927
|
-
*
|
|
24928
|
-
*
|
|
24929
|
-
|
|
24930
|
-
|
|
24931
|
-
|
|
24932
|
-
|
|
24933
|
-
|
|
24934
|
-
|
|
24935
|
-
|
|
24936
|
-
|
|
24937
|
-
|
|
24938
|
-
|
|
24939
|
-
|
|
24940
|
-
|
|
24941
|
-
|
|
24942
|
-
|
|
24943
|
-
|
|
24944
|
-
|
|
24945
|
-
|
|
24946
|
-
|
|
24947
|
-
|
|
24948
|
-
|
|
24949
|
-
|
|
24950
|
-
|
|
24951
|
-
|
|
24952
|
-
|
|
24953
|
-
|
|
24954
|
-
|
|
24955
|
-
|
|
24956
|
-
|
|
24957
|
-
* 父 rect 上的归一化最小角 `(anchorLeft, anchorBottom)`
|
|
24958
|
-
*/ _this.anchorMin = new Vector2(0, 0);
|
|
24959
|
-
/**
|
|
24960
|
-
* 父 rect 上的归一化最大角 `(anchorRight, anchorTop)`
|
|
24961
|
-
*/ _this.anchorMax = new Vector2(0, 0);
|
|
24962
|
-
/**
|
|
24963
|
-
* rect 左/下边相对 anchorMin 锚点的像素偏移 `(offsetLeft, offsetBottom)`
|
|
24964
|
-
*/ _this.offsetMin = new Vector2(0, 0);
|
|
24965
|
-
/**
|
|
24966
|
-
* rect 右/上边相对 anchorMax 锚点的像素偏移 `(offsetRight, offsetTop)`
|
|
24967
|
-
*/ _this.offsetMax = new Vector2(0, 0);
|
|
24968
|
-
/**
|
|
24969
|
-
* 自身 rect 上的归一化轴心 `(0..1)`,默认 `(0.5, 0.5)`(中心)。两层效果:
|
|
24970
|
-
* 1. **Layout**:`setSize` 时 rect 围绕此点对称缩放(pivot=(0.5, 0.5) → 居中扩展;pivot=(0, 0) → 从左下扩展;pivot=(1, 1) → 向左下缩)
|
|
24971
|
-
* 2. **矩阵**:`pivot` 自动同步到 `transform.anchor = pivot * size`(像素值,矩阵旋转/缩放中心),
|
|
24972
|
-
* 所以旋转/缩放也围绕同一点。`setPivot` 和每次 `sizeChanged`(size 重算后)都会刷新 `transform.anchor`
|
|
24973
|
-
*/ _this.pivot = new Vector2(0.5, 0.5);
|
|
24974
|
-
return _this;
|
|
24969
|
+
* A drawable GUI object. Controls form a tree independent from the VFXItem
|
|
24970
|
+
* scene tree. UIControl is the bridge between both trees.
|
|
24971
|
+
*/ var Control = /*#__PURE__*/ function() {
|
|
24972
|
+
function Control(engine) {
|
|
24973
|
+
this.engine = engine;
|
|
24974
|
+
this._parent = null;
|
|
24975
|
+
this._visible = true;
|
|
24976
|
+
this._enabled = true;
|
|
24977
|
+
this._mouseFilter = exports.MouseFilter.Stop;
|
|
24978
|
+
this._mouseBehaviorRecursive = exports.MouseBehaviorRecursive.Inherited;
|
|
24979
|
+
this._focusMode = exports.FocusMode.None;
|
|
24980
|
+
this._focusBehaviorRecursive = exports.FocusBehaviorRecursive.Inherited;
|
|
24981
|
+
this._defaultCursorShape = exports.CursorShape.Arrow;
|
|
24982
|
+
this._rotation = 0;
|
|
24983
|
+
this.transformDirty = true;
|
|
24984
|
+
this.cachedTransform = new Matrix3();
|
|
24985
|
+
this.eventEmitter = new EventEmitter();
|
|
24986
|
+
this.disposed = false;
|
|
24987
|
+
this./** Scene-tree bridge that owns this GUI object, if any. */ owner = null;
|
|
24988
|
+
this.position = new Vector2();
|
|
24989
|
+
this.size = new Vector2(1, 1);
|
|
24990
|
+
this.anchorMin = new Vector2();
|
|
24991
|
+
this.anchorMax = new Vector2();
|
|
24992
|
+
this.offsetMin = new Vector2();
|
|
24993
|
+
this.offsetMax = new Vector2(1, 1);
|
|
24994
|
+
this.pivot = new Vector2(0.5, 0.5);
|
|
24995
|
+
this.scale = new Vector2(1, 1);
|
|
24996
|
+
this.shear = new Vector2();
|
|
24997
|
+
this.mouseForcePassScrollEvents = true;
|
|
24998
|
+
this.clipContents = false;
|
|
24975
24999
|
}
|
|
24976
|
-
var _proto =
|
|
24977
|
-
|
|
24978
|
-
|
|
24979
|
-
|
|
24980
|
-
|
|
24981
|
-
|
|
24982
|
-
|
|
24983
|
-
|
|
24984
|
-
|
|
24985
|
-
|
|
24986
|
-
|
|
24987
|
-
Transform.prototype.fromData.call(this, data);
|
|
24988
|
-
if (this.size.x !== 0 && this.size.y !== 0) {
|
|
24989
|
-
this.pivot.set(this.anchor.x / this.size.x, this.anchor.y / this.size.y);
|
|
25000
|
+
var _proto = Control.prototype;
|
|
25001
|
+
_proto.on = function on(eventName, listener, options) {
|
|
25002
|
+
this.eventEmitter.on(eventName, listener, options);
|
|
25003
|
+
};
|
|
25004
|
+
_proto.off = function off(eventName, listener) {
|
|
25005
|
+
this.eventEmitter.off(eventName, listener);
|
|
25006
|
+
};
|
|
25007
|
+
_proto.setPosition = function setPosition(x, y, keepOffsets) {
|
|
25008
|
+
if (keepOffsets === void 0) keepOffsets = false;
|
|
25009
|
+
if (this.position.x === x && this.position.y === y) {
|
|
25010
|
+
return;
|
|
24990
25011
|
}
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
|
|
25012
|
+
var rect = {
|
|
25013
|
+
position: new Vector2(x, y),
|
|
25014
|
+
size: this.size.clone()
|
|
25015
|
+
};
|
|
25016
|
+
if (keepOffsets && this.parent) {
|
|
25017
|
+
this.computeAnchors(rect, this.getParentRect());
|
|
25018
|
+
} else {
|
|
25019
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
24995
25020
|
}
|
|
24996
|
-
|
|
24997
|
-
|
|
24998
|
-
|
|
24999
|
-
|
|
25021
|
+
this.updateLayout();
|
|
25022
|
+
};
|
|
25023
|
+
_proto.setSize = function setSize(width, height) {
|
|
25024
|
+
if (this.size.x === width && this.size.y === height) {
|
|
25025
|
+
return;
|
|
25000
25026
|
}
|
|
25001
|
-
|
|
25002
|
-
|
|
25003
|
-
|
|
25004
|
-
|
|
25027
|
+
var rect = {
|
|
25028
|
+
position: this.position.clone(),
|
|
25029
|
+
size: new Vector2(width, height)
|
|
25030
|
+
};
|
|
25031
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
25032
|
+
this.updateLayout();
|
|
25033
|
+
};
|
|
25034
|
+
_proto.setScale = function setScale(x, y) {
|
|
25035
|
+
if (this.scale.x !== x || this.scale.y !== y) {
|
|
25036
|
+
this.scale.set(x, y);
|
|
25037
|
+
this.markTransformDirty();
|
|
25005
25038
|
}
|
|
25006
|
-
|
|
25007
|
-
|
|
25008
|
-
|
|
25009
|
-
this.
|
|
25039
|
+
};
|
|
25040
|
+
_proto.setRotation = function setRotation(degrees) {
|
|
25041
|
+
if (this._rotation !== degrees) {
|
|
25042
|
+
this._rotation = degrees;
|
|
25043
|
+
this.markTransformDirty();
|
|
25044
|
+
}
|
|
25045
|
+
};
|
|
25046
|
+
_proto.setShear = function setShear(x, y) {
|
|
25047
|
+
if (this.shear.x !== x || this.shear.y !== y) {
|
|
25048
|
+
this.shear.set(x, y);
|
|
25049
|
+
this.markTransformDirty();
|
|
25050
|
+
}
|
|
25051
|
+
};
|
|
25052
|
+
_proto.setPivot = function setPivot(x, y) {
|
|
25053
|
+
if (this.pivot.x !== x || this.pivot.y !== y) {
|
|
25054
|
+
this.pivot.set(x, y);
|
|
25055
|
+
this.markTransformDirty();
|
|
25010
25056
|
}
|
|
25011
25057
|
};
|
|
25012
|
-
// ── layout-input setters(改完 → sizeChanged 重算)──────
|
|
25013
25058
|
_proto.setAnchorMin = function setAnchorMin(x, y) {
|
|
25014
25059
|
if (this.anchorMin.x !== x || this.anchorMin.y !== y) {
|
|
25015
|
-
this.anchorMin.x
|
|
25016
|
-
this.
|
|
25017
|
-
this.sizeChanged();
|
|
25060
|
+
this.anchorMin.set(x, y);
|
|
25061
|
+
this.updateLayout();
|
|
25018
25062
|
}
|
|
25019
25063
|
};
|
|
25020
25064
|
_proto.setAnchorMax = function setAnchorMax(x, y) {
|
|
25021
25065
|
if (this.anchorMax.x !== x || this.anchorMax.y !== y) {
|
|
25022
|
-
this.anchorMax.x
|
|
25023
|
-
this.
|
|
25024
|
-
this.sizeChanged();
|
|
25066
|
+
this.anchorMax.set(x, y);
|
|
25067
|
+
this.updateLayout();
|
|
25025
25068
|
}
|
|
25026
25069
|
};
|
|
25027
25070
|
_proto.setOffsetMin = function setOffsetMin(x, y) {
|
|
25028
25071
|
if (this.offsetMin.x !== x || this.offsetMin.y !== y) {
|
|
25029
|
-
this.offsetMin.x
|
|
25030
|
-
this.
|
|
25031
|
-
this.sizeChanged();
|
|
25072
|
+
this.offsetMin.set(x, y);
|
|
25073
|
+
this.updateLayout();
|
|
25032
25074
|
}
|
|
25033
25075
|
};
|
|
25034
25076
|
_proto.setOffsetMax = function setOffsetMax(x, y) {
|
|
25035
25077
|
if (this.offsetMax.x !== x || this.offsetMax.y !== y) {
|
|
25036
|
-
this.offsetMax.x
|
|
25037
|
-
this.
|
|
25038
|
-
this.sizeChanged();
|
|
25039
|
-
}
|
|
25040
|
-
};
|
|
25041
|
-
/**
|
|
25042
|
-
* 设置 rect 内的归一化轴心 `(0..1)`,同时把 `transform.anchor`(矩阵旋转/缩放中心)同步到 `pivot * size`。
|
|
25043
|
-
* 不重算 rect(pivot 只决定 setSize 行为,不直接影响当前 rect 位置 / 尺寸)
|
|
25044
|
-
*/ _proto.setPivot = function setPivot(x, y) {
|
|
25045
|
-
if (this.pivot.x !== x || this.pivot.y !== y) {
|
|
25046
|
-
this.pivot.x = x;
|
|
25047
|
-
this.pivot.y = y;
|
|
25048
|
-
// 同步 transform.anchor(像素 pivot)= pivot * size,让旋转/缩放绕同一点
|
|
25049
|
-
this.anchor.set(this.pivot.x * this.size.x, this.pivot.y * this.size.y, this.anchor.z);
|
|
25078
|
+
this.offsetMax.set(x, y);
|
|
25079
|
+
this.updateLayout();
|
|
25050
25080
|
}
|
|
25051
25081
|
};
|
|
25052
|
-
|
|
25053
|
-
* 重写父类 `setPosition`:
|
|
25054
|
-
* - 顶层(无 RectTransform 父):直接 `super.setPosition` 写位置,触发 `sizeChanged` 传播
|
|
25055
|
-
* - 非顶层:语义为"设置 rect 左下角到 (x, y)",反推 offset 维持当前 anchor,然后 `sizeChanged` 重算
|
|
25056
|
-
*
|
|
25057
|
-
* @param keepOffsets - 默认 false。true 时反推 anchor 而非 offset(rect 在屏幕上不动,但 anchor 比例改变)
|
|
25058
|
-
*/ _proto.setPosition = function setPosition(x, y, z, keepOffsets) {
|
|
25059
|
-
if (keepOffsets === void 0) keepOffsets = false;
|
|
25060
|
-
if (!_instanceof1(this.parentTransform, RectTransform)) {
|
|
25061
|
-
// 顶层:直接写,然后传播给子节点
|
|
25062
|
-
Transform.prototype.setPosition.call(this, x, y, z);
|
|
25063
|
-
this.sizeChanged();
|
|
25064
|
-
return;
|
|
25065
|
-
}
|
|
25066
|
-
var parentRect = {
|
|
25067
|
-
position: new Vector2(0, 0),
|
|
25068
|
-
size: this.parentTransform.size.clone()
|
|
25069
|
-
};
|
|
25070
|
-
var newRect = {
|
|
25071
|
-
position: new Vector2(x, y),
|
|
25072
|
-
size: this.size.clone()
|
|
25073
|
-
};
|
|
25074
|
-
if (keepOffsets) {
|
|
25075
|
-
this.computeAnchors(newRect, parentRect);
|
|
25076
|
-
} else {
|
|
25077
|
-
this.computeOffsets(newRect, parentRect);
|
|
25078
|
-
}
|
|
25079
|
-
this.sizeChanged();
|
|
25080
|
-
if (this.position.z !== z) {
|
|
25081
|
-
Transform.prototype.setPosition.call(this, this.position.x, this.position.y, z);
|
|
25082
|
-
}
|
|
25083
|
-
};
|
|
25084
|
-
/**
|
|
25085
|
-
* 重写父类 `setSize`:
|
|
25086
|
-
* - 顶层:直接 `super.setSize`,触发 `sizeChanged` 传播
|
|
25087
|
-
* - 非顶层:反推 offset 维持当前 anchor,然后 `sizeChanged` 重算
|
|
25088
|
-
*/ _proto.setSize = function setSize(x, y) {
|
|
25089
|
-
if (this.size.x === x && this.size.y === y) {
|
|
25090
|
-
return;
|
|
25091
|
-
}
|
|
25092
|
-
if (!_instanceof1(this.parentTransform, RectTransform)) {
|
|
25093
|
-
Transform.prototype.setSize.call(this, x, y);
|
|
25094
|
-
this.sizeChanged();
|
|
25095
|
-
return;
|
|
25096
|
-
}
|
|
25097
|
-
// 围绕 pivot 对称缩放:Δsize 在 offsetMin / offsetMax 上按 pivot / (1-pivot) 比例分配。
|
|
25098
|
-
// 例如 pivot=(0.5, 0.5) → 两边各 ±Δ/2,rect 居中扩展;pivot=(0, 0) → offsetMin 不动、offsetMax 全吃,rect 从左下扩展
|
|
25099
|
-
var dw = x - this.size.x;
|
|
25100
|
-
var dh = y - this.size.y;
|
|
25101
|
-
this.offsetMin.set(this.offsetMin.x - this.pivot.x * dw, this.offsetMin.y - this.pivot.y * dh);
|
|
25102
|
-
this.offsetMax.set(this.offsetMax.x + (1 - this.pivot.x) * dw, this.offsetMax.y + (1 - this.pivot.y) * dh);
|
|
25103
|
-
this.sizeChanged();
|
|
25104
|
-
};
|
|
25105
|
-
// ── rect query ───────────────────────────────────────
|
|
25106
|
-
/**
|
|
25107
|
-
* 当前自身 rect(在父 vertex 坐标下,Y 向上)。`sizeChanged` 之后才有意义
|
|
25108
|
-
*/ _proto.getRect = function getRect() {
|
|
25082
|
+
_proto.getRect = function getRect() {
|
|
25109
25083
|
return {
|
|
25110
|
-
position:
|
|
25084
|
+
position: this.position.clone(),
|
|
25111
25085
|
size: this.size.clone()
|
|
25112
25086
|
};
|
|
25113
25087
|
};
|
|
25114
|
-
|
|
25115
|
-
|
|
25116
|
-
|
|
25117
|
-
|
|
25118
|
-
|
|
25119
|
-
|
|
25120
|
-
|
|
25121
|
-
|
|
25122
|
-
|
|
25123
|
-
this.
|
|
25124
|
-
this.
|
|
25125
|
-
|
|
25126
|
-
|
|
25127
|
-
|
|
25128
|
-
|
|
25129
|
-
|
|
25130
|
-
|
|
25131
|
-
|
|
25132
|
-
|
|
25133
|
-
|
|
25134
|
-
|
|
25135
|
-
*
|
|
25136
|
-
* 1. 父是 RectTransform → 从 `parent.size` 求自身 rect,通过 `super.setPosition / super.setSize` 写回
|
|
25137
|
-
* (避免触发本类 setPosition / setSize 重写)
|
|
25138
|
-
* 2. 顶层(无 RectTransform 父):自身 size 视为权威值(由 CanvasLayer 等外部直接写),不自解算
|
|
25139
|
-
* 3. 遍历 `children` 中所有 RectTransform 子节点,直接调它们的 `sizeChanged()` 链式传播
|
|
25140
|
-
*/ _proto.sizeChanged = function sizeChanged() {
|
|
25141
|
-
if (_instanceof1(this.parentTransform, RectTransform)) {
|
|
25142
|
-
var parentSize = this.parentTransform.size;
|
|
25143
|
-
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25144
|
-
var bottom = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25145
|
-
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25146
|
-
var top = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25147
|
-
Transform.prototype.setPosition.call(this, left, bottom, this.position.z);
|
|
25148
|
-
Transform.prototype.setSize.call(this, right - left, top - bottom);
|
|
25149
|
-
}
|
|
25150
|
-
// size 更新后同步 transform.anchor(矩阵旋转/缩放中心)= pivot * size,跟 setPivot 保持统一
|
|
25151
|
-
this.anchor.set(this.pivot.x * this.size.x, this.pivot.y * this.size.y, this.anchor.z);
|
|
25152
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25153
|
-
var child = _step.value;
|
|
25154
|
-
if (_instanceof1(child, RectTransform)) {
|
|
25155
|
-
child.sizeChanged();
|
|
25156
|
-
}
|
|
25157
|
-
}
|
|
25158
|
-
};
|
|
25159
|
-
/**
|
|
25160
|
-
* 给定目标 rect 反推 offsetMin/Max,保持当前 anchor 不变
|
|
25161
|
-
*/ _proto.computeOffsets = function computeOffsets(rect, parentRect) {
|
|
25162
|
-
this.offsetMin.set(rect.position.x - parentRect.position.x - this.anchorMin.x * parentRect.size.x, rect.position.y - parentRect.position.y - this.anchorMin.y * parentRect.size.y);
|
|
25163
|
-
this.offsetMax.set(rect.position.x + rect.size.x - parentRect.position.x - this.anchorMax.x * parentRect.size.x, rect.position.y + rect.size.y - parentRect.position.y - this.anchorMax.y * parentRect.size.y);
|
|
25164
|
-
};
|
|
25165
|
-
/**
|
|
25166
|
-
* 给定目标 rect 反推 anchorMin/Max,保持当前 offset 不变。父 size 为 0 的方向不修改
|
|
25167
|
-
*/ _proto.computeAnchors = function computeAnchors(rect, parentRect) {
|
|
25168
|
-
if (parentRect.size.x !== 0) {
|
|
25169
|
-
var aMinX = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
|
|
25170
|
-
var aMaxX = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
|
|
25171
|
-
this.anchorMin.x = aMinX;
|
|
25172
|
-
this.anchorMax.x = aMaxX;
|
|
25173
|
-
}
|
|
25174
|
-
if (parentRect.size.y !== 0) {
|
|
25175
|
-
var aMinY = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
|
|
25176
|
-
var aMaxY = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
|
|
25177
|
-
this.anchorMin.y = aMinY;
|
|
25178
|
-
this.anchorMax.y = aMaxY;
|
|
25179
|
-
}
|
|
25180
|
-
};
|
|
25181
|
-
// ── preset API ───────────────────────────────────────
|
|
25182
|
-
/**
|
|
25183
|
-
* 把 anchorMin/Max 设为内建预设。
|
|
25184
|
-
* @param keepOffsets - 默认 true:offset 不动,rect 实际位置会跳到新 anchor 计算的位置(要求保留视觉位置请用 setAnchorsAndOffsetsPreset)
|
|
25185
|
-
*/ _proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
|
|
25088
|
+
_proto.getTransform2D = function getTransform2D() {
|
|
25089
|
+
if (this.transformDirty) {
|
|
25090
|
+
var radians = this._rotation * Math.PI / 180;
|
|
25091
|
+
var sin = Math.sin(radians);
|
|
25092
|
+
var cos = Math.cos(radians);
|
|
25093
|
+
var shearX = Math.tan(Math.max(-89, Math.min(89, this.shear.x)) * Math.PI / 180);
|
|
25094
|
+
var shearY = Math.tan(Math.max(-89, Math.min(89, this.shear.y)) * Math.PI / 180);
|
|
25095
|
+
var a = this.scale.x * (cos - sin * shearY);
|
|
25096
|
+
var b = this.scale.x * (sin + cos * shearY);
|
|
25097
|
+
var c = this.scale.y * (cos * shearX - sin);
|
|
25098
|
+
var d = this.scale.y * (sin * shearX + cos);
|
|
25099
|
+
var pivotX = this.pivot.x * this.size.x;
|
|
25100
|
+
var pivotY = this.pivot.y * this.size.y;
|
|
25101
|
+
var tx = this.position.x + pivotX - a * pivotX - c * pivotY;
|
|
25102
|
+
var ty = this.position.y + pivotY - b * pivotX - d * pivotY;
|
|
25103
|
+
this.cachedTransform.set(a, b, 0, c, d, 0, tx, ty, 1);
|
|
25104
|
+
this.transformDirty = false;
|
|
25105
|
+
}
|
|
25106
|
+
return this.cachedTransform;
|
|
25107
|
+
};
|
|
25108
|
+
_proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
|
|
25186
25109
|
if (keepOffsets === void 0) keepOffsets = true;
|
|
25187
|
-
var _ANCHOR_PRESET_TABLE_preset = ANCHOR_PRESET_TABLE[preset],
|
|
25110
|
+
var _ANCHOR_PRESET_TABLE_preset = ANCHOR_PRESET_TABLE[preset], minX = _ANCHOR_PRESET_TABLE_preset[0], minY = _ANCHOR_PRESET_TABLE_preset[1], maxX = _ANCHOR_PRESET_TABLE_preset[2], maxY = _ANCHOR_PRESET_TABLE_preset[3];
|
|
25188
25111
|
if (keepOffsets) {
|
|
25189
|
-
this.anchorMin.set(
|
|
25190
|
-
this.anchorMax.set(
|
|
25191
|
-
} else if (_instanceof1(this.parentTransform, RectTransform)) {
|
|
25192
|
-
var parentRect = {
|
|
25193
|
-
position: new Vector2(0, 0),
|
|
25194
|
-
size: this.parentTransform.size.clone()
|
|
25195
|
-
};
|
|
25196
|
-
var rect = this.getRect();
|
|
25197
|
-
this.anchorMin.set(aMinX, aMinY);
|
|
25198
|
-
this.anchorMax.set(aMaxX, aMaxY);
|
|
25199
|
-
this.computeOffsets(rect, parentRect);
|
|
25112
|
+
this.anchorMin.set(minX, minY);
|
|
25113
|
+
this.anchorMax.set(maxX, maxY);
|
|
25200
25114
|
} else {
|
|
25201
|
-
|
|
25202
|
-
this.anchorMin.set(
|
|
25203
|
-
this.anchorMax.set(
|
|
25115
|
+
var rect = this.getRect();
|
|
25116
|
+
this.anchorMin.set(minX, minY);
|
|
25117
|
+
this.anchorMax.set(maxX, maxY);
|
|
25118
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
25204
25119
|
}
|
|
25205
|
-
this.
|
|
25120
|
+
this.updateLayout();
|
|
25206
25121
|
};
|
|
25207
|
-
|
|
25208
|
-
* 把 offsetMin/Max 设为预设值,使 rect 在父 rect 内落在视觉上对应的位置(留 margin 像素边距)。
|
|
25209
|
-
* 当 anchor 已经按相同 preset 设定时,等价于“贴边放置带 margin 的 rect”。
|
|
25210
|
-
* 使用当前 size 作为 rect 尺寸。
|
|
25211
|
-
*/ _proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
|
|
25122
|
+
_proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
|
|
25212
25123
|
if (margin === void 0) margin = 0;
|
|
25213
|
-
if (!
|
|
25124
|
+
if (!this.parent) {
|
|
25214
25125
|
return;
|
|
25215
25126
|
}
|
|
25216
|
-
var
|
|
25217
|
-
var
|
|
25127
|
+
var parentSize = this.parent.size;
|
|
25128
|
+
var width = this.size.x;
|
|
25129
|
+
var height = this.size.y;
|
|
25218
25130
|
var a = this.anchorMin;
|
|
25219
25131
|
var b = this.anchorMax;
|
|
25220
|
-
var
|
|
25221
|
-
|
|
25222
|
-
var offMinX = 0;
|
|
25223
|
-
var offMaxX = 0;
|
|
25224
|
-
var offMinY = 0;
|
|
25225
|
-
var offMaxY = 0;
|
|
25226
|
-
// X 方向(left / right)
|
|
25132
|
+
var minX = 0, maxX = 0, minY = 0, maxY = 0;
|
|
25133
|
+
// Left edge.
|
|
25227
25134
|
switch(preset){
|
|
25228
25135
|
case "topLeft":
|
|
25229
25136
|
case "bottomLeft":
|
|
@@ -25233,119 +25140,1498 @@ exports.FrameComponent = __decorate([
|
|
|
25233
25140
|
case "leftWide":
|
|
25234
25141
|
case "hcenterWide":
|
|
25235
25142
|
case "fullRect":
|
|
25236
|
-
|
|
25237
|
-
offMaxX = margin + newSizeX - b.x * pw;
|
|
25143
|
+
minX = margin - a.x * parentSize.x;
|
|
25238
25144
|
break;
|
|
25239
25145
|
case "centerTop":
|
|
25240
25146
|
case "centerBottom":
|
|
25241
25147
|
case "center":
|
|
25242
25148
|
case "vcenterWide":
|
|
25243
|
-
|
|
25244
|
-
offMaxX = 0.5 * pw + newSizeX / 2 - b.x * pw;
|
|
25149
|
+
minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
|
|
25245
25150
|
break;
|
|
25246
|
-
|
|
25247
|
-
|
|
25248
|
-
case "centerRight":
|
|
25249
|
-
case "rightWide":
|
|
25250
|
-
offMinX = pw - margin - newSizeX - a.x * pw;
|
|
25251
|
-
offMaxX = pw - margin - b.x * pw;
|
|
25151
|
+
default:
|
|
25152
|
+
minX = parentSize.x - margin - width - a.x * parentSize.x;
|
|
25252
25153
|
break;
|
|
25253
25154
|
}
|
|
25254
|
-
// Y 方向(bottom / top)— Y 向上
|
|
25255
25155
|
switch(preset){
|
|
25156
|
+
case "topLeft":
|
|
25256
25157
|
case "bottomLeft":
|
|
25257
|
-
case "
|
|
25158
|
+
case "centerLeft":
|
|
25159
|
+
case "leftWide":
|
|
25160
|
+
maxX = margin + width - b.x * parentSize.x;
|
|
25161
|
+
break;
|
|
25162
|
+
case "centerTop":
|
|
25258
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":
|
|
25259
25177
|
case "leftWide":
|
|
25260
25178
|
case "rightWide":
|
|
25261
|
-
case "
|
|
25179
|
+
case "topWide":
|
|
25262
25180
|
case "vcenterWide":
|
|
25263
25181
|
case "fullRect":
|
|
25264
|
-
|
|
25265
|
-
offMaxY = margin + newSizeY - b.y * ph;
|
|
25182
|
+
minY = margin - a.y * parentSize.y;
|
|
25266
25183
|
break;
|
|
25267
25184
|
case "centerLeft":
|
|
25268
25185
|
case "centerRight":
|
|
25269
25186
|
case "center":
|
|
25270
25187
|
case "hcenterWide":
|
|
25271
|
-
|
|
25272
|
-
|
|
25188
|
+
minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
|
|
25189
|
+
break;
|
|
25190
|
+
default:
|
|
25191
|
+
minY = parentSize.y - margin - height - a.y * parentSize.y;
|
|
25273
25192
|
break;
|
|
25193
|
+
}
|
|
25194
|
+
// Bottom edge.
|
|
25195
|
+
switch(preset){
|
|
25274
25196
|
case "topLeft":
|
|
25275
25197
|
case "topRight":
|
|
25276
25198
|
case "centerTop":
|
|
25277
25199
|
case "topWide":
|
|
25278
|
-
|
|
25279
|
-
|
|
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:
|
|
25209
|
+
maxY = parentSize.y - margin - b.y * parentSize.y;
|
|
25280
25210
|
break;
|
|
25281
25211
|
}
|
|
25282
|
-
this.offsetMin.set(
|
|
25283
|
-
this.offsetMax.set(
|
|
25284
|
-
this.
|
|
25212
|
+
this.offsetMin.set(minX, minY);
|
|
25213
|
+
this.offsetMax.set(maxX, maxY);
|
|
25214
|
+
this.updateLayout();
|
|
25285
25215
|
};
|
|
25286
|
-
|
|
25287
|
-
* 同时设置 anchor 和 offset,达到“按 preset 摆放并贴边带 margin”的效果。
|
|
25288
|
-
*
|
|
25289
|
-
* 注意第一步用 `keepOffsets=false`(反推 offset 维持 rect 视觉位置),不能用默认 `true`:
|
|
25290
|
-
* 后者会让 rect 的 size 在中间步先跳到错值(因为 anchor 改了 offset 没改),
|
|
25291
|
-
* 第二步 `setOffsetsPreset` 又用这个错 size 算 offset,最终 rect size 不对
|
|
25292
|
-
*/ _proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
|
|
25216
|
+
_proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
|
|
25293
25217
|
if (margin === void 0) margin = 0;
|
|
25294
25218
|
this.setAnchorsPreset(preset, false);
|
|
25295
25219
|
this.setOffsetsPreset(preset, margin);
|
|
25296
25220
|
};
|
|
25297
|
-
|
|
25298
|
-
|
|
25299
|
-
|
|
25300
|
-
|
|
25301
|
-
|
|
25302
|
-
|
|
25221
|
+
_proto.getGlobalTransform2D = function getGlobalTransform2D() {
|
|
25222
|
+
var local = this.getTransform2D();
|
|
25223
|
+
return this.parent ? new Matrix3().multiplyMatrices(this.parent.getGlobalTransform2D(), local) : local.clone();
|
|
25224
|
+
};
|
|
25225
|
+
_proto.hasPoint = function hasPoint(point) {
|
|
25226
|
+
return point.x >= 0 && point.y >= 0 && point.x <= this.size.x && point.y <= this.size.y;
|
|
25227
|
+
};
|
|
25228
|
+
_proto.getEffectiveMouseFilter = function getEffectiveMouseFilter() {
|
|
25229
|
+
return this.enabledInHierarchy && this.isMouseRecursiveEnabled() ? this.mouseFilter : exports.MouseFilter.Ignore;
|
|
25230
|
+
};
|
|
25231
|
+
_proto.getFocusModeWithOverride = function getFocusModeWithOverride() {
|
|
25232
|
+
return this.enabledInHierarchy && this.isFocusRecursiveEnabled() ? this.focusMode : exports.FocusMode.None;
|
|
25233
|
+
};
|
|
25234
|
+
_proto.getCursorShape = function getCursorShape(position) {
|
|
25235
|
+
return this.defaultCursorShape;
|
|
25236
|
+
};
|
|
25237
|
+
_proto.focus = function focus() {
|
|
25238
|
+
var _this_root;
|
|
25239
|
+
(_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
|
|
25240
|
+
};
|
|
25241
|
+
_proto.grabFocus = function grabFocus() {
|
|
25242
|
+
this.focus();
|
|
25243
|
+
};
|
|
25244
|
+
_proto.grabClickFocus = function grabClickFocus() {
|
|
25245
|
+
var _this_root;
|
|
25246
|
+
(_this_root = this.root) == null ? void 0 : _this_root.grabControlClickFocus(this);
|
|
25247
|
+
};
|
|
25248
|
+
_proto.releaseFocus = function releaseFocus() {
|
|
25249
|
+
var _this_root;
|
|
25250
|
+
(_this_root = this.root) == null ? void 0 : _this_root.releaseControlFocus(this);
|
|
25251
|
+
};
|
|
25252
|
+
_proto.warpMouse = function warpMouse(position) {
|
|
25253
|
+
var _this_root;
|
|
25254
|
+
var matrix = this.getGlobalTransform2D().elements;
|
|
25255
|
+
(_this_root = this.root) == null ? void 0 : _this_root.warpControlMouse(new Vector2(matrix[0] * position.x + matrix[3] * position.y + matrix[6], matrix[1] * position.x + matrix[4] * position.y + matrix[7]));
|
|
25256
|
+
};
|
|
25257
|
+
/** Converts a window-space position into this control's local coordinates. */ _proto.makePositionLocal = function makePositionLocal(position) {
|
|
25258
|
+
var transform = this.getGlobalTransform2D().clone();
|
|
25259
|
+
if (Math.abs(transform.determinant()) < 1e-12) {
|
|
25260
|
+
return new Vector2();
|
|
25261
|
+
}
|
|
25262
|
+
var elements = transform.invert().elements;
|
|
25263
|
+
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
25264
|
+
};
|
|
25265
|
+
/** Gets the current mouse position transformed into this control's coordinates. */ _proto.getLocalMousePosition = function getLocalMousePosition() {
|
|
25266
|
+
var root = this.root;
|
|
25267
|
+
return root ? this.makePositionLocal(root.getMousePosition()) : new Vector2();
|
|
25268
|
+
};
|
|
25269
|
+
_proto.update = function update(deltaTime) {};
|
|
25270
|
+
_proto.draw = function draw() {
|
|
25271
|
+
// OVERRIDE
|
|
25272
|
+
};
|
|
25273
|
+
_proto.onDestroy = function onDestroy() {};
|
|
25274
|
+
/** @internal */ _proto.drawInternal = function drawInternal() {
|
|
25275
|
+
if (!this.visibleInHierarchy || this.disposed) {
|
|
25276
|
+
return;
|
|
25277
|
+
}
|
|
25278
|
+
var graphics = this.engine.graphics;
|
|
25279
|
+
graphics.pushTransform(this.getTransform2D());
|
|
25280
|
+
this.draw();
|
|
25281
|
+
graphics.popTransform();
|
|
25282
|
+
};
|
|
25283
|
+
_proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
|
|
25284
|
+
this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
|
|
25285
|
+
};
|
|
25286
|
+
_proto.drawPolyline = function drawPolyline(points, color, thickness) {
|
|
25287
|
+
this.engine.graphics.drawLines(points, color, thickness);
|
|
25288
|
+
};
|
|
25289
|
+
_proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
|
|
25290
|
+
this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
|
|
25291
|
+
};
|
|
25292
|
+
_proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
|
|
25293
|
+
this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
|
|
25294
|
+
};
|
|
25295
|
+
_proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
|
|
25296
|
+
this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
|
|
25297
|
+
};
|
|
25298
|
+
_proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
|
|
25299
|
+
this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
|
|
25300
|
+
};
|
|
25301
|
+
_proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
|
|
25302
|
+
this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
|
|
25303
|
+
};
|
|
25304
|
+
_proto.fillRect = function fillRect(x, y, width, height, color) {
|
|
25305
|
+
this.engine.graphics.fillRectangle(x, y, width, height, color);
|
|
25306
|
+
};
|
|
25307
|
+
_proto.fillCircle = function fillCircle(cx, cy, radius, color) {
|
|
25308
|
+
this.engine.graphics.fillCircle(cx, cy, radius, color);
|
|
25309
|
+
};
|
|
25310
|
+
_proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
|
|
25311
|
+
this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
|
|
25312
|
+
};
|
|
25313
|
+
_proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
|
|
25314
|
+
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
25315
|
+
};
|
|
25316
|
+
_proto.onMouseEnter = function onMouseEnter(location) {};
|
|
25317
|
+
_proto.onMouseMove = function onMouseMove(event) {};
|
|
25318
|
+
_proto.onMouseLeave = function onMouseLeave() {};
|
|
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) {};
|
|
25325
|
+
_proto.onKeyDown = function onKeyDown(event) {};
|
|
25326
|
+
_proto.onKeyUp = function onKeyUp(event) {};
|
|
25327
|
+
_proto.onGotFocus = function onGotFocus() {};
|
|
25328
|
+
_proto.onLostFocus = function onLostFocus() {};
|
|
25329
|
+
/** @internal */ _proto.invokeGetDragData = function invokeGetDragData(position) {
|
|
25330
|
+
return this.getDragData(position);
|
|
25331
|
+
};
|
|
25332
|
+
/** @internal */ _proto.invokeCanDropData = function invokeCanDropData(position, data) {
|
|
25333
|
+
return this.canDropData(position, data);
|
|
25334
|
+
};
|
|
25335
|
+
/** @internal */ _proto.invokeDropData = function invokeDropData(position, data) {
|
|
25336
|
+
this.dropData(position, data);
|
|
25337
|
+
};
|
|
25338
|
+
_proto.getDragData = function getDragData(position) {
|
|
25339
|
+
return null;
|
|
25340
|
+
};
|
|
25341
|
+
_proto.canDropData = function canDropData(position, data) {
|
|
25342
|
+
return false;
|
|
25343
|
+
};
|
|
25344
|
+
_proto.dropData = function dropData(position, data) {};
|
|
25345
|
+
_proto.dispose = function dispose() {
|
|
25346
|
+
if (this.disposed) {
|
|
25347
|
+
return;
|
|
25348
|
+
}
|
|
25349
|
+
this.disposed = true;
|
|
25350
|
+
this.onDestroy();
|
|
25351
|
+
this.parent = null;
|
|
25352
|
+
this.owner = null;
|
|
25353
|
+
};
|
|
25354
|
+
/** @internal */ _proto.updateLayout = function updateLayout() {
|
|
25355
|
+
var _this_parent;
|
|
25356
|
+
var _this_parent_size;
|
|
25357
|
+
var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
|
|
25358
|
+
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25359
|
+
var top = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25360
|
+
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25361
|
+
var bottom = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25362
|
+
this.applyBounds(left, top, right - left, bottom - top);
|
|
25363
|
+
};
|
|
25364
|
+
_proto.applyBounds = function applyBounds(x, y, width, height) {
|
|
25365
|
+
var locationChanged = this.position.x !== x || this.position.y !== y;
|
|
25366
|
+
var sizeChanged = this.size.x !== width || this.size.y !== height;
|
|
25367
|
+
if (!locationChanged && !sizeChanged) {
|
|
25368
|
+
return;
|
|
25369
|
+
}
|
|
25370
|
+
this.position.set(x, y);
|
|
25371
|
+
this.size.set(width, height);
|
|
25372
|
+
this.markTransformDirty();
|
|
25373
|
+
if (locationChanged) {
|
|
25374
|
+
this.eventEmitter.emit("locationChanged", this);
|
|
25375
|
+
}
|
|
25376
|
+
if (sizeChanged) {
|
|
25377
|
+
this.eventEmitter.emit("sizeChanged", this);
|
|
25378
|
+
if (_instanceof1(this, ContainerControl)) {
|
|
25379
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25380
|
+
var child = _step.value;
|
|
25381
|
+
child.updateLayout();
|
|
25382
|
+
}
|
|
25383
|
+
}
|
|
25384
|
+
}
|
|
25385
|
+
};
|
|
25386
|
+
_proto.markTransformDirty = function markTransformDirty() {
|
|
25387
|
+
var _this_root;
|
|
25388
|
+
this.transformDirty = true;
|
|
25389
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25390
|
+
};
|
|
25391
|
+
_proto.getParentRect = function getParentRect() {
|
|
25392
|
+
var _this_parent;
|
|
25393
|
+
var _this_parent_size_clone;
|
|
25394
|
+
return {
|
|
25395
|
+
position: new Vector2(),
|
|
25396
|
+
size: (_this_parent_size_clone = (_this_parent = this.parent) == null ? void 0 : _this_parent.size.clone()) != null ? _this_parent_size_clone : new Vector2()
|
|
25397
|
+
};
|
|
25398
|
+
};
|
|
25399
|
+
_proto.computeOffsets = function computeOffsets(rect, parentRect) {
|
|
25400
|
+
this.offsetMin.set(rect.position.x - parentRect.position.x - this.anchorMin.x * parentRect.size.x, rect.position.y - parentRect.position.y - this.anchorMin.y * parentRect.size.y);
|
|
25401
|
+
this.offsetMax.set(rect.position.x + rect.size.x - parentRect.position.x - this.anchorMax.x * parentRect.size.x, rect.position.y + rect.size.y - parentRect.position.y - this.anchorMax.y * parentRect.size.y);
|
|
25402
|
+
};
|
|
25403
|
+
_proto.computeAnchors = function computeAnchors(rect, parentRect) {
|
|
25404
|
+
if (parentRect.size.x !== 0) {
|
|
25405
|
+
this.anchorMin.x = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
|
|
25406
|
+
this.anchorMax.x = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
|
|
25407
|
+
}
|
|
25408
|
+
if (parentRect.size.y !== 0) {
|
|
25409
|
+
this.anchorMin.y = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
|
|
25410
|
+
this.anchorMax.y = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
|
|
25411
|
+
}
|
|
25412
|
+
};
|
|
25413
|
+
_proto.isMouseRecursiveEnabled = function isMouseRecursiveEnabled() {
|
|
25414
|
+
if (this.mouseBehaviorRecursive === exports.MouseBehaviorRecursive.Inherited) {
|
|
25415
|
+
var _this_parent;
|
|
25416
|
+
var _this_parent_isMouseRecursiveEnabled;
|
|
25417
|
+
return (_this_parent_isMouseRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isMouseRecursiveEnabled()) != null ? _this_parent_isMouseRecursiveEnabled : true;
|
|
25418
|
+
}
|
|
25419
|
+
return this.mouseBehaviorRecursive === exports.MouseBehaviorRecursive.Enabled;
|
|
25420
|
+
};
|
|
25421
|
+
_proto.isFocusRecursiveEnabled = function isFocusRecursiveEnabled() {
|
|
25422
|
+
if (this.focusBehaviorRecursive === exports.FocusBehaviorRecursive.Inherited) {
|
|
25423
|
+
var _this_parent;
|
|
25424
|
+
var _this_parent_isFocusRecursiveEnabled;
|
|
25425
|
+
return (_this_parent_isFocusRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isFocusRecursiveEnabled()) != null ? _this_parent_isFocusRecursiveEnabled : true;
|
|
25426
|
+
}
|
|
25427
|
+
return this.focusBehaviorRecursive === exports.FocusBehaviorRecursive.Enabled;
|
|
25428
|
+
};
|
|
25429
|
+
_create_class(Control, [
|
|
25430
|
+
{
|
|
25431
|
+
key: "parent",
|
|
25432
|
+
get: function get() {
|
|
25433
|
+
return this._parent;
|
|
25434
|
+
},
|
|
25435
|
+
set: function set(value) {
|
|
25436
|
+
var _this__parent;
|
|
25437
|
+
if (value === this._parent) {
|
|
25438
|
+
return;
|
|
25439
|
+
}
|
|
25440
|
+
var previousRoot = this.root;
|
|
25441
|
+
(_this__parent = this._parent) == null ? void 0 : _this__parent.removeChildInternal(this);
|
|
25442
|
+
this._parent = value;
|
|
25443
|
+
value == null ? void 0 : value.addChildInternal(this);
|
|
25444
|
+
this.updateLayout();
|
|
25445
|
+
var nextRoot = this.root;
|
|
25446
|
+
if (previousRoot && previousRoot !== nextRoot) {
|
|
25447
|
+
previousRoot.controlRemoved(this);
|
|
25448
|
+
}
|
|
25449
|
+
nextRoot == null ? void 0 : nextRoot.controlTreeChanged();
|
|
25450
|
+
this.eventEmitter.emit("parentChanged", this);
|
|
25451
|
+
}
|
|
25452
|
+
},
|
|
25453
|
+
{
|
|
25454
|
+
key: "item",
|
|
25455
|
+
get: /** Scene item exposed through the optional UIControl bridge. */ function get() {
|
|
25456
|
+
var _this_owner;
|
|
25457
|
+
var _this_owner_item;
|
|
25458
|
+
return (_this_owner_item = (_this_owner = this.owner) == null ? void 0 : _this_owner.item) != null ? _this_owner_item : null;
|
|
25459
|
+
}
|
|
25460
|
+
},
|
|
25461
|
+
{
|
|
25462
|
+
key: "indexInParent",
|
|
25463
|
+
get: function get() {
|
|
25464
|
+
var _this_parent;
|
|
25465
|
+
var _this_parent_getChildIndex;
|
|
25466
|
+
return (_this_parent_getChildIndex = (_this_parent = this.parent) == null ? void 0 : _this_parent.getChildIndex(this)) != null ? _this_parent_getChildIndex : -1;
|
|
25467
|
+
},
|
|
25468
|
+
set: function set(value) {
|
|
25469
|
+
var _this_parent;
|
|
25470
|
+
(_this_parent = this.parent) == null ? void 0 : _this_parent.changeChildIndex(this, value);
|
|
25471
|
+
}
|
|
25472
|
+
},
|
|
25473
|
+
{
|
|
25474
|
+
key: "visible",
|
|
25475
|
+
get: function get() {
|
|
25476
|
+
return this._visible;
|
|
25477
|
+
},
|
|
25478
|
+
set: function set(value) {
|
|
25479
|
+
if (this._visible !== value) {
|
|
25480
|
+
var _this_root;
|
|
25481
|
+
this._visible = value;
|
|
25482
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25483
|
+
}
|
|
25484
|
+
}
|
|
25485
|
+
},
|
|
25486
|
+
{
|
|
25487
|
+
key: "visibleInHierarchy",
|
|
25488
|
+
get: function get() {
|
|
25489
|
+
var _this_parent;
|
|
25490
|
+
var _this_parent_visibleInHierarchy;
|
|
25491
|
+
return this.visible && ((_this_parent_visibleInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.visibleInHierarchy) != null ? _this_parent_visibleInHierarchy : true);
|
|
25492
|
+
}
|
|
25493
|
+
},
|
|
25494
|
+
{
|
|
25495
|
+
key: "enabled",
|
|
25496
|
+
get: function get() {
|
|
25497
|
+
return this._enabled;
|
|
25498
|
+
},
|
|
25499
|
+
set: function set(value) {
|
|
25500
|
+
if (this._enabled !== value) {
|
|
25501
|
+
var _this_root;
|
|
25502
|
+
this._enabled = value;
|
|
25503
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25504
|
+
}
|
|
25505
|
+
}
|
|
25506
|
+
},
|
|
25507
|
+
{
|
|
25508
|
+
key: "enabledInHierarchy",
|
|
25509
|
+
get: function get() {
|
|
25510
|
+
var _this_parent;
|
|
25511
|
+
var _this_parent_enabledInHierarchy;
|
|
25512
|
+
return this.enabled && ((_this_parent_enabledInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.enabledInHierarchy) != null ? _this_parent_enabledInHierarchy : true);
|
|
25513
|
+
}
|
|
25514
|
+
},
|
|
25515
|
+
{
|
|
25516
|
+
key: "mouseFilter",
|
|
25517
|
+
get: function get() {
|
|
25518
|
+
return this._mouseFilter;
|
|
25519
|
+
},
|
|
25520
|
+
set: function set(value) {
|
|
25521
|
+
if (this._mouseFilter !== value) {
|
|
25522
|
+
var _this_root;
|
|
25523
|
+
this._mouseFilter = value;
|
|
25524
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25525
|
+
}
|
|
25526
|
+
}
|
|
25527
|
+
},
|
|
25528
|
+
{
|
|
25529
|
+
key: "mouseBehaviorRecursive",
|
|
25530
|
+
get: function get() {
|
|
25531
|
+
return this._mouseBehaviorRecursive;
|
|
25532
|
+
},
|
|
25533
|
+
set: function set(value) {
|
|
25534
|
+
if (this._mouseBehaviorRecursive !== value) {
|
|
25535
|
+
var _this_root;
|
|
25536
|
+
this._mouseBehaviorRecursive = value;
|
|
25537
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25538
|
+
}
|
|
25539
|
+
}
|
|
25540
|
+
},
|
|
25541
|
+
{
|
|
25542
|
+
key: "focusMode",
|
|
25543
|
+
get: function get() {
|
|
25544
|
+
return this._focusMode;
|
|
25545
|
+
},
|
|
25546
|
+
set: function set(value) {
|
|
25547
|
+
if (this._focusMode !== value) {
|
|
25548
|
+
var _this_root;
|
|
25549
|
+
this._focusMode = value;
|
|
25550
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25551
|
+
}
|
|
25552
|
+
}
|
|
25553
|
+
},
|
|
25554
|
+
{
|
|
25555
|
+
key: "focusBehaviorRecursive",
|
|
25556
|
+
get: function get() {
|
|
25557
|
+
return this._focusBehaviorRecursive;
|
|
25558
|
+
},
|
|
25559
|
+
set: function set(value) {
|
|
25560
|
+
if (this._focusBehaviorRecursive !== value) {
|
|
25561
|
+
var _this_root;
|
|
25562
|
+
this._focusBehaviorRecursive = value;
|
|
25563
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25564
|
+
}
|
|
25565
|
+
}
|
|
25566
|
+
},
|
|
25567
|
+
{
|
|
25568
|
+
key: "defaultCursorShape",
|
|
25569
|
+
get: function get() {
|
|
25570
|
+
return this._defaultCursorShape;
|
|
25571
|
+
},
|
|
25572
|
+
set: function set(value) {
|
|
25573
|
+
var _this_root;
|
|
25574
|
+
if (this._defaultCursorShape === value) {
|
|
25575
|
+
return;
|
|
25576
|
+
}
|
|
25577
|
+
this._defaultCursorShape = value;
|
|
25578
|
+
(_this_root = this.root) == null ? void 0 : _this_root.updateMouseCursorState();
|
|
25579
|
+
}
|
|
25580
|
+
},
|
|
25581
|
+
{
|
|
25582
|
+
key: "location",
|
|
25583
|
+
get: function get() {
|
|
25584
|
+
return this.position;
|
|
25585
|
+
},
|
|
25586
|
+
set: function set(value) {
|
|
25587
|
+
this.setPosition(value.x, value.y);
|
|
25588
|
+
}
|
|
25589
|
+
},
|
|
25590
|
+
{
|
|
25591
|
+
key: "rotation",
|
|
25592
|
+
get: function get() {
|
|
25593
|
+
return this._rotation;
|
|
25594
|
+
}
|
|
25595
|
+
},
|
|
25596
|
+
{
|
|
25597
|
+
key: "x",
|
|
25598
|
+
get: function get() {
|
|
25599
|
+
return this.position.x;
|
|
25600
|
+
},
|
|
25601
|
+
set: function set(value) {
|
|
25602
|
+
this.setPosition(value, this.position.y);
|
|
25603
|
+
}
|
|
25604
|
+
},
|
|
25605
|
+
{
|
|
25606
|
+
key: "y",
|
|
25607
|
+
get: function get() {
|
|
25608
|
+
return this.position.y;
|
|
25609
|
+
},
|
|
25610
|
+
set: function set(value) {
|
|
25611
|
+
this.setPosition(this.position.x, value);
|
|
25612
|
+
}
|
|
25613
|
+
},
|
|
25614
|
+
{
|
|
25615
|
+
key: "width",
|
|
25616
|
+
get: function get() {
|
|
25617
|
+
return this.size.x;
|
|
25618
|
+
},
|
|
25619
|
+
set: function set(value) {
|
|
25620
|
+
this.setSize(value, this.size.y);
|
|
25621
|
+
}
|
|
25622
|
+
},
|
|
25623
|
+
{
|
|
25624
|
+
key: "height",
|
|
25625
|
+
get: function get() {
|
|
25626
|
+
return this.size.y;
|
|
25627
|
+
},
|
|
25628
|
+
set: function set(value) {
|
|
25629
|
+
this.setSize(this.size.x, value);
|
|
25630
|
+
}
|
|
25631
|
+
},
|
|
25632
|
+
{
|
|
25633
|
+
key: "root",
|
|
25634
|
+
get: function get() {
|
|
25635
|
+
var _this_parent;
|
|
25636
|
+
var _this_parent_root;
|
|
25637
|
+
return _instanceof1(this, RootControl) ? this : (_this_parent_root = (_this_parent = this.parent) == null ? void 0 : _this_parent.root) != null ? _this_parent_root : null;
|
|
25638
|
+
}
|
|
25639
|
+
},
|
|
25640
|
+
{
|
|
25641
|
+
key: "isDisposed",
|
|
25642
|
+
get: function get() {
|
|
25643
|
+
return this.disposed;
|
|
25644
|
+
}
|
|
25645
|
+
}
|
|
25646
|
+
]);
|
|
25647
|
+
return Control;
|
|
25648
|
+
}();
|
|
25649
|
+
/** A Control that owns child Controls. */ var ContainerControl = /*#__PURE__*/ function(Control) {
|
|
25650
|
+
_inherits(ContainerControl, Control);
|
|
25651
|
+
function ContainerControl() {
|
|
25652
|
+
var _this;
|
|
25653
|
+
_this = Control.apply(this, arguments) || this;
|
|
25654
|
+
_this.children = [];
|
|
25655
|
+
return _this;
|
|
25656
|
+
}
|
|
25657
|
+
var _proto = ContainerControl.prototype;
|
|
25658
|
+
_proto.addChild = function addChild(child) {
|
|
25659
|
+
child.parent = this;
|
|
25660
|
+
return child;
|
|
25661
|
+
};
|
|
25662
|
+
_proto.removeChild = function removeChild(child) {
|
|
25663
|
+
if (child.parent === this) {
|
|
25664
|
+
child.parent = null;
|
|
25665
|
+
}
|
|
25666
|
+
};
|
|
25667
|
+
_proto.getChildIndex = function getChildIndex(child) {
|
|
25668
|
+
return this.children.indexOf(child);
|
|
25669
|
+
};
|
|
25670
|
+
/** @internal */ _proto.changeChildIndex = function changeChildIndex(child, newIndex) {
|
|
25671
|
+
var _this_root;
|
|
25672
|
+
var oldIndex = this.children.indexOf(child);
|
|
25673
|
+
if (oldIndex === newIndex || oldIndex === -1) {
|
|
25674
|
+
return;
|
|
25675
|
+
}
|
|
25676
|
+
this.children.splice(oldIndex, 1);
|
|
25677
|
+
if (newIndex < 0 || newIndex >= this.children.length) {
|
|
25678
|
+
this.children.push(child);
|
|
25679
|
+
} else {
|
|
25680
|
+
this.children.splice(newIndex, 0, child);
|
|
25681
|
+
}
|
|
25682
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25683
|
+
};
|
|
25684
|
+
/** @internal */ _proto.addChildInternal = function addChildInternal(child) {
|
|
25685
|
+
if (!this.children.includes(child)) {
|
|
25686
|
+
this.children.push(child);
|
|
25687
|
+
}
|
|
25688
|
+
};
|
|
25689
|
+
/** @internal */ _proto.removeChildInternal = function removeChildInternal(child) {
|
|
25690
|
+
var index = this.children.indexOf(child);
|
|
25691
|
+
if (index !== -1) {
|
|
25692
|
+
this.children.splice(index, 1);
|
|
25693
|
+
}
|
|
25694
|
+
};
|
|
25695
|
+
_proto.drawSelf = function drawSelf() {
|
|
25696
|
+
Control.prototype.draw.call(this);
|
|
25697
|
+
};
|
|
25698
|
+
_proto.draw = function draw() {
|
|
25699
|
+
this.drawSelf();
|
|
25700
|
+
this.drawChildren();
|
|
25701
|
+
};
|
|
25702
|
+
_proto.drawChildren = function drawChildren() {
|
|
25703
|
+
var graphics = this.engine.graphics;
|
|
25704
|
+
if (this.clipContents) ;
|
|
25705
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25706
|
+
var child = _step.value;
|
|
25707
|
+
if (!child.visible || child.isDisposed) {
|
|
25708
|
+
continue;
|
|
25709
|
+
}
|
|
25710
|
+
graphics.pushTransform(child.getTransform2D());
|
|
25711
|
+
child.draw();
|
|
25712
|
+
graphics.popTransform();
|
|
25713
|
+
}
|
|
25714
|
+
};
|
|
25715
|
+
_proto.update = function update(deltaTime) {
|
|
25716
|
+
Control.prototype.update.call(this, deltaTime);
|
|
25717
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25718
|
+
var child = _step.value;
|
|
25719
|
+
if (child.enabled && !child.isDisposed) {
|
|
25720
|
+
child.update(deltaTime);
|
|
25721
|
+
}
|
|
25722
|
+
}
|
|
25723
|
+
};
|
|
25724
|
+
_proto.dispose = function dispose() {
|
|
25725
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25726
|
+
var child = _step.value;
|
|
25727
|
+
child.dispose();
|
|
25728
|
+
}
|
|
25729
|
+
Control.prototype.dispose.call(this);
|
|
25730
|
+
};
|
|
25731
|
+
return ContainerControl;
|
|
25732
|
+
}(Control);
|
|
25733
|
+
/** Base class for GUI tree roots and input dispatchers. */ var RootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25734
|
+
_inherits(RootControl, ContainerControl);
|
|
25735
|
+
function RootControl() {
|
|
25736
|
+
return ContainerControl.apply(this, arguments);
|
|
25737
|
+
}
|
|
25738
|
+
return RootControl;
|
|
25739
|
+
}(ContainerControl);
|
|
25740
|
+
|
|
25741
|
+
var _obj$4;
|
|
25742
|
+
var cursorNames = (_obj$4 = {}, _obj$4[exports.CursorShape.Arrow] = "default", _obj$4[exports.CursorShape.Ibeam] = "text", _obj$4[exports.CursorShape.PointingHand] = "pointer", _obj$4[exports.CursorShape.Cross] = "crosshair", _obj$4[exports.CursorShape.Wait] = "wait", _obj$4[exports.CursorShape.Busy] = "progress", _obj$4[exports.CursorShape.Drag] = "grab", _obj$4[exports.CursorShape.CanDrop] = "copy", _obj$4[exports.CursorShape.Forbidden] = "not-allowed", _obj$4[exports.CursorShape.Vsize] = "ns-resize", _obj$4[exports.CursorShape.Hsize] = "ew-resize", _obj$4[exports.CursorShape.Bdiagsize] = "nesw-resize", _obj$4[exports.CursorShape.Fdiagsize] = "nwse-resize", _obj$4[exports.CursorShape.Move] = "move", _obj$4[exports.CursorShape.Vsplit] = "row-resize", _obj$4[exports.CursorShape.Hsplit] = "col-resize", _obj$4[exports.CursorShape.Help] = "help", _obj$4);
|
|
25743
|
+
function getButtonMask(button) {
|
|
25744
|
+
switch(button){
|
|
25745
|
+
case exports.MouseButton.Left:
|
|
25746
|
+
return exports.MouseButtonMask.Left;
|
|
25747
|
+
case exports.MouseButton.Right:
|
|
25748
|
+
return exports.MouseButtonMask.Right;
|
|
25749
|
+
case exports.MouseButton.Middle:
|
|
25750
|
+
return exports.MouseButtonMask.Middle;
|
|
25751
|
+
case exports.MouseButton.Xbutton1:
|
|
25752
|
+
return exports.MouseButtonMask.Xbutton1;
|
|
25753
|
+
case exports.MouseButton.Xbutton2:
|
|
25754
|
+
return exports.MouseButtonMask.Xbutton2;
|
|
25755
|
+
default:
|
|
25756
|
+
return exports.MouseButtonMask.None;
|
|
25757
|
+
}
|
|
25758
|
+
}
|
|
25759
|
+
function isWheelButton(button) {
|
|
25760
|
+
return button >= exports.MouseButton.WheelUp && button <= exports.MouseButton.WheelRight;
|
|
25761
|
+
}
|
|
25762
|
+
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25763
|
+
_inherits(CanvasRootControl, ContainerControl);
|
|
25764
|
+
function CanvasRootControl(engine, canvas) {
|
|
25765
|
+
var _this;
|
|
25766
|
+
_this = ContainerControl.call(this, engine) || this;
|
|
25767
|
+
_this.canvas = canvas;
|
|
25768
|
+
_this.mouseFilter = exports.MouseFilter.Ignore;
|
|
25769
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25770
|
+
return _this;
|
|
25771
|
+
}
|
|
25772
|
+
_create_class(CanvasRootControl, [
|
|
25773
|
+
{
|
|
25774
|
+
key: "inputDisabled",
|
|
25775
|
+
get: function get() {
|
|
25776
|
+
var _this_canvas_item;
|
|
25777
|
+
return !this.canvas.receivesEvents || !this.canvas.enabled || !((_this_canvas_item = this.canvas.item) == null ? void 0 : _this_canvas_item.isActive);
|
|
25778
|
+
}
|
|
25779
|
+
}
|
|
25780
|
+
]);
|
|
25781
|
+
return CanvasRootControl;
|
|
25782
|
+
}(ContainerControl);
|
|
25783
|
+
/** Global ordered collection of UICanvas roots. */ var CanvasContainer = /*#__PURE__*/ function(ContainerControl) {
|
|
25784
|
+
_inherits(CanvasContainer, ContainerControl);
|
|
25785
|
+
function CanvasContainer(engine) {
|
|
25786
|
+
var _this;
|
|
25787
|
+
_this = ContainerControl.call(this, engine) || this;
|
|
25788
|
+
_this.mouseFilter = exports.MouseFilter.Ignore;
|
|
25789
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25790
|
+
return _this;
|
|
25791
|
+
}
|
|
25792
|
+
var _proto = CanvasContainer.prototype;
|
|
25793
|
+
_proto.sortCanvases = function sortCanvases() {
|
|
25794
|
+
this.children.sort(function(left, right) {
|
|
25795
|
+
return left.canvas.order - right.canvas.order;
|
|
25796
|
+
});
|
|
25797
|
+
};
|
|
25798
|
+
_proto.addChildInternal = function addChildInternal(child) {
|
|
25799
|
+
ContainerControl.prototype.addChildInternal.call(this, child);
|
|
25800
|
+
this.sortCanvases();
|
|
25801
|
+
};
|
|
25802
|
+
_proto.draw = function draw() {
|
|
25803
|
+
this.sortCanvases();
|
|
25804
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25805
|
+
var child = _step.value;
|
|
25806
|
+
var root = child;
|
|
25807
|
+
if (root.canvas.isVisible) {
|
|
25808
|
+
root.draw();
|
|
25809
|
+
}
|
|
25810
|
+
}
|
|
25811
|
+
};
|
|
25812
|
+
return CanvasContainer;
|
|
25813
|
+
}(ContainerControl);
|
|
25814
|
+
/** Engine window GUI root. Routes events across all UICanvas roots. */ var WindowRootControl = /*#__PURE__*/ function(RootControl) {
|
|
25815
|
+
_inherits(WindowRootControl, RootControl);
|
|
25816
|
+
function WindowRootControl(engine) {
|
|
25817
|
+
var _this;
|
|
25818
|
+
_this = RootControl.call(this, engine) || this;
|
|
25819
|
+
_this.dragThreshold = 10;
|
|
25820
|
+
_this.lastInput = null;
|
|
25821
|
+
_this.gui = {
|
|
25822
|
+
mouseFocus: null,
|
|
25823
|
+
mouseClickGrabber: null,
|
|
25824
|
+
mouseFocusMask: exports.MouseButtonMask.None,
|
|
25825
|
+
mouseOver: null,
|
|
25826
|
+
mouseOverHierarchy: [],
|
|
25827
|
+
touchFocus: new Map(),
|
|
25828
|
+
keyFocus: null,
|
|
25829
|
+
dragAccum: new Vector2(),
|
|
25830
|
+
dragAttempted: false,
|
|
25831
|
+
dragging: false,
|
|
25832
|
+
dragData: null,
|
|
25833
|
+
dragMouseOver: null,
|
|
25834
|
+
dragSuccessful: false,
|
|
25835
|
+
lastMousePosition: new Vector2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY),
|
|
25836
|
+
sendingMouseEnterExit: false,
|
|
25837
|
+
mouseOverUpdatePending: false
|
|
25838
|
+
};
|
|
25839
|
+
_this.mouseFilter = exports.MouseFilter.Ignore;
|
|
25840
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25841
|
+
_this.canvases = new CanvasContainer(engine);
|
|
25842
|
+
_this.canvases.parent = _assert_this_initialized(_this);
|
|
25843
|
+
return _this;
|
|
25844
|
+
}
|
|
25845
|
+
var _proto = WindowRootControl.prototype;
|
|
25846
|
+
_proto.pushInput = function pushInput(event) {
|
|
25847
|
+
event.clearAccepted();
|
|
25848
|
+
this.lastInput = event;
|
|
25849
|
+
this.cleanupInternalState();
|
|
25850
|
+
this.processGUIInput(event);
|
|
25851
|
+
this.postGrabClickFocus();
|
|
25852
|
+
};
|
|
25853
|
+
_proto.isInputHandled = function isInputHandled() {
|
|
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;
|
|
25857
|
+
};
|
|
25858
|
+
_proto.getMousePosition = function getMousePosition() {
|
|
25859
|
+
return this.gui.lastMousePosition.clone();
|
|
25860
|
+
};
|
|
25861
|
+
_proto.guiGetFocusOwner = function guiGetFocusOwner() {
|
|
25862
|
+
return this.isFocusTargetUsable(this.gui.keyFocus) ? this.gui.keyFocus : null;
|
|
25863
|
+
};
|
|
25864
|
+
_proto.guiReleaseFocus = function guiReleaseFocus() {
|
|
25865
|
+
this.releaseControlFocus();
|
|
25866
|
+
};
|
|
25867
|
+
_proto.guiIsDragging = function guiIsDragging() {
|
|
25868
|
+
return this.gui.dragging;
|
|
25869
|
+
};
|
|
25870
|
+
_proto.guiGetDragData = function guiGetDragData() {
|
|
25871
|
+
return this.gui.dragData;
|
|
25872
|
+
};
|
|
25873
|
+
_proto.guiIsDragSuccessful = function guiIsDragSuccessful() {
|
|
25874
|
+
return this.gui.dragSuccessful;
|
|
25875
|
+
};
|
|
25876
|
+
_proto.guiCancelDrag = function guiCancelDrag() {
|
|
25877
|
+
this.endDragging(false);
|
|
25878
|
+
};
|
|
25879
|
+
_proto.grabControlFocus = function grabControlFocus(control) {
|
|
25880
|
+
if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
|
|
25881
|
+
return;
|
|
25882
|
+
}
|
|
25883
|
+
var previous = this.gui.keyFocus;
|
|
25884
|
+
this.gui.keyFocus = control;
|
|
25885
|
+
if (previous && !previous.isDisposed) {
|
|
25886
|
+
previous.onLostFocus();
|
|
25887
|
+
}
|
|
25888
|
+
control.onGotFocus();
|
|
25889
|
+
};
|
|
25890
|
+
_proto.grabControlClickFocus = function grabControlClickFocus(control) {
|
|
25891
|
+
var _this = this;
|
|
25892
|
+
if (this.isControlValid(control)) {
|
|
25893
|
+
this.gui.mouseClickGrabber = control;
|
|
25894
|
+
queueMicrotask(function() {
|
|
25895
|
+
return _this.postGrabClickFocus();
|
|
25896
|
+
});
|
|
25897
|
+
}
|
|
25898
|
+
};
|
|
25899
|
+
_proto.releaseControlFocus = function releaseControlFocus(control) {
|
|
25900
|
+
var previous = this.gui.keyFocus;
|
|
25901
|
+
if (!previous || control && previous !== control) {
|
|
25902
|
+
return;
|
|
25903
|
+
}
|
|
25904
|
+
this.gui.keyFocus = null;
|
|
25905
|
+
if (!previous.isDisposed) {
|
|
25906
|
+
previous.onLostFocus();
|
|
25907
|
+
}
|
|
25908
|
+
};
|
|
25909
|
+
_proto.warpControlMouse = function warpControlMouse(position) {
|
|
25910
|
+
this.gui.lastMousePosition.copyFrom(position);
|
|
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);
|
|
25918
|
+
};
|
|
25919
|
+
_proto.controlStateChanged = function controlStateChanged(control) {
|
|
25920
|
+
if (!this.isControlUsable(control)) {
|
|
25921
|
+
this.dropControlState(control);
|
|
25922
|
+
}
|
|
25923
|
+
this.requestMouseOverUpdate();
|
|
25924
|
+
};
|
|
25925
|
+
_proto.controlRemoved = function controlRemoved(control) {
|
|
25926
|
+
this.dropControlState(control);
|
|
25927
|
+
this.cleanupInternalState();
|
|
25928
|
+
this.requestMouseOverUpdate();
|
|
25929
|
+
};
|
|
25930
|
+
_proto.controlTreeChanged = function controlTreeChanged() {
|
|
25931
|
+
this.requestMouseOverUpdate();
|
|
25932
|
+
};
|
|
25933
|
+
_proto.cancelPointerInput = function cancelPointerInput() {
|
|
25934
|
+
this.dropMouseFocus();
|
|
25935
|
+
this.dropMouseOver();
|
|
25936
|
+
this.gui.touchFocus.clear();
|
|
25937
|
+
this.endDragging(false);
|
|
25938
|
+
this.releaseControlFocus();
|
|
25939
|
+
};
|
|
25940
|
+
_proto.resize = function resize(width, height) {
|
|
25941
|
+
this.setSize(width, height);
|
|
25942
|
+
this.canvases.setSize(width, height);
|
|
25943
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvases.children), _step; !(_step = _iterator()).done;){
|
|
25944
|
+
var root = _step.value;
|
|
25945
|
+
root.setSize(width, height);
|
|
25946
|
+
}
|
|
25947
|
+
};
|
|
25948
|
+
_proto.render = function render() {
|
|
25949
|
+
if (this.canvases.children.length === 0) {
|
|
25950
|
+
return;
|
|
25951
|
+
}
|
|
25952
|
+
this.engine.graphics.begin();
|
|
25953
|
+
this.draw();
|
|
25954
|
+
this.engine.graphics.end();
|
|
25955
|
+
};
|
|
25956
|
+
_proto.update = function update(deltaTime) {
|
|
25957
|
+
if (this.gui.mouseOverUpdatePending) {
|
|
25958
|
+
this.gui.mouseOverUpdatePending = false;
|
|
25959
|
+
this.updateMouseOver(this.gui.lastMousePosition);
|
|
25303
25960
|
}
|
|
25304
|
-
|
|
25305
|
-
|
|
25306
|
-
|
|
25307
|
-
|
|
25308
|
-
|
|
25309
|
-
|
|
25310
|
-
|
|
25311
|
-
|
|
25312
|
-
|
|
25313
|
-
|
|
25314
|
-
|
|
25315
|
-
|
|
25316
|
-
|
|
25961
|
+
RootControl.prototype.update.call(this, deltaTime);
|
|
25962
|
+
};
|
|
25963
|
+
_proto.dispose = function dispose() {
|
|
25964
|
+
this.cancelPointerInput();
|
|
25965
|
+
RootControl.prototype.dispose.call(this);
|
|
25966
|
+
};
|
|
25967
|
+
_proto.processGUIInput = function processGUIInput(event) {
|
|
25968
|
+
if (_instanceof1(event, InputEventKey)) {
|
|
25969
|
+
var target = this.guiGetFocusOwner();
|
|
25970
|
+
if (target) {
|
|
25971
|
+
this.callControlInput(target, event);
|
|
25972
|
+
}
|
|
25973
|
+
} else if (_instanceof1(event, InputEventMouse)) {
|
|
25974
|
+
this.gui.lastMousePosition.copyFrom(event.globalPosition);
|
|
25975
|
+
this.updateMouseOver(event.globalPosition);
|
|
25976
|
+
if (_instanceof1(event, InputEventMouseButton)) {
|
|
25977
|
+
this.processMouseButton(event);
|
|
25978
|
+
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
25979
|
+
this.processMouseMotion(event);
|
|
25980
|
+
}
|
|
25981
|
+
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
25982
|
+
this.processScreenTouch(event);
|
|
25983
|
+
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
25984
|
+
this.processScreenDrag(event);
|
|
25985
|
+
}
|
|
25986
|
+
};
|
|
25987
|
+
_proto.processMouseButton = function processMouseButton(event) {
|
|
25988
|
+
if (isWheelButton(event.buttonIndex)) {
|
|
25989
|
+
var target = this.findInputControl(event.globalPosition);
|
|
25990
|
+
if (target) {
|
|
25991
|
+
this.callGUIInput(target, event);
|
|
25992
|
+
}
|
|
25993
|
+
return;
|
|
25994
|
+
}
|
|
25995
|
+
var mask = getButtonMask(event.buttonIndex);
|
|
25996
|
+
if (event.isPressed()) {
|
|
25997
|
+
var target1 = this.gui.mouseFocusMask !== 0 ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
25998
|
+
this.gui.mouseFocus = target1;
|
|
25999
|
+
if (!target1) {
|
|
26000
|
+
return;
|
|
26001
|
+
}
|
|
26002
|
+
this.gui.mouseFocusMask |= mask;
|
|
26003
|
+
if (event.buttonIndex === exports.MouseButton.Left) {
|
|
26004
|
+
this.gui.dragAccum.setZero();
|
|
26005
|
+
this.gui.dragAttempted = false;
|
|
26006
|
+
this.findClickFocus(target1);
|
|
26007
|
+
}
|
|
26008
|
+
this.callGUIInput(target1, event);
|
|
26009
|
+
} else {
|
|
26010
|
+
if (event.buttonIndex === exports.MouseButton.Left && this.gui.dragging) {
|
|
26011
|
+
this.finishDrop(event.globalPosition);
|
|
26012
|
+
}
|
|
26013
|
+
this.gui.mouseFocusMask &= ~mask;
|
|
26014
|
+
var target2 = this.gui.mouseFocus;
|
|
26015
|
+
if (this.gui.mouseFocusMask === 0) {
|
|
26016
|
+
this.gui.mouseFocus = null;
|
|
26017
|
+
}
|
|
26018
|
+
if (this.isControlUsable(target2)) {
|
|
26019
|
+
this.callGUIInput(target2, event);
|
|
26020
|
+
}
|
|
26021
|
+
}
|
|
26022
|
+
};
|
|
26023
|
+
_proto.processMouseMotion = function processMouseMotion(event) {
|
|
26024
|
+
if (!this.gui.dragging && !this.gui.dragAttempted && this.gui.mouseFocus && (this.gui.mouseFocusMask & exports.MouseButtonMask.Left) !== 0) {
|
|
26025
|
+
this.gui.dragAccum.add(event.relative);
|
|
26026
|
+
if (this.gui.dragAccum.length() > this.dragThreshold) {
|
|
26027
|
+
var origin = event.globalPosition.clone().subtract(this.gui.dragAccum);
|
|
26028
|
+
this.beginDragging(this.gui.mouseFocus, origin);
|
|
26029
|
+
this.gui.dragAttempted = true;
|
|
26030
|
+
}
|
|
26031
|
+
}
|
|
26032
|
+
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
26033
|
+
if (target) {
|
|
26034
|
+
this.callGUIInput(target, event);
|
|
26035
|
+
}
|
|
26036
|
+
if (this.gui.dragging) {
|
|
26037
|
+
this.gui.dragMouseOver = this.findDropTarget(this.findInputControl(event.globalPosition), event.globalPosition);
|
|
26038
|
+
}
|
|
26039
|
+
this.updateCursor(target, event.globalPosition);
|
|
26040
|
+
};
|
|
26041
|
+
_proto.processScreenTouch = function processScreenTouch(event) {
|
|
26042
|
+
var target;
|
|
26043
|
+
if (event.isPressed()) {
|
|
26044
|
+
target = this.findInputControl(event.position);
|
|
26045
|
+
if (target) {
|
|
26046
|
+
this.gui.touchFocus.set(event.index, target);
|
|
26047
|
+
}
|
|
26048
|
+
} else {
|
|
26049
|
+
var _this_gui_touchFocus_get;
|
|
26050
|
+
target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : null;
|
|
26051
|
+
this.gui.touchFocus.delete(event.index);
|
|
26052
|
+
}
|
|
26053
|
+
if (this.isControlUsable(target)) {
|
|
26054
|
+
this.callGUIInput(target, event);
|
|
26055
|
+
}
|
|
26056
|
+
};
|
|
26057
|
+
_proto.processScreenDrag = function processScreenDrag(event) {
|
|
26058
|
+
var _this_gui_touchFocus_get;
|
|
26059
|
+
var target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : this.findInputControl(event.position);
|
|
26060
|
+
if (this.isControlUsable(target)) {
|
|
26061
|
+
this.callGUIInput(target, event);
|
|
26062
|
+
}
|
|
26063
|
+
};
|
|
26064
|
+
_proto.callGUIInput = function callGUIInput(target, event) {
|
|
26065
|
+
var current = target;
|
|
26066
|
+
var pointerEvent = _instanceof1(event, InputEventMouse) || _instanceof1(event, InputEventScreenTouch) || _instanceof1(event, InputEventScreenDrag);
|
|
26067
|
+
while(current && current !== this && this.isControlUsable(current)){
|
|
26068
|
+
var filter = current.getEffectiveMouseFilter();
|
|
26069
|
+
if (filter !== exports.MouseFilter.Ignore) {
|
|
26070
|
+
var localEvent = event.xformedBy(this.getGlobalInverse(current));
|
|
26071
|
+
this.callControlInput(current, localEvent);
|
|
26072
|
+
if (localEvent.isAccepted()) {
|
|
26073
|
+
event.accept();
|
|
26074
|
+
}
|
|
26075
|
+
}
|
|
26076
|
+
var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
|
|
26077
|
+
if (event.isAccepted() || filter === exports.MouseFilter.Stop && pointerEvent && !forcePassWheel) {
|
|
26078
|
+
event.accept();
|
|
26079
|
+
return;
|
|
26080
|
+
}
|
|
26081
|
+
current = current.parent;
|
|
26082
|
+
}
|
|
26083
|
+
};
|
|
26084
|
+
_proto.callControlInput = function callControlInput(control, event) {
|
|
26085
|
+
if (_instanceof1(event, InputEventMouseButton)) {
|
|
26086
|
+
if (isWheelButton(event.buttonIndex)) {
|
|
26087
|
+
control.onMouseWheel(event);
|
|
26088
|
+
} else if (event.isPressed()) {
|
|
26089
|
+
control.onMouseDown(event);
|
|
26090
|
+
} else {
|
|
26091
|
+
control.onMouseUp(event);
|
|
26092
|
+
}
|
|
26093
|
+
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
26094
|
+
control.onMouseMove(event);
|
|
26095
|
+
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
26096
|
+
if (event.isPressed()) {
|
|
26097
|
+
control.onTouchDown(event);
|
|
26098
|
+
} else {
|
|
26099
|
+
control.onTouchUp(event);
|
|
26100
|
+
}
|
|
26101
|
+
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
26102
|
+
control.onTouchMove(event);
|
|
26103
|
+
} else if (_instanceof1(event, InputEventKey)) {
|
|
26104
|
+
if (event.isPressed()) {
|
|
26105
|
+
control.onKeyDown(event);
|
|
26106
|
+
} else if (event.isReleased()) {
|
|
26107
|
+
control.onKeyUp(event);
|
|
26108
|
+
}
|
|
26109
|
+
}
|
|
26110
|
+
};
|
|
26111
|
+
_proto.findInputControl = function findInputControl(position) {
|
|
26112
|
+
this.canvases.sortCanvases();
|
|
26113
|
+
for(var index = this.canvases.children.length - 1; index >= 0; index--){
|
|
26114
|
+
var root = this.canvases.children[index];
|
|
26115
|
+
if (!root.canvas.isVisible || root.inputDisabled) {
|
|
26116
|
+
continue;
|
|
26117
|
+
}
|
|
26118
|
+
var target = this.findControlAtPosition(root, position, true);
|
|
26119
|
+
if (target) {
|
|
26120
|
+
return target;
|
|
26121
|
+
}
|
|
26122
|
+
}
|
|
26123
|
+
return null;
|
|
26124
|
+
};
|
|
26125
|
+
_proto.findControlAtPosition = function findControlAtPosition(container, position, skipSelf) {
|
|
26126
|
+
if (skipSelf === void 0) skipSelf = false;
|
|
26127
|
+
if (!container.visibleInHierarchy || container.isDisposed) {
|
|
26128
|
+
return null;
|
|
26129
|
+
}
|
|
26130
|
+
var localPosition = this.toLocal(container, position);
|
|
26131
|
+
if (container.clipContents && !container.hasPoint(localPosition)) {
|
|
26132
|
+
return null;
|
|
26133
|
+
}
|
|
26134
|
+
for(var index = container.children.length - 1; index >= 0; index--){
|
|
26135
|
+
var child = container.children[index];
|
|
26136
|
+
if (!child.visibleInHierarchy || child.isDisposed) {
|
|
26137
|
+
continue;
|
|
26138
|
+
}
|
|
26139
|
+
if (_instanceof1(child, ContainerControl)) {
|
|
26140
|
+
var found = this.findControlAtPosition(child, position);
|
|
26141
|
+
if (found) {
|
|
26142
|
+
return found;
|
|
26143
|
+
}
|
|
26144
|
+
} else if (child.getEffectiveMouseFilter() !== exports.MouseFilter.Ignore && child.hasPoint(this.toLocal(child, position))) {
|
|
26145
|
+
return child;
|
|
26146
|
+
}
|
|
26147
|
+
}
|
|
26148
|
+
if (!skipSelf && container.getEffectiveMouseFilter() !== exports.MouseFilter.Ignore && container.hasPoint(localPosition)) {
|
|
26149
|
+
return container;
|
|
26150
|
+
}
|
|
26151
|
+
return null;
|
|
26152
|
+
};
|
|
26153
|
+
_proto.updateMouseOver = function updateMouseOver(position) {
|
|
26154
|
+
if (this.gui.sendingMouseEnterExit) {
|
|
26155
|
+
this.gui.mouseOverUpdatePending = true;
|
|
26156
|
+
return;
|
|
26157
|
+
}
|
|
26158
|
+
this.gui.mouseOverUpdatePending = false;
|
|
26159
|
+
var target = this.findInputControl(position);
|
|
26160
|
+
var next = this.buildHoverHierarchy(target);
|
|
26161
|
+
var previous = this.gui.mouseOverHierarchy;
|
|
26162
|
+
var common = 0;
|
|
26163
|
+
while(common < previous.length && common < next.length && previous[common] === next[common]){
|
|
26164
|
+
common++;
|
|
26165
|
+
}
|
|
26166
|
+
this.gui.sendingMouseEnterExit = true;
|
|
26167
|
+
for(var index = previous.length - 1; index >= common; index--){
|
|
26168
|
+
if (!previous[index].isDisposed) {
|
|
26169
|
+
previous[index].onMouseLeave();
|
|
26170
|
+
}
|
|
26171
|
+
}
|
|
26172
|
+
for(var index1 = common; index1 < next.length; index1++){
|
|
26173
|
+
next[index1].onMouseEnter(this.toLocal(next[index1], position));
|
|
26174
|
+
}
|
|
26175
|
+
this.gui.sendingMouseEnterExit = false;
|
|
26176
|
+
this.gui.mouseOver = target;
|
|
26177
|
+
this.gui.mouseOverHierarchy = next;
|
|
26178
|
+
};
|
|
26179
|
+
_proto.buildHoverHierarchy = function buildHoverHierarchy(target) {
|
|
26180
|
+
var hierarchy = [];
|
|
26181
|
+
var current = target;
|
|
26182
|
+
while(current && current !== this){
|
|
26183
|
+
if (current.getEffectiveMouseFilter() !== exports.MouseFilter.Ignore) {
|
|
26184
|
+
hierarchy.push(current);
|
|
26185
|
+
}
|
|
26186
|
+
if (current.getEffectiveMouseFilter() === exports.MouseFilter.Stop) {
|
|
26187
|
+
break;
|
|
26188
|
+
}
|
|
26189
|
+
current = current.parent;
|
|
26190
|
+
}
|
|
26191
|
+
hierarchy.reverse();
|
|
26192
|
+
return hierarchy;
|
|
26193
|
+
};
|
|
26194
|
+
_proto.findClickFocus = function findClickFocus(target) {
|
|
26195
|
+
var current = target;
|
|
26196
|
+
while(current && current !== this){
|
|
26197
|
+
var mode = current.getFocusModeWithOverride();
|
|
26198
|
+
if (mode === exports.FocusMode.Click || mode === exports.FocusMode.All) {
|
|
26199
|
+
this.grabControlFocus(current);
|
|
26200
|
+
return;
|
|
26201
|
+
}
|
|
26202
|
+
if (current.getEffectiveMouseFilter() === exports.MouseFilter.Stop) {
|
|
26203
|
+
return;
|
|
26204
|
+
}
|
|
26205
|
+
current = current.parent;
|
|
26206
|
+
}
|
|
26207
|
+
};
|
|
26208
|
+
_proto.beginDragging = function beginDragging(source, position) {
|
|
26209
|
+
var current = source;
|
|
26210
|
+
while(current && current !== this){
|
|
26211
|
+
var data = current.invokeGetDragData(this.toLocal(current, position));
|
|
26212
|
+
if (data !== null && data !== undefined) {
|
|
26213
|
+
this.gui.dragging = true;
|
|
26214
|
+
this.gui.dragData = data;
|
|
26215
|
+
this.gui.mouseFocus = null;
|
|
26216
|
+
this.gui.mouseFocusMask = exports.MouseButtonMask.None;
|
|
26217
|
+
return;
|
|
26218
|
+
}
|
|
26219
|
+
if (current.getEffectiveMouseFilter() === exports.MouseFilter.Stop) {
|
|
26220
|
+
return;
|
|
26221
|
+
}
|
|
26222
|
+
current = current.parent;
|
|
26223
|
+
}
|
|
26224
|
+
};
|
|
26225
|
+
_proto.finishDrop = function finishDrop(position) {
|
|
26226
|
+
var target = this.findDropTarget(this.findInputControl(position), position);
|
|
26227
|
+
if (target) {
|
|
26228
|
+
target.invokeDropData(this.toLocal(target, position), this.gui.dragData);
|
|
26229
|
+
}
|
|
26230
|
+
this.endDragging(!!target);
|
|
26231
|
+
};
|
|
26232
|
+
_proto.findDropTarget = function findDropTarget(target, position) {
|
|
26233
|
+
var current = target;
|
|
26234
|
+
while(current && current !== this){
|
|
26235
|
+
if (current.invokeCanDropData(this.toLocal(current, position), this.gui.dragData)) {
|
|
26236
|
+
return current;
|
|
26237
|
+
}
|
|
26238
|
+
if (current.getEffectiveMouseFilter() === exports.MouseFilter.Stop) {
|
|
26239
|
+
return null;
|
|
26240
|
+
}
|
|
26241
|
+
current = current.parent;
|
|
26242
|
+
}
|
|
26243
|
+
return null;
|
|
26244
|
+
};
|
|
26245
|
+
_proto.endDragging = function endDragging(successful) {
|
|
26246
|
+
this.gui.dragSuccessful = successful;
|
|
26247
|
+
this.gui.dragging = false;
|
|
26248
|
+
this.gui.dragData = null;
|
|
26249
|
+
this.gui.dragMouseOver = null;
|
|
26250
|
+
};
|
|
26251
|
+
_proto.updateCursor = function updateCursor(target, position) {
|
|
26252
|
+
var current = target;
|
|
26253
|
+
var cursor = exports.CursorShape.Arrow;
|
|
26254
|
+
while(current && current !== this){
|
|
26255
|
+
var candidate = current.getCursorShape(this.toLocal(current, position));
|
|
26256
|
+
if (candidate !== exports.CursorShape.Arrow) {
|
|
26257
|
+
cursor = candidate;
|
|
26258
|
+
break;
|
|
26259
|
+
}
|
|
26260
|
+
if (current.getEffectiveMouseFilter() === exports.MouseFilter.Stop) {
|
|
26261
|
+
break;
|
|
26262
|
+
}
|
|
26263
|
+
current = current.parent;
|
|
26264
|
+
}
|
|
26265
|
+
this.engine.canvas.style.cursor = typeof cursor === "string" ? cursor : cursorNames[cursor];
|
|
26266
|
+
};
|
|
26267
|
+
_proto.postGrabClickFocus = function postGrabClickFocus() {
|
|
26268
|
+
var target = this.gui.mouseClickGrabber;
|
|
26269
|
+
this.gui.mouseClickGrabber = null;
|
|
26270
|
+
if (this.isControlUsable(target)) {
|
|
26271
|
+
this.gui.mouseFocus = target;
|
|
26272
|
+
}
|
|
26273
|
+
};
|
|
26274
|
+
_proto.cleanupInternalState = function cleanupInternalState() {
|
|
26275
|
+
if (!this.isControlUsable(this.gui.mouseFocus)) {
|
|
26276
|
+
this.dropMouseFocus();
|
|
26277
|
+
}
|
|
26278
|
+
if (this.gui.keyFocus && !this.isFocusTargetUsable(this.gui.keyFocus)) {
|
|
26279
|
+
this.releaseControlFocus(this.gui.keyFocus);
|
|
26280
|
+
}
|
|
26281
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26282
|
+
var _step_value = _step.value, index = _step_value[0], control = _step_value[1];
|
|
26283
|
+
if (!this.isControlUsable(control)) {
|
|
26284
|
+
this.gui.touchFocus.delete(index);
|
|
26285
|
+
}
|
|
26286
|
+
}
|
|
26287
|
+
};
|
|
26288
|
+
_proto.dropMouseFocus = function dropMouseFocus() {
|
|
26289
|
+
this.gui.mouseFocus = null;
|
|
26290
|
+
this.gui.mouseFocusMask = exports.MouseButtonMask.None;
|
|
26291
|
+
};
|
|
26292
|
+
_proto.dropMouseOver = function dropMouseOver() {
|
|
26293
|
+
for(var index = this.gui.mouseOverHierarchy.length - 1; index >= 0; index--){
|
|
26294
|
+
var control = this.gui.mouseOverHierarchy[index];
|
|
26295
|
+
if (!control.isDisposed) {
|
|
26296
|
+
control.onMouseLeave();
|
|
26297
|
+
}
|
|
26298
|
+
}
|
|
26299
|
+
this.gui.mouseOver = null;
|
|
26300
|
+
this.gui.mouseOverHierarchy = [];
|
|
26301
|
+
};
|
|
26302
|
+
_proto.dropControlState = function dropControlState(control) {
|
|
26303
|
+
if (this.controlBelongsToSubtree(this.gui.mouseFocus, control)) {
|
|
26304
|
+
this.dropMouseFocus();
|
|
26305
|
+
}
|
|
26306
|
+
if (this.controlBelongsToSubtree(this.gui.mouseClickGrabber, control)) {
|
|
26307
|
+
this.gui.mouseClickGrabber = null;
|
|
26308
|
+
}
|
|
26309
|
+
if (this.controlBelongsToSubtree(this.gui.keyFocus, control)) {
|
|
26310
|
+
var _this_gui_keyFocus;
|
|
26311
|
+
this.releaseControlFocus((_this_gui_keyFocus = this.gui.keyFocus) != null ? _this_gui_keyFocus : undefined);
|
|
26312
|
+
}
|
|
26313
|
+
if (this.controlBelongsToSubtree(this.gui.mouseOver, control)) {
|
|
26314
|
+
this.dropMouseOver();
|
|
26315
|
+
}
|
|
26316
|
+
if (this.controlBelongsToSubtree(this.gui.dragMouseOver, control)) {
|
|
26317
|
+
this.gui.dragMouseOver = null;
|
|
26318
|
+
}
|
|
26319
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26320
|
+
var _step_value = _step.value, index = _step_value[0], target = _step_value[1];
|
|
26321
|
+
if (this.controlBelongsToSubtree(target, control)) {
|
|
26322
|
+
this.gui.touchFocus.delete(index);
|
|
26323
|
+
}
|
|
25317
26324
|
}
|
|
25318
|
-
return rt;
|
|
25319
26325
|
};
|
|
25320
|
-
|
|
25321
|
-
|
|
26326
|
+
_proto.requestMouseOverUpdate = function requestMouseOverUpdate() {
|
|
26327
|
+
if (Number.isFinite(this.gui.lastMousePosition.x)) {
|
|
26328
|
+
this.updateMouseOver(this.gui.lastMousePosition);
|
|
26329
|
+
}
|
|
26330
|
+
};
|
|
26331
|
+
_proto.getGlobalInverse = function getGlobalInverse(control) {
|
|
26332
|
+
var transform = control.getGlobalTransform2D().clone();
|
|
26333
|
+
return Math.abs(transform.determinant()) < 1e-12 ? new Matrix3() : transform.invert();
|
|
26334
|
+
};
|
|
26335
|
+
_proto.toLocal = function toLocal(control, position) {
|
|
26336
|
+
var elements = this.getGlobalInverse(control).elements;
|
|
26337
|
+
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
26338
|
+
};
|
|
26339
|
+
_proto.controlBelongsToSubtree = function controlBelongsToSubtree(control, subtree) {
|
|
26340
|
+
var current = control;
|
|
26341
|
+
while(current){
|
|
26342
|
+
if (current === subtree) {
|
|
26343
|
+
return true;
|
|
26344
|
+
}
|
|
26345
|
+
current = current.parent;
|
|
26346
|
+
}
|
|
26347
|
+
return false;
|
|
26348
|
+
};
|
|
26349
|
+
_proto.isControlValid = function isControlValid(control) {
|
|
26350
|
+
return !!control && !control.isDisposed && control.root === this;
|
|
26351
|
+
};
|
|
26352
|
+
_proto.isControlUsable = function isControlUsable(control) {
|
|
26353
|
+
if (!this.isControlValid(control) || !control.visibleInHierarchy || !control.enabledInHierarchy) {
|
|
26354
|
+
return false;
|
|
26355
|
+
}
|
|
26356
|
+
var root = this.findCanvasRoot(control);
|
|
26357
|
+
return !root || !root.inputDisabled;
|
|
26358
|
+
};
|
|
26359
|
+
_proto.findCanvasRoot = function findCanvasRoot(control) {
|
|
26360
|
+
var current = control;
|
|
26361
|
+
while(current && current !== this){
|
|
26362
|
+
if (_instanceof1(current, CanvasRootControl)) {
|
|
26363
|
+
return current;
|
|
26364
|
+
}
|
|
26365
|
+
current = current.parent;
|
|
26366
|
+
}
|
|
26367
|
+
return null;
|
|
26368
|
+
};
|
|
26369
|
+
_proto.isFocusTargetUsable = function isFocusTargetUsable(control) {
|
|
26370
|
+
return this.isControlUsable(control) && control.getFocusModeWithOverride() !== exports.FocusMode.None;
|
|
26371
|
+
};
|
|
26372
|
+
return WindowRootControl;
|
|
26373
|
+
}(RootControl);
|
|
26374
|
+
|
|
26375
|
+
exports.CanvasRenderMode = void 0;
|
|
26376
|
+
(function(CanvasRenderMode) {
|
|
26377
|
+
CanvasRenderMode[CanvasRenderMode["ScreenSpace"] = 0] = "ScreenSpace";
|
|
26378
|
+
CanvasRenderMode[CanvasRenderMode["CameraSpace"] = 1] = "CameraSpace";
|
|
26379
|
+
CanvasRenderMode[CanvasRenderMode["WorldSpace"] = 2] = "WorldSpace";
|
|
26380
|
+
CanvasRenderMode[CanvasRenderMode["WorldSpaceFaceCamera"] = 3] = "WorldSpaceFaceCamera";
|
|
26381
|
+
})(exports.CanvasRenderMode || (exports.CanvasRenderMode = {}));
|
|
26382
|
+
/** Canvas-layer boundary attached to a VFXItem. Input state remains owned by the window root. */ var UICanvas = /*#__PURE__*/ function(Component) {
|
|
26383
|
+
_inherits(UICanvas, Component);
|
|
26384
|
+
function UICanvas(engine) {
|
|
26385
|
+
var _this;
|
|
26386
|
+
_this = Component.call(this, engine) || this;
|
|
26387
|
+
_this.renderMode = 0;
|
|
26388
|
+
_this.receivesEvents = true;
|
|
26389
|
+
_this._order = 0;
|
|
26390
|
+
_this.registered = false;
|
|
26391
|
+
_this.rootControl = new CanvasRootControl(engine, _assert_this_initialized(_this));
|
|
26392
|
+
return _this;
|
|
26393
|
+
}
|
|
26394
|
+
var _proto = UICanvas.prototype;
|
|
26395
|
+
_proto.onEnable = function onEnable() {
|
|
26396
|
+
this.register();
|
|
26397
|
+
};
|
|
26398
|
+
_proto.onDisable = function onDisable() {
|
|
26399
|
+
this.unregister();
|
|
26400
|
+
};
|
|
26401
|
+
_proto.onDestroy = function onDestroy() {
|
|
26402
|
+
this.destroyCanvas();
|
|
26403
|
+
};
|
|
26404
|
+
_proto.dispose = function dispose() {
|
|
26405
|
+
this.destroyCanvas();
|
|
26406
|
+
Component.prototype.dispose.call(this);
|
|
26407
|
+
};
|
|
26408
|
+
_proto.register = function register() {
|
|
26409
|
+
if (!this.registered) {
|
|
26410
|
+
this.rootControl.parent = this.engine.windowRoot.canvases;
|
|
26411
|
+
this.registered = true;
|
|
26412
|
+
}
|
|
26413
|
+
};
|
|
26414
|
+
_proto.unregister = function unregister() {
|
|
26415
|
+
if (this.registered) {
|
|
26416
|
+
this.rootControl.parent = null;
|
|
26417
|
+
this.registered = false;
|
|
26418
|
+
}
|
|
26419
|
+
};
|
|
26420
|
+
_proto.destroyCanvas = function destroyCanvas() {
|
|
26421
|
+
this.unregister();
|
|
26422
|
+
if (!this.rootControl.isDisposed) {
|
|
26423
|
+
this.rootControl.dispose();
|
|
26424
|
+
}
|
|
26425
|
+
};
|
|
26426
|
+
_create_class(UICanvas, [
|
|
26427
|
+
{
|
|
26428
|
+
key: "order",
|
|
26429
|
+
get: function get() {
|
|
26430
|
+
return this._order;
|
|
26431
|
+
},
|
|
26432
|
+
set: function set(value) {
|
|
26433
|
+
if (this._order !== value) {
|
|
26434
|
+
this._order = value;
|
|
26435
|
+
this.engine.windowRoot.canvases.sortCanvases();
|
|
26436
|
+
}
|
|
26437
|
+
}
|
|
26438
|
+
},
|
|
26439
|
+
{
|
|
26440
|
+
key: "isVisible",
|
|
26441
|
+
get: function get() {
|
|
26442
|
+
var _this_item;
|
|
26443
|
+
return this.renderMode === 0 && this.enabled && !!((_this_item = this.item) == null ? void 0 : _this_item.isActive);
|
|
26444
|
+
}
|
|
26445
|
+
}
|
|
26446
|
+
]);
|
|
26447
|
+
return UICanvas;
|
|
26448
|
+
}(Component);
|
|
25322
26449
|
|
|
25323
26450
|
/**
|
|
25324
|
-
*
|
|
25325
|
-
*
|
|
25326
|
-
|
|
25327
|
-
|
|
25328
|
-
|
|
25329
|
-
|
|
25330
|
-
|
|
25331
|
-
|
|
25332
|
-
|
|
25333
|
-
|
|
25334
|
-
|
|
25335
|
-
|
|
26451
|
+
* Scene-tree bridge for a GUI Control. The VFXItem tree owns lifecycle and
|
|
26452
|
+
* serialization while the Control tree owns layout, drawing and input.
|
|
26453
|
+
*/ var UIControl = /*#__PURE__*/ function(Component) {
|
|
26454
|
+
_inherits(UIControl, Component);
|
|
26455
|
+
function UIControl(engine) {
|
|
26456
|
+
var _this;
|
|
26457
|
+
_this = Component.call(this, engine) || this;
|
|
26458
|
+
_this.controlNode = null;
|
|
26459
|
+
_this.linkedItemTransform = null;
|
|
26460
|
+
_this.linkedControl = null;
|
|
26461
|
+
_this.syncingLocation = false;
|
|
26462
|
+
_this.itemTransformChanged = function() {
|
|
26463
|
+
return _this.syncItemLocationToControl();
|
|
26464
|
+
};
|
|
26465
|
+
_this.controlLocationChanged = function() {
|
|
26466
|
+
return _this.syncControlLocationToItem();
|
|
26467
|
+
};
|
|
26468
|
+
return _this;
|
|
25336
26469
|
}
|
|
25337
|
-
var _proto =
|
|
25338
|
-
|
|
25339
|
-
|
|
25340
|
-
|
|
25341
|
-
|
|
25342
|
-
|
|
25343
|
-
|
|
25344
|
-
|
|
26470
|
+
var _proto = UIControl.prototype;
|
|
26471
|
+
_proto.onAwake = function onAwake() {
|
|
26472
|
+
this.syncControl();
|
|
26473
|
+
};
|
|
26474
|
+
_proto.onEnable = function onEnable() {
|
|
26475
|
+
if (this.controlNode) {
|
|
26476
|
+
this.controlNode.visible = this.item.isActive;
|
|
26477
|
+
this.controlNode.enabled = true;
|
|
25345
26478
|
}
|
|
25346
26479
|
};
|
|
25347
|
-
|
|
25348
|
-
|
|
26480
|
+
_proto.onDisable = function onDisable() {
|
|
26481
|
+
if (this.controlNode) {
|
|
26482
|
+
this.controlNode.visible = this.item.isActive;
|
|
26483
|
+
this.controlNode.enabled = false;
|
|
26484
|
+
}
|
|
26485
|
+
};
|
|
26486
|
+
_proto.onParentChanged = function onParentChanged() {
|
|
26487
|
+
this.syncControl();
|
|
26488
|
+
};
|
|
26489
|
+
_proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
26490
|
+
this.syncControlOrder();
|
|
26491
|
+
};
|
|
26492
|
+
_proto.onDestroy = function onDestroy() {
|
|
26493
|
+
this.disposeControl();
|
|
26494
|
+
};
|
|
26495
|
+
_proto.dispose = function dispose() {
|
|
26496
|
+
this.disposeControl();
|
|
26497
|
+
Component.prototype.dispose.call(this);
|
|
26498
|
+
};
|
|
26499
|
+
/** Unlinks the GUI object without disposing or modifying it. */ _proto.unlinkControl = function unlinkControl() {
|
|
26500
|
+
if (this.controlNode) {
|
|
26501
|
+
this.unbindLocationSync();
|
|
26502
|
+
this.controlNode = null;
|
|
26503
|
+
}
|
|
26504
|
+
};
|
|
26505
|
+
_proto.disposeControl = function disposeControl() {
|
|
26506
|
+
var control = this.controlNode;
|
|
26507
|
+
if (control) {
|
|
26508
|
+
this.unbindLocationSync();
|
|
26509
|
+
this.controlNode = null;
|
|
26510
|
+
control.dispose();
|
|
26511
|
+
}
|
|
26512
|
+
};
|
|
26513
|
+
_proto.syncControl = function syncControl() {
|
|
26514
|
+
var control = this.controlNode;
|
|
26515
|
+
if (!control || !this.item) {
|
|
26516
|
+
return;
|
|
26517
|
+
}
|
|
26518
|
+
this.syncingLocation = true;
|
|
26519
|
+
try {
|
|
26520
|
+
control.visible = this.item.isActive;
|
|
26521
|
+
control.enabled = this.enabled;
|
|
26522
|
+
control.parent = this.resolveParent();
|
|
26523
|
+
this.syncControlOrder();
|
|
26524
|
+
this.copyItemLocationToControl();
|
|
26525
|
+
} finally{
|
|
26526
|
+
this.syncingLocation = false;
|
|
26527
|
+
}
|
|
26528
|
+
this.bindLocationSync();
|
|
26529
|
+
};
|
|
26530
|
+
_proto.syncControlOrder = function syncControlOrder() {
|
|
26531
|
+
if (this.controlNode && this.item) {
|
|
26532
|
+
this.controlNode.indexInParent = this.item.orderInParent;
|
|
26533
|
+
}
|
|
26534
|
+
};
|
|
26535
|
+
_proto.resolveParent = function resolveParent() {
|
|
26536
|
+
var parentItem = this.item.parent;
|
|
26537
|
+
if (!parentItem) {
|
|
26538
|
+
var _UIControl_fallbackParentGetDelegate;
|
|
26539
|
+
return (_UIControl_fallbackParentGetDelegate = UIControl.fallbackParentGetDelegate == null ? void 0 : UIControl.fallbackParentGetDelegate.call(UIControl, this)) != null ? _UIControl_fallbackParentGetDelegate : null;
|
|
26540
|
+
}
|
|
26541
|
+
var uiControl = parentItem.getComponent(UIControl);
|
|
26542
|
+
if ((uiControl == null ? void 0 : uiControl.control) && "children" in uiControl.control) {
|
|
26543
|
+
return uiControl.control;
|
|
26544
|
+
}
|
|
26545
|
+
var canvas = parentItem.getComponent(UICanvas);
|
|
26546
|
+
var _canvas_rootControl, _ref;
|
|
26547
|
+
return (_ref = (_canvas_rootControl = canvas == null ? void 0 : canvas.rootControl) != null ? _canvas_rootControl : UIControl.fallbackParentGetDelegate == null ? void 0 : UIControl.fallbackParentGetDelegate.call(UIControl, this)) != null ? _ref : null;
|
|
26548
|
+
};
|
|
26549
|
+
_proto.bindLocationSync = function bindLocationSync() {
|
|
26550
|
+
var itemTransform = this.item.transform;
|
|
26551
|
+
var control = this.controlNode;
|
|
26552
|
+
if (this.linkedItemTransform === itemTransform && this.linkedControl === control) {
|
|
26553
|
+
return;
|
|
26554
|
+
}
|
|
26555
|
+
this.unbindLocationSync();
|
|
26556
|
+
if (control) {
|
|
26557
|
+
this.linkedItemTransform = itemTransform;
|
|
26558
|
+
this.linkedControl = control;
|
|
26559
|
+
itemTransform.on("changed", this.itemTransformChanged);
|
|
26560
|
+
control.on("locationChanged", this.controlLocationChanged);
|
|
26561
|
+
}
|
|
26562
|
+
};
|
|
26563
|
+
_proto.unbindLocationSync = function unbindLocationSync() {
|
|
26564
|
+
var _this_linkedItemTransform, _this_linkedControl;
|
|
26565
|
+
(_this_linkedItemTransform = this.linkedItemTransform) == null ? void 0 : _this_linkedItemTransform.off("changed", this.itemTransformChanged);
|
|
26566
|
+
(_this_linkedControl = this.linkedControl) == null ? void 0 : _this_linkedControl.off("locationChanged", this.controlLocationChanged);
|
|
26567
|
+
this.linkedItemTransform = null;
|
|
26568
|
+
this.linkedControl = null;
|
|
26569
|
+
};
|
|
26570
|
+
_proto.syncItemLocationToControl = function syncItemLocationToControl() {
|
|
26571
|
+
if (!this.syncingLocation && this.controlNode) {
|
|
26572
|
+
this.syncingLocation = true;
|
|
26573
|
+
try {
|
|
26574
|
+
this.copyItemLocationToControl();
|
|
26575
|
+
} finally{
|
|
26576
|
+
this.syncingLocation = false;
|
|
26577
|
+
}
|
|
26578
|
+
}
|
|
26579
|
+
};
|
|
26580
|
+
_proto.syncControlLocationToItem = function syncControlLocationToItem() {
|
|
26581
|
+
var control = this.controlNode;
|
|
26582
|
+
if (!this.syncingLocation && control) {
|
|
26583
|
+
var source = control.location;
|
|
26584
|
+
var target = this.item.transform.position;
|
|
26585
|
+
if (source.x !== target.x || source.y !== target.y) {
|
|
26586
|
+
this.syncingLocation = true;
|
|
26587
|
+
try {
|
|
26588
|
+
this.item.transform.setPosition(source.x, source.y, target.z);
|
|
26589
|
+
} finally{
|
|
26590
|
+
this.syncingLocation = false;
|
|
26591
|
+
}
|
|
26592
|
+
}
|
|
26593
|
+
}
|
|
26594
|
+
};
|
|
26595
|
+
_proto.copyItemLocationToControl = function copyItemLocationToControl() {
|
|
26596
|
+
var control = this.controlNode;
|
|
26597
|
+
if (control) {
|
|
26598
|
+
var source = this.item.transform.position;
|
|
26599
|
+
var target = control.location;
|
|
26600
|
+
if (source.x !== target.x || source.y !== target.y) {
|
|
26601
|
+
control.setPosition(source.x, source.y);
|
|
26602
|
+
}
|
|
26603
|
+
}
|
|
26604
|
+
};
|
|
26605
|
+
_create_class(UIControl, [
|
|
26606
|
+
{
|
|
26607
|
+
key: "control",
|
|
26608
|
+
get: function get() {
|
|
26609
|
+
return this.controlNode;
|
|
26610
|
+
},
|
|
26611
|
+
set: function set(value) {
|
|
26612
|
+
if (value === this.controlNode) {
|
|
26613
|
+
return;
|
|
26614
|
+
}
|
|
26615
|
+
this.disposeControl();
|
|
26616
|
+
if (value) {
|
|
26617
|
+
if (value.owner && value.owner !== this && value.owner.control === value) {
|
|
26618
|
+
throw new Error("A Control can only be owned by one UIControl.");
|
|
26619
|
+
}
|
|
26620
|
+
this.controlNode = value;
|
|
26621
|
+
value.owner = this;
|
|
26622
|
+
this.syncControl();
|
|
26623
|
+
}
|
|
26624
|
+
}
|
|
26625
|
+
},
|
|
26626
|
+
{
|
|
26627
|
+
key: "hasControl",
|
|
26628
|
+
get: function get() {
|
|
26629
|
+
return this.controlNode !== null;
|
|
26630
|
+
}
|
|
26631
|
+
}
|
|
26632
|
+
]);
|
|
26633
|
+
return UIControl;
|
|
26634
|
+
}(Component);
|
|
25349
26635
|
|
|
25350
26636
|
exports.CameraController = /*#__PURE__*/ function(Component) {
|
|
25351
26637
|
_inherits(CameraController, Component);
|
|
@@ -25381,42 +26667,6 @@ exports.CameraController = __decorate([
|
|
|
25381
26667
|
effectsClass(DataType.CameraController)
|
|
25382
26668
|
], exports.CameraController);
|
|
25383
26669
|
|
|
25384
|
-
function _get_prototype_of(o) {
|
|
25385
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
25386
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
25387
|
-
};
|
|
25388
|
-
return _get_prototype_of(o);
|
|
25389
|
-
}
|
|
25390
|
-
|
|
25391
|
-
function _is_native_function(fn) {
|
|
25392
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
25393
|
-
}
|
|
25394
|
-
|
|
25395
|
-
function _wrap_native_super(Class) {
|
|
25396
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
25397
|
-
_wrap_native_super = function _wrap_native_super(Class) {
|
|
25398
|
-
if (Class === null || !_is_native_function(Class)) return Class;
|
|
25399
|
-
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
25400
|
-
if (typeof _cache !== "undefined") {
|
|
25401
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
25402
|
-
_cache.set(Class, Wrapper);
|
|
25403
|
-
}
|
|
25404
|
-
function Wrapper() {
|
|
25405
|
-
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
25406
|
-
}
|
|
25407
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
25408
|
-
constructor: {
|
|
25409
|
-
value: Wrapper,
|
|
25410
|
-
enumerable: false,
|
|
25411
|
-
writable: true,
|
|
25412
|
-
configurable: true
|
|
25413
|
-
}
|
|
25414
|
-
});
|
|
25415
|
-
return _set_prototype_of(Wrapper, Class);
|
|
25416
|
-
};
|
|
25417
|
-
return _wrap_native_super(Class);
|
|
25418
|
-
}
|
|
25419
|
-
|
|
25420
26670
|
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
25421
26671
|
_inherits(CameraVFXItemLoader, Plugin);
|
|
25422
26672
|
function CameraVFXItemLoader() {
|
|
@@ -25437,142 +26687,202 @@ exports.PointerEventType = void 0;
|
|
|
25437
26687
|
})(exports.PointerEventType || (exports.PointerEventType = {}));
|
|
25438
26688
|
var EventSystem = /*#__PURE__*/ function() {
|
|
25439
26689
|
function EventSystem(engine, allowPropagation) {
|
|
26690
|
+
var _this = this;
|
|
25440
26691
|
if (allowPropagation === void 0) allowPropagation = false;
|
|
25441
26692
|
this.engine = engine;
|
|
25442
26693
|
this.allowPropagation = allowPropagation;
|
|
25443
|
-
this.enabled = true;
|
|
25444
26694
|
this.skipPointerMovePicking = true;
|
|
26695
|
+
this.emulateMouseFromTouch = true;
|
|
26696
|
+
this.emulateTouchFromMouse = false;
|
|
26697
|
+
this._enabled = true;
|
|
25445
26698
|
this.handlers = {};
|
|
25446
|
-
this.nativeHandlers =
|
|
26699
|
+
this.nativeHandlers = [];
|
|
25447
26700
|
this.target = null;
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
|
|
25451
|
-
|
|
25452
|
-
this.
|
|
25453
|
-
|
|
25454
|
-
|
|
25455
|
-
|
|
25456
|
-
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
|
|
26701
|
+
this.mouseState = null;
|
|
26702
|
+
this.touchStates = new Map();
|
|
26703
|
+
this.mouseFromTouchIndex = null;
|
|
26704
|
+
this.touchFromMousePressed = false;
|
|
26705
|
+
this.addedTabIndex = false;
|
|
26706
|
+
this.addedOutlineStyle = false;
|
|
26707
|
+
this.onNativeWheel = function(event) {
|
|
26708
|
+
if (!_this.enabled || !_this.target) {
|
|
26709
|
+
return;
|
|
26710
|
+
}
|
|
26711
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26712
|
+
var handled = false;
|
|
26713
|
+
if (event.deltaY !== 0) {
|
|
26714
|
+
handled = _this.pushWheelButton(event.deltaY < 0 ? exports.MouseButton.WheelUp : exports.MouseButton.WheelDown, Math.abs(event.deltaY), position, event) || handled;
|
|
26715
|
+
}
|
|
26716
|
+
if (event.deltaX !== 0) {
|
|
26717
|
+
handled = _this.pushWheelButton(event.deltaX < 0 ? exports.MouseButton.WheelLeft : exports.MouseButton.WheelRight, Math.abs(event.deltaX), position, event) || handled;
|
|
26718
|
+
}
|
|
26719
|
+
_this.consumeNativeEvent(event, handled);
|
|
25460
26720
|
};
|
|
25461
|
-
|
|
25462
|
-
|
|
25463
|
-
|
|
25464
|
-
|
|
25465
|
-
|
|
25466
|
-
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
return
|
|
25474
|
-
x: x,
|
|
25475
|
-
y: y,
|
|
25476
|
-
vx: 0,
|
|
25477
|
-
vy: vy,
|
|
25478
|
-
dx: dx,
|
|
25479
|
-
dy: dy,
|
|
25480
|
-
ts: ts,
|
|
25481
|
-
width: 0,
|
|
25482
|
-
height: 0,
|
|
25483
|
-
origin: event
|
|
25484
|
-
};
|
|
26721
|
+
this.onNativeKeyDown = function(event) {
|
|
26722
|
+
_this.handleNativeKey(event, true);
|
|
26723
|
+
};
|
|
26724
|
+
this.onNativeKeyUp = function(event) {
|
|
26725
|
+
_this.handleNativeKey(event, false);
|
|
26726
|
+
};
|
|
26727
|
+
this.onNativeMouseDown = function(event) {
|
|
26728
|
+
_this.handleNativeMouseDown(event);
|
|
26729
|
+
};
|
|
26730
|
+
this.onNativeMouseMove = function(event) {
|
|
26731
|
+
var _state;
|
|
26732
|
+
if (!_this.enabled || !_this.target) {
|
|
26733
|
+
return;
|
|
25485
26734
|
}
|
|
25486
|
-
var
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
26735
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26736
|
+
var _this_mouseState;
|
|
26737
|
+
var state = (_this_mouseState = _this.mouseState) != null ? _this_mouseState : _this.createPointerState(position);
|
|
26738
|
+
_this.mouseState = state;
|
|
26739
|
+
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26740
|
+
var velocity = _this.getVelocity(state, position);
|
|
26741
|
+
var handled = _this.pushNativeMouseMotion(event, position, relative, velocity);
|
|
26742
|
+
(_state = state).controlHandled || (_state.controlHandled = handled);
|
|
26743
|
+
if (!handled && (!state.pressed || !state.controlHandled)) {
|
|
26744
|
+
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26745
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
26746
|
+
}
|
|
26747
|
+
_this.updatePointerState(state, position);
|
|
26748
|
+
_this.consumeNativeEvent(event, handled);
|
|
26749
|
+
};
|
|
26750
|
+
this.onNativeMouseUp = function(event) {
|
|
26751
|
+
if (!_this.enabled || !_this.target) {
|
|
26752
|
+
return;
|
|
25496
26753
|
}
|
|
25497
|
-
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
|
|
25501
|
-
|
|
25502
|
-
|
|
25503
|
-
|
|
25504
|
-
|
|
25505
|
-
|
|
25506
|
-
|
|
25507
|
-
|
|
25508
|
-
|
|
26754
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26755
|
+
var existingState = _this.mouseState;
|
|
26756
|
+
if (!(existingState == null ? void 0 : existingState.pressed)) {
|
|
26757
|
+
return;
|
|
26758
|
+
}
|
|
26759
|
+
var state = existingState;
|
|
26760
|
+
var handled = _this.pushNativeMouseButton(event, position, false);
|
|
26761
|
+
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26762
|
+
if (!state.controlHandled && !handled && _this.isClick(state, position)) {
|
|
26763
|
+
_this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26764
|
+
}
|
|
26765
|
+
if (!handled && !state.controlHandled) {
|
|
26766
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26767
|
+
}
|
|
26768
|
+
_this.mouseState = null;
|
|
26769
|
+
_this.consumeNativeEvent(event, handled || state.controlHandled || !_this.allowPropagation);
|
|
25509
26770
|
};
|
|
25510
|
-
|
|
25511
|
-
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
|
|
25515
|
-
|
|
25516
|
-
|
|
25517
|
-
|
|
25518
|
-
|
|
25519
|
-
|
|
25520
|
-
|
|
25521
|
-
|
|
25522
|
-
|
|
25523
|
-
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
y = cood.y;
|
|
25527
|
-
lastTouch = currentTouch = {
|
|
25528
|
-
clientX: touch.clientX,
|
|
25529
|
-
clientY: touch.clientY,
|
|
25530
|
-
ts: performance.now(),
|
|
25531
|
-
x: x,
|
|
25532
|
-
y: y
|
|
25533
|
-
};
|
|
25534
|
-
_this.dispatchEvent(EVENT_TYPE_TOUCH_START, getTouchEventValue(event, x, y));
|
|
25535
|
-
}
|
|
25536
|
-
}, _obj[touchmove] = function(event) {
|
|
25537
|
-
if (currentTouch && _this.enabled) {
|
|
25538
|
-
var cood = getCoord(getTouch(event));
|
|
25539
|
-
x = cood.x;
|
|
25540
|
-
y = cood.y;
|
|
25541
|
-
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, getTouchEventValue(event, x, y, x - currentTouch.x, y - currentTouch.y));
|
|
25542
|
-
}
|
|
25543
|
-
}, _obj[touchend] = function(event) {
|
|
25544
|
-
if (currentTouch && _this.enabled) {
|
|
25545
|
-
if (!_this.allowPropagation && event.cancelable) {
|
|
25546
|
-
event.preventDefault();
|
|
25547
|
-
event.stopPropagation();
|
|
26771
|
+
this.onNativeTouchStart = function(event) {
|
|
26772
|
+
if (!_this.enabled) {
|
|
26773
|
+
return;
|
|
26774
|
+
}
|
|
26775
|
+
_this.focusTarget();
|
|
26776
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26777
|
+
var touch = _step.value;
|
|
26778
|
+
var position = _this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26779
|
+
var state = _this.createPointerState(position);
|
|
26780
|
+
_this.touchStates.set(touch.identifier, state);
|
|
26781
|
+
state.pressed = true;
|
|
26782
|
+
var handled = _this.pushNativeScreenTouch(touch.identifier, position, true, false, false);
|
|
26783
|
+
state.controlHandled = handled;
|
|
26784
|
+
if (!handled) {
|
|
26785
|
+
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26786
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
25548
26787
|
}
|
|
25549
|
-
|
|
25550
|
-
|
|
25551
|
-
|
|
25552
|
-
|
|
25553
|
-
|
|
25554
|
-
|
|
25555
|
-
|
|
26788
|
+
_this.consumeNativeEvent(event, handled);
|
|
26789
|
+
}
|
|
26790
|
+
_this.preventTouchDefaults(event);
|
|
26791
|
+
};
|
|
26792
|
+
this.onNativeTouchMove = function(event) {
|
|
26793
|
+
if (!_this.enabled) {
|
|
26794
|
+
return;
|
|
26795
|
+
}
|
|
26796
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26797
|
+
var touch = _step.value;
|
|
26798
|
+
var _state;
|
|
26799
|
+
var position = _this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26800
|
+
var _this_touchStates_get;
|
|
26801
|
+
var state = (_this_touchStates_get = _this.touchStates.get(touch.identifier)) != null ? _this_touchStates_get : _this.createPointerState(position);
|
|
26802
|
+
_this.touchStates.set(touch.identifier, state);
|
|
26803
|
+
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26804
|
+
var velocity = _this.getVelocity(state, position);
|
|
26805
|
+
var handled = _this.pushNativeScreenDrag(touch.identifier, position, relative, velocity);
|
|
26806
|
+
(_state = state).controlHandled || (_state.controlHandled = handled);
|
|
26807
|
+
if (!handled && !state.controlHandled) {
|
|
26808
|
+
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26809
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
25556
26810
|
}
|
|
25557
|
-
_this.
|
|
25558
|
-
|
|
25559
|
-
|
|
25560
|
-
|
|
25561
|
-
|
|
25562
|
-
|
|
25563
|
-
|
|
25564
|
-
|
|
26811
|
+
_this.updatePointerState(state, position);
|
|
26812
|
+
_this.consumeNativeEvent(event, handled);
|
|
26813
|
+
}
|
|
26814
|
+
_this.preventTouchDefaults(event);
|
|
26815
|
+
};
|
|
26816
|
+
this.onNativeTouchEnd = function(event) {
|
|
26817
|
+
_this.handleNativeTouchEnd(event, false);
|
|
26818
|
+
};
|
|
26819
|
+
this.onNativeTouchCancel = function(event) {
|
|
26820
|
+
_this.handleNativeTouchEnd(event, true);
|
|
26821
|
+
};
|
|
26822
|
+
this.onWindowBlur = function() {
|
|
26823
|
+
if (_this.enabled) {
|
|
26824
|
+
_this.mouseState = null;
|
|
26825
|
+
_this.touchStates.clear();
|
|
26826
|
+
_this.mouseFromTouchIndex = null;
|
|
26827
|
+
_this.touchFromMousePressed = false;
|
|
26828
|
+
_this.engine.windowRoot.cancelPointerInput();
|
|
26829
|
+
}
|
|
26830
|
+
};
|
|
26831
|
+
}
|
|
26832
|
+
var _proto = EventSystem.prototype;
|
|
26833
|
+
_proto.bindListeners = function bindListeners(target) {
|
|
26834
|
+
this.unbindListeners();
|
|
26835
|
+
this.target = target;
|
|
26836
|
+
if (!target || typeof window === "undefined") {
|
|
26837
|
+
return;
|
|
26838
|
+
}
|
|
26839
|
+
if (!target.hasAttribute("tabindex")) {
|
|
26840
|
+
target.tabIndex = 0;
|
|
26841
|
+
this.addedTabIndex = true;
|
|
26842
|
+
}
|
|
26843
|
+
if (!target.style.outline) {
|
|
26844
|
+
target.style.outline = "none";
|
|
26845
|
+
this.addedOutlineStyle = true;
|
|
26846
|
+
}
|
|
26847
|
+
this.addNativeHandler(target, "mousedown", this.onNativeMouseDown);
|
|
26848
|
+
// The Window listener runs after the event reaches the host container, so keep a
|
|
26849
|
+
// target listener to preserve notifyTouch/allowPropagation for in-canvas releases.
|
|
26850
|
+
this.addNativeHandler(target, "mouseup", this.onNativeMouseUp);
|
|
26851
|
+
this.addNativeHandler(window, "mouseup", this.onNativeMouseUp);
|
|
26852
|
+
this.addNativeHandler(window, "pointermove", this.onNativeMouseMove);
|
|
26853
|
+
this.addNativeHandler(target, "touchstart", this.onNativeTouchStart, {
|
|
26854
|
+
passive: false
|
|
26855
|
+
});
|
|
26856
|
+
this.addNativeHandler(target, "touchmove", this.onNativeTouchMove, {
|
|
26857
|
+
passive: false
|
|
26858
|
+
});
|
|
26859
|
+
this.addNativeHandler(target, "touchend", this.onNativeTouchEnd, {
|
|
26860
|
+
passive: false
|
|
26861
|
+
});
|
|
26862
|
+
this.addNativeHandler(target, "touchcancel", this.onNativeTouchCancel, {
|
|
26863
|
+
passive: false
|
|
25565
26864
|
});
|
|
25566
|
-
this.
|
|
25567
|
-
|
|
25568
|
-
|
|
25569
|
-
this.
|
|
26865
|
+
this.addNativeHandler(target, "wheel", this.onNativeWheel, {
|
|
26866
|
+
passive: false
|
|
26867
|
+
});
|
|
26868
|
+
this.addNativeHandler(target, "keydown", this.onNativeKeyDown);
|
|
26869
|
+
this.addNativeHandler(target, "keyup", this.onNativeKeyUp);
|
|
26870
|
+
this.addNativeHandler(window, "blur", this.onWindowBlur);
|
|
25570
26871
|
};
|
|
25571
26872
|
_proto.dispatchEvent = function dispatchEvent(type, event) {
|
|
25572
26873
|
var handlers = this.handlers[type];
|
|
25573
|
-
handlers == null ? void 0 : handlers.forEach(function(fn) {
|
|
26874
|
+
handlers == null ? void 0 : handlers.slice().forEach(function(fn) {
|
|
25574
26875
|
return fn(event);
|
|
25575
26876
|
});
|
|
26877
|
+
if (type === EVENT_TYPE_CLICK) {
|
|
26878
|
+
this.onClick(event);
|
|
26879
|
+
} else if (type === EVENT_TYPE_TOUCH_START) {
|
|
26880
|
+
this.onPointerDown(event);
|
|
26881
|
+
} else if (type === EVENT_TYPE_TOUCH_END) {
|
|
26882
|
+
this.onPointerUp(event);
|
|
26883
|
+
} else if (type === EVENT_TYPE_TOUCH_MOVE) {
|
|
26884
|
+
this.onPointerMove(event);
|
|
26885
|
+
}
|
|
25576
26886
|
};
|
|
25577
26887
|
_proto.addEventListener = function addEventListener(type, callback) {
|
|
25578
26888
|
var handlers = this.handlers[type];
|
|
@@ -25590,14 +26900,229 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25590
26900
|
removeItem(handlers, callback);
|
|
25591
26901
|
}
|
|
25592
26902
|
};
|
|
25593
|
-
_proto.
|
|
25594
|
-
|
|
26903
|
+
_proto.dispose = function dispose() {
|
|
26904
|
+
this.engine.windowRoot.cancelPointerInput();
|
|
26905
|
+
this.mouseState = null;
|
|
26906
|
+
this.touchStates.clear();
|
|
26907
|
+
this.mouseFromTouchIndex = null;
|
|
26908
|
+
this.touchFromMousePressed = false;
|
|
26909
|
+
this.handlers = {};
|
|
26910
|
+
this.unbindListeners();
|
|
26911
|
+
this.target = null;
|
|
26912
|
+
};
|
|
26913
|
+
_proto.handleNativeMouseDown = function handleNativeMouseDown(event) {
|
|
26914
|
+
if (!this.enabled || !this.target) {
|
|
26915
|
+
return;
|
|
26916
|
+
}
|
|
26917
|
+
var position = this.getCanvasPosition(event.clientX, event.clientY);
|
|
26918
|
+
this.focusTarget();
|
|
26919
|
+
var state = this.createPointerState(position);
|
|
26920
|
+
this.mouseState = state;
|
|
26921
|
+
state.pressed = true;
|
|
26922
|
+
var handled = this.pushNativeMouseButton(event, position, true);
|
|
26923
|
+
state.controlHandled = handled;
|
|
26924
|
+
if (!handled) {
|
|
26925
|
+
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26926
|
+
this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
26927
|
+
}
|
|
26928
|
+
this.consumeNativeEvent(event, handled);
|
|
26929
|
+
};
|
|
26930
|
+
_proto.handleNativeKey = function handleNativeKey(event, pressed) {
|
|
26931
|
+
if (!this.enabled) {
|
|
26932
|
+
return;
|
|
26933
|
+
}
|
|
26934
|
+
var input = new InputEventKey();
|
|
26935
|
+
input.device = InputEvent.deviceIdKeyboard;
|
|
26936
|
+
input.pressed = pressed;
|
|
26937
|
+
input.echo = pressed && event.repeat;
|
|
26938
|
+
input.keycode = event.key;
|
|
26939
|
+
input.physicalKeycode = event.code;
|
|
26940
|
+
input.keyLabel = event.key;
|
|
26941
|
+
input.unicode = getUnicode(event.key);
|
|
26942
|
+
input.location = getKeyLocation(event.location);
|
|
26943
|
+
input.shiftPressed = event.shiftKey;
|
|
26944
|
+
input.altPressed = event.altKey;
|
|
26945
|
+
input.metaPressed = event.metaKey;
|
|
26946
|
+
input.ctrlPressed = event.ctrlKey;
|
|
26947
|
+
this.engine.windowRoot.pushInput(input);
|
|
26948
|
+
this.consumeNativeEvent(event, this.engine.windowRoot.isInputHandled());
|
|
26949
|
+
};
|
|
26950
|
+
_proto.handleNativeTouchEnd = function handleNativeTouchEnd(event, canceled) {
|
|
26951
|
+
if (!this.enabled) {
|
|
26952
|
+
return;
|
|
26953
|
+
}
|
|
26954
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26955
|
+
var touch = _step.value;
|
|
26956
|
+
var position = this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26957
|
+
var state = this.touchStates.get(touch.identifier);
|
|
26958
|
+
if (!(state == null ? void 0 : state.pressed)) {
|
|
26959
|
+
continue;
|
|
26960
|
+
}
|
|
26961
|
+
var handled = this.pushNativeScreenTouch(touch.identifier, position, false, canceled, false);
|
|
26962
|
+
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26963
|
+
if (!canceled && !state.controlHandled && !handled && this.isClick(state, position)) {
|
|
26964
|
+
this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26965
|
+
}
|
|
26966
|
+
if (!handled && !canceled && !state.controlHandled) {
|
|
26967
|
+
this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26968
|
+
}
|
|
26969
|
+
this.touchStates.delete(touch.identifier);
|
|
26970
|
+
this.consumeNativeEvent(event, handled || state.controlHandled || !this.allowPropagation);
|
|
26971
|
+
}
|
|
26972
|
+
this.preventTouchDefaults(event);
|
|
26973
|
+
};
|
|
26974
|
+
_proto.pushNativeMouseButton = function pushNativeMouseButton(event, position, pressed) {
|
|
26975
|
+
var handled = false;
|
|
26976
|
+
var button = getMouseButton(event.button);
|
|
26977
|
+
if (pressed && this.emulateTouchFromMouse && button === exports.MouseButton.Left) {
|
|
26978
|
+
this.touchFromMousePressed = true;
|
|
26979
|
+
}
|
|
26980
|
+
if (this.touchFromMousePressed && button === exports.MouseButton.Left) {
|
|
26981
|
+
handled = this.pushScreenTouch(0, position, pressed, false, event.detail > 1, InputEvent.deviceIdEmulation);
|
|
26982
|
+
if (!pressed) {
|
|
26983
|
+
this.touchFromMousePressed = false;
|
|
26984
|
+
}
|
|
26985
|
+
}
|
|
26986
|
+
return this.pushMouseButton(event, position, pressed) || handled;
|
|
26987
|
+
};
|
|
26988
|
+
_proto.pushNativeMouseMotion = function pushNativeMouseMotion(event, position, relative, velocity) {
|
|
26989
|
+
var handled = false;
|
|
26990
|
+
if (this.touchFromMousePressed && (event.buttons & 1) !== 0) {
|
|
26991
|
+
handled = this.pushScreenDrag(0, position, relative, velocity, InputEvent.deviceIdEmulation);
|
|
26992
|
+
}
|
|
26993
|
+
return this.pushMouseMotion(event, position, relative, velocity) || handled;
|
|
26994
|
+
};
|
|
26995
|
+
_proto.pushNativeScreenTouch = function pushNativeScreenTouch(index, position, pressed, canceled, doubleTap) {
|
|
26996
|
+
var handled = false;
|
|
26997
|
+
var emulateMouse = false;
|
|
26998
|
+
if (pressed && this.emulateMouseFromTouch && this.mouseFromTouchIndex === null) {
|
|
26999
|
+
this.mouseFromTouchIndex = index;
|
|
27000
|
+
emulateMouse = true;
|
|
27001
|
+
} else if (!pressed && this.mouseFromTouchIndex === index) {
|
|
27002
|
+
emulateMouse = true;
|
|
27003
|
+
this.mouseFromTouchIndex = null;
|
|
27004
|
+
}
|
|
27005
|
+
if (emulateMouse) {
|
|
27006
|
+
handled = this.pushEmulatedMouseButton(position, pressed, canceled, doubleTap);
|
|
27007
|
+
}
|
|
27008
|
+
return this.pushScreenTouch(index, position, pressed, canceled, doubleTap, 0) || handled;
|
|
27009
|
+
};
|
|
27010
|
+
_proto.pushNativeScreenDrag = function pushNativeScreenDrag(index, position, relative, velocity) {
|
|
27011
|
+
var handled = false;
|
|
27012
|
+
if (this.emulateMouseFromTouch && this.mouseFromTouchIndex === index) {
|
|
27013
|
+
handled = this.pushEmulatedMouseMotion(position, relative, velocity);
|
|
27014
|
+
}
|
|
27015
|
+
return this.pushScreenDrag(index, position, relative, velocity, 0) || handled;
|
|
27016
|
+
};
|
|
27017
|
+
_proto.pushEmulatedMouseButton = function pushEmulatedMouseButton(position, pressed, canceled, doubleClick) {
|
|
27018
|
+
var input = new InputEventMouseButton();
|
|
27019
|
+
input.device = InputEvent.deviceIdEmulation;
|
|
27020
|
+
input.position.copyFrom(position);
|
|
27021
|
+
input.globalPosition.copyFrom(position);
|
|
27022
|
+
input.buttonIndex = exports.MouseButton.Left;
|
|
27023
|
+
input.buttonMask = pressed ? exports.MouseButtonMask.Left : exports.MouseButtonMask.None;
|
|
27024
|
+
input.pressed = pressed;
|
|
27025
|
+
input.canceled = canceled;
|
|
27026
|
+
input.doubleClick = doubleClick;
|
|
27027
|
+
this.engine.windowRoot.pushInput(input);
|
|
27028
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27029
|
+
};
|
|
27030
|
+
_proto.pushEmulatedMouseMotion = function pushEmulatedMouseMotion(position, relative, velocity) {
|
|
27031
|
+
var input = new InputEventMouseMotion();
|
|
27032
|
+
input.device = InputEvent.deviceIdEmulation;
|
|
27033
|
+
input.position.copyFrom(position);
|
|
27034
|
+
input.globalPosition.copyFrom(position);
|
|
27035
|
+
input.buttonMask = exports.MouseButtonMask.Left;
|
|
27036
|
+
input.pressed = true;
|
|
27037
|
+
input.relative.copyFrom(relative);
|
|
27038
|
+
input.screenRelative.copyFrom(relative);
|
|
27039
|
+
input.velocity.copyFrom(velocity);
|
|
27040
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27041
|
+
this.engine.windowRoot.pushInput(input);
|
|
27042
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27043
|
+
};
|
|
27044
|
+
_proto.pushMouseButton = function pushMouseButton(event, position, pressed) {
|
|
27045
|
+
var input = new InputEventMouseButton();
|
|
27046
|
+
this.copyMouseFields(input, event, position);
|
|
27047
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27048
|
+
input.buttonIndex = getMouseButton(event.button);
|
|
27049
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27050
|
+
if (pressed) {
|
|
27051
|
+
input.buttonMask |= getMouseButtonBit(input.buttonIndex);
|
|
27052
|
+
} else {
|
|
27053
|
+
input.buttonMask &= ~getMouseButtonBit(input.buttonIndex);
|
|
27054
|
+
}
|
|
27055
|
+
input.pressed = pressed;
|
|
27056
|
+
input.doubleClick = event.detail > 1;
|
|
27057
|
+
this.engine.windowRoot.pushInput(input);
|
|
27058
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27059
|
+
};
|
|
27060
|
+
_proto.pushWheelButton = function pushWheelButton(button, factor, position, event) {
|
|
27061
|
+
var input = new InputEventMouseButton();
|
|
27062
|
+
this.copyMouseFields(input, event, position);
|
|
27063
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27064
|
+
input.buttonIndex = button;
|
|
27065
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27066
|
+
input.factor = factor;
|
|
27067
|
+
input.pressed = true;
|
|
27068
|
+
this.engine.windowRoot.pushInput(input);
|
|
27069
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27070
|
+
};
|
|
27071
|
+
_proto.pushMouseMotion = function pushMouseMotion(event, position, relative, velocity) {
|
|
27072
|
+
var input = new InputEventMouseMotion();
|
|
27073
|
+
this.copyMouseFields(input, event, position);
|
|
27074
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27075
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27076
|
+
input.pressed = event.buttons !== 0;
|
|
27077
|
+
input.relative.copyFrom(relative);
|
|
27078
|
+
input.screenRelative.copyFrom(relative);
|
|
27079
|
+
input.velocity.copyFrom(velocity);
|
|
27080
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27081
|
+
if ("pressure" in event) {
|
|
27082
|
+
input.pressure = event.pressure;
|
|
27083
|
+
input.tilt.set(event.tiltX, event.tiltY);
|
|
27084
|
+
}
|
|
27085
|
+
this.engine.windowRoot.pushInput(input);
|
|
27086
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27087
|
+
};
|
|
27088
|
+
_proto.pushScreenTouch = function pushScreenTouch(index, position, pressed, canceled, doubleTap, device) {
|
|
27089
|
+
var input = new InputEventScreenTouch();
|
|
27090
|
+
input.index = index;
|
|
27091
|
+
input.device = device;
|
|
27092
|
+
input.position.copyFrom(position);
|
|
27093
|
+
input.pressed = pressed;
|
|
27094
|
+
input.canceled = canceled;
|
|
27095
|
+
input.doubleTap = doubleTap;
|
|
27096
|
+
this.engine.windowRoot.pushInput(input);
|
|
27097
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27098
|
+
};
|
|
27099
|
+
_proto.pushScreenDrag = function pushScreenDrag(index, position, relative, velocity, device) {
|
|
27100
|
+
var input = new InputEventScreenDrag();
|
|
27101
|
+
input.index = index;
|
|
27102
|
+
input.device = device;
|
|
27103
|
+
input.position.copyFrom(position);
|
|
27104
|
+
input.relative.copyFrom(relative);
|
|
27105
|
+
input.screenRelative.copyFrom(relative);
|
|
27106
|
+
input.velocity.copyFrom(velocity);
|
|
27107
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27108
|
+
input.pressed = true;
|
|
27109
|
+
this.engine.windowRoot.pushInput(input);
|
|
27110
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27111
|
+
};
|
|
27112
|
+
_proto.copyMouseFields = function copyMouseFields(input, event, position) {
|
|
27113
|
+
input.position.copyFrom(position);
|
|
27114
|
+
input.globalPosition.copyFrom(position);
|
|
27115
|
+
input.shiftPressed = event.shiftKey;
|
|
27116
|
+
input.altPressed = event.altKey;
|
|
27117
|
+
input.metaPressed = event.metaKey;
|
|
27118
|
+
input.ctrlPressed = event.ctrlKey;
|
|
27119
|
+
};
|
|
27120
|
+
_proto.onClick = function onClick(event) {
|
|
25595
27121
|
var hitResults = [];
|
|
25596
|
-
// 收集所有的点击测试结果,click 回调执行可能会对 composition 点击结果有影响,放在点击测试执行完后再统一触发。
|
|
25597
27122
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.engine.compositions), _step; !(_step = _iterator()).done;){
|
|
25598
27123
|
var composition = _step.value;
|
|
25599
27124
|
var _hitResults;
|
|
25600
|
-
(_hitResults = hitResults).push.apply(_hitResults, [].concat(composition.hitTest(x, y)));
|
|
27125
|
+
(_hitResults = hitResults).push.apply(_hitResults, [].concat(composition.hitTest(event.x, event.y)));
|
|
25601
27126
|
}
|
|
25602
27127
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(hitResults), _step1; !(_step1 = _iterator1()).done;){
|
|
25603
27128
|
var hitResult = _step1.value;
|
|
@@ -25614,49 +27139,36 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25614
27139
|
this.engine.emit("click", clickInfo);
|
|
25615
27140
|
}
|
|
25616
27141
|
};
|
|
25617
|
-
_proto.onPointerDown = function onPointerDown(
|
|
25618
|
-
this.handlePointerEvent(
|
|
27142
|
+
_proto.onPointerDown = function onPointerDown(event) {
|
|
27143
|
+
this.handlePointerEvent(event, 0);
|
|
25619
27144
|
};
|
|
25620
|
-
_proto.onPointerUp = function onPointerUp(
|
|
25621
|
-
this.handlePointerEvent(
|
|
27145
|
+
_proto.onPointerUp = function onPointerUp(event) {
|
|
27146
|
+
this.handlePointerEvent(event, 1);
|
|
25622
27147
|
};
|
|
25623
|
-
_proto.onPointerMove = function onPointerMove(
|
|
25624
|
-
this.handlePointerEvent(
|
|
27148
|
+
_proto.onPointerMove = function onPointerMove(event) {
|
|
27149
|
+
this.handlePointerEvent(event, 2);
|
|
25625
27150
|
};
|
|
25626
|
-
_proto.handlePointerEvent = function handlePointerEvent(
|
|
27151
|
+
_proto.handlePointerEvent = function handlePointerEvent(event, type) {
|
|
25627
27152
|
var hitRegion = null;
|
|
25628
|
-
var x = e.x, y = e.y, width = e.width, height = e.height;
|
|
25629
27153
|
if (!(type === 2 && this.skipPointerMovePicking)) {
|
|
25630
27154
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.engine.compositions), _step; !(_step = _iterator()).done;){
|
|
25631
27155
|
var composition = _step.value;
|
|
25632
|
-
var regions = composition.hitTest(x, y);
|
|
27156
|
+
var regions = composition.hitTest(event.x, event.y);
|
|
25633
27157
|
if (regions.length > 0) {
|
|
25634
27158
|
hitRegion = regions[regions.length - 1];
|
|
25635
27159
|
}
|
|
25636
27160
|
}
|
|
25637
27161
|
}
|
|
25638
27162
|
var eventData = new PointerEventData();
|
|
25639
|
-
eventData.position.x = (x + 1) / 2 * width;
|
|
25640
|
-
eventData.position.y = (y + 1) / 2 * height;
|
|
25641
|
-
eventData.delta.x =
|
|
25642
|
-
eventData.delta.y =
|
|
25643
|
-
var raycast = eventData.pointerCurrentRaycast;
|
|
27163
|
+
eventData.position.x = (event.x + 1) / 2 * event.width;
|
|
27164
|
+
eventData.position.y = (event.y + 1) / 2 * event.height;
|
|
27165
|
+
eventData.delta.x = event.vx * event.width;
|
|
27166
|
+
eventData.delta.y = event.vy * event.height;
|
|
25644
27167
|
if (hitRegion) {
|
|
25645
|
-
|
|
25646
|
-
|
|
25647
|
-
}
|
|
25648
|
-
var eventName = "pointerdown";
|
|
25649
|
-
switch(type){
|
|
25650
|
-
case 0:
|
|
25651
|
-
eventName = "pointerdown";
|
|
25652
|
-
break;
|
|
25653
|
-
case 1:
|
|
25654
|
-
eventName = "pointerup";
|
|
25655
|
-
break;
|
|
25656
|
-
case 2:
|
|
25657
|
-
eventName = "pointermove";
|
|
25658
|
-
break;
|
|
27168
|
+
eventData.pointerCurrentRaycast.point = hitRegion.position;
|
|
27169
|
+
eventData.pointerCurrentRaycast.item = hitRegion.item;
|
|
25659
27170
|
}
|
|
27171
|
+
var eventName = type === 0 ? "pointerdown" : type === 1 ? "pointerup" : "pointermove";
|
|
25660
27172
|
if (hitRegion) {
|
|
25661
27173
|
var hitItem = hitRegion.item;
|
|
25662
27174
|
var hitComposition = hitItem.composition;
|
|
@@ -25665,29 +27177,185 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25665
27177
|
this.engine.emit(eventName, eventData);
|
|
25666
27178
|
}
|
|
25667
27179
|
};
|
|
25668
|
-
_proto.
|
|
25669
|
-
var
|
|
25670
|
-
|
|
25671
|
-
|
|
25672
|
-
|
|
25673
|
-
|
|
25674
|
-
|
|
25675
|
-
|
|
25676
|
-
|
|
27180
|
+
_proto.createPointerState = function createPointerState(position) {
|
|
27181
|
+
var state = {
|
|
27182
|
+
start: position.clone(),
|
|
27183
|
+
last: position.clone(),
|
|
27184
|
+
lastTime: performance.now(),
|
|
27185
|
+
controlHandled: false,
|
|
27186
|
+
pressed: false
|
|
27187
|
+
};
|
|
27188
|
+
return state;
|
|
27189
|
+
};
|
|
27190
|
+
_proto.updatePointerState = function updatePointerState(state, position) {
|
|
27191
|
+
state.last.copyFrom(position);
|
|
27192
|
+
state.lastTime = performance.now();
|
|
27193
|
+
};
|
|
27194
|
+
_proto.getVelocity = function getVelocity(state, position) {
|
|
27195
|
+
var elapsed = Math.max(performance.now() - state.lastTime, 1);
|
|
27196
|
+
return new Vector2((position.x - state.last.x) / elapsed, (position.y - state.last.y) / elapsed);
|
|
27197
|
+
};
|
|
27198
|
+
_proto.isClick = function isClick(state, position) {
|
|
27199
|
+
return Math.abs(position.x - state.start.x) + Math.abs(position.y - state.start.y) < 4;
|
|
27200
|
+
};
|
|
27201
|
+
_proto.createPointerEvent = function createPointerEvent(origin, position, state, velocity) {
|
|
27202
|
+
if (velocity === void 0) velocity = new Vector2();
|
|
27203
|
+
var target = this.target;
|
|
27204
|
+
var rect = target == null ? void 0 : target.getBoundingClientRect();
|
|
27205
|
+
var cssWidth = (rect == null ? void 0 : rect.width) || 1;
|
|
27206
|
+
var cssHeight = (rect == null ? void 0 : rect.height) || 1;
|
|
27207
|
+
var _target_width, _target_height;
|
|
27208
|
+
return {
|
|
27209
|
+
x: position.x / cssWidth * 2 - 1,
|
|
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,
|
|
27213
|
+
vx: velocity.x / cssWidth * 2,
|
|
27214
|
+
vy: -velocity.y / cssHeight * 2,
|
|
27215
|
+
ts: performance.now(),
|
|
27216
|
+
dx: (position.x - state.start.x) / cssWidth * 2,
|
|
27217
|
+
dy: -(position.y - state.start.y) / cssHeight * 2,
|
|
27218
|
+
width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
|
|
27219
|
+
height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
|
|
27220
|
+
origin: origin
|
|
27221
|
+
};
|
|
27222
|
+
};
|
|
27223
|
+
_proto.getCanvasPosition = function getCanvasPosition(clientX, clientY) {
|
|
27224
|
+
var _this_target;
|
|
27225
|
+
var rect = (_this_target = this.target) == null ? void 0 : _this_target.getBoundingClientRect();
|
|
27226
|
+
if (!rect) {
|
|
27227
|
+
return new Vector2();
|
|
25677
27228
|
}
|
|
27229
|
+
return new Vector2(clientX - rect.left, clientY - rect.top);
|
|
25678
27230
|
};
|
|
27231
|
+
_proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
|
|
27232
|
+
if (handled && !this.allowPropagation) {
|
|
27233
|
+
if (event.cancelable) {
|
|
27234
|
+
event.preventDefault();
|
|
27235
|
+
}
|
|
27236
|
+
event.stopPropagation();
|
|
27237
|
+
}
|
|
27238
|
+
};
|
|
27239
|
+
_proto.preventTouchDefaults = function preventTouchDefaults(event) {
|
|
27240
|
+
if (event.cancelable) {
|
|
27241
|
+
event.preventDefault();
|
|
27242
|
+
}
|
|
27243
|
+
};
|
|
27244
|
+
_proto.focusTarget = function focusTarget() {
|
|
27245
|
+
var _this_target;
|
|
27246
|
+
(_this_target = this.target) == null ? void 0 : _this_target.focus();
|
|
27247
|
+
};
|
|
27248
|
+
_proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
|
|
27249
|
+
target.addEventListener(name, handler, options);
|
|
27250
|
+
this.nativeHandlers.push({
|
|
27251
|
+
target: target,
|
|
27252
|
+
name: name,
|
|
27253
|
+
handler: handler,
|
|
27254
|
+
options: options
|
|
27255
|
+
});
|
|
27256
|
+
};
|
|
27257
|
+
_proto.unbindListeners = function unbindListeners() {
|
|
27258
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.nativeHandlers), _step; !(_step = _iterator()).done;){
|
|
27259
|
+
var nativeHandler = _step.value;
|
|
27260
|
+
nativeHandler.target.removeEventListener(nativeHandler.name, nativeHandler.handler, nativeHandler.options);
|
|
27261
|
+
}
|
|
27262
|
+
this.nativeHandlers = [];
|
|
27263
|
+
if (this.addedTabIndex && this.target) {
|
|
27264
|
+
this.target.removeAttribute("tabindex");
|
|
27265
|
+
}
|
|
27266
|
+
if (this.addedOutlineStyle && this.target) {
|
|
27267
|
+
this.target.style.removeProperty("outline");
|
|
27268
|
+
}
|
|
27269
|
+
this.addedTabIndex = false;
|
|
27270
|
+
this.addedOutlineStyle = false;
|
|
27271
|
+
};
|
|
27272
|
+
_create_class(EventSystem, [
|
|
27273
|
+
{
|
|
27274
|
+
key: "enabled",
|
|
27275
|
+
get: function get() {
|
|
27276
|
+
return this._enabled;
|
|
27277
|
+
},
|
|
27278
|
+
set: function set(value) {
|
|
27279
|
+
if (this._enabled === value) {
|
|
27280
|
+
return;
|
|
27281
|
+
}
|
|
27282
|
+
this._enabled = value;
|
|
27283
|
+
if (!value) {
|
|
27284
|
+
this.mouseState = null;
|
|
27285
|
+
this.touchStates.clear();
|
|
27286
|
+
this.mouseFromTouchIndex = null;
|
|
27287
|
+
this.touchFromMousePressed = false;
|
|
27288
|
+
this.engine.windowRoot.cancelPointerInput();
|
|
27289
|
+
}
|
|
27290
|
+
}
|
|
27291
|
+
}
|
|
27292
|
+
]);
|
|
25679
27293
|
return EventSystem;
|
|
25680
27294
|
}();
|
|
25681
|
-
function
|
|
25682
|
-
|
|
25683
|
-
|
|
25684
|
-
|
|
25685
|
-
|
|
25686
|
-
|
|
25687
|
-
|
|
25688
|
-
|
|
25689
|
-
|
|
25690
|
-
|
|
27295
|
+
function getKeyLocation(location) {
|
|
27296
|
+
if (location === 1) {
|
|
27297
|
+
return exports.KeyLocation.Left;
|
|
27298
|
+
}
|
|
27299
|
+
if (location === 2) {
|
|
27300
|
+
return exports.KeyLocation.Right;
|
|
27301
|
+
}
|
|
27302
|
+
return exports.KeyLocation.Unspecified;
|
|
27303
|
+
}
|
|
27304
|
+
function getUnicode(key) {
|
|
27305
|
+
var characters = Array.from(key);
|
|
27306
|
+
var _characters__codePointAt;
|
|
27307
|
+
return characters.length === 1 ? (_characters__codePointAt = characters[0].codePointAt(0)) != null ? _characters__codePointAt : 0 : 0;
|
|
27308
|
+
}
|
|
27309
|
+
function getMouseButton(button) {
|
|
27310
|
+
switch(button){
|
|
27311
|
+
case 0:
|
|
27312
|
+
return exports.MouseButton.Left;
|
|
27313
|
+
case 1:
|
|
27314
|
+
return exports.MouseButton.Middle;
|
|
27315
|
+
case 2:
|
|
27316
|
+
return exports.MouseButton.Right;
|
|
27317
|
+
case 3:
|
|
27318
|
+
return exports.MouseButton.Xbutton1;
|
|
27319
|
+
case 4:
|
|
27320
|
+
return exports.MouseButton.Xbutton2;
|
|
27321
|
+
default:
|
|
27322
|
+
return exports.MouseButton.None;
|
|
27323
|
+
}
|
|
27324
|
+
}
|
|
27325
|
+
function getMouseButtonMask(buttons) {
|
|
27326
|
+
var mask = exports.MouseButtonMask.None;
|
|
27327
|
+
if ((buttons & 1) !== 0) {
|
|
27328
|
+
mask |= exports.MouseButtonMask.Left;
|
|
27329
|
+
}
|
|
27330
|
+
if ((buttons & 2) !== 0) {
|
|
27331
|
+
mask |= exports.MouseButtonMask.Right;
|
|
27332
|
+
}
|
|
27333
|
+
if ((buttons & 4) !== 0) {
|
|
27334
|
+
mask |= exports.MouseButtonMask.Middle;
|
|
27335
|
+
}
|
|
27336
|
+
if ((buttons & 8) !== 0) {
|
|
27337
|
+
mask |= exports.MouseButtonMask.Xbutton1;
|
|
27338
|
+
}
|
|
27339
|
+
if ((buttons & 16) !== 0) {
|
|
27340
|
+
mask |= exports.MouseButtonMask.Xbutton2;
|
|
27341
|
+
}
|
|
27342
|
+
return mask;
|
|
27343
|
+
}
|
|
27344
|
+
function getMouseButtonBit(button) {
|
|
27345
|
+
switch(button){
|
|
27346
|
+
case exports.MouseButton.Left:
|
|
27347
|
+
return exports.MouseButtonMask.Left;
|
|
27348
|
+
case exports.MouseButton.Right:
|
|
27349
|
+
return exports.MouseButtonMask.Right;
|
|
27350
|
+
case exports.MouseButton.Middle:
|
|
27351
|
+
return exports.MouseButtonMask.Middle;
|
|
27352
|
+
case exports.MouseButton.Xbutton1:
|
|
27353
|
+
return exports.MouseButtonMask.Xbutton1;
|
|
27354
|
+
case exports.MouseButton.Xbutton2:
|
|
27355
|
+
return exports.MouseButtonMask.Xbutton2;
|
|
27356
|
+
default:
|
|
27357
|
+
return exports.MouseButtonMask.None;
|
|
27358
|
+
}
|
|
25691
27359
|
}
|
|
25692
27360
|
|
|
25693
27361
|
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
@@ -27708,11 +29376,6 @@ exports.SpritePropertyTrack = __decorate([
|
|
|
27708
29376
|
effectsClass("SpritePropertyTrack")
|
|
27709
29377
|
], exports.SpritePropertyTrack);
|
|
27710
29378
|
|
|
27711
|
-
function _assert_this_initialized(self) {
|
|
27712
|
-
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
27713
|
-
return self;
|
|
27714
|
-
}
|
|
27715
|
-
|
|
27716
29379
|
var Cone = /*#__PURE__*/ function() {
|
|
27717
29380
|
function Cone(props) {
|
|
27718
29381
|
var _this = this;
|
|
@@ -37717,7 +39380,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
37717
39380
|
return ret;
|
|
37718
39381
|
}
|
|
37719
39382
|
|
|
37720
|
-
var version$2 = "2.10.0-alpha.
|
|
39383
|
+
var version$2 = "2.10.0-alpha.4";
|
|
37721
39384
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
37722
39385
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
37723
39386
|
var reverseParticle = false;
|
|
@@ -39669,10 +41332,11 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39669
41332
|
_this./**
|
|
39670
41333
|
* 是否开启后处理
|
|
39671
41334
|
*/ postProcessingEnabled = false;
|
|
39672
|
-
_this.canvasLayers = [];
|
|
39673
41335
|
_this.destroyed = false;
|
|
39674
41336
|
_this.paused = true;
|
|
39675
41337
|
_this.isEndCalled = false;
|
|
41338
|
+
_this._renderOrder = 0;
|
|
41339
|
+
_this._interactive = true;
|
|
39676
41340
|
_this._textures = [];
|
|
39677
41341
|
var _ref = props != null ? props : {}, _ref_reusable = _ref.reusable, reusable = _ref_reusable === void 0 ? false : _ref_reusable, _ref_speed = _ref.speed, speed = _ref_speed === void 0 ? 1 : _ref_speed, _ref_baseRenderOrder = _ref.baseRenderOrder, baseRenderOrder = _ref_baseRenderOrder === void 0 ? 0 : _ref_baseRenderOrder, onItemMessage = _ref.onItemMessage;
|
|
39678
41342
|
_this.engine.addComposition(_assert_this_initialized(_this));
|
|
@@ -39705,13 +41369,14 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39705
41369
|
_this.root = new exports.VFXItem(_this.engine);
|
|
39706
41370
|
_this.root.name = "root";
|
|
39707
41371
|
_this.root.composition = _assert_this_initialized(_this);
|
|
41372
|
+
_this.root.setParent(_this.engine.root);
|
|
39708
41373
|
_this.pluginRoot = new exports.VFXItem(_this.engine);
|
|
39709
41374
|
_this.pluginRoot.name = "pluginRoot";
|
|
39710
41375
|
_this.pluginRoot.setParent(_this.root);
|
|
39711
|
-
_this.pluginRoot.addComponent(CanvasLayer);
|
|
39712
41376
|
// Instantiate composition rootItem
|
|
39713
41377
|
_this.sceneRoot = new exports.VFXItem(_this.engine);
|
|
39714
41378
|
_this.sceneRoot.setParent(_this.root);
|
|
41379
|
+
_this.uiCanvas = _this.sceneRoot.addComponent(UICanvas);
|
|
39715
41380
|
if (sourceContent) {
|
|
39716
41381
|
_this.sceneRoot.setInstanceId(sourceContent.id);
|
|
39717
41382
|
_this.sceneRoot.instantiatePreComposition(sourceContent, false);
|
|
@@ -39910,9 +41575,13 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39910
41575
|
this.isEndCalled = false;
|
|
39911
41576
|
this.rootComposition.setTime(0);
|
|
39912
41577
|
};
|
|
39913
|
-
_proto.render = function render() {
|
|
41578
|
+
/** Renders this Composition content. Screen-space UI is rendered by Engine. */ _proto.render = function render() {
|
|
41579
|
+
this.renderContent();
|
|
41580
|
+
};
|
|
41581
|
+
/**
|
|
41582
|
+
* Renders only the Composition scene content.
|
|
41583
|
+
*/ _proto.renderContent = function renderContent() {
|
|
39914
41584
|
this.renderer.renderRenderFrame(this.renderFrame);
|
|
39915
|
-
this.renderCanvasLayers();
|
|
39916
41585
|
};
|
|
39917
41586
|
/**
|
|
39918
41587
|
* 合成更新,针对所有 item 的更新
|
|
@@ -40001,17 +41670,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
40001
41670
|
}
|
|
40002
41671
|
}
|
|
40003
41672
|
};
|
|
40004
|
-
_proto.renderCanvasLayers = function renderCanvasLayers() {
|
|
40005
|
-
this.engine.graphics.begin();
|
|
40006
|
-
this.canvasLayers.sort(function(leftLayer, rightLayer) {
|
|
40007
|
-
return leftLayer.layer - rightLayer.layer;
|
|
40008
|
-
});
|
|
40009
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvasLayers), _step; !(_step = _iterator()).done;){
|
|
40010
|
-
var canvasLayer = _step.value;
|
|
40011
|
-
canvasLayer.draw();
|
|
40012
|
-
}
|
|
40013
|
-
this.engine.graphics.end();
|
|
40014
|
-
};
|
|
40015
41673
|
/**
|
|
40016
41674
|
* @internal
|
|
40017
41675
|
*/ _proto.createTexturesFromData = function createTexturesFromData(textureDataList) {
|
|
@@ -40280,6 +41938,35 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
40280
41938
|
})();
|
|
40281
41939
|
};
|
|
40282
41940
|
_create_class(Composition, [
|
|
41941
|
+
{
|
|
41942
|
+
key: "renderOrder",
|
|
41943
|
+
get: /**
|
|
41944
|
+
* 合成渲染顺序,默认按升序渲染
|
|
41945
|
+
*/ function get() {
|
|
41946
|
+
return this._renderOrder;
|
|
41947
|
+
},
|
|
41948
|
+
set: function set(value) {
|
|
41949
|
+
this._renderOrder = value;
|
|
41950
|
+
if (this.uiCanvas) {
|
|
41951
|
+
this.uiCanvas.order = value;
|
|
41952
|
+
}
|
|
41953
|
+
}
|
|
41954
|
+
},
|
|
41955
|
+
{
|
|
41956
|
+
key: "interactive",
|
|
41957
|
+
get: /**
|
|
41958
|
+
* 合成内的元素否允许点击、拖拽交互
|
|
41959
|
+
* @since 1.6.0
|
|
41960
|
+
*/ function get() {
|
|
41961
|
+
return this._interactive;
|
|
41962
|
+
},
|
|
41963
|
+
set: function set(value) {
|
|
41964
|
+
this._interactive = !!value;
|
|
41965
|
+
if (this.uiCanvas) {
|
|
41966
|
+
this.uiCanvas.receivesEvents = this._interactive;
|
|
41967
|
+
}
|
|
41968
|
+
}
|
|
41969
|
+
},
|
|
40283
41970
|
{
|
|
40284
41971
|
key: "width",
|
|
40285
41972
|
get: /**
|
|
@@ -42057,7 +43744,6 @@ var DEFAULT_FPS = 60;
|
|
|
42057
43744
|
/**
|
|
42058
43745
|
* 渲染过程中错误队列
|
|
42059
43746
|
*/ _this.renderErrors = new Set();
|
|
42060
|
-
_this.compositions = [];
|
|
42061
43747
|
_this.assetManagers = [];
|
|
42062
43748
|
_this.env = "";
|
|
42063
43749
|
/**
|
|
@@ -42079,6 +43765,7 @@ var DEFAULT_FPS = 60;
|
|
|
42079
43765
|
_this.framebuffers = [];
|
|
42080
43766
|
_this.renderbuffers = [];
|
|
42081
43767
|
_this.particleSystems = [];
|
|
43768
|
+
_this._compositions = [];
|
|
42082
43769
|
_this.clearAction = {
|
|
42083
43770
|
stencilAction: exports.TextureLoadAction.clear,
|
|
42084
43771
|
clearStencil: 0,
|
|
@@ -42103,6 +43790,9 @@ var DEFAULT_FPS = 60;
|
|
|
42103
43790
|
_this.pixelRatio = (_options_pixelRatio = options == null ? void 0 : options.pixelRatio) != null ? _options_pixelRatio : getPixelRatio();
|
|
42104
43791
|
_this.jsonSceneData = {};
|
|
42105
43792
|
_this.objectInstance = {};
|
|
43793
|
+
_this.root = new exports.VFXItem(_assert_this_initialized(_this));
|
|
43794
|
+
_this.root.name = "root";
|
|
43795
|
+
_this.windowRoot = new WindowRootControl(_assert_this_initialized(_this));
|
|
42106
43796
|
_this.whiteTexture = generateWhiteTexture(_assert_this_initialized(_this));
|
|
42107
43797
|
_this.transparentTexture = generateEmptyTexture(_assert_this_initialized(_this));
|
|
42108
43798
|
if (!(options == null ? void 0 : options.manualRender)) {
|
|
@@ -42237,9 +43927,6 @@ var DEFAULT_FPS = 60;
|
|
|
42237
43927
|
// Sort compositions by index
|
|
42238
43928
|
//-------------------------------------------------------------------------
|
|
42239
43929
|
var compositions = this.compositions;
|
|
42240
|
-
compositions.sort(function(a, b) {
|
|
42241
|
-
return a.getIndex() - b.getIndex();
|
|
42242
|
-
});
|
|
42243
43930
|
var skipRender = false;
|
|
42244
43931
|
// Update Compositions
|
|
42245
43932
|
//-------------------------------------------------------------------------
|
|
@@ -42258,6 +43945,7 @@ var DEFAULT_FPS = 60;
|
|
|
42258
43945
|
(_this_ticker1 = this.ticker) == null ? void 0 : _this_ticker1.pause();
|
|
42259
43946
|
return;
|
|
42260
43947
|
}
|
|
43948
|
+
this.windowRoot.update(dt);
|
|
42261
43949
|
// Tick compositions onPreRender
|
|
42262
43950
|
//-------------------------------------------------------------------------
|
|
42263
43951
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -42270,8 +43958,9 @@ var DEFAULT_FPS = 60;
|
|
|
42270
43958
|
this.renderer.clear(this.clearAction);
|
|
42271
43959
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(compositions), _step2; !(_step2 = _iterator2()).done;){
|
|
42272
43960
|
var composition2 = _step2.value;
|
|
42273
|
-
composition2.
|
|
43961
|
+
composition2.renderContent();
|
|
42274
43962
|
}
|
|
43963
|
+
this.windowRoot.render();
|
|
42275
43964
|
this.renderTargetPool.flush();
|
|
42276
43965
|
};
|
|
42277
43966
|
/**
|
|
@@ -42313,6 +44002,7 @@ var DEFAULT_FPS = 60;
|
|
|
42313
44002
|
this.canvas.style.height = containerHeight + "px";
|
|
42314
44003
|
logger.info("Resize engine " + this.name + " [" + canvasWidth + "," + canvasHeight + "," + containerWidth + "," + containerHeight + "].");
|
|
42315
44004
|
this.setSize(canvasWidth, canvasHeight);
|
|
44005
|
+
this.windowRoot.resize(canvasWidth, canvasHeight);
|
|
42316
44006
|
}
|
|
42317
44007
|
};
|
|
42318
44008
|
_proto.setSize = function setSize(width, height) {
|
|
@@ -42320,7 +44010,7 @@ var DEFAULT_FPS = 60;
|
|
|
42320
44010
|
if (this.getWidth() !== width || this.getHeight() !== height) {
|
|
42321
44011
|
this.canvas.width = width;
|
|
42322
44012
|
this.canvas.height = height;
|
|
42323
|
-
this.
|
|
44013
|
+
this.setViewport(0, 0, width, height);
|
|
42324
44014
|
}
|
|
42325
44015
|
(_this_compositions = this.compositions) == null ? void 0 : _this_compositions.forEach(function(comp) {
|
|
42326
44016
|
comp.camera.aspect = width / height;
|
|
@@ -42349,6 +44039,26 @@ var DEFAULT_FPS = 60;
|
|
|
42349
44039
|
/** @hide */ _proto.bindBuffers = function bindBuffers(vertexBuffers, indexBuffer, effect) {
|
|
42350
44040
|
throw new Error("The active rendering backend cannot bind geometry buffers.");
|
|
42351
44041
|
};
|
|
44042
|
+
/**
|
|
44043
|
+
* 使用当前绑定的顶点和索引缓冲区绘制图元。
|
|
44044
|
+
* @param mode - 图元类型
|
|
44045
|
+
* @param indexOffset - 索引缓冲区中的字节偏移
|
|
44046
|
+
* @param indexCount - 索引数量
|
|
44047
|
+
* @param instanceCount - 实例数量
|
|
44048
|
+
* @hide
|
|
44049
|
+
*/ _proto.drawElementsType = function drawElementsType(mode, indexOffset, indexCount, instanceCount) {
|
|
44050
|
+
throw new Error("The active rendering backend cannot draw indexed primitives.");
|
|
44051
|
+
};
|
|
44052
|
+
/**
|
|
44053
|
+
* 使用当前绑定的顶点缓冲区绘制图元。
|
|
44054
|
+
* @param mode - 图元类型
|
|
44055
|
+
* @param vertexStart - 起始顶点
|
|
44056
|
+
* @param vertexCount - 顶点数量
|
|
44057
|
+
* @param instanceCount - 实例数量
|
|
44058
|
+
* @hide
|
|
44059
|
+
*/ _proto.drawArraysType = function drawArraysType(mode, vertexStart, vertexCount, instanceCount) {
|
|
44060
|
+
throw new Error("The active rendering backend cannot draw primitives.");
|
|
44061
|
+
};
|
|
42352
44062
|
_proto.addTexture = function addTexture(tex) {
|
|
42353
44063
|
if (this.disposed) {
|
|
42354
44064
|
return;
|
|
@@ -42480,15 +44190,12 @@ var DEFAULT_FPS = 60;
|
|
|
42480
44190
|
* @param height
|
|
42481
44191
|
* example:
|
|
42482
44192
|
* gl.viewport(0, 0, width, height);
|
|
42483
|
-
*/ _proto.
|
|
44193
|
+
*/ _proto.setViewport = function setViewport(x, y, width, height) {
|
|
42484
44194
|
// OVERRIDE
|
|
42485
44195
|
};
|
|
42486
44196
|
_proto.clear = function clear(action) {
|
|
42487
44197
|
// OVERRIDE
|
|
42488
44198
|
};
|
|
42489
|
-
_proto.drawGeometry = function drawGeometry(geometry, matrix, material, subMeshIndex) {
|
|
42490
|
-
// OVERRIDE
|
|
42491
|
-
};
|
|
42492
44199
|
/*** 渲染状态控制 ***/ _proto.setSampleAlphaToCoverage = function setSampleAlphaToCoverage(enable) {
|
|
42493
44200
|
// OVERRIDE
|
|
42494
44201
|
};
|
|
@@ -42573,6 +44280,12 @@ var DEFAULT_FPS = 60;
|
|
|
42573
44280
|
}
|
|
42574
44281
|
(_this_ticker = this.ticker) == null ? void 0 : _this_ticker.stop();
|
|
42575
44282
|
(_this_eventSystem = this.eventSystem) == null ? void 0 : _this_eventSystem.dispose();
|
|
44283
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this._compositions.slice()), _step; !(_step = _iterator()).done;){
|
|
44284
|
+
var composition = _step.value;
|
|
44285
|
+
composition.dispose();
|
|
44286
|
+
}
|
|
44287
|
+
this.root.dispose();
|
|
44288
|
+
this.windowRoot.dispose();
|
|
42576
44289
|
(_this_assetService = this.assetService) == null ? void 0 : _this_assetService.dispose();
|
|
42577
44290
|
(_this__graphics = this._graphics) == null ? void 0 : _this__graphics.dispose();
|
|
42578
44291
|
this.renderPasses.forEach(function(pass) {
|
|
@@ -42593,16 +44306,13 @@ var DEFAULT_FPS = 60;
|
|
|
42593
44306
|
this.assetManagers.forEach(function(assetManager) {
|
|
42594
44307
|
return assetManager.dispose();
|
|
42595
44308
|
});
|
|
42596
|
-
this.compositions.forEach(function(comp) {
|
|
42597
|
-
return comp.dispose();
|
|
42598
|
-
});
|
|
42599
44309
|
this.textures = [];
|
|
42600
44310
|
this.materials = [];
|
|
42601
44311
|
this.geometries = [];
|
|
42602
44312
|
this.meshes = [];
|
|
42603
44313
|
this.renderPasses = [];
|
|
42604
|
-
this.compositions = [];
|
|
42605
44314
|
this.particleSystems = [];
|
|
44315
|
+
this._compositions = [];
|
|
42606
44316
|
};
|
|
42607
44317
|
_proto.getTargetSize = function getTargetSize(parentEle) {
|
|
42608
44318
|
if (parentEle === undefined || parentEle === null) {
|
|
@@ -42655,6 +44365,14 @@ var DEFAULT_FPS = 60;
|
|
|
42655
44365
|
];
|
|
42656
44366
|
};
|
|
42657
44367
|
_create_class(Engine, [
|
|
44368
|
+
{
|
|
44369
|
+
key: "compositions",
|
|
44370
|
+
get: function get() {
|
|
44371
|
+
return this._compositions.sort(function(a, b) {
|
|
44372
|
+
return a.getIndex() - b.getIndex();
|
|
44373
|
+
});
|
|
44374
|
+
}
|
|
44375
|
+
},
|
|
42658
44376
|
{
|
|
42659
44377
|
key: "graphics",
|
|
42660
44378
|
get: function get() {
|
|
@@ -42892,7 +44610,7 @@ registerPlugin("text", TextLoader);
|
|
|
42892
44610
|
registerPlugin("sprite", SpriteLoader);
|
|
42893
44611
|
registerPlugin("particle", ParticleLoader);
|
|
42894
44612
|
registerPlugin("interact", InteractLoader);
|
|
42895
|
-
var version$1 = "2.10.0-alpha.
|
|
44613
|
+
var version$1 = "2.10.0-alpha.4";
|
|
42896
44614
|
logger.info("Core version: " + version$1 + ".");
|
|
42897
44615
|
|
|
42898
44616
|
var _obj;
|
|
@@ -43839,7 +45557,7 @@ function disposeThreeGeometry(source) {
|
|
|
43839
45557
|
return Composition.call(this, engine, props, scene);
|
|
43840
45558
|
}
|
|
43841
45559
|
var _proto = ThreeComposition.prototype;
|
|
43842
|
-
_proto.
|
|
45560
|
+
_proto.renderContent = function renderContent() {
|
|
43843
45561
|
var render = this.renderer;
|
|
43844
45562
|
var frame = this.renderFrame;
|
|
43845
45563
|
frame.renderPasses[0].meshes.length = 0;
|
|
@@ -43874,6 +45592,8 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
43874
45592
|
_proto.getHeight = function getHeight() {
|
|
43875
45593
|
return this.engine.canvas.height;
|
|
43876
45594
|
};
|
|
45595
|
+
_proto.drawGeometry = function drawGeometry(geometry, matrix, material, subMeshIndex) {
|
|
45596
|
+
};
|
|
43877
45597
|
return ThreeRenderer;
|
|
43878
45598
|
}(Renderer);
|
|
43879
45599
|
|
|
@@ -44383,7 +46103,7 @@ applyMixins(exports.ThreeTextComponent, [
|
|
|
44383
46103
|
*/ Mesh.create = function(engine, props) {
|
|
44384
46104
|
return new ThreeMesh(engine, props);
|
|
44385
46105
|
};
|
|
44386
|
-
var version = "2.10.0-alpha.
|
|
46106
|
+
var version = "2.10.0-alpha.4";
|
|
44387
46107
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
44388
46108
|
|
|
44389
46109
|
exports.ATLAS_SIZE = ATLAS_SIZE;
|
|
@@ -44422,8 +46142,8 @@ exports.COPY_MESH_SHADER_ID = COPY_MESH_SHADER_ID;
|
|
|
44422
46142
|
exports.COPY_VERTEX_SHADER = COPY_VERTEX_SHADER;
|
|
44423
46143
|
exports.Camera = Camera;
|
|
44424
46144
|
exports.CameraVFXItemLoader = CameraVFXItemLoader;
|
|
44425
|
-
exports.
|
|
44426
|
-
exports.
|
|
46145
|
+
exports.CanvasContainer = CanvasContainer;
|
|
46146
|
+
exports.CanvasRootControl = CanvasRootControl;
|
|
44427
46147
|
exports.Circle = Circle$1;
|
|
44428
46148
|
exports.ColorCurve = ColorCurve;
|
|
44429
46149
|
exports.ColorPlayable = ColorPlayable;
|
|
@@ -44436,6 +46156,7 @@ exports.Composition = Composition;
|
|
|
44436
46156
|
exports.ConstBoolNode = ConstBoolNode;
|
|
44437
46157
|
exports.ConstFloatNode = ConstFloatNode;
|
|
44438
46158
|
exports.ConstraintTarget = ConstraintTarget;
|
|
46159
|
+
exports.ContainerControl = ContainerControl;
|
|
44439
46160
|
exports.Control = Control;
|
|
44440
46161
|
exports.ControlParameterBoolNode = ControlParameterBoolNode;
|
|
44441
46162
|
exports.ControlParameterFloatNode = ControlParameterFloatNode;
|
|
@@ -44459,7 +46180,6 @@ exports.Ellipse = Ellipse;
|
|
|
44459
46180
|
exports.Engine = Engine;
|
|
44460
46181
|
exports.EventEmitter = EventEmitter;
|
|
44461
46182
|
exports.EventSystem = EventSystem;
|
|
44462
|
-
exports.FONT_SCALE = FONT_SCALE;
|
|
44463
46183
|
exports.Float16ArrayWrapper = Float16ArrayWrapper;
|
|
44464
46184
|
exports.FloatComparisonNode = FloatComparisonNode;
|
|
44465
46185
|
exports.FloatComparisonNodeData = FloatComparisonNodeData;
|
|
@@ -44476,6 +46196,14 @@ exports.GraphNode = GraphNode;
|
|
|
44476
46196
|
exports.GraphNodeData = GraphNodeData;
|
|
44477
46197
|
exports.Graphics = Graphics;
|
|
44478
46198
|
exports.HELP_LINK = HELP_LINK;
|
|
46199
|
+
exports.InputEvent = InputEvent;
|
|
46200
|
+
exports.InputEventKey = InputEventKey;
|
|
46201
|
+
exports.InputEventMouse = InputEventMouse;
|
|
46202
|
+
exports.InputEventMouseButton = InputEventMouseButton;
|
|
46203
|
+
exports.InputEventMouseMotion = InputEventMouseMotion;
|
|
46204
|
+
exports.InputEventScreenDrag = InputEventScreenDrag;
|
|
46205
|
+
exports.InputEventScreenTouch = InputEventScreenTouch;
|
|
46206
|
+
exports.InputEventWithModifiers = InputEventWithModifiers;
|
|
44479
46207
|
exports.InteractLoader = InteractLoader;
|
|
44480
46208
|
exports.InteractMesh = InteractMesh;
|
|
44481
46209
|
exports.InvalidIndex = InvalidIndex;
|
|
@@ -44524,7 +46252,6 @@ exports.RandomSetValue = RandomSetValue;
|
|
|
44524
46252
|
exports.RandomValue = RandomValue;
|
|
44525
46253
|
exports.RandomVectorValue = RandomVectorValue;
|
|
44526
46254
|
exports.RaycastResult = RaycastResult;
|
|
44527
|
-
exports.RectTransform = RectTransform;
|
|
44528
46255
|
exports.Rectangle = Rectangle$1;
|
|
44529
46256
|
exports.ReferenceCurve = ReferenceCurve;
|
|
44530
46257
|
exports.RenderFrame = RenderFrame;
|
|
@@ -44537,6 +46264,7 @@ exports.RenderTargetPool = RenderTargetPool;
|
|
|
44537
46264
|
exports.Renderbuffer = Renderbuffer;
|
|
44538
46265
|
exports.Renderer = Renderer;
|
|
44539
46266
|
exports.RendererComponent = RendererComponent;
|
|
46267
|
+
exports.RootControl = RootControl;
|
|
44540
46268
|
exports.RuntimeClip = RuntimeClip;
|
|
44541
46269
|
exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0;
|
|
44542
46270
|
exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0;
|
|
@@ -44580,6 +46308,8 @@ exports.TransformPlayable = TransformPlayable;
|
|
|
44580
46308
|
exports.TransitionNode = TransitionNode;
|
|
44581
46309
|
exports.Triangle = Triangle;
|
|
44582
46310
|
exports.TrimPath = TrimPath;
|
|
46311
|
+
exports.UICanvas = UICanvas;
|
|
46312
|
+
exports.UIControl = UIControl;
|
|
44583
46313
|
exports.ValueGetter = ValueGetter;
|
|
44584
46314
|
exports.ValueNode = ValueNode;
|
|
44585
46315
|
exports.Vector2Curve = Vector2Curve;
|
|
@@ -44589,6 +46319,7 @@ exports.Vector3PropertyMixerPlayable = Vector3PropertyMixerPlayable;
|
|
|
44589
46319
|
exports.Vector4Curve = Vector4Curve;
|
|
44590
46320
|
exports.Vector4PropertyMixerPlayable = Vector4PropertyMixerPlayable;
|
|
44591
46321
|
exports.VertexBuffer = VertexBuffer;
|
|
46322
|
+
exports.WindowRootControl = WindowRootControl;
|
|
44592
46323
|
exports.addByOrder = addByOrder;
|
|
44593
46324
|
exports.addItem = addItem;
|
|
44594
46325
|
exports.addItemWithOrder = addItemWithOrder;
|