@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.mjs
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
|
import * as THREE from 'three';
|
|
@@ -7059,6 +7059,11 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
7059
7059
|
// OVERRIDE
|
|
7060
7060
|
};
|
|
7061
7061
|
/**
|
|
7062
|
+
* Called when the owning item's sibling order changes.
|
|
7063
|
+
*/ _proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
7064
|
+
// OVERRIDE
|
|
7065
|
+
};
|
|
7066
|
+
/**
|
|
7062
7067
|
* @internal
|
|
7063
7068
|
*/ _proto.enable = function enable() {
|
|
7064
7069
|
if (this.item.composition) {
|
|
@@ -14016,6 +14021,7 @@ var seed$7 = 1;
|
|
|
14016
14021
|
quat: new Quaternion(0, 0, 0, 1),
|
|
14017
14022
|
scale: new Vector3(1, 1, 1)
|
|
14018
14023
|
};
|
|
14024
|
+
this.eventEmitter = new EventEmitter();
|
|
14019
14025
|
this.name = "transform_" + seed$7++;
|
|
14020
14026
|
if (props) {
|
|
14021
14027
|
this.setTransform(props);
|
|
@@ -14028,6 +14034,12 @@ var seed$7 = 1;
|
|
|
14028
14034
|
}
|
|
14029
14035
|
}
|
|
14030
14036
|
var _proto = Transform.prototype;
|
|
14037
|
+
_proto.on = function on(eventName, listener, options) {
|
|
14038
|
+
this.eventEmitter.on(eventName, listener, options);
|
|
14039
|
+
};
|
|
14040
|
+
_proto.off = function off(eventName, listener) {
|
|
14041
|
+
this.eventEmitter.off(eventName, listener);
|
|
14042
|
+
};
|
|
14031
14043
|
/**
|
|
14032
14044
|
* 父 transform 切换时的 hook。子类可重写以接管订阅 / 解算等逻辑
|
|
14033
14045
|
* @param oldParent - 切换前的父 transform(若没有则为 null)
|
|
@@ -14446,6 +14458,7 @@ var seed$7 = 1;
|
|
|
14446
14458
|
this.children.forEach(function(c) {
|
|
14447
14459
|
c.worldMatrixDirty = true;
|
|
14448
14460
|
});
|
|
14461
|
+
this.eventEmitter.emit("changed", this);
|
|
14449
14462
|
};
|
|
14450
14463
|
/**
|
|
14451
14464
|
* 转换右手坐标系左手螺旋对应的四元数到对应的旋转角
|
|
@@ -14464,14 +14477,16 @@ var seed$7 = 1;
|
|
|
14464
14477
|
return this.parent;
|
|
14465
14478
|
},
|
|
14466
14479
|
set: function set(transform) {
|
|
14467
|
-
if (
|
|
14480
|
+
if (this.parent === transform || this === transform) {
|
|
14468
14481
|
return;
|
|
14469
14482
|
}
|
|
14470
14483
|
var oldParent = this.parent;
|
|
14471
14484
|
if (this.parent) {
|
|
14472
14485
|
this.parent.removeChild(this);
|
|
14473
14486
|
}
|
|
14474
|
-
transform
|
|
14487
|
+
if (transform) {
|
|
14488
|
+
transform.addChild(this);
|
|
14489
|
+
}
|
|
14475
14490
|
this.parent = transform;
|
|
14476
14491
|
this.worldMatrixDirty = true;
|
|
14477
14492
|
this.onParentTransformChanged(oldParent, transform);
|
|
@@ -14654,7 +14669,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
14654
14669
|
return results;
|
|
14655
14670
|
};
|
|
14656
14671
|
_proto.setParent = function setParent(vfxItem) {
|
|
14657
|
-
if (vfxItem === this
|
|
14672
|
+
if (vfxItem === this || this.parent === vfxItem) {
|
|
14658
14673
|
return;
|
|
14659
14674
|
}
|
|
14660
14675
|
if (this.parent) {
|
|
@@ -15041,6 +15056,12 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15041
15056
|
child.onParentChanged();
|
|
15042
15057
|
}
|
|
15043
15058
|
};
|
|
15059
|
+
_proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
15060
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
15061
|
+
var component = _step.value;
|
|
15062
|
+
component.onOrderInParentChanged();
|
|
15063
|
+
}
|
|
15064
|
+
};
|
|
15044
15065
|
/**
|
|
15045
15066
|
* @internal
|
|
15046
15067
|
*/ _proto.setRendererComponentOrder = function setRendererComponentOrder(renderOrder) {
|
|
@@ -15125,15 +15146,16 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15125
15146
|
*/ _proto.dispose = function dispose() {
|
|
15126
15147
|
if (this.composition) {
|
|
15127
15148
|
this.composition.destroyItem(this);
|
|
15128
|
-
// component 调用 dispose() 会将自身从 this.components 数组删除,slice() 避免迭代错误
|
|
15129
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.components.slice()), _step; !(_step = _iterator()).done;){
|
|
15130
|
-
var component = _step.value;
|
|
15131
|
-
component.dispose();
|
|
15132
|
-
}
|
|
15133
|
-
this.components = [];
|
|
15134
|
-
this._composition = null;
|
|
15135
|
-
this.transform.setValid(false);
|
|
15136
15149
|
}
|
|
15150
|
+
// component.dispose() removes itself from this.components. Use a snapshot
|
|
15151
|
+
// so Engine.root components are also disposed even without a Composition.
|
|
15152
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components.slice()), _step; !(_step = _iterator()).done;){
|
|
15153
|
+
var component = _step.value;
|
|
15154
|
+
component.dispose();
|
|
15155
|
+
}
|
|
15156
|
+
this.components = [];
|
|
15157
|
+
this._composition = null;
|
|
15158
|
+
this.transform.setValid(false);
|
|
15137
15159
|
this.resetChildrenParent();
|
|
15138
15160
|
EffectsObject.prototype.dispose.call(this);
|
|
15139
15161
|
};
|
|
@@ -15329,6 +15351,33 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15329
15351
|
this.setRendererComponentOrder(value);
|
|
15330
15352
|
}
|
|
15331
15353
|
},
|
|
15354
|
+
{
|
|
15355
|
+
key: "orderInParent",
|
|
15356
|
+
get: /** Zero-based sibling order within the parent item. */ function get() {
|
|
15357
|
+
var _this_parent;
|
|
15358
|
+
var _this_parent_children_indexOf;
|
|
15359
|
+
return (_this_parent_children_indexOf = (_this_parent = this.parent) == null ? void 0 : _this_parent.children.indexOf(this)) != null ? _this_parent_children_indexOf : -1;
|
|
15360
|
+
},
|
|
15361
|
+
set: function set(value) {
|
|
15362
|
+
var _this_parent;
|
|
15363
|
+
var siblings = (_this_parent = this.parent) == null ? void 0 : _this_parent.children;
|
|
15364
|
+
var _siblings_indexOf;
|
|
15365
|
+
var oldIndex = (_siblings_indexOf = siblings == null ? void 0 : siblings.indexOf(this)) != null ? _siblings_indexOf : -1;
|
|
15366
|
+
if (!siblings || oldIndex === -1) {
|
|
15367
|
+
return;
|
|
15368
|
+
}
|
|
15369
|
+
var newIndex = Math.max(0, Math.min(Math.trunc(value), siblings.length - 1));
|
|
15370
|
+
if (oldIndex === newIndex) {
|
|
15371
|
+
return;
|
|
15372
|
+
}
|
|
15373
|
+
siblings.splice(oldIndex, 1);
|
|
15374
|
+
siblings.splice(newIndex, 0, this);
|
|
15375
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(siblings), _step; !(_step = _iterator()).done;){
|
|
15376
|
+
var sibling = _step.value;
|
|
15377
|
+
sibling.onOrderInParentChanged();
|
|
15378
|
+
}
|
|
15379
|
+
}
|
|
15380
|
+
},
|
|
15332
15381
|
{
|
|
15333
15382
|
key: "isActive",
|
|
15334
15383
|
get: /**
|
|
@@ -15585,35 +15634,35 @@ function vecMulCombine(out, a, b) {
|
|
|
15585
15634
|
}
|
|
15586
15635
|
return out;
|
|
15587
15636
|
}
|
|
15588
|
-
var _obj$
|
|
15589
|
-
var particleOriginTranslateMap$1 = (_obj$
|
|
15637
|
+
var _obj$7;
|
|
15638
|
+
var particleOriginTranslateMap$1 = (_obj$7 = {}, _obj$7[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
15590
15639
|
0,
|
|
15591
15640
|
0
|
|
15592
|
-
], _obj$
|
|
15641
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
15593
15642
|
0,
|
|
15594
15643
|
-0.5
|
|
15595
|
-
], _obj$
|
|
15644
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
15596
15645
|
0,
|
|
15597
15646
|
0.5
|
|
15598
|
-
], _obj$
|
|
15647
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
15599
15648
|
-0.5,
|
|
15600
15649
|
0.5
|
|
15601
|
-
], _obj$
|
|
15650
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
15602
15651
|
-0.5,
|
|
15603
15652
|
0
|
|
15604
|
-
], _obj$
|
|
15653
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
15605
15654
|
-0.5,
|
|
15606
15655
|
-0.5
|
|
15607
|
-
], _obj$
|
|
15656
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
15608
15657
|
0.5,
|
|
15609
15658
|
0
|
|
15610
|
-
], _obj$
|
|
15659
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
15611
15660
|
0.5,
|
|
15612
15661
|
-0.5
|
|
15613
|
-
], _obj$
|
|
15662
|
+
], _obj$7[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
15614
15663
|
0.5,
|
|
15615
15664
|
0.5
|
|
15616
|
-
], _obj$
|
|
15665
|
+
], _obj$7);
|
|
15617
15666
|
function nearestPowerOfTwo(value) {
|
|
15618
15667
|
return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
|
|
15619
15668
|
}
|
|
@@ -17351,27 +17400,27 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
17351
17400
|
* 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
|
|
17352
17401
|
* props 为 [[time, value], ...],value 为已解析的对象引用实例。
|
|
17353
17402
|
*/ var REFERENCE_CURVE = 28;
|
|
17354
|
-
var _obj$
|
|
17355
|
-
var map$1 = (_obj$
|
|
17403
|
+
var _obj$6;
|
|
17404
|
+
var map$1 = (_obj$6 = {}, _obj$6[ValueType.RANDOM] = function(props) {
|
|
17356
17405
|
if (_instanceof1(props[0], Array)) {
|
|
17357
17406
|
return new RandomVectorValue(props);
|
|
17358
17407
|
}
|
|
17359
17408
|
return new RandomValue(props);
|
|
17360
|
-
}, _obj$
|
|
17409
|
+
}, _obj$6[ValueType.CONSTANT] = function(props) {
|
|
17361
17410
|
return new StaticValue(props);
|
|
17362
|
-
}, _obj$
|
|
17411
|
+
}, _obj$6[ValueType.CONSTANT_VEC2] = function(props) {
|
|
17363
17412
|
return new StaticValue(props);
|
|
17364
|
-
}, _obj$
|
|
17413
|
+
}, _obj$6[ValueType.CONSTANT_VEC3] = function(props) {
|
|
17365
17414
|
return new StaticValue(props);
|
|
17366
|
-
}, _obj$
|
|
17415
|
+
}, _obj$6[ValueType.CONSTANT_VEC4] = function(props) {
|
|
17367
17416
|
return new StaticValue(props);
|
|
17368
|
-
}, _obj$
|
|
17417
|
+
}, _obj$6[ValueType.RGBA_COLOR] = function(props) {
|
|
17369
17418
|
return new StaticValue(props);
|
|
17370
|
-
}, _obj$
|
|
17419
|
+
}, _obj$6[ValueType.COLORS] = function(props) {
|
|
17371
17420
|
return new RandomSetValue(props.map(function(c) {
|
|
17372
17421
|
return colorToArr$1(c, false);
|
|
17373
17422
|
}));
|
|
17374
|
-
}, _obj$
|
|
17423
|
+
}, _obj$6[ValueType.LINE] = function(props) {
|
|
17375
17424
|
if (props.length === 2 && props[0][0] === 0 && props[1][0] === 1) {
|
|
17376
17425
|
return new LinearValue([
|
|
17377
17426
|
props[0][1],
|
|
@@ -17379,38 +17428,38 @@ var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
|
|
|
17379
17428
|
]);
|
|
17380
17429
|
}
|
|
17381
17430
|
return new LineSegments(props);
|
|
17382
|
-
}, _obj$
|
|
17431
|
+
}, _obj$6[ValueType.GRADIENT_COLOR] = function(props) {
|
|
17383
17432
|
return new GradientValue(props);
|
|
17384
|
-
}, _obj$
|
|
17433
|
+
}, _obj$6[ValueType.LINEAR_PATH] = function(pros) {
|
|
17385
17434
|
return new PathSegments(pros);
|
|
17386
|
-
}, _obj$
|
|
17435
|
+
}, _obj$6[ValueType.BEZIER_CURVE] = function(props) {
|
|
17387
17436
|
if (props.length === 1) {
|
|
17388
17437
|
return new StaticValue(props[0][1][1]);
|
|
17389
17438
|
}
|
|
17390
17439
|
return new BezierCurve(props);
|
|
17391
|
-
}, _obj$
|
|
17440
|
+
}, _obj$6[ValueType.BEZIER_CURVE_PATH] = function(props) {
|
|
17392
17441
|
if (props[0].length === 1) {
|
|
17393
17442
|
return new StaticValue(_construct(Vector3, [].concat(props[1][0])));
|
|
17394
17443
|
}
|
|
17395
17444
|
return new BezierCurvePath(props);
|
|
17396
|
-
}, _obj$
|
|
17445
|
+
}, _obj$6[ValueType.BEZIER_CURVE_QUAT] = function(props) {
|
|
17397
17446
|
if (props[0].length === 1) {
|
|
17398
17447
|
return new StaticValue(_construct(Quaternion, [].concat(props[1][0])));
|
|
17399
17448
|
}
|
|
17400
17449
|
return new BezierCurveQuat(props);
|
|
17401
|
-
}, _obj$
|
|
17450
|
+
}, _obj$6[ValueType.COLOR_CURVE] = function(props) {
|
|
17402
17451
|
return new ColorCurve(props);
|
|
17403
|
-
}, _obj$
|
|
17452
|
+
}, _obj$6[ValueType.VECTOR4_CURVE] = function(props) {
|
|
17404
17453
|
return new Vector4Curve(props);
|
|
17405
|
-
}, _obj$
|
|
17454
|
+
}, _obj$6[ValueType.VECTOR2_CURVE] = function(props) {
|
|
17406
17455
|
return new Vector2Curve(props);
|
|
17407
17456
|
}, // TODO: add spec
|
|
17408
|
-
_obj$
|
|
17457
|
+
_obj$6[VECTOR3_CURVE] = function(props) {
|
|
17409
17458
|
return new Vector3Curve(props);
|
|
17410
17459
|
}, // 对象引用阶梯曲线(不插值):props.data 为 [time, value][],value 已解析为 EffectsObject
|
|
17411
|
-
_obj$
|
|
17460
|
+
_obj$6[REFERENCE_CURVE] = function(props) {
|
|
17412
17461
|
return new ReferenceCurve(props);
|
|
17413
|
-
}, _obj$
|
|
17462
|
+
}, _obj$6);
|
|
17414
17463
|
function createValueGetter(args) {
|
|
17415
17464
|
if (!args || !isNaN(+args)) {
|
|
17416
17465
|
return new StaticValue(args || 0);
|
|
@@ -20927,20 +20976,24 @@ var geometryId = 1;
|
|
|
20927
20976
|
var vertexArrayObjects = this.vertexArrayObjects;
|
|
20928
20977
|
var engine = this.engine;
|
|
20929
20978
|
if (!vertexArrayObjects || !supportsVertexArrayObjects(engine)) {
|
|
20930
|
-
|
|
20979
|
+
var _this_indexBuffer;
|
|
20980
|
+
engine.bindBuffers(this.vertexBuffers, (_this_indexBuffer = this.indexBuffer) != null ? _this_indexBuffer : null, shader);
|
|
20931
20981
|
return;
|
|
20932
20982
|
}
|
|
20933
20983
|
var vertexArrayObject = vertexArrayObjects[shader.key];
|
|
20934
20984
|
if (!vertexArrayObject) {
|
|
20935
|
-
|
|
20985
|
+
var _this_indexBuffer1;
|
|
20986
|
+
vertexArrayObject = engine.recordVertexArrayObject(this.vertexBuffers, (_this_indexBuffer1 = this.indexBuffer) != null ? _this_indexBuffer1 : null, shader);
|
|
20936
20987
|
if (vertexArrayObject) {
|
|
20937
20988
|
vertexArrayObjects[shader.key] = vertexArrayObject;
|
|
20938
20989
|
}
|
|
20939
20990
|
}
|
|
20940
20991
|
if (vertexArrayObject) {
|
|
20941
|
-
|
|
20992
|
+
var _this_indexBuffer2;
|
|
20993
|
+
engine.bindVertexArrayObject(vertexArrayObject, (_this_indexBuffer2 = this.indexBuffer) != null ? _this_indexBuffer2 : null);
|
|
20942
20994
|
} else {
|
|
20943
|
-
|
|
20995
|
+
var _this_indexBuffer3;
|
|
20996
|
+
engine.bindBuffers(this.vertexBuffers, (_this_indexBuffer3 = this.indexBuffer) != null ? _this_indexBuffer3 : null, shader);
|
|
20944
20997
|
}
|
|
20945
20998
|
};
|
|
20946
20999
|
_proto.releaseVertexArrayObject = function releaseVertexArrayObject(key) {
|
|
@@ -21347,8 +21400,8 @@ var vertexBufferSemanticMap = {
|
|
|
21347
21400
|
TANGENT_BS2: "aTargetTangent2",
|
|
21348
21401
|
TANGENT_BS3: "aTargetTangent3"
|
|
21349
21402
|
};
|
|
21350
|
-
var _obj$
|
|
21351
|
-
var BYTES_TYPE_MAP = (_obj$
|
|
21403
|
+
var _obj$5;
|
|
21404
|
+
var BYTES_TYPE_MAP = (_obj$5 = {}, _obj$5[BufferDataType.Float] = 4, _obj$5[BufferDataType.Int] = 4, _obj$5[BufferDataType.UnsignedInt] = 4, _obj$5[BufferDataType.Short] = 2, _obj$5[BufferDataType.UnsignedShort] = 2, _obj$5[BufferDataType.Byte] = 1, _obj$5[BufferDataType.UnsignedByte] = 1, _obj$5);
|
|
21352
21405
|
function generateEmptyTypedArray(type) {
|
|
21353
21406
|
return createTypedArray(type, 0);
|
|
21354
21407
|
}
|
|
@@ -22358,7 +22411,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
22358
22411
|
}
|
|
22359
22412
|
};
|
|
22360
22413
|
_proto.setViewport = function setViewport(x, y, width, height) {
|
|
22361
|
-
this.engine.
|
|
22414
|
+
this.engine.setViewport(x, y, width, height);
|
|
22362
22415
|
};
|
|
22363
22416
|
_proto.clear = function clear(action) {
|
|
22364
22417
|
this.engine.clear(action);
|
|
@@ -22421,7 +22474,40 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
22421
22474
|
};
|
|
22422
22475
|
_proto.drawGeometry = function drawGeometry(geometry, matrix, material, subMeshIndex) {
|
|
22423
22476
|
if (subMeshIndex === void 0) subMeshIndex = 0;
|
|
22424
|
-
|
|
22477
|
+
if (!geometry || !material) {
|
|
22478
|
+
return;
|
|
22479
|
+
}
|
|
22480
|
+
material.initialize();
|
|
22481
|
+
geometry.initialize();
|
|
22482
|
+
geometry.flush();
|
|
22483
|
+
material.setMatrix("effects_ObjectToWorld", matrix);
|
|
22484
|
+
try {
|
|
22485
|
+
material.use(this, this.renderingData.currentFrame.globalUniforms);
|
|
22486
|
+
} catch (e) {
|
|
22487
|
+
console.error(e);
|
|
22488
|
+
this.engine.renderErrors.add(e);
|
|
22489
|
+
return;
|
|
22490
|
+
}
|
|
22491
|
+
var indexBuffer = geometry.getIndexBuffer();
|
|
22492
|
+
var offset = geometry.getDrawStart();
|
|
22493
|
+
var count = geometry.getDrawCount();
|
|
22494
|
+
var subMeshes = geometry.subMeshes;
|
|
22495
|
+
if (subMeshes.length > 0) {
|
|
22496
|
+
var subMesh = subMeshes[subMeshIndex];
|
|
22497
|
+
offset = subMesh.offset;
|
|
22498
|
+
var _subMesh_indexCount;
|
|
22499
|
+
count = indexBuffer ? (_subMesh_indexCount = subMesh.indexCount) != null ? _subMesh_indexCount : 0 : subMesh.vertexCount;
|
|
22500
|
+
}
|
|
22501
|
+
if (count <= 0) {
|
|
22502
|
+
return;
|
|
22503
|
+
}
|
|
22504
|
+
geometry.bind(material.shaderVariant);
|
|
22505
|
+
var instanceCount = geometry.instanceCount || undefined;
|
|
22506
|
+
if (indexBuffer) {
|
|
22507
|
+
this.engine.drawElementsType(geometry.mode, offset, count, instanceCount);
|
|
22508
|
+
} else {
|
|
22509
|
+
this.engine.drawArraysType(geometry.mode, offset, count, instanceCount);
|
|
22510
|
+
}
|
|
22425
22511
|
};
|
|
22426
22512
|
_proto.getTemporaryRT = function getTemporaryRT(name, width, height, depthBuffer, filter, format) {
|
|
22427
22513
|
return this.engine.renderTargetPool.get(name, width, height, depthBuffer, filter, format);
|
|
@@ -22689,11 +22775,7 @@ var CanvasPool = /*#__PURE__*/ function() {
|
|
|
22689
22775
|
var canvasPool = new CanvasPool();
|
|
22690
22776
|
|
|
22691
22777
|
/**
|
|
22692
|
-
*
|
|
22693
|
-
* 但 quad 仍按 1x 逻辑尺寸绘制 — 双线性 downsample 后比原 1x 渲染清晰得多
|
|
22694
|
-
*/ var FONT_SCALE = 2;
|
|
22695
|
-
/**
|
|
22696
|
-
* 单张字符 atlas 的边长(像素,scale 后的实际像素,非逻辑尺寸)。
|
|
22778
|
+
* 单张字符 atlas 的逻辑边长。实际 canvas 像素尺寸会乘以渲染 resolution。
|
|
22697
22779
|
* 512×512 在 24px 字号下约可容纳 250+ 字形,常见 demo 文本足够
|
|
22698
22780
|
*/ var ATLAS_SIZE = 512;
|
|
22699
22781
|
/**
|
|
@@ -22715,7 +22797,7 @@ var canvasPool = new CanvasPool();
|
|
|
22715
22797
|
* canvas 内容变更后需要 `uploadIfDirty` 重新上传到纹理 — 由调用方在使用纹理前主动触发,
|
|
22716
22798
|
* 避免每加一字都 upload 一次造成的 GL 开销
|
|
22717
22799
|
*/ var GlyphAtlas = /*#__PURE__*/ function() {
|
|
22718
|
-
function GlyphAtlas(engine, scaledFontString, /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */ ascentPx, /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */ descentPx, fontStyle) {
|
|
22800
|
+
function GlyphAtlas(engine, scaledFontString, /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */ ascentPx, /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */ descentPx, fontStyle, resolution) {
|
|
22719
22801
|
this.engine = engine;
|
|
22720
22802
|
this.scaledFontString = scaledFontString;
|
|
22721
22803
|
this.glyphs = new Map();
|
|
@@ -22723,9 +22805,10 @@ var canvasPool = new CanvasPool();
|
|
|
22723
22805
|
this.currentY = 0;
|
|
22724
22806
|
this.full = false;
|
|
22725
22807
|
this.dirty = true;
|
|
22808
|
+
this.resolution = resolution;
|
|
22726
22809
|
this.canvas = document.createElement("canvas");
|
|
22727
|
-
this.canvas.width = ATLAS_SIZE;
|
|
22728
|
-
this.canvas.height = ATLAS_SIZE;
|
|
22810
|
+
this.canvas.width = Math.ceil(ATLAS_SIZE * resolution);
|
|
22811
|
+
this.canvas.height = Math.ceil(ATLAS_SIZE * resolution);
|
|
22729
22812
|
var ctx = this.canvas.getContext("2d", {
|
|
22730
22813
|
willReadFrequently: false
|
|
22731
22814
|
});
|
|
@@ -22736,14 +22819,14 @@ var canvasPool = new CanvasPool();
|
|
|
22736
22819
|
ctx.font = scaledFontString;
|
|
22737
22820
|
ctx.textBaseline = "alphabetic";
|
|
22738
22821
|
ctx.fillStyle = "#ffffff";
|
|
22739
|
-
this.paddingPx = GLYPH_PADDING *
|
|
22822
|
+
this.paddingPx = GLYPH_PADDING * resolution;
|
|
22740
22823
|
this.italicScale = fontStyle === "italic" ? 2 : 1;
|
|
22741
22824
|
// ascent/descent 由探针 '|ÉqÅM' 测得 actualBoundingBox(重音字已抬高 ink 顶),
|
|
22742
22825
|
// 两者内部保持浮点,仅 cell 高做一次外层 ceil — 与 padding 共同保证 cell 内不裁切
|
|
22743
22826
|
var fontHeightPx = ascentPx + descentPx;
|
|
22744
22827
|
this.baselinePx = this.paddingPx + ascentPx;
|
|
22745
22828
|
this.cellHPx = Math.ceil(fontHeightPx + this.paddingPx * 2);
|
|
22746
|
-
this.lineHeight = this.cellHPx /
|
|
22829
|
+
this.lineHeight = this.cellHPx / resolution;
|
|
22747
22830
|
this.texture = Texture.create(engine, {
|
|
22748
22831
|
sourceType: TextureSourceType.image,
|
|
22749
22832
|
image: this.canvas,
|
|
@@ -22752,7 +22835,8 @@ var canvasPool = new CanvasPool();
|
|
|
22752
22835
|
magFilter: glContext.LINEAR,
|
|
22753
22836
|
minFilter: glContext.LINEAR,
|
|
22754
22837
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
22755
|
-
wrapT: glContext.CLAMP_TO_EDGE
|
|
22838
|
+
wrapT: glContext.CLAMP_TO_EDGE,
|
|
22839
|
+
premultiplyAlpha: true
|
|
22756
22840
|
});
|
|
22757
22841
|
this.texture.initialize();
|
|
22758
22842
|
}
|
|
@@ -22770,19 +22854,19 @@ var canvasPool = new CanvasPool();
|
|
|
22770
22854
|
var ctx = this.ctx;
|
|
22771
22855
|
// 每次重设字体,防御外部潜在污染(虽然 ctx 私有)
|
|
22772
22856
|
ctx.font = this.scaledFontString;
|
|
22773
|
-
// measureText 用的是 scaledFontString,advance 已经是
|
|
22857
|
+
// measureText 用的是 scaledFontString,advance 已经是 resolution 后的像素
|
|
22774
22858
|
var advancePx = ctx.measureText(char).width;
|
|
22775
22859
|
// italic 放大 cell 宽防斜体越界;ceil 对齐像素网格避免相邻字采样重叠
|
|
22776
22860
|
var widthPx = Math.max(1, Math.ceil(advancePx * this.italicScale));
|
|
22777
22861
|
var paddedWidthPx = widthPx + this.paddingPx * 2;
|
|
22778
22862
|
var cellH = this.cellHPx;
|
|
22779
22863
|
// 行尾换行
|
|
22780
|
-
if (this.currentX + paddedWidthPx >
|
|
22864
|
+
if (this.currentX + paddedWidthPx > this.canvas.width) {
|
|
22781
22865
|
this.currentX = 0;
|
|
22782
22866
|
this.currentY += cellH;
|
|
22783
22867
|
}
|
|
22784
22868
|
// atlas 满,后续不再尝试
|
|
22785
|
-
if (this.currentY + cellH >
|
|
22869
|
+
if (this.currentY + cellH > this.canvas.height) {
|
|
22786
22870
|
this.full = true;
|
|
22787
22871
|
console.warn('GlyphAtlas full, dropping char "' + char + '"');
|
|
22788
22872
|
return null;
|
|
@@ -22798,8 +22882,8 @@ var canvasPool = new CanvasPool();
|
|
|
22798
22882
|
py: py,
|
|
22799
22883
|
pw: paddedWidthPx,
|
|
22800
22884
|
ph: cellH,
|
|
22801
|
-
advance: advancePx /
|
|
22802
|
-
paddingLeft: this.paddingPx /
|
|
22885
|
+
advance: advancePx / this.resolution,
|
|
22886
|
+
paddingLeft: this.paddingPx / this.resolution
|
|
22803
22887
|
};
|
|
22804
22888
|
this.glyphs.set(char, info);
|
|
22805
22889
|
return info;
|
|
@@ -22818,7 +22902,8 @@ var canvasPool = new CanvasPool();
|
|
|
22818
22902
|
magFilter: glContext.LINEAR,
|
|
22819
22903
|
minFilter: glContext.LINEAR,
|
|
22820
22904
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
22821
|
-
wrapT: glContext.CLAMP_TO_EDGE
|
|
22905
|
+
wrapT: glContext.CLAMP_TO_EDGE,
|
|
22906
|
+
premultiplyAlpha: true
|
|
22822
22907
|
});
|
|
22823
22908
|
this.dirty = false;
|
|
22824
22909
|
};
|
|
@@ -22841,26 +22926,33 @@ var canvasPool = new CanvasPool();
|
|
|
22841
22926
|
function TextCache(engine) {
|
|
22842
22927
|
this.engine = engine;
|
|
22843
22928
|
this.atlases = new Map();
|
|
22929
|
+
this.resolution = engine.pixelRatio;
|
|
22844
22930
|
}
|
|
22845
22931
|
var _proto = TextCache.prototype;
|
|
22846
22932
|
/**
|
|
22847
22933
|
* 取(必要时新建)对应字体的字符 atlas
|
|
22848
22934
|
*/ _proto.getAtlas = function getAtlas(fontSize, fontFamily, fontWeight, fontStyle) {
|
|
22849
|
-
|
|
22935
|
+
// Pixi CanvasText 默认跟随 renderer.resolution;这里对应 Engine.pixelRatio。
|
|
22936
|
+
var resolution = this.engine.pixelRatio;
|
|
22937
|
+
if (resolution !== this.resolution) {
|
|
22938
|
+
this.clear();
|
|
22939
|
+
this.resolution = resolution;
|
|
22940
|
+
}
|
|
22941
|
+
var fontKey = fontStyle + "|" + fontWeight + "|" + fontSize + "|" + fontFamily + "|" + resolution;
|
|
22850
22942
|
var cached = this.atlases.get(fontKey);
|
|
22851
22943
|
if (cached) {
|
|
22852
22944
|
return cached;
|
|
22853
22945
|
}
|
|
22854
|
-
var scaledFontString = fontStyle + " " + fontWeight + " " + fontSize *
|
|
22946
|
+
var scaledFontString = fontStyle + " " + fontWeight + " " + fontSize * resolution + "px " + fontFamily;
|
|
22855
22947
|
// 探一次得到字体级 ascent/descent(整张 atlas 共享 cell 高与 baseline,各字对齐)。
|
|
22856
|
-
// 直接在 scaledFontString 下测,得到的就是
|
|
22948
|
+
// 直接在 scaledFontString 下测,得到的就是 resolution 后像素。
|
|
22857
22949
|
// 探针用 '|ÉqÅ' + 'M':带重音符的 ÉÅ 把 ink 顶推到接近字体真实 ascent,
|
|
22858
22950
|
// 单字 'M' 只有 cap height(~0.7em) 太矮,CJK / 带重音字顶部会越过 cell 上界被裁。
|
|
22859
22951
|
// 取 actualBoundingBoxAscent/Descent 度量 ink 边界,跨平台语义稳定
|
|
22860
22952
|
var probeCanvasAndContext = canvasPool.getCanvasAndContext(1, 1);
|
|
22861
22953
|
var probeCtx = probeCanvasAndContext.context;
|
|
22862
|
-
var ascentPx = fontSize * 0.8 *
|
|
22863
|
-
var descentPx = fontSize * 0.2 *
|
|
22954
|
+
var ascentPx = fontSize * 0.8 * resolution;
|
|
22955
|
+
var descentPx = fontSize * 0.2 * resolution;
|
|
22864
22956
|
try {
|
|
22865
22957
|
probeCtx.font = scaledFontString;
|
|
22866
22958
|
var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
|
|
@@ -22869,7 +22961,7 @@ var canvasPool = new CanvasPool();
|
|
|
22869
22961
|
} finally{
|
|
22870
22962
|
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22871
22963
|
}
|
|
22872
|
-
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle);
|
|
22964
|
+
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle, resolution);
|
|
22873
22965
|
this.atlases.set(fontKey, atlas);
|
|
22874
22966
|
return atlas;
|
|
22875
22967
|
};
|
|
@@ -22886,6 +22978,9 @@ var canvasPool = new CanvasPool();
|
|
|
22886
22978
|
/**
|
|
22887
22979
|
* 清空所有 atlas 并 dispose 对应纹理。Engine dispose 时调用
|
|
22888
22980
|
*/ _proto.dispose = function dispose() {
|
|
22981
|
+
this.clear();
|
|
22982
|
+
};
|
|
22983
|
+
_proto.clear = function clear() {
|
|
22889
22984
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.atlases.values()), _step; !(_step = _iterator()).done;){
|
|
22890
22985
|
var atlas = _step.value;
|
|
22891
22986
|
atlas.dispose();
|
|
@@ -23008,6 +23103,17 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23008
23103
|
this.texturedMaterial.depthTest = false;
|
|
23009
23104
|
this.texturedMaterial.depthMask = false;
|
|
23010
23105
|
this.texturedMaterial.blending = true;
|
|
23106
|
+
// 文本 atlas 按 Pixi 的方式在上传时预乘 alpha,因此采样后只需应用顶点色和顶点 alpha。
|
|
23107
|
+
// 单独使用 material,避免改变 drawTexture 对普通非预乘纹理的处理。
|
|
23108
|
+
this.textMaterial = Material.create(this.engine, {
|
|
23109
|
+
shader: {
|
|
23110
|
+
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 }",
|
|
23111
|
+
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 }"
|
|
23112
|
+
}
|
|
23113
|
+
});
|
|
23114
|
+
this.textMaterial.depthTest = false;
|
|
23115
|
+
this.textMaterial.depthMask = false;
|
|
23116
|
+
this.textMaterial.blending = true;
|
|
23011
23117
|
this.textCache = new TextCache(engine);
|
|
23012
23118
|
}
|
|
23013
23119
|
var _proto = Graphics.prototype;
|
|
@@ -23022,13 +23128,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23022
23128
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23023
23129
|
this.currentBatchType = "colored";
|
|
23024
23130
|
this.currentBatchTexture = null;
|
|
23025
|
-
// 创建从屏幕坐标到 NDC
|
|
23131
|
+
// 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
|
|
23026
23132
|
var _this_engine_canvas_getBoundingClientRect = this.engine.canvas.getBoundingClientRect(), width = _this_engine_canvas_getBoundingClientRect.width, height = _this_engine_canvas_getBoundingClientRect.height;
|
|
23027
23133
|
// 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
|
|
23028
|
-
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, -1, 0, -1,
|
|
23134
|
+
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
|
|
23029
23135
|
);
|
|
23030
23136
|
this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23031
23137
|
this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23138
|
+
this.textMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23032
23139
|
};
|
|
23033
23140
|
/**
|
|
23034
23141
|
* 将当前变换压入栈,并设置新的变换
|
|
@@ -23056,7 +23163,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23056
23163
|
* 切换到指定批次类型/纹理。若与当前批次不一致,先 flush 已累积顶点
|
|
23057
23164
|
*/ _proto.ensureBatch = function ensureBatch(type, texture) {
|
|
23058
23165
|
if (texture === void 0) texture = null;
|
|
23059
|
-
var sameBatch = this.currentBatchType === type && (type
|
|
23166
|
+
var sameBatch = this.currentBatchType === type && (type === "colored" || this.currentBatchTexture === texture);
|
|
23060
23167
|
if (!sameBatch && this.currentVertexCount > 0) {
|
|
23061
23168
|
this.flushBatch();
|
|
23062
23169
|
}
|
|
@@ -23082,8 +23189,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23082
23189
|
this.geometry.setIndexData(indicesArray);
|
|
23083
23190
|
this.geometry.setDrawCount(this.currentIndexCount);
|
|
23084
23191
|
var material;
|
|
23085
|
-
if (this.currentBatchType === "textured") {
|
|
23086
|
-
material = this.texturedMaterial;
|
|
23192
|
+
if (this.currentBatchType === "textured" || this.currentBatchType === "text") {
|
|
23193
|
+
material = this.currentBatchType === "text" ? this.textMaterial : this.texturedMaterial;
|
|
23087
23194
|
var _this_currentBatchTexture;
|
|
23088
23195
|
var tex = (_this_currentBatchTexture = this.currentBatchTexture) != null ? _this_currentBatchTexture : this.engine.whiteTexture;
|
|
23089
23196
|
material.setTexture("uMainTexture", tex);
|
|
@@ -23189,8 +23296,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23189
23296
|
};
|
|
23190
23297
|
/**
|
|
23191
23298
|
* 绘制矩形边框
|
|
23192
|
-
* @param x -
|
|
23193
|
-
* @param y -
|
|
23299
|
+
* @param x - 矩形左上角 X 坐标
|
|
23300
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23194
23301
|
* @param width - 矩形宽度
|
|
23195
23302
|
* @param height - 矩形高度
|
|
23196
23303
|
* @param color - 边框颜色,默认白色,范围 0-1
|
|
@@ -23233,8 +23340,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23233
23340
|
};
|
|
23234
23341
|
/**
|
|
23235
23342
|
* 绘制填充矩形
|
|
23236
|
-
* @param x -
|
|
23237
|
-
* @param y -
|
|
23343
|
+
* @param x - 矩形左上角 X 坐标
|
|
23344
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23238
23345
|
* @param width - 矩形宽度
|
|
23239
23346
|
* @param height - 矩形高度
|
|
23240
23347
|
* @param color - 填充颜色,默认白色,范围 0-1
|
|
@@ -23260,9 +23367,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23260
23367
|
this.buildShape(this.circleShape, color);
|
|
23261
23368
|
};
|
|
23262
23369
|
/**
|
|
23263
|
-
* 绘制纹理矩形(本地坐标,Y
|
|
23264
|
-
* @param x -
|
|
23265
|
-
* @param y -
|
|
23370
|
+
* 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
|
|
23371
|
+
* @param x - 矩形左上角 X 坐标
|
|
23372
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23266
23373
|
* @param width - 矩形宽度
|
|
23267
23374
|
* @param height - 矩形高度
|
|
23268
23375
|
* @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
|
|
@@ -23275,14 +23382,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23275
23382
|
this.pushQuad(x, y, width, height, color, region);
|
|
23276
23383
|
};
|
|
23277
23384
|
/**
|
|
23278
|
-
* 绘制文本(本地坐标,Y
|
|
23385
|
+
* 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
|
|
23279
23386
|
*
|
|
23280
23387
|
* 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
|
|
23281
23388
|
* `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
|
|
23282
23389
|
*
|
|
23283
23390
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
23284
|
-
* @param x -
|
|
23285
|
-
* @param y -
|
|
23391
|
+
* @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
23392
|
+
* @param y - 文本 cell 顶部 Y 坐标
|
|
23286
23393
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
23287
23394
|
* @param fontSize - 字号(逻辑像素)
|
|
23288
23395
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -23298,7 +23405,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23298
23405
|
return;
|
|
23299
23406
|
}
|
|
23300
23407
|
var atlas = this.textCache.getAtlas(fontSize, fontFamily, fontWeight, fontStyle);
|
|
23301
|
-
this.ensureBatch("
|
|
23408
|
+
this.ensureBatch("text", atlas.texture);
|
|
23302
23409
|
var lineHeight = atlas.lineHeight;
|
|
23303
23410
|
var cursorX = x;
|
|
23304
23411
|
// ensureChar 可能往 atlas canvas 写新字并打 dirty 标;实际 upload 推迟到
|
|
@@ -23309,13 +23416,15 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23309
23416
|
continue;
|
|
23310
23417
|
}
|
|
23311
23418
|
// atlas 像素坐标 → UV(纹理 flipY 后,canvas 顶 → v=1,canvas 底 → v=0)
|
|
23312
|
-
var
|
|
23313
|
-
var
|
|
23314
|
-
var
|
|
23315
|
-
var
|
|
23419
|
+
var atlasWidth = atlas.canvas.width;
|
|
23420
|
+
var atlasHeight = atlas.canvas.height;
|
|
23421
|
+
var u0 = info.px / atlasWidth;
|
|
23422
|
+
var u1 = (info.px + info.pw) / atlasWidth;
|
|
23423
|
+
var v0 = 1 - (info.py + info.ph) / atlasHeight;
|
|
23424
|
+
var v1 = 1 - info.py / atlasHeight;
|
|
23316
23425
|
// quad 宽与采样区都含四周 padding(cell 留白透明);但光标只按 advance 前进,
|
|
23317
23426
|
// quad 起点左偏 paddingLeft 使字形 ink 落在 cursorX — padding 区重叠无妨
|
|
23318
|
-
this.pushQuad(cursorX - info.paddingLeft, y, info.pw /
|
|
23427
|
+
this.pushQuad(cursorX - info.paddingLeft, y, info.pw / atlas.resolution, lineHeight, color, {
|
|
23319
23428
|
u0: u0,
|
|
23320
23429
|
v0: v0,
|
|
23321
23430
|
u1: u1,
|
|
@@ -23328,6 +23437,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23328
23437
|
this.geometry.dispose();
|
|
23329
23438
|
this.coloredMaterial.dispose();
|
|
23330
23439
|
this.texturedMaterial.dispose();
|
|
23440
|
+
this.textMaterial.dispose();
|
|
23331
23441
|
this.textCache.dispose();
|
|
23332
23442
|
};
|
|
23333
23443
|
_proto.buildShape = function buildShape(shape, color) {
|
|
@@ -23394,7 +23504,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23394
23504
|
* 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
|
|
23395
23505
|
*/ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
|
|
23396
23506
|
var vertexOffset = this.vertices.length / 2;
|
|
23397
|
-
// 4
|
|
23507
|
+
// 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
|
|
23398
23508
|
var corners = [
|
|
23399
23509
|
[
|
|
23400
23510
|
x,
|
|
@@ -23420,19 +23530,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23420
23530
|
var cornerUVs = [
|
|
23421
23531
|
[
|
|
23422
23532
|
u0,
|
|
23423
|
-
|
|
23533
|
+
v1
|
|
23424
23534
|
],
|
|
23425
23535
|
[
|
|
23426
23536
|
u1,
|
|
23427
|
-
|
|
23537
|
+
v1
|
|
23428
23538
|
],
|
|
23429
23539
|
[
|
|
23430
23540
|
u0,
|
|
23431
|
-
|
|
23541
|
+
v0
|
|
23432
23542
|
],
|
|
23433
23543
|
[
|
|
23434
23544
|
u1,
|
|
23435
|
-
|
|
23545
|
+
v0
|
|
23436
23546
|
]
|
|
23437
23547
|
];
|
|
23438
23548
|
for(var i = 0; i < 4; i++){
|
|
@@ -24398,433 +24508,365 @@ FrameComponent = __decorate([
|
|
|
24398
24508
|
// 第四列 (位移) 乘 1,无需修改
|
|
24399
24509
|
}
|
|
24400
24510
|
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
|
|
24417
|
-
|
|
24418
|
-
|
|
24419
|
-
|
|
24420
|
-
|
|
24421
|
-
|
|
24422
|
-
|
|
24423
|
-
|
|
24424
|
-
|
|
24425
|
-
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
|
|
24434
|
-
|
|
24435
|
-
|
|
24436
|
-
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24445
|
-
|
|
24511
|
+
function _assert_this_initialized(self) {
|
|
24512
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
24513
|
+
return self;
|
|
24514
|
+
}
|
|
24515
|
+
|
|
24516
|
+
var MouseFilter;
|
|
24517
|
+
(function(MouseFilter) {
|
|
24518
|
+
MouseFilter[MouseFilter["Stop"] = 0] = "Stop";
|
|
24519
|
+
MouseFilter[MouseFilter["Pass"] = 1] = "Pass";
|
|
24520
|
+
MouseFilter[MouseFilter["Ignore"] = 2] = "Ignore";
|
|
24521
|
+
})(MouseFilter || (MouseFilter = {}));
|
|
24522
|
+
var MouseBehaviorRecursive;
|
|
24523
|
+
(function(MouseBehaviorRecursive) {
|
|
24524
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Inherited"] = 0] = "Inherited";
|
|
24525
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Disabled"] = 1] = "Disabled";
|
|
24526
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Enabled"] = 2] = "Enabled";
|
|
24527
|
+
})(MouseBehaviorRecursive || (MouseBehaviorRecursive = {}));
|
|
24528
|
+
var MouseButton;
|
|
24529
|
+
(function(MouseButton) {
|
|
24530
|
+
MouseButton[MouseButton["None"] = 0] = "None";
|
|
24531
|
+
MouseButton[MouseButton["Left"] = 1] = "Left";
|
|
24532
|
+
MouseButton[MouseButton["Right"] = 2] = "Right";
|
|
24533
|
+
MouseButton[MouseButton["Middle"] = 3] = "Middle";
|
|
24534
|
+
MouseButton[MouseButton["WheelUp"] = 4] = "WheelUp";
|
|
24535
|
+
MouseButton[MouseButton["WheelDown"] = 5] = "WheelDown";
|
|
24536
|
+
MouseButton[MouseButton["WheelLeft"] = 6] = "WheelLeft";
|
|
24537
|
+
MouseButton[MouseButton["WheelRight"] = 7] = "WheelRight";
|
|
24538
|
+
MouseButton[MouseButton["Xbutton1"] = 8] = "Xbutton1";
|
|
24539
|
+
MouseButton[MouseButton["Xbutton2"] = 9] = "Xbutton2";
|
|
24540
|
+
})(MouseButton || (MouseButton = {}));
|
|
24541
|
+
var MouseButtonMask;
|
|
24542
|
+
(function(MouseButtonMask) {
|
|
24543
|
+
MouseButtonMask[MouseButtonMask["None"] = 0] = "None";
|
|
24544
|
+
MouseButtonMask[MouseButtonMask["Left"] = 1] = "Left";
|
|
24545
|
+
MouseButtonMask[MouseButtonMask["Right"] = 2] = "Right";
|
|
24546
|
+
MouseButtonMask[MouseButtonMask["Middle"] = 4] = "Middle";
|
|
24547
|
+
MouseButtonMask[MouseButtonMask["Xbutton1"] = 128] = "Xbutton1";
|
|
24548
|
+
MouseButtonMask[MouseButtonMask["Xbutton2"] = 256] = "Xbutton2";
|
|
24549
|
+
})(MouseButtonMask || (MouseButtonMask = {}));
|
|
24550
|
+
var FocusMode;
|
|
24551
|
+
(function(FocusMode) {
|
|
24552
|
+
FocusMode[FocusMode["None"] = 0] = "None";
|
|
24553
|
+
FocusMode[FocusMode["Click"] = 1] = "Click";
|
|
24554
|
+
FocusMode[FocusMode["All"] = 2] = "All";
|
|
24555
|
+
FocusMode[FocusMode["Accessibility"] = 3] = "Accessibility";
|
|
24556
|
+
})(FocusMode || (FocusMode = {}));
|
|
24557
|
+
var FocusBehaviorRecursive;
|
|
24558
|
+
(function(FocusBehaviorRecursive) {
|
|
24559
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Inherited"] = 0] = "Inherited";
|
|
24560
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Disabled"] = 1] = "Disabled";
|
|
24561
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Enabled"] = 2] = "Enabled";
|
|
24562
|
+
})(FocusBehaviorRecursive || (FocusBehaviorRecursive = {}));
|
|
24563
|
+
var KeyLocation;
|
|
24564
|
+
(function(KeyLocation) {
|
|
24565
|
+
KeyLocation[KeyLocation["Unspecified"] = 0] = "Unspecified";
|
|
24566
|
+
KeyLocation[KeyLocation["Left"] = 1] = "Left";
|
|
24567
|
+
KeyLocation[KeyLocation["Right"] = 2] = "Right";
|
|
24568
|
+
})(KeyLocation || (KeyLocation = {}));
|
|
24569
|
+
var CursorShape;
|
|
24570
|
+
(function(CursorShape) {
|
|
24571
|
+
CursorShape[CursorShape["Arrow"] = 0] = "Arrow";
|
|
24572
|
+
CursorShape[CursorShape["Ibeam"] = 1] = "Ibeam";
|
|
24573
|
+
CursorShape[CursorShape["PointingHand"] = 2] = "PointingHand";
|
|
24574
|
+
CursorShape[CursorShape["Cross"] = 3] = "Cross";
|
|
24575
|
+
CursorShape[CursorShape["Wait"] = 4] = "Wait";
|
|
24576
|
+
CursorShape[CursorShape["Busy"] = 5] = "Busy";
|
|
24577
|
+
CursorShape[CursorShape["Drag"] = 6] = "Drag";
|
|
24578
|
+
CursorShape[CursorShape["CanDrop"] = 7] = "CanDrop";
|
|
24579
|
+
CursorShape[CursorShape["Forbidden"] = 8] = "Forbidden";
|
|
24580
|
+
CursorShape[CursorShape["Vsize"] = 9] = "Vsize";
|
|
24581
|
+
CursorShape[CursorShape["Hsize"] = 10] = "Hsize";
|
|
24582
|
+
CursorShape[CursorShape["Bdiagsize"] = 11] = "Bdiagsize";
|
|
24583
|
+
CursorShape[CursorShape["Fdiagsize"] = 12] = "Fdiagsize";
|
|
24584
|
+
CursorShape[CursorShape["Move"] = 13] = "Move";
|
|
24585
|
+
CursorShape[CursorShape["Vsplit"] = 14] = "Vsplit";
|
|
24586
|
+
CursorShape[CursorShape["Hsplit"] = 15] = "Hsplit";
|
|
24587
|
+
CursorShape[CursorShape["Help"] = 16] = "Help";
|
|
24588
|
+
})(CursorShape || (CursorShape = {}));
|
|
24589
|
+
|
|
24590
|
+
function _get_prototype_of(o) {
|
|
24591
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
24592
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
24446
24593
|
};
|
|
24447
|
-
|
|
24448
|
-
|
|
24449
|
-
|
|
24450
|
-
|
|
24451
|
-
|
|
24594
|
+
return _get_prototype_of(o);
|
|
24595
|
+
}
|
|
24596
|
+
|
|
24597
|
+
function _is_native_function(fn) {
|
|
24598
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
24599
|
+
}
|
|
24600
|
+
|
|
24601
|
+
function _wrap_native_super(Class) {
|
|
24602
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
24603
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
24604
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
24605
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
24606
|
+
if (typeof _cache !== "undefined") {
|
|
24607
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
24608
|
+
_cache.set(Class, Wrapper);
|
|
24452
24609
|
}
|
|
24453
|
-
|
|
24454
|
-
|
|
24455
|
-
// CanvasLayer 失效时,让其下挂的 CanvasItem 重新查找归属层
|
|
24456
|
-
// 拷贝一份避免迭代过程中数组被修改
|
|
24457
|
-
var items = this.canvasItems.slice();
|
|
24458
|
-
this.canvasItems.length = 0;
|
|
24459
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
24460
|
-
var canvasItem = _step.value;
|
|
24461
|
-
canvasItem.updateCanvasLayer();
|
|
24610
|
+
function Wrapper() {
|
|
24611
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
24462
24612
|
}
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24468
|
-
|
|
24469
|
-
*
|
|
24470
|
-
* 注:画布尺寸到 RectTransform.size 的同步目前未在此处处理(由 RectTransform 自身按需 resolve);
|
|
24471
|
-
* 后续若需要在每帧强制刷新顶层 size,可在此处补回写入与 sizeChanged 传播
|
|
24472
|
-
*
|
|
24473
|
-
* @internal
|
|
24474
|
-
*/ _proto.draw = function draw() {
|
|
24475
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvasItems), _step; !(_step = _iterator()).done;){
|
|
24476
|
-
var canvasItem = _step.value;
|
|
24477
|
-
if (!canvasItem.item.isActive) {
|
|
24478
|
-
continue;
|
|
24613
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
24614
|
+
constructor: {
|
|
24615
|
+
value: Wrapper,
|
|
24616
|
+
enumerable: false,
|
|
24617
|
+
writable: true,
|
|
24618
|
+
configurable: true
|
|
24479
24619
|
}
|
|
24480
|
-
|
|
24481
|
-
|
|
24620
|
+
});
|
|
24621
|
+
return _set_prototype_of(Wrapper, Class);
|
|
24482
24622
|
};
|
|
24483
|
-
return
|
|
24484
|
-
}
|
|
24623
|
+
return _wrap_native_super(Class);
|
|
24624
|
+
}
|
|
24485
24625
|
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
*
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
/**
|
|
24501
|
-
* 父 CanvasItem
|
|
24502
|
-
* 沿 VFXItem 父链向上查找到的最近的 CanvasItem(只看类型,不看 active/enabled — 拓扑跟激活状态解耦)。
|
|
24503
|
-
* 若不存在 CanvasItem 祖先(即直属于 CanvasLayer 或处于游离状态),该值为 null。
|
|
24504
|
-
*/ _this.parent = null;
|
|
24505
|
-
/**
|
|
24506
|
-
* 子 CanvasItem 列表(按注册顺序)
|
|
24507
|
-
* 由子节点在维护自身 parent 时反向写入,draw 时按数组顺序递归绘制
|
|
24508
|
-
*/ _this.children = [];
|
|
24509
|
-
/**
|
|
24510
|
-
* 当前所属的 CanvasLayer,未注册到任何 CanvasLayer 时为 null
|
|
24511
|
-
*/ _this.canvasLayerNode = null;
|
|
24512
|
-
return _this;
|
|
24626
|
+
function transformPoint(transform, value) {
|
|
24627
|
+
var elements = transform.elements;
|
|
24628
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y + elements[6], elements[1] * value.x + elements[4] * value.y + elements[7]);
|
|
24629
|
+
}
|
|
24630
|
+
function transformVector(transform, value) {
|
|
24631
|
+
var elements = transform.elements;
|
|
24632
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y, elements[1] * value.x + elements[4] * value.y);
|
|
24633
|
+
}
|
|
24634
|
+
var InputEvent = /*#__PURE__*/ function() {
|
|
24635
|
+
function InputEvent() {
|
|
24636
|
+
this.device = 0;
|
|
24637
|
+
this.pressed = false;
|
|
24638
|
+
this.canceled = false;
|
|
24639
|
+
this._accepted = false;
|
|
24513
24640
|
}
|
|
24514
|
-
var _proto =
|
|
24515
|
-
_proto.
|
|
24516
|
-
|
|
24517
|
-
// 注意 enable/disable 不再改变 CanvasItem 父子拓扑 — 拓扑由 VFXItem 父链(setParent / onParentChanged)维护,
|
|
24518
|
-
// enable 在这里只是兜底首次入树
|
|
24519
|
-
this.updateCanvasLayer();
|
|
24520
|
-
this.updateParentItem();
|
|
24521
|
-
};
|
|
24522
|
-
_proto.onDisable = function onDisable() {
|
|
24523
|
-
// 组件禁用 = 仅 self.draw 跳过,不应改父子拓扑(否则 enable 回来位置就乱了)。
|
|
24524
|
-
// 整棵子树的隐藏由 `vfxItem.setActive(false)` 配合 drawInternal 中的 `item.isActive` 检查处理
|
|
24525
|
-
};
|
|
24526
|
-
_proto.onParentChanged = function onParentChanged() {
|
|
24527
|
-
// VFXItem 的父级(或间接父级)发生变化时,CanvasLayer 与父 CanvasItem 都可能改变,需要联动刷新
|
|
24528
|
-
this.updateCanvasLayer();
|
|
24529
|
-
this.updateParentItem();
|
|
24530
|
-
};
|
|
24531
|
-
_proto.onDestroy = function onDestroy() {
|
|
24532
|
-
this.removeFromParent();
|
|
24533
|
-
this.removeFromCanvasLayer();
|
|
24534
|
-
// 防止子 canvasItem updateParentItem 的时候继续找到当前已销毁的 canvasItem
|
|
24535
|
-
this.enabled = false;
|
|
24536
|
-
this.updateChildrenParentItems();
|
|
24537
|
-
};
|
|
24538
|
-
/**
|
|
24539
|
-
* 重新计算并更新当前 CanvasItem 应归属的 CanvasLayer
|
|
24540
|
-
* 在父级变化、所在 CanvasLayer 失效等场景中调用
|
|
24541
|
-
*
|
|
24542
|
-
* 仅当自身是顶层 CanvasItem(parent 为 null)时才会登记到 CanvasLayer.canvasItems;
|
|
24543
|
-
* 嵌套的子 CanvasItem 仅记录 canvasLayerNode 引用,不进入 layer 的顶层列表。
|
|
24544
|
-
* @internal
|
|
24545
|
-
*/ _proto.updateCanvasLayer = function updateCanvasLayer() {
|
|
24546
|
-
// 拓扑跟 enabled/active 解耦,只看 item 是否还在
|
|
24547
|
-
if (!this.item) {
|
|
24548
|
-
this.removeFromCanvasLayer();
|
|
24549
|
-
return;
|
|
24550
|
-
}
|
|
24551
|
-
var newLayer = this.getCanvasLayerNode();
|
|
24552
|
-
if (newLayer === this.canvasLayerNode) {
|
|
24553
|
-
return;
|
|
24554
|
-
}
|
|
24555
|
-
// 仅当自身是顶层 CanvasItem 时,才需要在 layer 的 canvasItems 中迁移
|
|
24556
|
-
if (this.parent === null && this.canvasLayerNode) {
|
|
24557
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24558
|
-
}
|
|
24559
|
-
this.canvasLayerNode = newLayer;
|
|
24560
|
-
if (this.parent === null && newLayer) {
|
|
24561
|
-
newLayer.addCanvasItem(this);
|
|
24562
|
-
}
|
|
24563
|
-
};
|
|
24564
|
-
/**
|
|
24565
|
-
* 重新计算并更新当前 CanvasItem 的父 CanvasItem
|
|
24566
|
-
* 在 VFXItem 父级变化、自身启用/禁用、父 CanvasItem 失效等场景中调用
|
|
24567
|
-
*
|
|
24568
|
-
* parent 的变化会同步影响在 CanvasLayer.canvasItems 中的归属:
|
|
24569
|
-
* - 由有 parent 变成无 parent 且仍归属某 layer:加入 layer.canvasItems
|
|
24570
|
-
* - 由无 parent 变成有 parent:从 layer.canvasItems 中移除
|
|
24571
|
-
* @internal
|
|
24572
|
-
*/ _proto.updateParentItem = function updateParentItem() {
|
|
24573
|
-
// 拓扑跟 enabled/active 解耦,只看 item 是否还在
|
|
24574
|
-
if (!this.item) {
|
|
24575
|
-
this.removeFromParent();
|
|
24576
|
-
return;
|
|
24577
|
-
}
|
|
24578
|
-
var newParent = this.getParentItem();
|
|
24579
|
-
if (newParent === this.parent) {
|
|
24580
|
-
return;
|
|
24581
|
-
}
|
|
24582
|
-
var wasTopLevel = this.parent === null;
|
|
24583
|
-
this.removeFromParent();
|
|
24584
|
-
if (newParent) {
|
|
24585
|
-
this.parent = newParent;
|
|
24586
|
-
newParent.children.push(this);
|
|
24587
|
-
// 由顶层变成嵌套:从 layer 的顶层列表中移除
|
|
24588
|
-
if (wasTopLevel && this.canvasLayerNode) {
|
|
24589
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24590
|
-
}
|
|
24591
|
-
} else if (!wasTopLevel && this.canvasLayerNode) {
|
|
24592
|
-
// 由嵌套变成顶层:加入 layer 的顶层列表
|
|
24593
|
-
this.canvasLayerNode.addCanvasItem(this);
|
|
24594
|
-
}
|
|
24595
|
-
};
|
|
24596
|
-
/**
|
|
24597
|
-
* 绘制函数
|
|
24598
|
-
* 子类重写此方法以输出实际的绘制内容;调用时 graphics 的变换栈顶已经累积了从根到当前节点的所有父变换,
|
|
24599
|
-
* 子类直接使用 this.drawXxx / this.fillXxx 系列封装方法绘制即可,绘制坐标视为本地坐标。
|
|
24600
|
-
*/ _proto.draw = function draw() {
|
|
24601
|
-
// OVERRIDE
|
|
24602
|
-
};
|
|
24603
|
-
/**
|
|
24604
|
-
* 绘制单条线段
|
|
24605
|
-
* @param x1 - 起点 x
|
|
24606
|
-
* @param y1 - 起点 y
|
|
24607
|
-
* @param x2 - 终点 x
|
|
24608
|
-
* @param y2 - 终点 y
|
|
24609
|
-
* @param color - 线条颜色
|
|
24610
|
-
* @param thickness - 线宽
|
|
24611
|
-
*/ _proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
|
|
24612
|
-
this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
|
|
24613
|
-
};
|
|
24614
|
-
/**
|
|
24615
|
-
* 按顺序连接所有点绘制折线(首尾相同则视为闭合)
|
|
24616
|
-
* @param points - 点数组,格式 [x1,y1,x2,y2,...]
|
|
24617
|
-
* @param color - 线条颜色
|
|
24618
|
-
* @param thickness - 线宽
|
|
24619
|
-
*/ _proto.drawPolyline = function drawPolyline(points, color, thickness) {
|
|
24620
|
-
this.engine.graphics.drawLines(points, color, thickness);
|
|
24621
|
-
};
|
|
24622
|
-
/**
|
|
24623
|
-
* 绘制三次贝塞尔曲线
|
|
24624
|
-
*/ _proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
|
|
24625
|
-
this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
|
|
24626
|
-
};
|
|
24627
|
-
/**
|
|
24628
|
-
* 绘制三角形边框
|
|
24629
|
-
*/ _proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
|
|
24630
|
-
this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
|
|
24631
|
-
};
|
|
24632
|
-
/**
|
|
24633
|
-
* 绘制矩形边框
|
|
24634
|
-
* @param x - 矩形左下角 x 坐标
|
|
24635
|
-
* @param y - 矩形左下角 y 坐标
|
|
24636
|
-
*/ _proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
|
|
24637
|
-
this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
|
|
24638
|
-
};
|
|
24639
|
-
/**
|
|
24640
|
-
* 绘制圆形边框
|
|
24641
|
-
*/ _proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
|
|
24642
|
-
this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
|
|
24643
|
-
};
|
|
24644
|
-
/**
|
|
24645
|
-
* 绘制填充三角形
|
|
24646
|
-
*/ _proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
|
|
24647
|
-
this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
|
|
24648
|
-
};
|
|
24649
|
-
/**
|
|
24650
|
-
* 绘制填充矩形
|
|
24651
|
-
* @param x - 矩形左下角 x 坐标
|
|
24652
|
-
* @param y - 矩形左下角 y 坐标
|
|
24653
|
-
*/ _proto.fillRect = function fillRect(x, y, width, height, color) {
|
|
24654
|
-
this.engine.graphics.fillRectangle(x, y, width, height, color);
|
|
24641
|
+
var _proto = InputEvent.prototype;
|
|
24642
|
+
_proto.accept = function accept() {
|
|
24643
|
+
this._accepted = true;
|
|
24655
24644
|
};
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
*/ _proto.fillCircle = function fillCircle(cx, cy, radius, color) {
|
|
24659
|
-
this.engine.graphics.fillCircle(cx, cy, radius, color);
|
|
24660
|
-
};
|
|
24661
|
-
/**
|
|
24662
|
-
* 绘制纹理矩形(本地坐标,Y 向上,(x, y) 为左下角)
|
|
24663
|
-
* @param region - 纹理 UV 子矩形,默认全图。Y 向上,(u0, v0) 为左下角 UV
|
|
24664
|
-
* @param color - 乘色,默认白色
|
|
24665
|
-
*/ _proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
|
|
24666
|
-
this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
|
|
24645
|
+
_proto.clearAccepted = function clearAccepted() {
|
|
24646
|
+
this._accepted = false;
|
|
24667
24647
|
};
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
*
|
|
24671
|
-
* 同一段文本不同颜色不会重复 upload — 颜色由 `color` 参数透传作为乘色,纹理只缓存白色字形。
|
|
24672
|
-
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
24673
|
-
*/ _proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
|
|
24674
|
-
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
24648
|
+
_proto.isAccepted = function isAccepted() {
|
|
24649
|
+
return this._accepted;
|
|
24675
24650
|
};
|
|
24676
|
-
|
|
24677
|
-
|
|
24678
|
-
* @internal
|
|
24679
|
-
*/ _proto.drawInternal = function drawInternal() {
|
|
24680
|
-
var graphics = this.engine.graphics;
|
|
24681
|
-
var localMatrix2D = this.transform.getMatrix2D();
|
|
24682
|
-
graphics.pushTransform(localMatrix2D);
|
|
24683
|
-
// self 是否绘制只看 component.enabled — 其它都不影响。
|
|
24684
|
-
// transform 始终被 push,children 始终被遍历,这样 component.enabled=false 时 self 隐藏
|
|
24685
|
-
// 但 children 的位置不受影响
|
|
24686
|
-
if (this.enabled) {
|
|
24687
|
-
this.draw();
|
|
24688
|
-
}
|
|
24689
|
-
// 子是否参与绘制看 VFXItem.isActive(整棵跳过的语义)。
|
|
24690
|
-
// 子自身的 component.enabled 在它自己的 drawInternal 里再判断
|
|
24691
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
24692
|
-
var child = _step.value;
|
|
24693
|
-
if (!child.item.isActive) {
|
|
24694
|
-
continue;
|
|
24695
|
-
}
|
|
24696
|
-
child.drawInternal();
|
|
24697
|
-
}
|
|
24698
|
-
graphics.popTransform();
|
|
24651
|
+
_proto.isPressed = function isPressed() {
|
|
24652
|
+
return this.pressed && !this.canceled;
|
|
24699
24653
|
};
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
* 仅当自身是顶层 CanvasItem 时,才会触发 layer 顶层列表的移除
|
|
24703
|
-
*/ _proto.removeFromCanvasLayer = function removeFromCanvasLayer() {
|
|
24704
|
-
if (!this.canvasLayerNode) {
|
|
24705
|
-
return;
|
|
24706
|
-
}
|
|
24707
|
-
if (this.parent === null) {
|
|
24708
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24709
|
-
}
|
|
24710
|
-
this.canvasLayerNode = null;
|
|
24654
|
+
_proto.isReleased = function isReleased() {
|
|
24655
|
+
return !this.pressed && !this.canceled;
|
|
24711
24656
|
};
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
*/ _proto.removeFromParent = function removeFromParent() {
|
|
24715
|
-
if (!this.parent) {
|
|
24716
|
-
return;
|
|
24717
|
-
}
|
|
24718
|
-
removeItem(this.parent.children, this);
|
|
24719
|
-
this.parent = null;
|
|
24657
|
+
_proto.isCanceled = function isCanceled() {
|
|
24658
|
+
return this.canceled;
|
|
24720
24659
|
};
|
|
24721
|
-
|
|
24722
|
-
|
|
24723
|
-
* 自身失效时调用,子节点会跳过自己向上找到新的父 CanvasItem(可能为 null)。
|
|
24724
|
-
*/ _proto.updateChildrenParentItems = function updateChildrenParentItems() {
|
|
24725
|
-
if (this.children.length === 0) {
|
|
24726
|
-
return;
|
|
24727
|
-
}
|
|
24728
|
-
// 拷贝避免迭代过程中数组被 removeFromParent 修改
|
|
24729
|
-
var snapshot = this.children.slice();
|
|
24730
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(snapshot), _step; !(_step = _iterator()).done;){
|
|
24731
|
-
var child = _step.value;
|
|
24732
|
-
child.updateParentItem();
|
|
24733
|
-
}
|
|
24660
|
+
_proto.isEcho = function isEcho() {
|
|
24661
|
+
return false;
|
|
24734
24662
|
};
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
* 注意:自身所在 VFXItem 上的 CanvasLayer 也参与查找(同节点上可能并存 CanvasLayer 与 CanvasItem)
|
|
24738
|
-
*/ _proto.getCanvasLayerNode = function getCanvasLayerNode() {
|
|
24739
|
-
var current = this.item;
|
|
24740
|
-
while(current){
|
|
24741
|
-
var layer = getCanvasLayerFromItem(current);
|
|
24742
|
-
if (layer) {
|
|
24743
|
-
return layer;
|
|
24744
|
-
}
|
|
24745
|
-
var _current_parent;
|
|
24746
|
-
current = (_current_parent = current.parent) != null ? _current_parent : null;
|
|
24747
|
-
}
|
|
24748
|
-
return null;
|
|
24663
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24664
|
+
return this;
|
|
24749
24665
|
};
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24763
|
-
|
|
24764
|
-
|
|
24666
|
+
return InputEvent;
|
|
24667
|
+
}();
|
|
24668
|
+
InputEvent.deviceIdEmulation = -1;
|
|
24669
|
+
InputEvent.deviceIdInternal = -2;
|
|
24670
|
+
InputEvent.deviceIdKeyboard = 16;
|
|
24671
|
+
InputEvent.deviceIdMouse = 32;
|
|
24672
|
+
var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
24673
|
+
_inherits(InputEventWithModifiers, InputEvent);
|
|
24674
|
+
function InputEventWithModifiers() {
|
|
24675
|
+
var _this;
|
|
24676
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24677
|
+
_this.commandOrControlAutoremap = false;
|
|
24678
|
+
_this.shiftPressed = false;
|
|
24679
|
+
_this.altPressed = false;
|
|
24680
|
+
_this.metaPressed = false;
|
|
24681
|
+
_this.ctrlPressed = false;
|
|
24682
|
+
return _this;
|
|
24683
|
+
}
|
|
24684
|
+
var _proto = InputEventWithModifiers.prototype;
|
|
24685
|
+
_proto.copyModifiersTo = function copyModifiersTo(event) {
|
|
24686
|
+
event.device = this.device;
|
|
24687
|
+
event.pressed = this.pressed;
|
|
24688
|
+
event.canceled = this.canceled;
|
|
24689
|
+
event.commandOrControlAutoremap = this.commandOrControlAutoremap;
|
|
24690
|
+
event.shiftPressed = this.shiftPressed;
|
|
24691
|
+
event.altPressed = this.altPressed;
|
|
24692
|
+
event.metaPressed = this.metaPressed;
|
|
24693
|
+
event.ctrlPressed = this.ctrlPressed;
|
|
24694
|
+
};
|
|
24695
|
+
return InputEventWithModifiers;
|
|
24696
|
+
}(_wrap_native_super(InputEvent));
|
|
24697
|
+
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24698
|
+
_inherits(InputEventKey, InputEventWithModifiers);
|
|
24699
|
+
function InputEventKey() {
|
|
24700
|
+
var _this;
|
|
24701
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24702
|
+
_this.keycode = "";
|
|
24703
|
+
_this.physicalKeycode = "";
|
|
24704
|
+
_this.keyLabel = "";
|
|
24705
|
+
_this.unicode = 0;
|
|
24706
|
+
_this.location = KeyLocation.Unspecified;
|
|
24707
|
+
_this.echo = false;
|
|
24708
|
+
return _this;
|
|
24709
|
+
}
|
|
24710
|
+
var _proto = InputEventKey.prototype;
|
|
24711
|
+
_proto.isEcho = function isEcho() {
|
|
24712
|
+
return this.echo;
|
|
24765
24713
|
};
|
|
24766
|
-
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
24772
|
-
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
}(Component);
|
|
24778
|
-
/**
|
|
24779
|
-
* 在指定 VFXItem 上查找一个激活的 CanvasLayer 组件
|
|
24780
|
-
*/ function getCanvasLayerFromItem(item) {
|
|
24781
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
24782
|
-
var component = _step.value;
|
|
24783
|
-
if (_instanceof1(component, CanvasLayer) && component.isActiveAndEnabled) {
|
|
24784
|
-
return component;
|
|
24785
|
-
}
|
|
24714
|
+
return InputEventKey;
|
|
24715
|
+
}(InputEventWithModifiers);
|
|
24716
|
+
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24717
|
+
_inherits(InputEventMouse, InputEventWithModifiers);
|
|
24718
|
+
function InputEventMouse() {
|
|
24719
|
+
var _this;
|
|
24720
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24721
|
+
_this.buttonMask = MouseButtonMask.None;
|
|
24722
|
+
_this.position = new Vector2();
|
|
24723
|
+
_this.globalPosition = new Vector2();
|
|
24724
|
+
return _this;
|
|
24786
24725
|
}
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24726
|
+
var _proto = InputEventMouse.prototype;
|
|
24727
|
+
_proto.copyMouseTo = function copyMouseTo(event) {
|
|
24728
|
+
this.copyModifiersTo(event);
|
|
24729
|
+
event.buttonMask = this.buttonMask;
|
|
24730
|
+
event.position.copyFrom(this.position);
|
|
24731
|
+
event.globalPosition.copyFrom(this.globalPosition);
|
|
24732
|
+
};
|
|
24733
|
+
return InputEventMouse;
|
|
24734
|
+
}(InputEventWithModifiers);
|
|
24735
|
+
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
24736
|
+
_inherits(InputEventMouseButton, InputEventMouse);
|
|
24737
|
+
function InputEventMouseButton() {
|
|
24738
|
+
var _this;
|
|
24739
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24740
|
+
_this.factor = 1;
|
|
24741
|
+
_this.buttonIndex = MouseButton.None;
|
|
24742
|
+
_this.doubleClick = false;
|
|
24743
|
+
return _this;
|
|
24797
24744
|
}
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
|
|
24803
|
-
|
|
24804
|
-
|
|
24745
|
+
var _proto = InputEventMouseButton.prototype;
|
|
24746
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24747
|
+
var event = new InputEventMouseButton();
|
|
24748
|
+
this.copyMouseTo(event);
|
|
24749
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24750
|
+
event.factor = this.factor;
|
|
24751
|
+
event.buttonIndex = this.buttonIndex;
|
|
24752
|
+
event.doubleClick = this.doubleClick;
|
|
24753
|
+
return event;
|
|
24754
|
+
};
|
|
24755
|
+
return InputEventMouseButton;
|
|
24756
|
+
}(InputEventMouse);
|
|
24757
|
+
var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
|
|
24758
|
+
_inherits(InputEventMouseMotion, InputEventMouse);
|
|
24759
|
+
function InputEventMouseMotion() {
|
|
24760
|
+
var _this;
|
|
24761
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24762
|
+
_this.tilt = new Vector2();
|
|
24763
|
+
_this.pressure = 0;
|
|
24764
|
+
_this.relative = new Vector2();
|
|
24765
|
+
_this.screenRelative = new Vector2();
|
|
24766
|
+
_this.velocity = new Vector2();
|
|
24767
|
+
_this.screenVelocity = new Vector2();
|
|
24768
|
+
_this.penInverted = false;
|
|
24769
|
+
return _this;
|
|
24770
|
+
}
|
|
24771
|
+
var _proto = InputEventMouseMotion.prototype;
|
|
24772
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24773
|
+
var event = new InputEventMouseMotion();
|
|
24774
|
+
this.copyMouseTo(event);
|
|
24775
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24776
|
+
event.tilt.copyFrom(this.tilt);
|
|
24777
|
+
event.pressure = this.pressure;
|
|
24778
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24779
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
24780
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24781
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24782
|
+
event.penInverted = this.penInverted;
|
|
24783
|
+
return event;
|
|
24784
|
+
};
|
|
24785
|
+
return InputEventMouseMotion;
|
|
24786
|
+
}(InputEventMouse);
|
|
24787
|
+
var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
|
|
24788
|
+
_inherits(InputEventScreenTouch, InputEvent);
|
|
24789
|
+
function InputEventScreenTouch() {
|
|
24790
|
+
var _this;
|
|
24791
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24792
|
+
_this.index = 0;
|
|
24793
|
+
_this.position = new Vector2();
|
|
24794
|
+
_this.doubleTap = false;
|
|
24795
|
+
return _this;
|
|
24796
|
+
}
|
|
24797
|
+
var _proto = InputEventScreenTouch.prototype;
|
|
24798
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24799
|
+
var event = new InputEventScreenTouch();
|
|
24800
|
+
event.device = this.device;
|
|
24801
|
+
event.pressed = this.pressed;
|
|
24802
|
+
event.canceled = this.canceled;
|
|
24803
|
+
event.index = this.index;
|
|
24804
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24805
|
+
event.doubleTap = this.doubleTap;
|
|
24806
|
+
return event;
|
|
24807
|
+
};
|
|
24808
|
+
return InputEventScreenTouch;
|
|
24809
|
+
}(_wrap_native_super(InputEvent));
|
|
24810
|
+
var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
24811
|
+
_inherits(InputEventScreenDrag, InputEvent);
|
|
24812
|
+
function InputEventScreenDrag() {
|
|
24813
|
+
var _this;
|
|
24814
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24815
|
+
_this.index = 0;
|
|
24816
|
+
_this.position = new Vector2();
|
|
24817
|
+
_this.relative = new Vector2();
|
|
24818
|
+
_this.screenRelative = new Vector2();
|
|
24819
|
+
_this.velocity = new Vector2();
|
|
24820
|
+
_this.screenVelocity = new Vector2();
|
|
24821
|
+
_this.pressure = 0;
|
|
24822
|
+
_this.tilt = new Vector2();
|
|
24823
|
+
_this.penInverted = false;
|
|
24824
|
+
return _this;
|
|
24825
|
+
}
|
|
24826
|
+
var _proto = InputEventScreenDrag.prototype;
|
|
24827
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24828
|
+
var event = new InputEventScreenDrag();
|
|
24829
|
+
event.device = this.device;
|
|
24830
|
+
event.pressed = this.pressed;
|
|
24831
|
+
event.canceled = this.canceled;
|
|
24832
|
+
event.index = this.index;
|
|
24833
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24834
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24835
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
24836
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24837
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24838
|
+
event.pressure = this.pressure;
|
|
24839
|
+
event.tilt.copyFrom(this.tilt);
|
|
24840
|
+
event.penInverted = this.penInverted;
|
|
24841
|
+
return event;
|
|
24842
|
+
};
|
|
24843
|
+
return InputEventScreenDrag;
|
|
24844
|
+
}(_wrap_native_super(InputEvent));
|
|
24845
|
+
|
|
24846
|
+
var ANCHOR_PRESET_TABLE = {
|
|
24805
24847
|
topLeft: [
|
|
24806
24848
|
0,
|
|
24807
|
-
1,
|
|
24808
24849
|
0,
|
|
24809
|
-
|
|
24850
|
+
0,
|
|
24851
|
+
0
|
|
24810
24852
|
],
|
|
24811
24853
|
topRight: [
|
|
24812
24854
|
1,
|
|
24855
|
+
0,
|
|
24813
24856
|
1,
|
|
24814
|
-
|
|
24815
|
-
1
|
|
24857
|
+
0
|
|
24816
24858
|
],
|
|
24817
24859
|
bottomLeft: [
|
|
24818
24860
|
0,
|
|
24861
|
+
1,
|
|
24819
24862
|
0,
|
|
24820
|
-
|
|
24821
|
-
0
|
|
24863
|
+
1
|
|
24822
24864
|
],
|
|
24823
24865
|
bottomRight: [
|
|
24824
24866
|
1,
|
|
24825
|
-
0,
|
|
24826
24867
|
1,
|
|
24827
|
-
|
|
24868
|
+
1,
|
|
24869
|
+
1
|
|
24828
24870
|
],
|
|
24829
24871
|
centerLeft: [
|
|
24830
24872
|
0,
|
|
@@ -24834,9 +24876,9 @@ FrameComponent = __decorate([
|
|
|
24834
24876
|
],
|
|
24835
24877
|
centerTop: [
|
|
24836
24878
|
0.5,
|
|
24837
|
-
|
|
24879
|
+
0,
|
|
24838
24880
|
0.5,
|
|
24839
|
-
|
|
24881
|
+
0
|
|
24840
24882
|
],
|
|
24841
24883
|
centerRight: [
|
|
24842
24884
|
1,
|
|
@@ -24846,9 +24888,9 @@ FrameComponent = __decorate([
|
|
|
24846
24888
|
],
|
|
24847
24889
|
centerBottom: [
|
|
24848
24890
|
0.5,
|
|
24849
|
-
|
|
24891
|
+
1,
|
|
24850
24892
|
0.5,
|
|
24851
|
-
|
|
24893
|
+
1
|
|
24852
24894
|
],
|
|
24853
24895
|
center: [
|
|
24854
24896
|
0.5,
|
|
@@ -24863,10 +24905,10 @@ FrameComponent = __decorate([
|
|
|
24863
24905
|
1
|
|
24864
24906
|
],
|
|
24865
24907
|
topWide: [
|
|
24908
|
+
0,
|
|
24866
24909
|
0,
|
|
24867
24910
|
1,
|
|
24868
|
-
|
|
24869
|
-
1
|
|
24911
|
+
0
|
|
24870
24912
|
],
|
|
24871
24913
|
rightWide: [
|
|
24872
24914
|
1,
|
|
@@ -24875,10 +24917,10 @@ FrameComponent = __decorate([
|
|
|
24875
24917
|
1
|
|
24876
24918
|
],
|
|
24877
24919
|
bottomWide: [
|
|
24878
|
-
0,
|
|
24879
24920
|
0,
|
|
24880
24921
|
1,
|
|
24881
|
-
|
|
24922
|
+
1,
|
|
24923
|
+
1
|
|
24882
24924
|
],
|
|
24883
24925
|
vcenterWide: [
|
|
24884
24926
|
0.5,
|
|
@@ -24900,306 +24942,171 @@ FrameComponent = __decorate([
|
|
|
24900
24942
|
]
|
|
24901
24943
|
};
|
|
24902
24944
|
/**
|
|
24903
|
-
*
|
|
24904
|
-
*
|
|
24905
|
-
|
|
24906
|
-
|
|
24907
|
-
|
|
24908
|
-
|
|
24909
|
-
|
|
24910
|
-
|
|
24911
|
-
|
|
24912
|
-
|
|
24913
|
-
|
|
24914
|
-
|
|
24915
|
-
|
|
24916
|
-
|
|
24917
|
-
|
|
24918
|
-
|
|
24919
|
-
|
|
24920
|
-
|
|
24921
|
-
|
|
24922
|
-
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
|
|
24927
|
-
|
|
24928
|
-
|
|
24929
|
-
|
|
24930
|
-
|
|
24931
|
-
|
|
24932
|
-
|
|
24933
|
-
* 父 rect 上的归一化最小角 `(anchorLeft, anchorBottom)`
|
|
24934
|
-
*/ _this.anchorMin = new Vector2(0, 0);
|
|
24935
|
-
/**
|
|
24936
|
-
* 父 rect 上的归一化最大角 `(anchorRight, anchorTop)`
|
|
24937
|
-
*/ _this.anchorMax = new Vector2(0, 0);
|
|
24938
|
-
/**
|
|
24939
|
-
* rect 左/下边相对 anchorMin 锚点的像素偏移 `(offsetLeft, offsetBottom)`
|
|
24940
|
-
*/ _this.offsetMin = new Vector2(0, 0);
|
|
24941
|
-
/**
|
|
24942
|
-
* rect 右/上边相对 anchorMax 锚点的像素偏移 `(offsetRight, offsetTop)`
|
|
24943
|
-
*/ _this.offsetMax = new Vector2(0, 0);
|
|
24944
|
-
/**
|
|
24945
|
-
* 自身 rect 上的归一化轴心 `(0..1)`,默认 `(0.5, 0.5)`(中心)。两层效果:
|
|
24946
|
-
* 1. **Layout**:`setSize` 时 rect 围绕此点对称缩放(pivot=(0.5, 0.5) → 居中扩展;pivot=(0, 0) → 从左下扩展;pivot=(1, 1) → 向左下缩)
|
|
24947
|
-
* 2. **矩阵**:`pivot` 自动同步到 `transform.anchor = pivot * size`(像素值,矩阵旋转/缩放中心),
|
|
24948
|
-
* 所以旋转/缩放也围绕同一点。`setPivot` 和每次 `sizeChanged`(size 重算后)都会刷新 `transform.anchor`
|
|
24949
|
-
*/ _this.pivot = new Vector2(0.5, 0.5);
|
|
24950
|
-
return _this;
|
|
24945
|
+
* A drawable GUI object. Controls form a tree independent from the VFXItem
|
|
24946
|
+
* scene tree. UIControl is the bridge between both trees.
|
|
24947
|
+
*/ var Control = /*#__PURE__*/ function() {
|
|
24948
|
+
function Control(engine) {
|
|
24949
|
+
this.engine = engine;
|
|
24950
|
+
this._parent = null;
|
|
24951
|
+
this._visible = true;
|
|
24952
|
+
this._enabled = true;
|
|
24953
|
+
this._mouseFilter = MouseFilter.Stop;
|
|
24954
|
+
this._mouseBehaviorRecursive = MouseBehaviorRecursive.Inherited;
|
|
24955
|
+
this._focusMode = FocusMode.None;
|
|
24956
|
+
this._focusBehaviorRecursive = FocusBehaviorRecursive.Inherited;
|
|
24957
|
+
this._defaultCursorShape = CursorShape.Arrow;
|
|
24958
|
+
this._rotation = 0;
|
|
24959
|
+
this.transformDirty = true;
|
|
24960
|
+
this.cachedTransform = new Matrix3();
|
|
24961
|
+
this.eventEmitter = new EventEmitter();
|
|
24962
|
+
this.disposed = false;
|
|
24963
|
+
this./** Scene-tree bridge that owns this GUI object, if any. */ owner = null;
|
|
24964
|
+
this.position = new Vector2();
|
|
24965
|
+
this.size = new Vector2(1, 1);
|
|
24966
|
+
this.anchorMin = new Vector2();
|
|
24967
|
+
this.anchorMax = new Vector2();
|
|
24968
|
+
this.offsetMin = new Vector2();
|
|
24969
|
+
this.offsetMax = new Vector2(1, 1);
|
|
24970
|
+
this.pivot = new Vector2(0.5, 0.5);
|
|
24971
|
+
this.scale = new Vector2(1, 1);
|
|
24972
|
+
this.shear = new Vector2();
|
|
24973
|
+
this.mouseForcePassScrollEvents = true;
|
|
24974
|
+
this.clipContents = false;
|
|
24951
24975
|
}
|
|
24952
|
-
var _proto =
|
|
24953
|
-
|
|
24954
|
-
|
|
24955
|
-
|
|
24956
|
-
|
|
24957
|
-
|
|
24958
|
-
|
|
24959
|
-
|
|
24960
|
-
|
|
24961
|
-
|
|
24962
|
-
|
|
24963
|
-
Transform.prototype.fromData.call(this, data);
|
|
24964
|
-
if (this.size.x !== 0 && this.size.y !== 0) {
|
|
24965
|
-
this.pivot.set(this.anchor.x / this.size.x, this.anchor.y / this.size.y);
|
|
24976
|
+
var _proto = Control.prototype;
|
|
24977
|
+
_proto.on = function on(eventName, listener, options) {
|
|
24978
|
+
this.eventEmitter.on(eventName, listener, options);
|
|
24979
|
+
};
|
|
24980
|
+
_proto.off = function off(eventName, listener) {
|
|
24981
|
+
this.eventEmitter.off(eventName, listener);
|
|
24982
|
+
};
|
|
24983
|
+
_proto.setPosition = function setPosition(x, y, keepOffsets) {
|
|
24984
|
+
if (keepOffsets === void 0) keepOffsets = false;
|
|
24985
|
+
if (this.position.x === x && this.position.y === y) {
|
|
24986
|
+
return;
|
|
24966
24987
|
}
|
|
24967
|
-
|
|
24968
|
-
|
|
24969
|
-
|
|
24970
|
-
|
|
24988
|
+
var rect = {
|
|
24989
|
+
position: new Vector2(x, y),
|
|
24990
|
+
size: this.size.clone()
|
|
24991
|
+
};
|
|
24992
|
+
if (keepOffsets && this.parent) {
|
|
24993
|
+
this.computeAnchors(rect, this.getParentRect());
|
|
24994
|
+
} else {
|
|
24995
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
24971
24996
|
}
|
|
24972
|
-
|
|
24973
|
-
|
|
24974
|
-
|
|
24975
|
-
|
|
24997
|
+
this.updateLayout();
|
|
24998
|
+
};
|
|
24999
|
+
_proto.setSize = function setSize(width, height) {
|
|
25000
|
+
if (this.size.x === width && this.size.y === height) {
|
|
25001
|
+
return;
|
|
24976
25002
|
}
|
|
24977
|
-
|
|
24978
|
-
|
|
24979
|
-
|
|
24980
|
-
|
|
25003
|
+
var rect = {
|
|
25004
|
+
position: this.position.clone(),
|
|
25005
|
+
size: new Vector2(width, height)
|
|
25006
|
+
};
|
|
25007
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
25008
|
+
this.updateLayout();
|
|
25009
|
+
};
|
|
25010
|
+
_proto.setScale = function setScale(x, y) {
|
|
25011
|
+
if (this.scale.x !== x || this.scale.y !== y) {
|
|
25012
|
+
this.scale.set(x, y);
|
|
25013
|
+
this.markTransformDirty();
|
|
24981
25014
|
}
|
|
24982
|
-
|
|
24983
|
-
|
|
24984
|
-
|
|
24985
|
-
this.
|
|
25015
|
+
};
|
|
25016
|
+
_proto.setRotation = function setRotation(degrees) {
|
|
25017
|
+
if (this._rotation !== degrees) {
|
|
25018
|
+
this._rotation = degrees;
|
|
25019
|
+
this.markTransformDirty();
|
|
25020
|
+
}
|
|
25021
|
+
};
|
|
25022
|
+
_proto.setShear = function setShear(x, y) {
|
|
25023
|
+
if (this.shear.x !== x || this.shear.y !== y) {
|
|
25024
|
+
this.shear.set(x, y);
|
|
25025
|
+
this.markTransformDirty();
|
|
25026
|
+
}
|
|
25027
|
+
};
|
|
25028
|
+
_proto.setPivot = function setPivot(x, y) {
|
|
25029
|
+
if (this.pivot.x !== x || this.pivot.y !== y) {
|
|
25030
|
+
this.pivot.set(x, y);
|
|
25031
|
+
this.markTransformDirty();
|
|
24986
25032
|
}
|
|
24987
25033
|
};
|
|
24988
|
-
// ── layout-input setters(改完 → sizeChanged 重算)──────
|
|
24989
25034
|
_proto.setAnchorMin = function setAnchorMin(x, y) {
|
|
24990
25035
|
if (this.anchorMin.x !== x || this.anchorMin.y !== y) {
|
|
24991
|
-
this.anchorMin.x
|
|
24992
|
-
this.
|
|
24993
|
-
this.sizeChanged();
|
|
25036
|
+
this.anchorMin.set(x, y);
|
|
25037
|
+
this.updateLayout();
|
|
24994
25038
|
}
|
|
24995
25039
|
};
|
|
24996
25040
|
_proto.setAnchorMax = function setAnchorMax(x, y) {
|
|
24997
25041
|
if (this.anchorMax.x !== x || this.anchorMax.y !== y) {
|
|
24998
|
-
this.anchorMax.x
|
|
24999
|
-
this.
|
|
25000
|
-
this.sizeChanged();
|
|
25042
|
+
this.anchorMax.set(x, y);
|
|
25043
|
+
this.updateLayout();
|
|
25001
25044
|
}
|
|
25002
25045
|
};
|
|
25003
25046
|
_proto.setOffsetMin = function setOffsetMin(x, y) {
|
|
25004
25047
|
if (this.offsetMin.x !== x || this.offsetMin.y !== y) {
|
|
25005
|
-
this.offsetMin.x
|
|
25006
|
-
this.
|
|
25007
|
-
this.sizeChanged();
|
|
25048
|
+
this.offsetMin.set(x, y);
|
|
25049
|
+
this.updateLayout();
|
|
25008
25050
|
}
|
|
25009
25051
|
};
|
|
25010
25052
|
_proto.setOffsetMax = function setOffsetMax(x, y) {
|
|
25011
25053
|
if (this.offsetMax.x !== x || this.offsetMax.y !== y) {
|
|
25012
|
-
this.offsetMax.x
|
|
25013
|
-
this.
|
|
25014
|
-
this.sizeChanged();
|
|
25015
|
-
}
|
|
25016
|
-
};
|
|
25017
|
-
/**
|
|
25018
|
-
* 设置 rect 内的归一化轴心 `(0..1)`,同时把 `transform.anchor`(矩阵旋转/缩放中心)同步到 `pivot * size`。
|
|
25019
|
-
* 不重算 rect(pivot 只决定 setSize 行为,不直接影响当前 rect 位置 / 尺寸)
|
|
25020
|
-
*/ _proto.setPivot = function setPivot(x, y) {
|
|
25021
|
-
if (this.pivot.x !== x || this.pivot.y !== y) {
|
|
25022
|
-
this.pivot.x = x;
|
|
25023
|
-
this.pivot.y = y;
|
|
25024
|
-
// 同步 transform.anchor(像素 pivot)= pivot * size,让旋转/缩放绕同一点
|
|
25025
|
-
this.anchor.set(this.pivot.x * this.size.x, this.pivot.y * this.size.y, this.anchor.z);
|
|
25054
|
+
this.offsetMax.set(x, y);
|
|
25055
|
+
this.updateLayout();
|
|
25026
25056
|
}
|
|
25027
25057
|
};
|
|
25028
|
-
|
|
25029
|
-
* 重写父类 `setPosition`:
|
|
25030
|
-
* - 顶层(无 RectTransform 父):直接 `super.setPosition` 写位置,触发 `sizeChanged` 传播
|
|
25031
|
-
* - 非顶层:语义为"设置 rect 左下角到 (x, y)",反推 offset 维持当前 anchor,然后 `sizeChanged` 重算
|
|
25032
|
-
*
|
|
25033
|
-
* @param keepOffsets - 默认 false。true 时反推 anchor 而非 offset(rect 在屏幕上不动,但 anchor 比例改变)
|
|
25034
|
-
*/ _proto.setPosition = function setPosition(x, y, z, keepOffsets) {
|
|
25035
|
-
if (keepOffsets === void 0) keepOffsets = false;
|
|
25036
|
-
if (!_instanceof1(this.parentTransform, RectTransform)) {
|
|
25037
|
-
// 顶层:直接写,然后传播给子节点
|
|
25038
|
-
Transform.prototype.setPosition.call(this, x, y, z);
|
|
25039
|
-
this.sizeChanged();
|
|
25040
|
-
return;
|
|
25041
|
-
}
|
|
25042
|
-
var parentRect = {
|
|
25043
|
-
position: new Vector2(0, 0),
|
|
25044
|
-
size: this.parentTransform.size.clone()
|
|
25045
|
-
};
|
|
25046
|
-
var newRect = {
|
|
25047
|
-
position: new Vector2(x, y),
|
|
25048
|
-
size: this.size.clone()
|
|
25049
|
-
};
|
|
25050
|
-
if (keepOffsets) {
|
|
25051
|
-
this.computeAnchors(newRect, parentRect);
|
|
25052
|
-
} else {
|
|
25053
|
-
this.computeOffsets(newRect, parentRect);
|
|
25054
|
-
}
|
|
25055
|
-
this.sizeChanged();
|
|
25056
|
-
if (this.position.z !== z) {
|
|
25057
|
-
Transform.prototype.setPosition.call(this, this.position.x, this.position.y, z);
|
|
25058
|
-
}
|
|
25059
|
-
};
|
|
25060
|
-
/**
|
|
25061
|
-
* 重写父类 `setSize`:
|
|
25062
|
-
* - 顶层:直接 `super.setSize`,触发 `sizeChanged` 传播
|
|
25063
|
-
* - 非顶层:反推 offset 维持当前 anchor,然后 `sizeChanged` 重算
|
|
25064
|
-
*/ _proto.setSize = function setSize(x, y) {
|
|
25065
|
-
if (this.size.x === x && this.size.y === y) {
|
|
25066
|
-
return;
|
|
25067
|
-
}
|
|
25068
|
-
if (!_instanceof1(this.parentTransform, RectTransform)) {
|
|
25069
|
-
Transform.prototype.setSize.call(this, x, y);
|
|
25070
|
-
this.sizeChanged();
|
|
25071
|
-
return;
|
|
25072
|
-
}
|
|
25073
|
-
// 围绕 pivot 对称缩放:Δsize 在 offsetMin / offsetMax 上按 pivot / (1-pivot) 比例分配。
|
|
25074
|
-
// 例如 pivot=(0.5, 0.5) → 两边各 ±Δ/2,rect 居中扩展;pivot=(0, 0) → offsetMin 不动、offsetMax 全吃,rect 从左下扩展
|
|
25075
|
-
var dw = x - this.size.x;
|
|
25076
|
-
var dh = y - this.size.y;
|
|
25077
|
-
this.offsetMin.set(this.offsetMin.x - this.pivot.x * dw, this.offsetMin.y - this.pivot.y * dh);
|
|
25078
|
-
this.offsetMax.set(this.offsetMax.x + (1 - this.pivot.x) * dw, this.offsetMax.y + (1 - this.pivot.y) * dh);
|
|
25079
|
-
this.sizeChanged();
|
|
25080
|
-
};
|
|
25081
|
-
// ── rect query ───────────────────────────────────────
|
|
25082
|
-
/**
|
|
25083
|
-
* 当前自身 rect(在父 vertex 坐标下,Y 向上)。`sizeChanged` 之后才有意义
|
|
25084
|
-
*/ _proto.getRect = function getRect() {
|
|
25058
|
+
_proto.getRect = function getRect() {
|
|
25085
25059
|
return {
|
|
25086
|
-
position:
|
|
25060
|
+
position: this.position.clone(),
|
|
25087
25061
|
size: this.size.clone()
|
|
25088
25062
|
};
|
|
25089
25063
|
};
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
|
|
25093
|
-
|
|
25094
|
-
|
|
25095
|
-
|
|
25096
|
-
|
|
25097
|
-
|
|
25098
|
-
|
|
25099
|
-
this.
|
|
25100
|
-
this.
|
|
25101
|
-
|
|
25102
|
-
|
|
25103
|
-
|
|
25104
|
-
|
|
25105
|
-
|
|
25106
|
-
|
|
25107
|
-
|
|
25108
|
-
|
|
25109
|
-
|
|
25110
|
-
|
|
25111
|
-
*
|
|
25112
|
-
* 1. 父是 RectTransform → 从 `parent.size` 求自身 rect,通过 `super.setPosition / super.setSize` 写回
|
|
25113
|
-
* (避免触发本类 setPosition / setSize 重写)
|
|
25114
|
-
* 2. 顶层(无 RectTransform 父):自身 size 视为权威值(由 CanvasLayer 等外部直接写),不自解算
|
|
25115
|
-
* 3. 遍历 `children` 中所有 RectTransform 子节点,直接调它们的 `sizeChanged()` 链式传播
|
|
25116
|
-
*/ _proto.sizeChanged = function sizeChanged() {
|
|
25117
|
-
if (_instanceof1(this.parentTransform, RectTransform)) {
|
|
25118
|
-
var parentSize = this.parentTransform.size;
|
|
25119
|
-
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25120
|
-
var bottom = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25121
|
-
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25122
|
-
var top = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25123
|
-
Transform.prototype.setPosition.call(this, left, bottom, this.position.z);
|
|
25124
|
-
Transform.prototype.setSize.call(this, right - left, top - bottom);
|
|
25125
|
-
}
|
|
25126
|
-
// size 更新后同步 transform.anchor(矩阵旋转/缩放中心)= pivot * size,跟 setPivot 保持统一
|
|
25127
|
-
this.anchor.set(this.pivot.x * this.size.x, this.pivot.y * this.size.y, this.anchor.z);
|
|
25128
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25129
|
-
var child = _step.value;
|
|
25130
|
-
if (_instanceof1(child, RectTransform)) {
|
|
25131
|
-
child.sizeChanged();
|
|
25132
|
-
}
|
|
25133
|
-
}
|
|
25134
|
-
};
|
|
25135
|
-
/**
|
|
25136
|
-
* 给定目标 rect 反推 offsetMin/Max,保持当前 anchor 不变
|
|
25137
|
-
*/ _proto.computeOffsets = function computeOffsets(rect, parentRect) {
|
|
25138
|
-
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);
|
|
25139
|
-
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);
|
|
25140
|
-
};
|
|
25141
|
-
/**
|
|
25142
|
-
* 给定目标 rect 反推 anchorMin/Max,保持当前 offset 不变。父 size 为 0 的方向不修改
|
|
25143
|
-
*/ _proto.computeAnchors = function computeAnchors(rect, parentRect) {
|
|
25144
|
-
if (parentRect.size.x !== 0) {
|
|
25145
|
-
var aMinX = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
|
|
25146
|
-
var aMaxX = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
|
|
25147
|
-
this.anchorMin.x = aMinX;
|
|
25148
|
-
this.anchorMax.x = aMaxX;
|
|
25149
|
-
}
|
|
25150
|
-
if (parentRect.size.y !== 0) {
|
|
25151
|
-
var aMinY = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
|
|
25152
|
-
var aMaxY = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
|
|
25153
|
-
this.anchorMin.y = aMinY;
|
|
25154
|
-
this.anchorMax.y = aMaxY;
|
|
25155
|
-
}
|
|
25156
|
-
};
|
|
25157
|
-
// ── preset API ───────────────────────────────────────
|
|
25158
|
-
/**
|
|
25159
|
-
* 把 anchorMin/Max 设为内建预设。
|
|
25160
|
-
* @param keepOffsets - 默认 true:offset 不动,rect 实际位置会跳到新 anchor 计算的位置(要求保留视觉位置请用 setAnchorsAndOffsetsPreset)
|
|
25161
|
-
*/ _proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
|
|
25064
|
+
_proto.getTransform2D = function getTransform2D() {
|
|
25065
|
+
if (this.transformDirty) {
|
|
25066
|
+
var radians = this._rotation * Math.PI / 180;
|
|
25067
|
+
var sin = Math.sin(radians);
|
|
25068
|
+
var cos = Math.cos(radians);
|
|
25069
|
+
var shearX = Math.tan(Math.max(-89, Math.min(89, this.shear.x)) * Math.PI / 180);
|
|
25070
|
+
var shearY = Math.tan(Math.max(-89, Math.min(89, this.shear.y)) * Math.PI / 180);
|
|
25071
|
+
var a = this.scale.x * (cos - sin * shearY);
|
|
25072
|
+
var b = this.scale.x * (sin + cos * shearY);
|
|
25073
|
+
var c = this.scale.y * (cos * shearX - sin);
|
|
25074
|
+
var d = this.scale.y * (sin * shearX + cos);
|
|
25075
|
+
var pivotX = this.pivot.x * this.size.x;
|
|
25076
|
+
var pivotY = this.pivot.y * this.size.y;
|
|
25077
|
+
var tx = this.position.x + pivotX - a * pivotX - c * pivotY;
|
|
25078
|
+
var ty = this.position.y + pivotY - b * pivotX - d * pivotY;
|
|
25079
|
+
this.cachedTransform.set(a, b, 0, c, d, 0, tx, ty, 1);
|
|
25080
|
+
this.transformDirty = false;
|
|
25081
|
+
}
|
|
25082
|
+
return this.cachedTransform;
|
|
25083
|
+
};
|
|
25084
|
+
_proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
|
|
25162
25085
|
if (keepOffsets === void 0) keepOffsets = true;
|
|
25163
|
-
var _ANCHOR_PRESET_TABLE_preset = ANCHOR_PRESET_TABLE[preset],
|
|
25086
|
+
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];
|
|
25164
25087
|
if (keepOffsets) {
|
|
25165
|
-
this.anchorMin.set(
|
|
25166
|
-
this.anchorMax.set(
|
|
25167
|
-
} else if (_instanceof1(this.parentTransform, RectTransform)) {
|
|
25168
|
-
var parentRect = {
|
|
25169
|
-
position: new Vector2(0, 0),
|
|
25170
|
-
size: this.parentTransform.size.clone()
|
|
25171
|
-
};
|
|
25172
|
-
var rect = this.getRect();
|
|
25173
|
-
this.anchorMin.set(aMinX, aMinY);
|
|
25174
|
-
this.anchorMax.set(aMaxX, aMaxY);
|
|
25175
|
-
this.computeOffsets(rect, parentRect);
|
|
25088
|
+
this.anchorMin.set(minX, minY);
|
|
25089
|
+
this.anchorMax.set(maxX, maxY);
|
|
25176
25090
|
} else {
|
|
25177
|
-
|
|
25178
|
-
this.anchorMin.set(
|
|
25179
|
-
this.anchorMax.set(
|
|
25091
|
+
var rect = this.getRect();
|
|
25092
|
+
this.anchorMin.set(minX, minY);
|
|
25093
|
+
this.anchorMax.set(maxX, maxY);
|
|
25094
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
25180
25095
|
}
|
|
25181
|
-
this.
|
|
25096
|
+
this.updateLayout();
|
|
25182
25097
|
};
|
|
25183
|
-
|
|
25184
|
-
* 把 offsetMin/Max 设为预设值,使 rect 在父 rect 内落在视觉上对应的位置(留 margin 像素边距)。
|
|
25185
|
-
* 当 anchor 已经按相同 preset 设定时,等价于“贴边放置带 margin 的 rect”。
|
|
25186
|
-
* 使用当前 size 作为 rect 尺寸。
|
|
25187
|
-
*/ _proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
|
|
25098
|
+
_proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
|
|
25188
25099
|
if (margin === void 0) margin = 0;
|
|
25189
|
-
if (!
|
|
25100
|
+
if (!this.parent) {
|
|
25190
25101
|
return;
|
|
25191
25102
|
}
|
|
25192
|
-
var
|
|
25193
|
-
var
|
|
25103
|
+
var parentSize = this.parent.size;
|
|
25104
|
+
var width = this.size.x;
|
|
25105
|
+
var height = this.size.y;
|
|
25194
25106
|
var a = this.anchorMin;
|
|
25195
25107
|
var b = this.anchorMax;
|
|
25196
|
-
var
|
|
25197
|
-
|
|
25198
|
-
var offMinX = 0;
|
|
25199
|
-
var offMaxX = 0;
|
|
25200
|
-
var offMinY = 0;
|
|
25201
|
-
var offMaxY = 0;
|
|
25202
|
-
// X 方向(left / right)
|
|
25108
|
+
var minX = 0, maxX = 0, minY = 0, maxY = 0;
|
|
25109
|
+
// Left edge.
|
|
25203
25110
|
switch(preset){
|
|
25204
25111
|
case "topLeft":
|
|
25205
25112
|
case "bottomLeft":
|
|
@@ -25209,119 +25116,1498 @@ FrameComponent = __decorate([
|
|
|
25209
25116
|
case "leftWide":
|
|
25210
25117
|
case "hcenterWide":
|
|
25211
25118
|
case "fullRect":
|
|
25212
|
-
|
|
25213
|
-
offMaxX = margin + newSizeX - b.x * pw;
|
|
25119
|
+
minX = margin - a.x * parentSize.x;
|
|
25214
25120
|
break;
|
|
25215
25121
|
case "centerTop":
|
|
25216
25122
|
case "centerBottom":
|
|
25217
25123
|
case "center":
|
|
25218
25124
|
case "vcenterWide":
|
|
25219
|
-
|
|
25220
|
-
offMaxX = 0.5 * pw + newSizeX / 2 - b.x * pw;
|
|
25125
|
+
minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
|
|
25221
25126
|
break;
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
case "centerRight":
|
|
25225
|
-
case "rightWide":
|
|
25226
|
-
offMinX = pw - margin - newSizeX - a.x * pw;
|
|
25227
|
-
offMaxX = pw - margin - b.x * pw;
|
|
25127
|
+
default:
|
|
25128
|
+
minX = parentSize.x - margin - width - a.x * parentSize.x;
|
|
25228
25129
|
break;
|
|
25229
25130
|
}
|
|
25230
|
-
// Y 方向(bottom / top)— Y 向上
|
|
25231
25131
|
switch(preset){
|
|
25132
|
+
case "topLeft":
|
|
25232
25133
|
case "bottomLeft":
|
|
25233
|
-
case "
|
|
25134
|
+
case "centerLeft":
|
|
25135
|
+
case "leftWide":
|
|
25136
|
+
maxX = margin + width - b.x * parentSize.x;
|
|
25137
|
+
break;
|
|
25138
|
+
case "centerTop":
|
|
25234
25139
|
case "centerBottom":
|
|
25140
|
+
case "center":
|
|
25141
|
+
case "vcenterWide":
|
|
25142
|
+
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25143
|
+
break;
|
|
25144
|
+
default:
|
|
25145
|
+
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25146
|
+
break;
|
|
25147
|
+
}
|
|
25148
|
+
// Top edge.
|
|
25149
|
+
switch(preset){
|
|
25150
|
+
case "topLeft":
|
|
25151
|
+
case "topRight":
|
|
25152
|
+
case "centerTop":
|
|
25235
25153
|
case "leftWide":
|
|
25236
25154
|
case "rightWide":
|
|
25237
|
-
case "
|
|
25155
|
+
case "topWide":
|
|
25238
25156
|
case "vcenterWide":
|
|
25239
25157
|
case "fullRect":
|
|
25240
|
-
|
|
25241
|
-
offMaxY = margin + newSizeY - b.y * ph;
|
|
25158
|
+
minY = margin - a.y * parentSize.y;
|
|
25242
25159
|
break;
|
|
25243
25160
|
case "centerLeft":
|
|
25244
25161
|
case "centerRight":
|
|
25245
25162
|
case "center":
|
|
25246
25163
|
case "hcenterWide":
|
|
25247
|
-
|
|
25248
|
-
|
|
25164
|
+
minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
|
|
25165
|
+
break;
|
|
25166
|
+
default:
|
|
25167
|
+
minY = parentSize.y - margin - height - a.y * parentSize.y;
|
|
25249
25168
|
break;
|
|
25169
|
+
}
|
|
25170
|
+
// Bottom edge.
|
|
25171
|
+
switch(preset){
|
|
25250
25172
|
case "topLeft":
|
|
25251
25173
|
case "topRight":
|
|
25252
25174
|
case "centerTop":
|
|
25253
25175
|
case "topWide":
|
|
25254
|
-
|
|
25255
|
-
|
|
25176
|
+
maxY = margin + height - b.y * parentSize.y;
|
|
25177
|
+
break;
|
|
25178
|
+
case "centerLeft":
|
|
25179
|
+
case "centerRight":
|
|
25180
|
+
case "center":
|
|
25181
|
+
case "hcenterWide":
|
|
25182
|
+
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25183
|
+
break;
|
|
25184
|
+
default:
|
|
25185
|
+
maxY = parentSize.y - margin - b.y * parentSize.y;
|
|
25256
25186
|
break;
|
|
25257
25187
|
}
|
|
25258
|
-
this.offsetMin.set(
|
|
25259
|
-
this.offsetMax.set(
|
|
25260
|
-
this.
|
|
25188
|
+
this.offsetMin.set(minX, minY);
|
|
25189
|
+
this.offsetMax.set(maxX, maxY);
|
|
25190
|
+
this.updateLayout();
|
|
25261
25191
|
};
|
|
25262
|
-
|
|
25263
|
-
* 同时设置 anchor 和 offset,达到“按 preset 摆放并贴边带 margin”的效果。
|
|
25264
|
-
*
|
|
25265
|
-
* 注意第一步用 `keepOffsets=false`(反推 offset 维持 rect 视觉位置),不能用默认 `true`:
|
|
25266
|
-
* 后者会让 rect 的 size 在中间步先跳到错值(因为 anchor 改了 offset 没改),
|
|
25267
|
-
* 第二步 `setOffsetsPreset` 又用这个错 size 算 offset,最终 rect size 不对
|
|
25268
|
-
*/ _proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
|
|
25192
|
+
_proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
|
|
25269
25193
|
if (margin === void 0) margin = 0;
|
|
25270
25194
|
this.setAnchorsPreset(preset, false);
|
|
25271
25195
|
this.setOffsetsPreset(preset, margin);
|
|
25272
25196
|
};
|
|
25273
|
-
|
|
25274
|
-
|
|
25275
|
-
|
|
25276
|
-
|
|
25277
|
-
|
|
25278
|
-
|
|
25197
|
+
_proto.getGlobalTransform2D = function getGlobalTransform2D() {
|
|
25198
|
+
var local = this.getTransform2D();
|
|
25199
|
+
return this.parent ? new Matrix3().multiplyMatrices(this.parent.getGlobalTransform2D(), local) : local.clone();
|
|
25200
|
+
};
|
|
25201
|
+
_proto.hasPoint = function hasPoint(point) {
|
|
25202
|
+
return point.x >= 0 && point.y >= 0 && point.x <= this.size.x && point.y <= this.size.y;
|
|
25203
|
+
};
|
|
25204
|
+
_proto.getEffectiveMouseFilter = function getEffectiveMouseFilter() {
|
|
25205
|
+
return this.enabledInHierarchy && this.isMouseRecursiveEnabled() ? this.mouseFilter : MouseFilter.Ignore;
|
|
25206
|
+
};
|
|
25207
|
+
_proto.getFocusModeWithOverride = function getFocusModeWithOverride() {
|
|
25208
|
+
return this.enabledInHierarchy && this.isFocusRecursiveEnabled() ? this.focusMode : FocusMode.None;
|
|
25209
|
+
};
|
|
25210
|
+
_proto.getCursorShape = function getCursorShape(position) {
|
|
25211
|
+
return this.defaultCursorShape;
|
|
25212
|
+
};
|
|
25213
|
+
_proto.focus = function focus() {
|
|
25214
|
+
var _this_root;
|
|
25215
|
+
(_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
|
|
25216
|
+
};
|
|
25217
|
+
_proto.grabFocus = function grabFocus() {
|
|
25218
|
+
this.focus();
|
|
25219
|
+
};
|
|
25220
|
+
_proto.grabClickFocus = function grabClickFocus() {
|
|
25221
|
+
var _this_root;
|
|
25222
|
+
(_this_root = this.root) == null ? void 0 : _this_root.grabControlClickFocus(this);
|
|
25223
|
+
};
|
|
25224
|
+
_proto.releaseFocus = function releaseFocus() {
|
|
25225
|
+
var _this_root;
|
|
25226
|
+
(_this_root = this.root) == null ? void 0 : _this_root.releaseControlFocus(this);
|
|
25227
|
+
};
|
|
25228
|
+
_proto.warpMouse = function warpMouse(position) {
|
|
25229
|
+
var _this_root;
|
|
25230
|
+
var matrix = this.getGlobalTransform2D().elements;
|
|
25231
|
+
(_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]));
|
|
25232
|
+
};
|
|
25233
|
+
/** Converts a window-space position into this control's local coordinates. */ _proto.makePositionLocal = function makePositionLocal(position) {
|
|
25234
|
+
var transform = this.getGlobalTransform2D().clone();
|
|
25235
|
+
if (Math.abs(transform.determinant()) < 1e-12) {
|
|
25236
|
+
return new Vector2();
|
|
25237
|
+
}
|
|
25238
|
+
var elements = transform.invert().elements;
|
|
25239
|
+
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
25240
|
+
};
|
|
25241
|
+
/** Gets the current mouse position transformed into this control's coordinates. */ _proto.getLocalMousePosition = function getLocalMousePosition() {
|
|
25242
|
+
var root = this.root;
|
|
25243
|
+
return root ? this.makePositionLocal(root.getMousePosition()) : new Vector2();
|
|
25244
|
+
};
|
|
25245
|
+
_proto.update = function update(deltaTime) {};
|
|
25246
|
+
_proto.draw = function draw() {
|
|
25247
|
+
// OVERRIDE
|
|
25248
|
+
};
|
|
25249
|
+
_proto.onDestroy = function onDestroy() {};
|
|
25250
|
+
/** @internal */ _proto.drawInternal = function drawInternal() {
|
|
25251
|
+
if (!this.visibleInHierarchy || this.disposed) {
|
|
25252
|
+
return;
|
|
25253
|
+
}
|
|
25254
|
+
var graphics = this.engine.graphics;
|
|
25255
|
+
graphics.pushTransform(this.getTransform2D());
|
|
25256
|
+
this.draw();
|
|
25257
|
+
graphics.popTransform();
|
|
25258
|
+
};
|
|
25259
|
+
_proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
|
|
25260
|
+
this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
|
|
25261
|
+
};
|
|
25262
|
+
_proto.drawPolyline = function drawPolyline(points, color, thickness) {
|
|
25263
|
+
this.engine.graphics.drawLines(points, color, thickness);
|
|
25264
|
+
};
|
|
25265
|
+
_proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
|
|
25266
|
+
this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
|
|
25267
|
+
};
|
|
25268
|
+
_proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
|
|
25269
|
+
this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
|
|
25270
|
+
};
|
|
25271
|
+
_proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
|
|
25272
|
+
this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
|
|
25273
|
+
};
|
|
25274
|
+
_proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
|
|
25275
|
+
this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
|
|
25276
|
+
};
|
|
25277
|
+
_proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
|
|
25278
|
+
this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
|
|
25279
|
+
};
|
|
25280
|
+
_proto.fillRect = function fillRect(x, y, width, height, color) {
|
|
25281
|
+
this.engine.graphics.fillRectangle(x, y, width, height, color);
|
|
25282
|
+
};
|
|
25283
|
+
_proto.fillCircle = function fillCircle(cx, cy, radius, color) {
|
|
25284
|
+
this.engine.graphics.fillCircle(cx, cy, radius, color);
|
|
25285
|
+
};
|
|
25286
|
+
_proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
|
|
25287
|
+
this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
|
|
25288
|
+
};
|
|
25289
|
+
_proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
|
|
25290
|
+
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
25291
|
+
};
|
|
25292
|
+
_proto.onMouseEnter = function onMouseEnter(location) {};
|
|
25293
|
+
_proto.onMouseMove = function onMouseMove(event) {};
|
|
25294
|
+
_proto.onMouseLeave = function onMouseLeave() {};
|
|
25295
|
+
_proto.onMouseWheel = function onMouseWheel(event) {};
|
|
25296
|
+
_proto.onMouseDown = function onMouseDown(event) {};
|
|
25297
|
+
_proto.onMouseUp = function onMouseUp(event) {};
|
|
25298
|
+
_proto.onTouchDown = function onTouchDown(event) {};
|
|
25299
|
+
_proto.onTouchMove = function onTouchMove(event) {};
|
|
25300
|
+
_proto.onTouchUp = function onTouchUp(event) {};
|
|
25301
|
+
_proto.onKeyDown = function onKeyDown(event) {};
|
|
25302
|
+
_proto.onKeyUp = function onKeyUp(event) {};
|
|
25303
|
+
_proto.onGotFocus = function onGotFocus() {};
|
|
25304
|
+
_proto.onLostFocus = function onLostFocus() {};
|
|
25305
|
+
/** @internal */ _proto.invokeGetDragData = function invokeGetDragData(position) {
|
|
25306
|
+
return this.getDragData(position);
|
|
25307
|
+
};
|
|
25308
|
+
/** @internal */ _proto.invokeCanDropData = function invokeCanDropData(position, data) {
|
|
25309
|
+
return this.canDropData(position, data);
|
|
25310
|
+
};
|
|
25311
|
+
/** @internal */ _proto.invokeDropData = function invokeDropData(position, data) {
|
|
25312
|
+
this.dropData(position, data);
|
|
25313
|
+
};
|
|
25314
|
+
_proto.getDragData = function getDragData(position) {
|
|
25315
|
+
return null;
|
|
25316
|
+
};
|
|
25317
|
+
_proto.canDropData = function canDropData(position, data) {
|
|
25318
|
+
return false;
|
|
25319
|
+
};
|
|
25320
|
+
_proto.dropData = function dropData(position, data) {};
|
|
25321
|
+
_proto.dispose = function dispose() {
|
|
25322
|
+
if (this.disposed) {
|
|
25323
|
+
return;
|
|
25324
|
+
}
|
|
25325
|
+
this.disposed = true;
|
|
25326
|
+
this.onDestroy();
|
|
25327
|
+
this.parent = null;
|
|
25328
|
+
this.owner = null;
|
|
25329
|
+
};
|
|
25330
|
+
/** @internal */ _proto.updateLayout = function updateLayout() {
|
|
25331
|
+
var _this_parent;
|
|
25332
|
+
var _this_parent_size;
|
|
25333
|
+
var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
|
|
25334
|
+
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25335
|
+
var top = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25336
|
+
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25337
|
+
var bottom = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25338
|
+
this.applyBounds(left, top, right - left, bottom - top);
|
|
25339
|
+
};
|
|
25340
|
+
_proto.applyBounds = function applyBounds(x, y, width, height) {
|
|
25341
|
+
var locationChanged = this.position.x !== x || this.position.y !== y;
|
|
25342
|
+
var sizeChanged = this.size.x !== width || this.size.y !== height;
|
|
25343
|
+
if (!locationChanged && !sizeChanged) {
|
|
25344
|
+
return;
|
|
25345
|
+
}
|
|
25346
|
+
this.position.set(x, y);
|
|
25347
|
+
this.size.set(width, height);
|
|
25348
|
+
this.markTransformDirty();
|
|
25349
|
+
if (locationChanged) {
|
|
25350
|
+
this.eventEmitter.emit("locationChanged", this);
|
|
25351
|
+
}
|
|
25352
|
+
if (sizeChanged) {
|
|
25353
|
+
this.eventEmitter.emit("sizeChanged", this);
|
|
25354
|
+
if (_instanceof1(this, ContainerControl)) {
|
|
25355
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25356
|
+
var child = _step.value;
|
|
25357
|
+
child.updateLayout();
|
|
25358
|
+
}
|
|
25359
|
+
}
|
|
25360
|
+
}
|
|
25361
|
+
};
|
|
25362
|
+
_proto.markTransformDirty = function markTransformDirty() {
|
|
25363
|
+
var _this_root;
|
|
25364
|
+
this.transformDirty = true;
|
|
25365
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25366
|
+
};
|
|
25367
|
+
_proto.getParentRect = function getParentRect() {
|
|
25368
|
+
var _this_parent;
|
|
25369
|
+
var _this_parent_size_clone;
|
|
25370
|
+
return {
|
|
25371
|
+
position: new Vector2(),
|
|
25372
|
+
size: (_this_parent_size_clone = (_this_parent = this.parent) == null ? void 0 : _this_parent.size.clone()) != null ? _this_parent_size_clone : new Vector2()
|
|
25373
|
+
};
|
|
25374
|
+
};
|
|
25375
|
+
_proto.computeOffsets = function computeOffsets(rect, parentRect) {
|
|
25376
|
+
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);
|
|
25377
|
+
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);
|
|
25378
|
+
};
|
|
25379
|
+
_proto.computeAnchors = function computeAnchors(rect, parentRect) {
|
|
25380
|
+
if (parentRect.size.x !== 0) {
|
|
25381
|
+
this.anchorMin.x = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
|
|
25382
|
+
this.anchorMax.x = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
|
|
25383
|
+
}
|
|
25384
|
+
if (parentRect.size.y !== 0) {
|
|
25385
|
+
this.anchorMin.y = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
|
|
25386
|
+
this.anchorMax.y = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
|
|
25387
|
+
}
|
|
25388
|
+
};
|
|
25389
|
+
_proto.isMouseRecursiveEnabled = function isMouseRecursiveEnabled() {
|
|
25390
|
+
if (this.mouseBehaviorRecursive === MouseBehaviorRecursive.Inherited) {
|
|
25391
|
+
var _this_parent;
|
|
25392
|
+
var _this_parent_isMouseRecursiveEnabled;
|
|
25393
|
+
return (_this_parent_isMouseRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isMouseRecursiveEnabled()) != null ? _this_parent_isMouseRecursiveEnabled : true;
|
|
25394
|
+
}
|
|
25395
|
+
return this.mouseBehaviorRecursive === MouseBehaviorRecursive.Enabled;
|
|
25396
|
+
};
|
|
25397
|
+
_proto.isFocusRecursiveEnabled = function isFocusRecursiveEnabled() {
|
|
25398
|
+
if (this.focusBehaviorRecursive === FocusBehaviorRecursive.Inherited) {
|
|
25399
|
+
var _this_parent;
|
|
25400
|
+
var _this_parent_isFocusRecursiveEnabled;
|
|
25401
|
+
return (_this_parent_isFocusRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isFocusRecursiveEnabled()) != null ? _this_parent_isFocusRecursiveEnabled : true;
|
|
25402
|
+
}
|
|
25403
|
+
return this.focusBehaviorRecursive === FocusBehaviorRecursive.Enabled;
|
|
25404
|
+
};
|
|
25405
|
+
_create_class(Control, [
|
|
25406
|
+
{
|
|
25407
|
+
key: "parent",
|
|
25408
|
+
get: function get() {
|
|
25409
|
+
return this._parent;
|
|
25410
|
+
},
|
|
25411
|
+
set: function set(value) {
|
|
25412
|
+
var _this__parent;
|
|
25413
|
+
if (value === this._parent) {
|
|
25414
|
+
return;
|
|
25415
|
+
}
|
|
25416
|
+
var previousRoot = this.root;
|
|
25417
|
+
(_this__parent = this._parent) == null ? void 0 : _this__parent.removeChildInternal(this);
|
|
25418
|
+
this._parent = value;
|
|
25419
|
+
value == null ? void 0 : value.addChildInternal(this);
|
|
25420
|
+
this.updateLayout();
|
|
25421
|
+
var nextRoot = this.root;
|
|
25422
|
+
if (previousRoot && previousRoot !== nextRoot) {
|
|
25423
|
+
previousRoot.controlRemoved(this);
|
|
25424
|
+
}
|
|
25425
|
+
nextRoot == null ? void 0 : nextRoot.controlTreeChanged();
|
|
25426
|
+
this.eventEmitter.emit("parentChanged", this);
|
|
25427
|
+
}
|
|
25428
|
+
},
|
|
25429
|
+
{
|
|
25430
|
+
key: "item",
|
|
25431
|
+
get: /** Scene item exposed through the optional UIControl bridge. */ function get() {
|
|
25432
|
+
var _this_owner;
|
|
25433
|
+
var _this_owner_item;
|
|
25434
|
+
return (_this_owner_item = (_this_owner = this.owner) == null ? void 0 : _this_owner.item) != null ? _this_owner_item : null;
|
|
25435
|
+
}
|
|
25436
|
+
},
|
|
25437
|
+
{
|
|
25438
|
+
key: "indexInParent",
|
|
25439
|
+
get: function get() {
|
|
25440
|
+
var _this_parent;
|
|
25441
|
+
var _this_parent_getChildIndex;
|
|
25442
|
+
return (_this_parent_getChildIndex = (_this_parent = this.parent) == null ? void 0 : _this_parent.getChildIndex(this)) != null ? _this_parent_getChildIndex : -1;
|
|
25443
|
+
},
|
|
25444
|
+
set: function set(value) {
|
|
25445
|
+
var _this_parent;
|
|
25446
|
+
(_this_parent = this.parent) == null ? void 0 : _this_parent.changeChildIndex(this, value);
|
|
25447
|
+
}
|
|
25448
|
+
},
|
|
25449
|
+
{
|
|
25450
|
+
key: "visible",
|
|
25451
|
+
get: function get() {
|
|
25452
|
+
return this._visible;
|
|
25453
|
+
},
|
|
25454
|
+
set: function set(value) {
|
|
25455
|
+
if (this._visible !== value) {
|
|
25456
|
+
var _this_root;
|
|
25457
|
+
this._visible = value;
|
|
25458
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25459
|
+
}
|
|
25460
|
+
}
|
|
25461
|
+
},
|
|
25462
|
+
{
|
|
25463
|
+
key: "visibleInHierarchy",
|
|
25464
|
+
get: function get() {
|
|
25465
|
+
var _this_parent;
|
|
25466
|
+
var _this_parent_visibleInHierarchy;
|
|
25467
|
+
return this.visible && ((_this_parent_visibleInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.visibleInHierarchy) != null ? _this_parent_visibleInHierarchy : true);
|
|
25468
|
+
}
|
|
25469
|
+
},
|
|
25470
|
+
{
|
|
25471
|
+
key: "enabled",
|
|
25472
|
+
get: function get() {
|
|
25473
|
+
return this._enabled;
|
|
25474
|
+
},
|
|
25475
|
+
set: function set(value) {
|
|
25476
|
+
if (this._enabled !== value) {
|
|
25477
|
+
var _this_root;
|
|
25478
|
+
this._enabled = value;
|
|
25479
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25480
|
+
}
|
|
25481
|
+
}
|
|
25482
|
+
},
|
|
25483
|
+
{
|
|
25484
|
+
key: "enabledInHierarchy",
|
|
25485
|
+
get: function get() {
|
|
25486
|
+
var _this_parent;
|
|
25487
|
+
var _this_parent_enabledInHierarchy;
|
|
25488
|
+
return this.enabled && ((_this_parent_enabledInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.enabledInHierarchy) != null ? _this_parent_enabledInHierarchy : true);
|
|
25489
|
+
}
|
|
25490
|
+
},
|
|
25491
|
+
{
|
|
25492
|
+
key: "mouseFilter",
|
|
25493
|
+
get: function get() {
|
|
25494
|
+
return this._mouseFilter;
|
|
25495
|
+
},
|
|
25496
|
+
set: function set(value) {
|
|
25497
|
+
if (this._mouseFilter !== value) {
|
|
25498
|
+
var _this_root;
|
|
25499
|
+
this._mouseFilter = value;
|
|
25500
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25501
|
+
}
|
|
25502
|
+
}
|
|
25503
|
+
},
|
|
25504
|
+
{
|
|
25505
|
+
key: "mouseBehaviorRecursive",
|
|
25506
|
+
get: function get() {
|
|
25507
|
+
return this._mouseBehaviorRecursive;
|
|
25508
|
+
},
|
|
25509
|
+
set: function set(value) {
|
|
25510
|
+
if (this._mouseBehaviorRecursive !== value) {
|
|
25511
|
+
var _this_root;
|
|
25512
|
+
this._mouseBehaviorRecursive = value;
|
|
25513
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25514
|
+
}
|
|
25515
|
+
}
|
|
25516
|
+
},
|
|
25517
|
+
{
|
|
25518
|
+
key: "focusMode",
|
|
25519
|
+
get: function get() {
|
|
25520
|
+
return this._focusMode;
|
|
25521
|
+
},
|
|
25522
|
+
set: function set(value) {
|
|
25523
|
+
if (this._focusMode !== value) {
|
|
25524
|
+
var _this_root;
|
|
25525
|
+
this._focusMode = value;
|
|
25526
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25527
|
+
}
|
|
25528
|
+
}
|
|
25529
|
+
},
|
|
25530
|
+
{
|
|
25531
|
+
key: "focusBehaviorRecursive",
|
|
25532
|
+
get: function get() {
|
|
25533
|
+
return this._focusBehaviorRecursive;
|
|
25534
|
+
},
|
|
25535
|
+
set: function set(value) {
|
|
25536
|
+
if (this._focusBehaviorRecursive !== value) {
|
|
25537
|
+
var _this_root;
|
|
25538
|
+
this._focusBehaviorRecursive = value;
|
|
25539
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25540
|
+
}
|
|
25541
|
+
}
|
|
25542
|
+
},
|
|
25543
|
+
{
|
|
25544
|
+
key: "defaultCursorShape",
|
|
25545
|
+
get: function get() {
|
|
25546
|
+
return this._defaultCursorShape;
|
|
25547
|
+
},
|
|
25548
|
+
set: function set(value) {
|
|
25549
|
+
var _this_root;
|
|
25550
|
+
if (this._defaultCursorShape === value) {
|
|
25551
|
+
return;
|
|
25552
|
+
}
|
|
25553
|
+
this._defaultCursorShape = value;
|
|
25554
|
+
(_this_root = this.root) == null ? void 0 : _this_root.updateMouseCursorState();
|
|
25555
|
+
}
|
|
25556
|
+
},
|
|
25557
|
+
{
|
|
25558
|
+
key: "location",
|
|
25559
|
+
get: function get() {
|
|
25560
|
+
return this.position;
|
|
25561
|
+
},
|
|
25562
|
+
set: function set(value) {
|
|
25563
|
+
this.setPosition(value.x, value.y);
|
|
25564
|
+
}
|
|
25565
|
+
},
|
|
25566
|
+
{
|
|
25567
|
+
key: "rotation",
|
|
25568
|
+
get: function get() {
|
|
25569
|
+
return this._rotation;
|
|
25570
|
+
}
|
|
25571
|
+
},
|
|
25572
|
+
{
|
|
25573
|
+
key: "x",
|
|
25574
|
+
get: function get() {
|
|
25575
|
+
return this.position.x;
|
|
25576
|
+
},
|
|
25577
|
+
set: function set(value) {
|
|
25578
|
+
this.setPosition(value, this.position.y);
|
|
25579
|
+
}
|
|
25580
|
+
},
|
|
25581
|
+
{
|
|
25582
|
+
key: "y",
|
|
25583
|
+
get: function get() {
|
|
25584
|
+
return this.position.y;
|
|
25585
|
+
},
|
|
25586
|
+
set: function set(value) {
|
|
25587
|
+
this.setPosition(this.position.x, value);
|
|
25588
|
+
}
|
|
25589
|
+
},
|
|
25590
|
+
{
|
|
25591
|
+
key: "width",
|
|
25592
|
+
get: function get() {
|
|
25593
|
+
return this.size.x;
|
|
25594
|
+
},
|
|
25595
|
+
set: function set(value) {
|
|
25596
|
+
this.setSize(value, this.size.y);
|
|
25597
|
+
}
|
|
25598
|
+
},
|
|
25599
|
+
{
|
|
25600
|
+
key: "height",
|
|
25601
|
+
get: function get() {
|
|
25602
|
+
return this.size.y;
|
|
25603
|
+
},
|
|
25604
|
+
set: function set(value) {
|
|
25605
|
+
this.setSize(this.size.x, value);
|
|
25606
|
+
}
|
|
25607
|
+
},
|
|
25608
|
+
{
|
|
25609
|
+
key: "root",
|
|
25610
|
+
get: function get() {
|
|
25611
|
+
var _this_parent;
|
|
25612
|
+
var _this_parent_root;
|
|
25613
|
+
return _instanceof1(this, RootControl) ? this : (_this_parent_root = (_this_parent = this.parent) == null ? void 0 : _this_parent.root) != null ? _this_parent_root : null;
|
|
25614
|
+
}
|
|
25615
|
+
},
|
|
25616
|
+
{
|
|
25617
|
+
key: "isDisposed",
|
|
25618
|
+
get: function get() {
|
|
25619
|
+
return this.disposed;
|
|
25620
|
+
}
|
|
25621
|
+
}
|
|
25622
|
+
]);
|
|
25623
|
+
return Control;
|
|
25624
|
+
}();
|
|
25625
|
+
/** A Control that owns child Controls. */ var ContainerControl = /*#__PURE__*/ function(Control) {
|
|
25626
|
+
_inherits(ContainerControl, Control);
|
|
25627
|
+
function ContainerControl() {
|
|
25628
|
+
var _this;
|
|
25629
|
+
_this = Control.apply(this, arguments) || this;
|
|
25630
|
+
_this.children = [];
|
|
25631
|
+
return _this;
|
|
25632
|
+
}
|
|
25633
|
+
var _proto = ContainerControl.prototype;
|
|
25634
|
+
_proto.addChild = function addChild(child) {
|
|
25635
|
+
child.parent = this;
|
|
25636
|
+
return child;
|
|
25637
|
+
};
|
|
25638
|
+
_proto.removeChild = function removeChild(child) {
|
|
25639
|
+
if (child.parent === this) {
|
|
25640
|
+
child.parent = null;
|
|
25641
|
+
}
|
|
25642
|
+
};
|
|
25643
|
+
_proto.getChildIndex = function getChildIndex(child) {
|
|
25644
|
+
return this.children.indexOf(child);
|
|
25645
|
+
};
|
|
25646
|
+
/** @internal */ _proto.changeChildIndex = function changeChildIndex(child, newIndex) {
|
|
25647
|
+
var _this_root;
|
|
25648
|
+
var oldIndex = this.children.indexOf(child);
|
|
25649
|
+
if (oldIndex === newIndex || oldIndex === -1) {
|
|
25650
|
+
return;
|
|
25651
|
+
}
|
|
25652
|
+
this.children.splice(oldIndex, 1);
|
|
25653
|
+
if (newIndex < 0 || newIndex >= this.children.length) {
|
|
25654
|
+
this.children.push(child);
|
|
25655
|
+
} else {
|
|
25656
|
+
this.children.splice(newIndex, 0, child);
|
|
25657
|
+
}
|
|
25658
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25659
|
+
};
|
|
25660
|
+
/** @internal */ _proto.addChildInternal = function addChildInternal(child) {
|
|
25661
|
+
if (!this.children.includes(child)) {
|
|
25662
|
+
this.children.push(child);
|
|
25663
|
+
}
|
|
25664
|
+
};
|
|
25665
|
+
/** @internal */ _proto.removeChildInternal = function removeChildInternal(child) {
|
|
25666
|
+
var index = this.children.indexOf(child);
|
|
25667
|
+
if (index !== -1) {
|
|
25668
|
+
this.children.splice(index, 1);
|
|
25669
|
+
}
|
|
25670
|
+
};
|
|
25671
|
+
_proto.drawSelf = function drawSelf() {
|
|
25672
|
+
Control.prototype.draw.call(this);
|
|
25673
|
+
};
|
|
25674
|
+
_proto.draw = function draw() {
|
|
25675
|
+
this.drawSelf();
|
|
25676
|
+
this.drawChildren();
|
|
25677
|
+
};
|
|
25678
|
+
_proto.drawChildren = function drawChildren() {
|
|
25679
|
+
var graphics = this.engine.graphics;
|
|
25680
|
+
if (this.clipContents) ;
|
|
25681
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25682
|
+
var child = _step.value;
|
|
25683
|
+
if (!child.visible || child.isDisposed) {
|
|
25684
|
+
continue;
|
|
25685
|
+
}
|
|
25686
|
+
graphics.pushTransform(child.getTransform2D());
|
|
25687
|
+
child.draw();
|
|
25688
|
+
graphics.popTransform();
|
|
25689
|
+
}
|
|
25690
|
+
};
|
|
25691
|
+
_proto.update = function update(deltaTime) {
|
|
25692
|
+
Control.prototype.update.call(this, deltaTime);
|
|
25693
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25694
|
+
var child = _step.value;
|
|
25695
|
+
if (child.enabled && !child.isDisposed) {
|
|
25696
|
+
child.update(deltaTime);
|
|
25697
|
+
}
|
|
25698
|
+
}
|
|
25699
|
+
};
|
|
25700
|
+
_proto.dispose = function dispose() {
|
|
25701
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25702
|
+
var child = _step.value;
|
|
25703
|
+
child.dispose();
|
|
25704
|
+
}
|
|
25705
|
+
Control.prototype.dispose.call(this);
|
|
25706
|
+
};
|
|
25707
|
+
return ContainerControl;
|
|
25708
|
+
}(Control);
|
|
25709
|
+
/** Base class for GUI tree roots and input dispatchers. */ var RootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25710
|
+
_inherits(RootControl, ContainerControl);
|
|
25711
|
+
function RootControl() {
|
|
25712
|
+
return ContainerControl.apply(this, arguments);
|
|
25713
|
+
}
|
|
25714
|
+
return RootControl;
|
|
25715
|
+
}(ContainerControl);
|
|
25716
|
+
|
|
25717
|
+
var _obj$4;
|
|
25718
|
+
var cursorNames = (_obj$4 = {}, _obj$4[CursorShape.Arrow] = "default", _obj$4[CursorShape.Ibeam] = "text", _obj$4[CursorShape.PointingHand] = "pointer", _obj$4[CursorShape.Cross] = "crosshair", _obj$4[CursorShape.Wait] = "wait", _obj$4[CursorShape.Busy] = "progress", _obj$4[CursorShape.Drag] = "grab", _obj$4[CursorShape.CanDrop] = "copy", _obj$4[CursorShape.Forbidden] = "not-allowed", _obj$4[CursorShape.Vsize] = "ns-resize", _obj$4[CursorShape.Hsize] = "ew-resize", _obj$4[CursorShape.Bdiagsize] = "nesw-resize", _obj$4[CursorShape.Fdiagsize] = "nwse-resize", _obj$4[CursorShape.Move] = "move", _obj$4[CursorShape.Vsplit] = "row-resize", _obj$4[CursorShape.Hsplit] = "col-resize", _obj$4[CursorShape.Help] = "help", _obj$4);
|
|
25719
|
+
function getButtonMask(button) {
|
|
25720
|
+
switch(button){
|
|
25721
|
+
case MouseButton.Left:
|
|
25722
|
+
return MouseButtonMask.Left;
|
|
25723
|
+
case MouseButton.Right:
|
|
25724
|
+
return MouseButtonMask.Right;
|
|
25725
|
+
case MouseButton.Middle:
|
|
25726
|
+
return MouseButtonMask.Middle;
|
|
25727
|
+
case MouseButton.Xbutton1:
|
|
25728
|
+
return MouseButtonMask.Xbutton1;
|
|
25729
|
+
case MouseButton.Xbutton2:
|
|
25730
|
+
return MouseButtonMask.Xbutton2;
|
|
25731
|
+
default:
|
|
25732
|
+
return MouseButtonMask.None;
|
|
25733
|
+
}
|
|
25734
|
+
}
|
|
25735
|
+
function isWheelButton(button) {
|
|
25736
|
+
return button >= MouseButton.WheelUp && button <= MouseButton.WheelRight;
|
|
25737
|
+
}
|
|
25738
|
+
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25739
|
+
_inherits(CanvasRootControl, ContainerControl);
|
|
25740
|
+
function CanvasRootControl(engine, canvas) {
|
|
25741
|
+
var _this;
|
|
25742
|
+
_this = ContainerControl.call(this, engine) || this;
|
|
25743
|
+
_this.canvas = canvas;
|
|
25744
|
+
_this.mouseFilter = MouseFilter.Ignore;
|
|
25745
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25746
|
+
return _this;
|
|
25747
|
+
}
|
|
25748
|
+
_create_class(CanvasRootControl, [
|
|
25749
|
+
{
|
|
25750
|
+
key: "inputDisabled",
|
|
25751
|
+
get: function get() {
|
|
25752
|
+
var _this_canvas_item;
|
|
25753
|
+
return !this.canvas.receivesEvents || !this.canvas.enabled || !((_this_canvas_item = this.canvas.item) == null ? void 0 : _this_canvas_item.isActive);
|
|
25754
|
+
}
|
|
25755
|
+
}
|
|
25756
|
+
]);
|
|
25757
|
+
return CanvasRootControl;
|
|
25758
|
+
}(ContainerControl);
|
|
25759
|
+
/** Global ordered collection of UICanvas roots. */ var CanvasContainer = /*#__PURE__*/ function(ContainerControl) {
|
|
25760
|
+
_inherits(CanvasContainer, ContainerControl);
|
|
25761
|
+
function CanvasContainer(engine) {
|
|
25762
|
+
var _this;
|
|
25763
|
+
_this = ContainerControl.call(this, engine) || this;
|
|
25764
|
+
_this.mouseFilter = MouseFilter.Ignore;
|
|
25765
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25766
|
+
return _this;
|
|
25767
|
+
}
|
|
25768
|
+
var _proto = CanvasContainer.prototype;
|
|
25769
|
+
_proto.sortCanvases = function sortCanvases() {
|
|
25770
|
+
this.children.sort(function(left, right) {
|
|
25771
|
+
return left.canvas.order - right.canvas.order;
|
|
25772
|
+
});
|
|
25773
|
+
};
|
|
25774
|
+
_proto.addChildInternal = function addChildInternal(child) {
|
|
25775
|
+
ContainerControl.prototype.addChildInternal.call(this, child);
|
|
25776
|
+
this.sortCanvases();
|
|
25777
|
+
};
|
|
25778
|
+
_proto.draw = function draw() {
|
|
25779
|
+
this.sortCanvases();
|
|
25780
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25781
|
+
var child = _step.value;
|
|
25782
|
+
var root = child;
|
|
25783
|
+
if (root.canvas.isVisible) {
|
|
25784
|
+
root.draw();
|
|
25785
|
+
}
|
|
25786
|
+
}
|
|
25787
|
+
};
|
|
25788
|
+
return CanvasContainer;
|
|
25789
|
+
}(ContainerControl);
|
|
25790
|
+
/** Engine window GUI root. Routes events across all UICanvas roots. */ var WindowRootControl = /*#__PURE__*/ function(RootControl) {
|
|
25791
|
+
_inherits(WindowRootControl, RootControl);
|
|
25792
|
+
function WindowRootControl(engine) {
|
|
25793
|
+
var _this;
|
|
25794
|
+
_this = RootControl.call(this, engine) || this;
|
|
25795
|
+
_this.dragThreshold = 10;
|
|
25796
|
+
_this.lastInput = null;
|
|
25797
|
+
_this.gui = {
|
|
25798
|
+
mouseFocus: null,
|
|
25799
|
+
mouseClickGrabber: null,
|
|
25800
|
+
mouseFocusMask: MouseButtonMask.None,
|
|
25801
|
+
mouseOver: null,
|
|
25802
|
+
mouseOverHierarchy: [],
|
|
25803
|
+
touchFocus: new Map(),
|
|
25804
|
+
keyFocus: null,
|
|
25805
|
+
dragAccum: new Vector2(),
|
|
25806
|
+
dragAttempted: false,
|
|
25807
|
+
dragging: false,
|
|
25808
|
+
dragData: null,
|
|
25809
|
+
dragMouseOver: null,
|
|
25810
|
+
dragSuccessful: false,
|
|
25811
|
+
lastMousePosition: new Vector2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY),
|
|
25812
|
+
sendingMouseEnterExit: false,
|
|
25813
|
+
mouseOverUpdatePending: false
|
|
25814
|
+
};
|
|
25815
|
+
_this.mouseFilter = MouseFilter.Ignore;
|
|
25816
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25817
|
+
_this.canvases = new CanvasContainer(engine);
|
|
25818
|
+
_this.canvases.parent = _assert_this_initialized(_this);
|
|
25819
|
+
return _this;
|
|
25820
|
+
}
|
|
25821
|
+
var _proto = WindowRootControl.prototype;
|
|
25822
|
+
_proto.pushInput = function pushInput(event) {
|
|
25823
|
+
event.clearAccepted();
|
|
25824
|
+
this.lastInput = event;
|
|
25825
|
+
this.cleanupInternalState();
|
|
25826
|
+
this.processGUIInput(event);
|
|
25827
|
+
this.postGrabClickFocus();
|
|
25828
|
+
};
|
|
25829
|
+
_proto.isInputHandled = function isInputHandled() {
|
|
25830
|
+
var _this_lastInput;
|
|
25831
|
+
var _this_lastInput_isAccepted;
|
|
25832
|
+
return (_this_lastInput_isAccepted = (_this_lastInput = this.lastInput) == null ? void 0 : _this_lastInput.isAccepted()) != null ? _this_lastInput_isAccepted : false;
|
|
25833
|
+
};
|
|
25834
|
+
_proto.getMousePosition = function getMousePosition() {
|
|
25835
|
+
return this.gui.lastMousePosition.clone();
|
|
25836
|
+
};
|
|
25837
|
+
_proto.guiGetFocusOwner = function guiGetFocusOwner() {
|
|
25838
|
+
return this.isFocusTargetUsable(this.gui.keyFocus) ? this.gui.keyFocus : null;
|
|
25839
|
+
};
|
|
25840
|
+
_proto.guiReleaseFocus = function guiReleaseFocus() {
|
|
25841
|
+
this.releaseControlFocus();
|
|
25842
|
+
};
|
|
25843
|
+
_proto.guiIsDragging = function guiIsDragging() {
|
|
25844
|
+
return this.gui.dragging;
|
|
25845
|
+
};
|
|
25846
|
+
_proto.guiGetDragData = function guiGetDragData() {
|
|
25847
|
+
return this.gui.dragData;
|
|
25848
|
+
};
|
|
25849
|
+
_proto.guiIsDragSuccessful = function guiIsDragSuccessful() {
|
|
25850
|
+
return this.gui.dragSuccessful;
|
|
25851
|
+
};
|
|
25852
|
+
_proto.guiCancelDrag = function guiCancelDrag() {
|
|
25853
|
+
this.endDragging(false);
|
|
25854
|
+
};
|
|
25855
|
+
_proto.grabControlFocus = function grabControlFocus(control) {
|
|
25856
|
+
if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
|
|
25857
|
+
return;
|
|
25858
|
+
}
|
|
25859
|
+
var previous = this.gui.keyFocus;
|
|
25860
|
+
this.gui.keyFocus = control;
|
|
25861
|
+
if (previous && !previous.isDisposed) {
|
|
25862
|
+
previous.onLostFocus();
|
|
25863
|
+
}
|
|
25864
|
+
control.onGotFocus();
|
|
25865
|
+
};
|
|
25866
|
+
_proto.grabControlClickFocus = function grabControlClickFocus(control) {
|
|
25867
|
+
var _this = this;
|
|
25868
|
+
if (this.isControlValid(control)) {
|
|
25869
|
+
this.gui.mouseClickGrabber = control;
|
|
25870
|
+
queueMicrotask(function() {
|
|
25871
|
+
return _this.postGrabClickFocus();
|
|
25872
|
+
});
|
|
25873
|
+
}
|
|
25874
|
+
};
|
|
25875
|
+
_proto.releaseControlFocus = function releaseControlFocus(control) {
|
|
25876
|
+
var previous = this.gui.keyFocus;
|
|
25877
|
+
if (!previous || control && previous !== control) {
|
|
25878
|
+
return;
|
|
25879
|
+
}
|
|
25880
|
+
this.gui.keyFocus = null;
|
|
25881
|
+
if (!previous.isDisposed) {
|
|
25882
|
+
previous.onLostFocus();
|
|
25883
|
+
}
|
|
25884
|
+
};
|
|
25885
|
+
_proto.warpControlMouse = function warpControlMouse(position) {
|
|
25886
|
+
this.gui.lastMousePosition.copyFrom(position);
|
|
25887
|
+
this.updateMouseOver(position);
|
|
25888
|
+
this.updateMouseCursorState();
|
|
25889
|
+
};
|
|
25890
|
+
_proto.updateMouseCursorState = function updateMouseCursorState() {
|
|
25891
|
+
var position = this.gui.lastMousePosition;
|
|
25892
|
+
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.isControlUsable(this.gui.mouseOver) ? this.gui.mouseOver : null;
|
|
25893
|
+
this.updateCursor(target, position);
|
|
25894
|
+
};
|
|
25895
|
+
_proto.controlStateChanged = function controlStateChanged(control) {
|
|
25896
|
+
if (!this.isControlUsable(control)) {
|
|
25897
|
+
this.dropControlState(control);
|
|
25898
|
+
}
|
|
25899
|
+
this.requestMouseOverUpdate();
|
|
25900
|
+
};
|
|
25901
|
+
_proto.controlRemoved = function controlRemoved(control) {
|
|
25902
|
+
this.dropControlState(control);
|
|
25903
|
+
this.cleanupInternalState();
|
|
25904
|
+
this.requestMouseOverUpdate();
|
|
25905
|
+
};
|
|
25906
|
+
_proto.controlTreeChanged = function controlTreeChanged() {
|
|
25907
|
+
this.requestMouseOverUpdate();
|
|
25908
|
+
};
|
|
25909
|
+
_proto.cancelPointerInput = function cancelPointerInput() {
|
|
25910
|
+
this.dropMouseFocus();
|
|
25911
|
+
this.dropMouseOver();
|
|
25912
|
+
this.gui.touchFocus.clear();
|
|
25913
|
+
this.endDragging(false);
|
|
25914
|
+
this.releaseControlFocus();
|
|
25915
|
+
};
|
|
25916
|
+
_proto.resize = function resize(width, height) {
|
|
25917
|
+
this.setSize(width, height);
|
|
25918
|
+
this.canvases.setSize(width, height);
|
|
25919
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvases.children), _step; !(_step = _iterator()).done;){
|
|
25920
|
+
var root = _step.value;
|
|
25921
|
+
root.setSize(width, height);
|
|
25922
|
+
}
|
|
25923
|
+
};
|
|
25924
|
+
_proto.render = function render() {
|
|
25925
|
+
if (this.canvases.children.length === 0) {
|
|
25926
|
+
return;
|
|
25927
|
+
}
|
|
25928
|
+
this.engine.graphics.begin();
|
|
25929
|
+
this.draw();
|
|
25930
|
+
this.engine.graphics.end();
|
|
25931
|
+
};
|
|
25932
|
+
_proto.update = function update(deltaTime) {
|
|
25933
|
+
if (this.gui.mouseOverUpdatePending) {
|
|
25934
|
+
this.gui.mouseOverUpdatePending = false;
|
|
25935
|
+
this.updateMouseOver(this.gui.lastMousePosition);
|
|
25279
25936
|
}
|
|
25280
|
-
|
|
25281
|
-
|
|
25282
|
-
|
|
25283
|
-
|
|
25284
|
-
|
|
25285
|
-
|
|
25286
|
-
|
|
25287
|
-
|
|
25288
|
-
|
|
25289
|
-
|
|
25290
|
-
|
|
25291
|
-
|
|
25292
|
-
|
|
25937
|
+
RootControl.prototype.update.call(this, deltaTime);
|
|
25938
|
+
};
|
|
25939
|
+
_proto.dispose = function dispose() {
|
|
25940
|
+
this.cancelPointerInput();
|
|
25941
|
+
RootControl.prototype.dispose.call(this);
|
|
25942
|
+
};
|
|
25943
|
+
_proto.processGUIInput = function processGUIInput(event) {
|
|
25944
|
+
if (_instanceof1(event, InputEventKey)) {
|
|
25945
|
+
var target = this.guiGetFocusOwner();
|
|
25946
|
+
if (target) {
|
|
25947
|
+
this.callControlInput(target, event);
|
|
25948
|
+
}
|
|
25949
|
+
} else if (_instanceof1(event, InputEventMouse)) {
|
|
25950
|
+
this.gui.lastMousePosition.copyFrom(event.globalPosition);
|
|
25951
|
+
this.updateMouseOver(event.globalPosition);
|
|
25952
|
+
if (_instanceof1(event, InputEventMouseButton)) {
|
|
25953
|
+
this.processMouseButton(event);
|
|
25954
|
+
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
25955
|
+
this.processMouseMotion(event);
|
|
25956
|
+
}
|
|
25957
|
+
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
25958
|
+
this.processScreenTouch(event);
|
|
25959
|
+
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
25960
|
+
this.processScreenDrag(event);
|
|
25961
|
+
}
|
|
25962
|
+
};
|
|
25963
|
+
_proto.processMouseButton = function processMouseButton(event) {
|
|
25964
|
+
if (isWheelButton(event.buttonIndex)) {
|
|
25965
|
+
var target = this.findInputControl(event.globalPosition);
|
|
25966
|
+
if (target) {
|
|
25967
|
+
this.callGUIInput(target, event);
|
|
25968
|
+
}
|
|
25969
|
+
return;
|
|
25970
|
+
}
|
|
25971
|
+
var mask = getButtonMask(event.buttonIndex);
|
|
25972
|
+
if (event.isPressed()) {
|
|
25973
|
+
var target1 = this.gui.mouseFocusMask !== 0 ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
25974
|
+
this.gui.mouseFocus = target1;
|
|
25975
|
+
if (!target1) {
|
|
25976
|
+
return;
|
|
25977
|
+
}
|
|
25978
|
+
this.gui.mouseFocusMask |= mask;
|
|
25979
|
+
if (event.buttonIndex === MouseButton.Left) {
|
|
25980
|
+
this.gui.dragAccum.setZero();
|
|
25981
|
+
this.gui.dragAttempted = false;
|
|
25982
|
+
this.findClickFocus(target1);
|
|
25983
|
+
}
|
|
25984
|
+
this.callGUIInput(target1, event);
|
|
25985
|
+
} else {
|
|
25986
|
+
if (event.buttonIndex === MouseButton.Left && this.gui.dragging) {
|
|
25987
|
+
this.finishDrop(event.globalPosition);
|
|
25988
|
+
}
|
|
25989
|
+
this.gui.mouseFocusMask &= ~mask;
|
|
25990
|
+
var target2 = this.gui.mouseFocus;
|
|
25991
|
+
if (this.gui.mouseFocusMask === 0) {
|
|
25992
|
+
this.gui.mouseFocus = null;
|
|
25993
|
+
}
|
|
25994
|
+
if (this.isControlUsable(target2)) {
|
|
25995
|
+
this.callGUIInput(target2, event);
|
|
25996
|
+
}
|
|
25997
|
+
}
|
|
25998
|
+
};
|
|
25999
|
+
_proto.processMouseMotion = function processMouseMotion(event) {
|
|
26000
|
+
if (!this.gui.dragging && !this.gui.dragAttempted && this.gui.mouseFocus && (this.gui.mouseFocusMask & MouseButtonMask.Left) !== 0) {
|
|
26001
|
+
this.gui.dragAccum.add(event.relative);
|
|
26002
|
+
if (this.gui.dragAccum.length() > this.dragThreshold) {
|
|
26003
|
+
var origin = event.globalPosition.clone().subtract(this.gui.dragAccum);
|
|
26004
|
+
this.beginDragging(this.gui.mouseFocus, origin);
|
|
26005
|
+
this.gui.dragAttempted = true;
|
|
26006
|
+
}
|
|
26007
|
+
}
|
|
26008
|
+
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
26009
|
+
if (target) {
|
|
26010
|
+
this.callGUIInput(target, event);
|
|
26011
|
+
}
|
|
26012
|
+
if (this.gui.dragging) {
|
|
26013
|
+
this.gui.dragMouseOver = this.findDropTarget(this.findInputControl(event.globalPosition), event.globalPosition);
|
|
26014
|
+
}
|
|
26015
|
+
this.updateCursor(target, event.globalPosition);
|
|
26016
|
+
};
|
|
26017
|
+
_proto.processScreenTouch = function processScreenTouch(event) {
|
|
26018
|
+
var target;
|
|
26019
|
+
if (event.isPressed()) {
|
|
26020
|
+
target = this.findInputControl(event.position);
|
|
26021
|
+
if (target) {
|
|
26022
|
+
this.gui.touchFocus.set(event.index, target);
|
|
26023
|
+
}
|
|
26024
|
+
} else {
|
|
26025
|
+
var _this_gui_touchFocus_get;
|
|
26026
|
+
target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : null;
|
|
26027
|
+
this.gui.touchFocus.delete(event.index);
|
|
26028
|
+
}
|
|
26029
|
+
if (this.isControlUsable(target)) {
|
|
26030
|
+
this.callGUIInput(target, event);
|
|
26031
|
+
}
|
|
26032
|
+
};
|
|
26033
|
+
_proto.processScreenDrag = function processScreenDrag(event) {
|
|
26034
|
+
var _this_gui_touchFocus_get;
|
|
26035
|
+
var target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : this.findInputControl(event.position);
|
|
26036
|
+
if (this.isControlUsable(target)) {
|
|
26037
|
+
this.callGUIInput(target, event);
|
|
26038
|
+
}
|
|
26039
|
+
};
|
|
26040
|
+
_proto.callGUIInput = function callGUIInput(target, event) {
|
|
26041
|
+
var current = target;
|
|
26042
|
+
var pointerEvent = _instanceof1(event, InputEventMouse) || _instanceof1(event, InputEventScreenTouch) || _instanceof1(event, InputEventScreenDrag);
|
|
26043
|
+
while(current && current !== this && this.isControlUsable(current)){
|
|
26044
|
+
var filter = current.getEffectiveMouseFilter();
|
|
26045
|
+
if (filter !== MouseFilter.Ignore) {
|
|
26046
|
+
var localEvent = event.xformedBy(this.getGlobalInverse(current));
|
|
26047
|
+
this.callControlInput(current, localEvent);
|
|
26048
|
+
if (localEvent.isAccepted()) {
|
|
26049
|
+
event.accept();
|
|
26050
|
+
}
|
|
26051
|
+
}
|
|
26052
|
+
var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
|
|
26053
|
+
if (event.isAccepted() || filter === MouseFilter.Stop && pointerEvent && !forcePassWheel) {
|
|
26054
|
+
event.accept();
|
|
26055
|
+
return;
|
|
26056
|
+
}
|
|
26057
|
+
current = current.parent;
|
|
26058
|
+
}
|
|
26059
|
+
};
|
|
26060
|
+
_proto.callControlInput = function callControlInput(control, event) {
|
|
26061
|
+
if (_instanceof1(event, InputEventMouseButton)) {
|
|
26062
|
+
if (isWheelButton(event.buttonIndex)) {
|
|
26063
|
+
control.onMouseWheel(event);
|
|
26064
|
+
} else if (event.isPressed()) {
|
|
26065
|
+
control.onMouseDown(event);
|
|
26066
|
+
} else {
|
|
26067
|
+
control.onMouseUp(event);
|
|
26068
|
+
}
|
|
26069
|
+
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
26070
|
+
control.onMouseMove(event);
|
|
26071
|
+
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
26072
|
+
if (event.isPressed()) {
|
|
26073
|
+
control.onTouchDown(event);
|
|
26074
|
+
} else {
|
|
26075
|
+
control.onTouchUp(event);
|
|
26076
|
+
}
|
|
26077
|
+
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
26078
|
+
control.onTouchMove(event);
|
|
26079
|
+
} else if (_instanceof1(event, InputEventKey)) {
|
|
26080
|
+
if (event.isPressed()) {
|
|
26081
|
+
control.onKeyDown(event);
|
|
26082
|
+
} else if (event.isReleased()) {
|
|
26083
|
+
control.onKeyUp(event);
|
|
26084
|
+
}
|
|
26085
|
+
}
|
|
26086
|
+
};
|
|
26087
|
+
_proto.findInputControl = function findInputControl(position) {
|
|
26088
|
+
this.canvases.sortCanvases();
|
|
26089
|
+
for(var index = this.canvases.children.length - 1; index >= 0; index--){
|
|
26090
|
+
var root = this.canvases.children[index];
|
|
26091
|
+
if (!root.canvas.isVisible || root.inputDisabled) {
|
|
26092
|
+
continue;
|
|
26093
|
+
}
|
|
26094
|
+
var target = this.findControlAtPosition(root, position, true);
|
|
26095
|
+
if (target) {
|
|
26096
|
+
return target;
|
|
26097
|
+
}
|
|
26098
|
+
}
|
|
26099
|
+
return null;
|
|
26100
|
+
};
|
|
26101
|
+
_proto.findControlAtPosition = function findControlAtPosition(container, position, skipSelf) {
|
|
26102
|
+
if (skipSelf === void 0) skipSelf = false;
|
|
26103
|
+
if (!container.visibleInHierarchy || container.isDisposed) {
|
|
26104
|
+
return null;
|
|
26105
|
+
}
|
|
26106
|
+
var localPosition = this.toLocal(container, position);
|
|
26107
|
+
if (container.clipContents && !container.hasPoint(localPosition)) {
|
|
26108
|
+
return null;
|
|
26109
|
+
}
|
|
26110
|
+
for(var index = container.children.length - 1; index >= 0; index--){
|
|
26111
|
+
var child = container.children[index];
|
|
26112
|
+
if (!child.visibleInHierarchy || child.isDisposed) {
|
|
26113
|
+
continue;
|
|
26114
|
+
}
|
|
26115
|
+
if (_instanceof1(child, ContainerControl)) {
|
|
26116
|
+
var found = this.findControlAtPosition(child, position);
|
|
26117
|
+
if (found) {
|
|
26118
|
+
return found;
|
|
26119
|
+
}
|
|
26120
|
+
} else if (child.getEffectiveMouseFilter() !== MouseFilter.Ignore && child.hasPoint(this.toLocal(child, position))) {
|
|
26121
|
+
return child;
|
|
26122
|
+
}
|
|
26123
|
+
}
|
|
26124
|
+
if (!skipSelf && container.getEffectiveMouseFilter() !== MouseFilter.Ignore && container.hasPoint(localPosition)) {
|
|
26125
|
+
return container;
|
|
26126
|
+
}
|
|
26127
|
+
return null;
|
|
26128
|
+
};
|
|
26129
|
+
_proto.updateMouseOver = function updateMouseOver(position) {
|
|
26130
|
+
if (this.gui.sendingMouseEnterExit) {
|
|
26131
|
+
this.gui.mouseOverUpdatePending = true;
|
|
26132
|
+
return;
|
|
26133
|
+
}
|
|
26134
|
+
this.gui.mouseOverUpdatePending = false;
|
|
26135
|
+
var target = this.findInputControl(position);
|
|
26136
|
+
var next = this.buildHoverHierarchy(target);
|
|
26137
|
+
var previous = this.gui.mouseOverHierarchy;
|
|
26138
|
+
var common = 0;
|
|
26139
|
+
while(common < previous.length && common < next.length && previous[common] === next[common]){
|
|
26140
|
+
common++;
|
|
26141
|
+
}
|
|
26142
|
+
this.gui.sendingMouseEnterExit = true;
|
|
26143
|
+
for(var index = previous.length - 1; index >= common; index--){
|
|
26144
|
+
if (!previous[index].isDisposed) {
|
|
26145
|
+
previous[index].onMouseLeave();
|
|
26146
|
+
}
|
|
26147
|
+
}
|
|
26148
|
+
for(var index1 = common; index1 < next.length; index1++){
|
|
26149
|
+
next[index1].onMouseEnter(this.toLocal(next[index1], position));
|
|
26150
|
+
}
|
|
26151
|
+
this.gui.sendingMouseEnterExit = false;
|
|
26152
|
+
this.gui.mouseOver = target;
|
|
26153
|
+
this.gui.mouseOverHierarchy = next;
|
|
26154
|
+
};
|
|
26155
|
+
_proto.buildHoverHierarchy = function buildHoverHierarchy(target) {
|
|
26156
|
+
var hierarchy = [];
|
|
26157
|
+
var current = target;
|
|
26158
|
+
while(current && current !== this){
|
|
26159
|
+
if (current.getEffectiveMouseFilter() !== MouseFilter.Ignore) {
|
|
26160
|
+
hierarchy.push(current);
|
|
26161
|
+
}
|
|
26162
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26163
|
+
break;
|
|
26164
|
+
}
|
|
26165
|
+
current = current.parent;
|
|
26166
|
+
}
|
|
26167
|
+
hierarchy.reverse();
|
|
26168
|
+
return hierarchy;
|
|
26169
|
+
};
|
|
26170
|
+
_proto.findClickFocus = function findClickFocus(target) {
|
|
26171
|
+
var current = target;
|
|
26172
|
+
while(current && current !== this){
|
|
26173
|
+
var mode = current.getFocusModeWithOverride();
|
|
26174
|
+
if (mode === FocusMode.Click || mode === FocusMode.All) {
|
|
26175
|
+
this.grabControlFocus(current);
|
|
26176
|
+
return;
|
|
26177
|
+
}
|
|
26178
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26179
|
+
return;
|
|
26180
|
+
}
|
|
26181
|
+
current = current.parent;
|
|
26182
|
+
}
|
|
26183
|
+
};
|
|
26184
|
+
_proto.beginDragging = function beginDragging(source, position) {
|
|
26185
|
+
var current = source;
|
|
26186
|
+
while(current && current !== this){
|
|
26187
|
+
var data = current.invokeGetDragData(this.toLocal(current, position));
|
|
26188
|
+
if (data !== null && data !== undefined) {
|
|
26189
|
+
this.gui.dragging = true;
|
|
26190
|
+
this.gui.dragData = data;
|
|
26191
|
+
this.gui.mouseFocus = null;
|
|
26192
|
+
this.gui.mouseFocusMask = MouseButtonMask.None;
|
|
26193
|
+
return;
|
|
26194
|
+
}
|
|
26195
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26196
|
+
return;
|
|
26197
|
+
}
|
|
26198
|
+
current = current.parent;
|
|
26199
|
+
}
|
|
26200
|
+
};
|
|
26201
|
+
_proto.finishDrop = function finishDrop(position) {
|
|
26202
|
+
var target = this.findDropTarget(this.findInputControl(position), position);
|
|
26203
|
+
if (target) {
|
|
26204
|
+
target.invokeDropData(this.toLocal(target, position), this.gui.dragData);
|
|
26205
|
+
}
|
|
26206
|
+
this.endDragging(!!target);
|
|
26207
|
+
};
|
|
26208
|
+
_proto.findDropTarget = function findDropTarget(target, position) {
|
|
26209
|
+
var current = target;
|
|
26210
|
+
while(current && current !== this){
|
|
26211
|
+
if (current.invokeCanDropData(this.toLocal(current, position), this.gui.dragData)) {
|
|
26212
|
+
return current;
|
|
26213
|
+
}
|
|
26214
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26215
|
+
return null;
|
|
26216
|
+
}
|
|
26217
|
+
current = current.parent;
|
|
26218
|
+
}
|
|
26219
|
+
return null;
|
|
26220
|
+
};
|
|
26221
|
+
_proto.endDragging = function endDragging(successful) {
|
|
26222
|
+
this.gui.dragSuccessful = successful;
|
|
26223
|
+
this.gui.dragging = false;
|
|
26224
|
+
this.gui.dragData = null;
|
|
26225
|
+
this.gui.dragMouseOver = null;
|
|
26226
|
+
};
|
|
26227
|
+
_proto.updateCursor = function updateCursor(target, position) {
|
|
26228
|
+
var current = target;
|
|
26229
|
+
var cursor = CursorShape.Arrow;
|
|
26230
|
+
while(current && current !== this){
|
|
26231
|
+
var candidate = current.getCursorShape(this.toLocal(current, position));
|
|
26232
|
+
if (candidate !== CursorShape.Arrow) {
|
|
26233
|
+
cursor = candidate;
|
|
26234
|
+
break;
|
|
26235
|
+
}
|
|
26236
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26237
|
+
break;
|
|
26238
|
+
}
|
|
26239
|
+
current = current.parent;
|
|
26240
|
+
}
|
|
26241
|
+
this.engine.canvas.style.cursor = typeof cursor === "string" ? cursor : cursorNames[cursor];
|
|
26242
|
+
};
|
|
26243
|
+
_proto.postGrabClickFocus = function postGrabClickFocus() {
|
|
26244
|
+
var target = this.gui.mouseClickGrabber;
|
|
26245
|
+
this.gui.mouseClickGrabber = null;
|
|
26246
|
+
if (this.isControlUsable(target)) {
|
|
26247
|
+
this.gui.mouseFocus = target;
|
|
26248
|
+
}
|
|
26249
|
+
};
|
|
26250
|
+
_proto.cleanupInternalState = function cleanupInternalState() {
|
|
26251
|
+
if (!this.isControlUsable(this.gui.mouseFocus)) {
|
|
26252
|
+
this.dropMouseFocus();
|
|
26253
|
+
}
|
|
26254
|
+
if (this.gui.keyFocus && !this.isFocusTargetUsable(this.gui.keyFocus)) {
|
|
26255
|
+
this.releaseControlFocus(this.gui.keyFocus);
|
|
26256
|
+
}
|
|
26257
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26258
|
+
var _step_value = _step.value, index = _step_value[0], control = _step_value[1];
|
|
26259
|
+
if (!this.isControlUsable(control)) {
|
|
26260
|
+
this.gui.touchFocus.delete(index);
|
|
26261
|
+
}
|
|
26262
|
+
}
|
|
26263
|
+
};
|
|
26264
|
+
_proto.dropMouseFocus = function dropMouseFocus() {
|
|
26265
|
+
this.gui.mouseFocus = null;
|
|
26266
|
+
this.gui.mouseFocusMask = MouseButtonMask.None;
|
|
26267
|
+
};
|
|
26268
|
+
_proto.dropMouseOver = function dropMouseOver() {
|
|
26269
|
+
for(var index = this.gui.mouseOverHierarchy.length - 1; index >= 0; index--){
|
|
26270
|
+
var control = this.gui.mouseOverHierarchy[index];
|
|
26271
|
+
if (!control.isDisposed) {
|
|
26272
|
+
control.onMouseLeave();
|
|
26273
|
+
}
|
|
26274
|
+
}
|
|
26275
|
+
this.gui.mouseOver = null;
|
|
26276
|
+
this.gui.mouseOverHierarchy = [];
|
|
26277
|
+
};
|
|
26278
|
+
_proto.dropControlState = function dropControlState(control) {
|
|
26279
|
+
if (this.controlBelongsToSubtree(this.gui.mouseFocus, control)) {
|
|
26280
|
+
this.dropMouseFocus();
|
|
26281
|
+
}
|
|
26282
|
+
if (this.controlBelongsToSubtree(this.gui.mouseClickGrabber, control)) {
|
|
26283
|
+
this.gui.mouseClickGrabber = null;
|
|
26284
|
+
}
|
|
26285
|
+
if (this.controlBelongsToSubtree(this.gui.keyFocus, control)) {
|
|
26286
|
+
var _this_gui_keyFocus;
|
|
26287
|
+
this.releaseControlFocus((_this_gui_keyFocus = this.gui.keyFocus) != null ? _this_gui_keyFocus : undefined);
|
|
26288
|
+
}
|
|
26289
|
+
if (this.controlBelongsToSubtree(this.gui.mouseOver, control)) {
|
|
26290
|
+
this.dropMouseOver();
|
|
26291
|
+
}
|
|
26292
|
+
if (this.controlBelongsToSubtree(this.gui.dragMouseOver, control)) {
|
|
26293
|
+
this.gui.dragMouseOver = null;
|
|
26294
|
+
}
|
|
26295
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26296
|
+
var _step_value = _step.value, index = _step_value[0], target = _step_value[1];
|
|
26297
|
+
if (this.controlBelongsToSubtree(target, control)) {
|
|
26298
|
+
this.gui.touchFocus.delete(index);
|
|
26299
|
+
}
|
|
25293
26300
|
}
|
|
25294
|
-
return rt;
|
|
25295
26301
|
};
|
|
25296
|
-
|
|
25297
|
-
|
|
26302
|
+
_proto.requestMouseOverUpdate = function requestMouseOverUpdate() {
|
|
26303
|
+
if (Number.isFinite(this.gui.lastMousePosition.x)) {
|
|
26304
|
+
this.updateMouseOver(this.gui.lastMousePosition);
|
|
26305
|
+
}
|
|
26306
|
+
};
|
|
26307
|
+
_proto.getGlobalInverse = function getGlobalInverse(control) {
|
|
26308
|
+
var transform = control.getGlobalTransform2D().clone();
|
|
26309
|
+
return Math.abs(transform.determinant()) < 1e-12 ? new Matrix3() : transform.invert();
|
|
26310
|
+
};
|
|
26311
|
+
_proto.toLocal = function toLocal(control, position) {
|
|
26312
|
+
var elements = this.getGlobalInverse(control).elements;
|
|
26313
|
+
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
26314
|
+
};
|
|
26315
|
+
_proto.controlBelongsToSubtree = function controlBelongsToSubtree(control, subtree) {
|
|
26316
|
+
var current = control;
|
|
26317
|
+
while(current){
|
|
26318
|
+
if (current === subtree) {
|
|
26319
|
+
return true;
|
|
26320
|
+
}
|
|
26321
|
+
current = current.parent;
|
|
26322
|
+
}
|
|
26323
|
+
return false;
|
|
26324
|
+
};
|
|
26325
|
+
_proto.isControlValid = function isControlValid(control) {
|
|
26326
|
+
return !!control && !control.isDisposed && control.root === this;
|
|
26327
|
+
};
|
|
26328
|
+
_proto.isControlUsable = function isControlUsable(control) {
|
|
26329
|
+
if (!this.isControlValid(control) || !control.visibleInHierarchy || !control.enabledInHierarchy) {
|
|
26330
|
+
return false;
|
|
26331
|
+
}
|
|
26332
|
+
var root = this.findCanvasRoot(control);
|
|
26333
|
+
return !root || !root.inputDisabled;
|
|
26334
|
+
};
|
|
26335
|
+
_proto.findCanvasRoot = function findCanvasRoot(control) {
|
|
26336
|
+
var current = control;
|
|
26337
|
+
while(current && current !== this){
|
|
26338
|
+
if (_instanceof1(current, CanvasRootControl)) {
|
|
26339
|
+
return current;
|
|
26340
|
+
}
|
|
26341
|
+
current = current.parent;
|
|
26342
|
+
}
|
|
26343
|
+
return null;
|
|
26344
|
+
};
|
|
26345
|
+
_proto.isFocusTargetUsable = function isFocusTargetUsable(control) {
|
|
26346
|
+
return this.isControlUsable(control) && control.getFocusModeWithOverride() !== FocusMode.None;
|
|
26347
|
+
};
|
|
26348
|
+
return WindowRootControl;
|
|
26349
|
+
}(RootControl);
|
|
26350
|
+
|
|
26351
|
+
var CanvasRenderMode;
|
|
26352
|
+
(function(CanvasRenderMode) {
|
|
26353
|
+
CanvasRenderMode[CanvasRenderMode["ScreenSpace"] = 0] = "ScreenSpace";
|
|
26354
|
+
CanvasRenderMode[CanvasRenderMode["CameraSpace"] = 1] = "CameraSpace";
|
|
26355
|
+
CanvasRenderMode[CanvasRenderMode["WorldSpace"] = 2] = "WorldSpace";
|
|
26356
|
+
CanvasRenderMode[CanvasRenderMode["WorldSpaceFaceCamera"] = 3] = "WorldSpaceFaceCamera";
|
|
26357
|
+
})(CanvasRenderMode || (CanvasRenderMode = {}));
|
|
26358
|
+
/** Canvas-layer boundary attached to a VFXItem. Input state remains owned by the window root. */ var UICanvas = /*#__PURE__*/ function(Component) {
|
|
26359
|
+
_inherits(UICanvas, Component);
|
|
26360
|
+
function UICanvas(engine) {
|
|
26361
|
+
var _this;
|
|
26362
|
+
_this = Component.call(this, engine) || this;
|
|
26363
|
+
_this.renderMode = 0;
|
|
26364
|
+
_this.receivesEvents = true;
|
|
26365
|
+
_this._order = 0;
|
|
26366
|
+
_this.registered = false;
|
|
26367
|
+
_this.rootControl = new CanvasRootControl(engine, _assert_this_initialized(_this));
|
|
26368
|
+
return _this;
|
|
26369
|
+
}
|
|
26370
|
+
var _proto = UICanvas.prototype;
|
|
26371
|
+
_proto.onEnable = function onEnable() {
|
|
26372
|
+
this.register();
|
|
26373
|
+
};
|
|
26374
|
+
_proto.onDisable = function onDisable() {
|
|
26375
|
+
this.unregister();
|
|
26376
|
+
};
|
|
26377
|
+
_proto.onDestroy = function onDestroy() {
|
|
26378
|
+
this.destroyCanvas();
|
|
26379
|
+
};
|
|
26380
|
+
_proto.dispose = function dispose() {
|
|
26381
|
+
this.destroyCanvas();
|
|
26382
|
+
Component.prototype.dispose.call(this);
|
|
26383
|
+
};
|
|
26384
|
+
_proto.register = function register() {
|
|
26385
|
+
if (!this.registered) {
|
|
26386
|
+
this.rootControl.parent = this.engine.windowRoot.canvases;
|
|
26387
|
+
this.registered = true;
|
|
26388
|
+
}
|
|
26389
|
+
};
|
|
26390
|
+
_proto.unregister = function unregister() {
|
|
26391
|
+
if (this.registered) {
|
|
26392
|
+
this.rootControl.parent = null;
|
|
26393
|
+
this.registered = false;
|
|
26394
|
+
}
|
|
26395
|
+
};
|
|
26396
|
+
_proto.destroyCanvas = function destroyCanvas() {
|
|
26397
|
+
this.unregister();
|
|
26398
|
+
if (!this.rootControl.isDisposed) {
|
|
26399
|
+
this.rootControl.dispose();
|
|
26400
|
+
}
|
|
26401
|
+
};
|
|
26402
|
+
_create_class(UICanvas, [
|
|
26403
|
+
{
|
|
26404
|
+
key: "order",
|
|
26405
|
+
get: function get() {
|
|
26406
|
+
return this._order;
|
|
26407
|
+
},
|
|
26408
|
+
set: function set(value) {
|
|
26409
|
+
if (this._order !== value) {
|
|
26410
|
+
this._order = value;
|
|
26411
|
+
this.engine.windowRoot.canvases.sortCanvases();
|
|
26412
|
+
}
|
|
26413
|
+
}
|
|
26414
|
+
},
|
|
26415
|
+
{
|
|
26416
|
+
key: "isVisible",
|
|
26417
|
+
get: function get() {
|
|
26418
|
+
var _this_item;
|
|
26419
|
+
return this.renderMode === 0 && this.enabled && !!((_this_item = this.item) == null ? void 0 : _this_item.isActive);
|
|
26420
|
+
}
|
|
26421
|
+
}
|
|
26422
|
+
]);
|
|
26423
|
+
return UICanvas;
|
|
26424
|
+
}(Component);
|
|
25298
26425
|
|
|
25299
26426
|
/**
|
|
25300
|
-
*
|
|
25301
|
-
*
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
|
|
25305
|
-
|
|
25306
|
-
|
|
25307
|
-
|
|
25308
|
-
|
|
25309
|
-
|
|
25310
|
-
|
|
25311
|
-
|
|
26427
|
+
* Scene-tree bridge for a GUI Control. The VFXItem tree owns lifecycle and
|
|
26428
|
+
* serialization while the Control tree owns layout, drawing and input.
|
|
26429
|
+
*/ var UIControl = /*#__PURE__*/ function(Component) {
|
|
26430
|
+
_inherits(UIControl, Component);
|
|
26431
|
+
function UIControl(engine) {
|
|
26432
|
+
var _this;
|
|
26433
|
+
_this = Component.call(this, engine) || this;
|
|
26434
|
+
_this.controlNode = null;
|
|
26435
|
+
_this.linkedItemTransform = null;
|
|
26436
|
+
_this.linkedControl = null;
|
|
26437
|
+
_this.syncingLocation = false;
|
|
26438
|
+
_this.itemTransformChanged = function() {
|
|
26439
|
+
return _this.syncItemLocationToControl();
|
|
26440
|
+
};
|
|
26441
|
+
_this.controlLocationChanged = function() {
|
|
26442
|
+
return _this.syncControlLocationToItem();
|
|
26443
|
+
};
|
|
26444
|
+
return _this;
|
|
25312
26445
|
}
|
|
25313
|
-
var _proto =
|
|
25314
|
-
|
|
25315
|
-
|
|
25316
|
-
|
|
25317
|
-
|
|
25318
|
-
|
|
25319
|
-
|
|
25320
|
-
|
|
26446
|
+
var _proto = UIControl.prototype;
|
|
26447
|
+
_proto.onAwake = function onAwake() {
|
|
26448
|
+
this.syncControl();
|
|
26449
|
+
};
|
|
26450
|
+
_proto.onEnable = function onEnable() {
|
|
26451
|
+
if (this.controlNode) {
|
|
26452
|
+
this.controlNode.visible = this.item.isActive;
|
|
26453
|
+
this.controlNode.enabled = true;
|
|
25321
26454
|
}
|
|
25322
26455
|
};
|
|
25323
|
-
|
|
25324
|
-
|
|
26456
|
+
_proto.onDisable = function onDisable() {
|
|
26457
|
+
if (this.controlNode) {
|
|
26458
|
+
this.controlNode.visible = this.item.isActive;
|
|
26459
|
+
this.controlNode.enabled = false;
|
|
26460
|
+
}
|
|
26461
|
+
};
|
|
26462
|
+
_proto.onParentChanged = function onParentChanged() {
|
|
26463
|
+
this.syncControl();
|
|
26464
|
+
};
|
|
26465
|
+
_proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
26466
|
+
this.syncControlOrder();
|
|
26467
|
+
};
|
|
26468
|
+
_proto.onDestroy = function onDestroy() {
|
|
26469
|
+
this.disposeControl();
|
|
26470
|
+
};
|
|
26471
|
+
_proto.dispose = function dispose() {
|
|
26472
|
+
this.disposeControl();
|
|
26473
|
+
Component.prototype.dispose.call(this);
|
|
26474
|
+
};
|
|
26475
|
+
/** Unlinks the GUI object without disposing or modifying it. */ _proto.unlinkControl = function unlinkControl() {
|
|
26476
|
+
if (this.controlNode) {
|
|
26477
|
+
this.unbindLocationSync();
|
|
26478
|
+
this.controlNode = null;
|
|
26479
|
+
}
|
|
26480
|
+
};
|
|
26481
|
+
_proto.disposeControl = function disposeControl() {
|
|
26482
|
+
var control = this.controlNode;
|
|
26483
|
+
if (control) {
|
|
26484
|
+
this.unbindLocationSync();
|
|
26485
|
+
this.controlNode = null;
|
|
26486
|
+
control.dispose();
|
|
26487
|
+
}
|
|
26488
|
+
};
|
|
26489
|
+
_proto.syncControl = function syncControl() {
|
|
26490
|
+
var control = this.controlNode;
|
|
26491
|
+
if (!control || !this.item) {
|
|
26492
|
+
return;
|
|
26493
|
+
}
|
|
26494
|
+
this.syncingLocation = true;
|
|
26495
|
+
try {
|
|
26496
|
+
control.visible = this.item.isActive;
|
|
26497
|
+
control.enabled = this.enabled;
|
|
26498
|
+
control.parent = this.resolveParent();
|
|
26499
|
+
this.syncControlOrder();
|
|
26500
|
+
this.copyItemLocationToControl();
|
|
26501
|
+
} finally{
|
|
26502
|
+
this.syncingLocation = false;
|
|
26503
|
+
}
|
|
26504
|
+
this.bindLocationSync();
|
|
26505
|
+
};
|
|
26506
|
+
_proto.syncControlOrder = function syncControlOrder() {
|
|
26507
|
+
if (this.controlNode && this.item) {
|
|
26508
|
+
this.controlNode.indexInParent = this.item.orderInParent;
|
|
26509
|
+
}
|
|
26510
|
+
};
|
|
26511
|
+
_proto.resolveParent = function resolveParent() {
|
|
26512
|
+
var parentItem = this.item.parent;
|
|
26513
|
+
if (!parentItem) {
|
|
26514
|
+
var _UIControl_fallbackParentGetDelegate;
|
|
26515
|
+
return (_UIControl_fallbackParentGetDelegate = UIControl.fallbackParentGetDelegate == null ? void 0 : UIControl.fallbackParentGetDelegate.call(UIControl, this)) != null ? _UIControl_fallbackParentGetDelegate : null;
|
|
26516
|
+
}
|
|
26517
|
+
var uiControl = parentItem.getComponent(UIControl);
|
|
26518
|
+
if ((uiControl == null ? void 0 : uiControl.control) && "children" in uiControl.control) {
|
|
26519
|
+
return uiControl.control;
|
|
26520
|
+
}
|
|
26521
|
+
var canvas = parentItem.getComponent(UICanvas);
|
|
26522
|
+
var _canvas_rootControl, _ref;
|
|
26523
|
+
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;
|
|
26524
|
+
};
|
|
26525
|
+
_proto.bindLocationSync = function bindLocationSync() {
|
|
26526
|
+
var itemTransform = this.item.transform;
|
|
26527
|
+
var control = this.controlNode;
|
|
26528
|
+
if (this.linkedItemTransform === itemTransform && this.linkedControl === control) {
|
|
26529
|
+
return;
|
|
26530
|
+
}
|
|
26531
|
+
this.unbindLocationSync();
|
|
26532
|
+
if (control) {
|
|
26533
|
+
this.linkedItemTransform = itemTransform;
|
|
26534
|
+
this.linkedControl = control;
|
|
26535
|
+
itemTransform.on("changed", this.itemTransformChanged);
|
|
26536
|
+
control.on("locationChanged", this.controlLocationChanged);
|
|
26537
|
+
}
|
|
26538
|
+
};
|
|
26539
|
+
_proto.unbindLocationSync = function unbindLocationSync() {
|
|
26540
|
+
var _this_linkedItemTransform, _this_linkedControl;
|
|
26541
|
+
(_this_linkedItemTransform = this.linkedItemTransform) == null ? void 0 : _this_linkedItemTransform.off("changed", this.itemTransformChanged);
|
|
26542
|
+
(_this_linkedControl = this.linkedControl) == null ? void 0 : _this_linkedControl.off("locationChanged", this.controlLocationChanged);
|
|
26543
|
+
this.linkedItemTransform = null;
|
|
26544
|
+
this.linkedControl = null;
|
|
26545
|
+
};
|
|
26546
|
+
_proto.syncItemLocationToControl = function syncItemLocationToControl() {
|
|
26547
|
+
if (!this.syncingLocation && this.controlNode) {
|
|
26548
|
+
this.syncingLocation = true;
|
|
26549
|
+
try {
|
|
26550
|
+
this.copyItemLocationToControl();
|
|
26551
|
+
} finally{
|
|
26552
|
+
this.syncingLocation = false;
|
|
26553
|
+
}
|
|
26554
|
+
}
|
|
26555
|
+
};
|
|
26556
|
+
_proto.syncControlLocationToItem = function syncControlLocationToItem() {
|
|
26557
|
+
var control = this.controlNode;
|
|
26558
|
+
if (!this.syncingLocation && control) {
|
|
26559
|
+
var source = control.location;
|
|
26560
|
+
var target = this.item.transform.position;
|
|
26561
|
+
if (source.x !== target.x || source.y !== target.y) {
|
|
26562
|
+
this.syncingLocation = true;
|
|
26563
|
+
try {
|
|
26564
|
+
this.item.transform.setPosition(source.x, source.y, target.z);
|
|
26565
|
+
} finally{
|
|
26566
|
+
this.syncingLocation = false;
|
|
26567
|
+
}
|
|
26568
|
+
}
|
|
26569
|
+
}
|
|
26570
|
+
};
|
|
26571
|
+
_proto.copyItemLocationToControl = function copyItemLocationToControl() {
|
|
26572
|
+
var control = this.controlNode;
|
|
26573
|
+
if (control) {
|
|
26574
|
+
var source = this.item.transform.position;
|
|
26575
|
+
var target = control.location;
|
|
26576
|
+
if (source.x !== target.x || source.y !== target.y) {
|
|
26577
|
+
control.setPosition(source.x, source.y);
|
|
26578
|
+
}
|
|
26579
|
+
}
|
|
26580
|
+
};
|
|
26581
|
+
_create_class(UIControl, [
|
|
26582
|
+
{
|
|
26583
|
+
key: "control",
|
|
26584
|
+
get: function get() {
|
|
26585
|
+
return this.controlNode;
|
|
26586
|
+
},
|
|
26587
|
+
set: function set(value) {
|
|
26588
|
+
if (value === this.controlNode) {
|
|
26589
|
+
return;
|
|
26590
|
+
}
|
|
26591
|
+
this.disposeControl();
|
|
26592
|
+
if (value) {
|
|
26593
|
+
if (value.owner && value.owner !== this && value.owner.control === value) {
|
|
26594
|
+
throw new Error("A Control can only be owned by one UIControl.");
|
|
26595
|
+
}
|
|
26596
|
+
this.controlNode = value;
|
|
26597
|
+
value.owner = this;
|
|
26598
|
+
this.syncControl();
|
|
26599
|
+
}
|
|
26600
|
+
}
|
|
26601
|
+
},
|
|
26602
|
+
{
|
|
26603
|
+
key: "hasControl",
|
|
26604
|
+
get: function get() {
|
|
26605
|
+
return this.controlNode !== null;
|
|
26606
|
+
}
|
|
26607
|
+
}
|
|
26608
|
+
]);
|
|
26609
|
+
return UIControl;
|
|
26610
|
+
}(Component);
|
|
25325
26611
|
|
|
25326
26612
|
var CameraController = /*#__PURE__*/ function(Component) {
|
|
25327
26613
|
_inherits(CameraController, Component);
|
|
@@ -25357,42 +26643,6 @@ CameraController = __decorate([
|
|
|
25357
26643
|
effectsClass(DataType.CameraController)
|
|
25358
26644
|
], CameraController);
|
|
25359
26645
|
|
|
25360
|
-
function _get_prototype_of(o) {
|
|
25361
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
25362
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
25363
|
-
};
|
|
25364
|
-
return _get_prototype_of(o);
|
|
25365
|
-
}
|
|
25366
|
-
|
|
25367
|
-
function _is_native_function(fn) {
|
|
25368
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
25369
|
-
}
|
|
25370
|
-
|
|
25371
|
-
function _wrap_native_super(Class) {
|
|
25372
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
25373
|
-
_wrap_native_super = function _wrap_native_super(Class) {
|
|
25374
|
-
if (Class === null || !_is_native_function(Class)) return Class;
|
|
25375
|
-
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
25376
|
-
if (typeof _cache !== "undefined") {
|
|
25377
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
25378
|
-
_cache.set(Class, Wrapper);
|
|
25379
|
-
}
|
|
25380
|
-
function Wrapper() {
|
|
25381
|
-
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
25382
|
-
}
|
|
25383
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
25384
|
-
constructor: {
|
|
25385
|
-
value: Wrapper,
|
|
25386
|
-
enumerable: false,
|
|
25387
|
-
writable: true,
|
|
25388
|
-
configurable: true
|
|
25389
|
-
}
|
|
25390
|
-
});
|
|
25391
|
-
return _set_prototype_of(Wrapper, Class);
|
|
25392
|
-
};
|
|
25393
|
-
return _wrap_native_super(Class);
|
|
25394
|
-
}
|
|
25395
|
-
|
|
25396
26646
|
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
25397
26647
|
_inherits(CameraVFXItemLoader, Plugin);
|
|
25398
26648
|
function CameraVFXItemLoader() {
|
|
@@ -25413,142 +26663,202 @@ var PointerEventType;
|
|
|
25413
26663
|
})(PointerEventType || (PointerEventType = {}));
|
|
25414
26664
|
var EventSystem = /*#__PURE__*/ function() {
|
|
25415
26665
|
function EventSystem(engine, allowPropagation) {
|
|
26666
|
+
var _this = this;
|
|
25416
26667
|
if (allowPropagation === void 0) allowPropagation = false;
|
|
25417
26668
|
this.engine = engine;
|
|
25418
26669
|
this.allowPropagation = allowPropagation;
|
|
25419
|
-
this.enabled = true;
|
|
25420
26670
|
this.skipPointerMovePicking = true;
|
|
26671
|
+
this.emulateMouseFromTouch = true;
|
|
26672
|
+
this.emulateTouchFromMouse = false;
|
|
26673
|
+
this._enabled = true;
|
|
25421
26674
|
this.handlers = {};
|
|
25422
|
-
this.nativeHandlers =
|
|
26675
|
+
this.nativeHandlers = [];
|
|
25423
26676
|
this.target = null;
|
|
25424
|
-
|
|
25425
|
-
|
|
25426
|
-
|
|
25427
|
-
|
|
25428
|
-
this.
|
|
25429
|
-
|
|
25430
|
-
|
|
25431
|
-
|
|
25432
|
-
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
26677
|
+
this.mouseState = null;
|
|
26678
|
+
this.touchStates = new Map();
|
|
26679
|
+
this.mouseFromTouchIndex = null;
|
|
26680
|
+
this.touchFromMousePressed = false;
|
|
26681
|
+
this.addedTabIndex = false;
|
|
26682
|
+
this.addedOutlineStyle = false;
|
|
26683
|
+
this.onNativeWheel = function(event) {
|
|
26684
|
+
if (!_this.enabled || !_this.target) {
|
|
26685
|
+
return;
|
|
26686
|
+
}
|
|
26687
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26688
|
+
var handled = false;
|
|
26689
|
+
if (event.deltaY !== 0) {
|
|
26690
|
+
handled = _this.pushWheelButton(event.deltaY < 0 ? MouseButton.WheelUp : MouseButton.WheelDown, Math.abs(event.deltaY), position, event) || handled;
|
|
26691
|
+
}
|
|
26692
|
+
if (event.deltaX !== 0) {
|
|
26693
|
+
handled = _this.pushWheelButton(event.deltaX < 0 ? MouseButton.WheelLeft : MouseButton.WheelRight, Math.abs(event.deltaX), position, event) || handled;
|
|
26694
|
+
}
|
|
26695
|
+
_this.consumeNativeEvent(event, handled);
|
|
25436
26696
|
};
|
|
25437
|
-
|
|
25438
|
-
|
|
25439
|
-
|
|
25440
|
-
|
|
25441
|
-
|
|
25442
|
-
|
|
25443
|
-
|
|
25444
|
-
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
|
|
25448
|
-
|
|
25449
|
-
return
|
|
25450
|
-
x: x,
|
|
25451
|
-
y: y,
|
|
25452
|
-
vx: 0,
|
|
25453
|
-
vy: vy,
|
|
25454
|
-
dx: dx,
|
|
25455
|
-
dy: dy,
|
|
25456
|
-
ts: ts,
|
|
25457
|
-
width: 0,
|
|
25458
|
-
height: 0,
|
|
25459
|
-
origin: event
|
|
25460
|
-
};
|
|
26697
|
+
this.onNativeKeyDown = function(event) {
|
|
26698
|
+
_this.handleNativeKey(event, true);
|
|
26699
|
+
};
|
|
26700
|
+
this.onNativeKeyUp = function(event) {
|
|
26701
|
+
_this.handleNativeKey(event, false);
|
|
26702
|
+
};
|
|
26703
|
+
this.onNativeMouseDown = function(event) {
|
|
26704
|
+
_this.handleNativeMouseDown(event);
|
|
26705
|
+
};
|
|
26706
|
+
this.onNativeMouseMove = function(event) {
|
|
26707
|
+
var _state;
|
|
26708
|
+
if (!_this.enabled || !_this.target) {
|
|
26709
|
+
return;
|
|
25461
26710
|
}
|
|
25462
|
-
var
|
|
25463
|
-
|
|
25464
|
-
|
|
25465
|
-
|
|
25466
|
-
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
26711
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26712
|
+
var _this_mouseState;
|
|
26713
|
+
var state = (_this_mouseState = _this.mouseState) != null ? _this_mouseState : _this.createPointerState(position);
|
|
26714
|
+
_this.mouseState = state;
|
|
26715
|
+
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26716
|
+
var velocity = _this.getVelocity(state, position);
|
|
26717
|
+
var handled = _this.pushNativeMouseMotion(event, position, relative, velocity);
|
|
26718
|
+
(_state = state).controlHandled || (_state.controlHandled = handled);
|
|
26719
|
+
if (!handled && (!state.pressed || !state.controlHandled)) {
|
|
26720
|
+
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26721
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
26722
|
+
}
|
|
26723
|
+
_this.updatePointerState(state, position);
|
|
26724
|
+
_this.consumeNativeEvent(event, handled);
|
|
26725
|
+
};
|
|
26726
|
+
this.onNativeMouseUp = function(event) {
|
|
26727
|
+
if (!_this.enabled || !_this.target) {
|
|
26728
|
+
return;
|
|
25472
26729
|
}
|
|
25473
|
-
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
|
|
25477
|
-
|
|
25478
|
-
|
|
25479
|
-
|
|
25480
|
-
|
|
25481
|
-
|
|
25482
|
-
|
|
25483
|
-
|
|
25484
|
-
|
|
26730
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26731
|
+
var existingState = _this.mouseState;
|
|
26732
|
+
if (!(existingState == null ? void 0 : existingState.pressed)) {
|
|
26733
|
+
return;
|
|
26734
|
+
}
|
|
26735
|
+
var state = existingState;
|
|
26736
|
+
var handled = _this.pushNativeMouseButton(event, position, false);
|
|
26737
|
+
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26738
|
+
if (!state.controlHandled && !handled && _this.isClick(state, position)) {
|
|
26739
|
+
_this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26740
|
+
}
|
|
26741
|
+
if (!handled && !state.controlHandled) {
|
|
26742
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26743
|
+
}
|
|
26744
|
+
_this.mouseState = null;
|
|
26745
|
+
_this.consumeNativeEvent(event, handled || state.controlHandled || !_this.allowPropagation);
|
|
25485
26746
|
};
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
25497
|
-
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
|
|
25501
|
-
|
|
25502
|
-
y = cood.y;
|
|
25503
|
-
lastTouch = currentTouch = {
|
|
25504
|
-
clientX: touch.clientX,
|
|
25505
|
-
clientY: touch.clientY,
|
|
25506
|
-
ts: performance.now(),
|
|
25507
|
-
x: x,
|
|
25508
|
-
y: y
|
|
25509
|
-
};
|
|
25510
|
-
_this.dispatchEvent(EVENT_TYPE_TOUCH_START, getTouchEventValue(event, x, y));
|
|
25511
|
-
}
|
|
25512
|
-
}, _obj[touchmove] = function(event) {
|
|
25513
|
-
if (currentTouch && _this.enabled) {
|
|
25514
|
-
var cood = getCoord(getTouch(event));
|
|
25515
|
-
x = cood.x;
|
|
25516
|
-
y = cood.y;
|
|
25517
|
-
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, getTouchEventValue(event, x, y, x - currentTouch.x, y - currentTouch.y));
|
|
25518
|
-
}
|
|
25519
|
-
}, _obj[touchend] = function(event) {
|
|
25520
|
-
if (currentTouch && _this.enabled) {
|
|
25521
|
-
if (!_this.allowPropagation && event.cancelable) {
|
|
25522
|
-
event.preventDefault();
|
|
25523
|
-
event.stopPropagation();
|
|
26747
|
+
this.onNativeTouchStart = function(event) {
|
|
26748
|
+
if (!_this.enabled) {
|
|
26749
|
+
return;
|
|
26750
|
+
}
|
|
26751
|
+
_this.focusTarget();
|
|
26752
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26753
|
+
var touch = _step.value;
|
|
26754
|
+
var position = _this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26755
|
+
var state = _this.createPointerState(position);
|
|
26756
|
+
_this.touchStates.set(touch.identifier, state);
|
|
26757
|
+
state.pressed = true;
|
|
26758
|
+
var handled = _this.pushNativeScreenTouch(touch.identifier, position, true, false, false);
|
|
26759
|
+
state.controlHandled = handled;
|
|
26760
|
+
if (!handled) {
|
|
26761
|
+
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26762
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
25524
26763
|
}
|
|
25525
|
-
|
|
25526
|
-
|
|
25527
|
-
|
|
25528
|
-
|
|
25529
|
-
|
|
25530
|
-
|
|
25531
|
-
|
|
26764
|
+
_this.consumeNativeEvent(event, handled);
|
|
26765
|
+
}
|
|
26766
|
+
_this.preventTouchDefaults(event);
|
|
26767
|
+
};
|
|
26768
|
+
this.onNativeTouchMove = function(event) {
|
|
26769
|
+
if (!_this.enabled) {
|
|
26770
|
+
return;
|
|
26771
|
+
}
|
|
26772
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26773
|
+
var touch = _step.value;
|
|
26774
|
+
var _state;
|
|
26775
|
+
var position = _this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26776
|
+
var _this_touchStates_get;
|
|
26777
|
+
var state = (_this_touchStates_get = _this.touchStates.get(touch.identifier)) != null ? _this_touchStates_get : _this.createPointerState(position);
|
|
26778
|
+
_this.touchStates.set(touch.identifier, state);
|
|
26779
|
+
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26780
|
+
var velocity = _this.getVelocity(state, position);
|
|
26781
|
+
var handled = _this.pushNativeScreenDrag(touch.identifier, position, relative, velocity);
|
|
26782
|
+
(_state = state).controlHandled || (_state.controlHandled = handled);
|
|
26783
|
+
if (!handled && !state.controlHandled) {
|
|
26784
|
+
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26785
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
25532
26786
|
}
|
|
25533
|
-
_this.
|
|
25534
|
-
|
|
25535
|
-
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
|
|
25539
|
-
|
|
25540
|
-
|
|
26787
|
+
_this.updatePointerState(state, position);
|
|
26788
|
+
_this.consumeNativeEvent(event, handled);
|
|
26789
|
+
}
|
|
26790
|
+
_this.preventTouchDefaults(event);
|
|
26791
|
+
};
|
|
26792
|
+
this.onNativeTouchEnd = function(event) {
|
|
26793
|
+
_this.handleNativeTouchEnd(event, false);
|
|
26794
|
+
};
|
|
26795
|
+
this.onNativeTouchCancel = function(event) {
|
|
26796
|
+
_this.handleNativeTouchEnd(event, true);
|
|
26797
|
+
};
|
|
26798
|
+
this.onWindowBlur = function() {
|
|
26799
|
+
if (_this.enabled) {
|
|
26800
|
+
_this.mouseState = null;
|
|
26801
|
+
_this.touchStates.clear();
|
|
26802
|
+
_this.mouseFromTouchIndex = null;
|
|
26803
|
+
_this.touchFromMousePressed = false;
|
|
26804
|
+
_this.engine.windowRoot.cancelPointerInput();
|
|
26805
|
+
}
|
|
26806
|
+
};
|
|
26807
|
+
}
|
|
26808
|
+
var _proto = EventSystem.prototype;
|
|
26809
|
+
_proto.bindListeners = function bindListeners(target) {
|
|
26810
|
+
this.unbindListeners();
|
|
26811
|
+
this.target = target;
|
|
26812
|
+
if (!target || typeof window === "undefined") {
|
|
26813
|
+
return;
|
|
26814
|
+
}
|
|
26815
|
+
if (!target.hasAttribute("tabindex")) {
|
|
26816
|
+
target.tabIndex = 0;
|
|
26817
|
+
this.addedTabIndex = true;
|
|
26818
|
+
}
|
|
26819
|
+
if (!target.style.outline) {
|
|
26820
|
+
target.style.outline = "none";
|
|
26821
|
+
this.addedOutlineStyle = true;
|
|
26822
|
+
}
|
|
26823
|
+
this.addNativeHandler(target, "mousedown", this.onNativeMouseDown);
|
|
26824
|
+
// The Window listener runs after the event reaches the host container, so keep a
|
|
26825
|
+
// target listener to preserve notifyTouch/allowPropagation for in-canvas releases.
|
|
26826
|
+
this.addNativeHandler(target, "mouseup", this.onNativeMouseUp);
|
|
26827
|
+
this.addNativeHandler(window, "mouseup", this.onNativeMouseUp);
|
|
26828
|
+
this.addNativeHandler(window, "pointermove", this.onNativeMouseMove);
|
|
26829
|
+
this.addNativeHandler(target, "touchstart", this.onNativeTouchStart, {
|
|
26830
|
+
passive: false
|
|
26831
|
+
});
|
|
26832
|
+
this.addNativeHandler(target, "touchmove", this.onNativeTouchMove, {
|
|
26833
|
+
passive: false
|
|
26834
|
+
});
|
|
26835
|
+
this.addNativeHandler(target, "touchend", this.onNativeTouchEnd, {
|
|
26836
|
+
passive: false
|
|
26837
|
+
});
|
|
26838
|
+
this.addNativeHandler(target, "touchcancel", this.onNativeTouchCancel, {
|
|
26839
|
+
passive: false
|
|
25541
26840
|
});
|
|
25542
|
-
this.
|
|
25543
|
-
|
|
25544
|
-
|
|
25545
|
-
this.
|
|
26841
|
+
this.addNativeHandler(target, "wheel", this.onNativeWheel, {
|
|
26842
|
+
passive: false
|
|
26843
|
+
});
|
|
26844
|
+
this.addNativeHandler(target, "keydown", this.onNativeKeyDown);
|
|
26845
|
+
this.addNativeHandler(target, "keyup", this.onNativeKeyUp);
|
|
26846
|
+
this.addNativeHandler(window, "blur", this.onWindowBlur);
|
|
25546
26847
|
};
|
|
25547
26848
|
_proto.dispatchEvent = function dispatchEvent(type, event) {
|
|
25548
26849
|
var handlers = this.handlers[type];
|
|
25549
|
-
handlers == null ? void 0 : handlers.forEach(function(fn) {
|
|
26850
|
+
handlers == null ? void 0 : handlers.slice().forEach(function(fn) {
|
|
25550
26851
|
return fn(event);
|
|
25551
26852
|
});
|
|
26853
|
+
if (type === EVENT_TYPE_CLICK) {
|
|
26854
|
+
this.onClick(event);
|
|
26855
|
+
} else if (type === EVENT_TYPE_TOUCH_START) {
|
|
26856
|
+
this.onPointerDown(event);
|
|
26857
|
+
} else if (type === EVENT_TYPE_TOUCH_END) {
|
|
26858
|
+
this.onPointerUp(event);
|
|
26859
|
+
} else if (type === EVENT_TYPE_TOUCH_MOVE) {
|
|
26860
|
+
this.onPointerMove(event);
|
|
26861
|
+
}
|
|
25552
26862
|
};
|
|
25553
26863
|
_proto.addEventListener = function addEventListener(type, callback) {
|
|
25554
26864
|
var handlers = this.handlers[type];
|
|
@@ -25566,14 +26876,229 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25566
26876
|
removeItem(handlers, callback);
|
|
25567
26877
|
}
|
|
25568
26878
|
};
|
|
25569
|
-
_proto.
|
|
25570
|
-
|
|
26879
|
+
_proto.dispose = function dispose() {
|
|
26880
|
+
this.engine.windowRoot.cancelPointerInput();
|
|
26881
|
+
this.mouseState = null;
|
|
26882
|
+
this.touchStates.clear();
|
|
26883
|
+
this.mouseFromTouchIndex = null;
|
|
26884
|
+
this.touchFromMousePressed = false;
|
|
26885
|
+
this.handlers = {};
|
|
26886
|
+
this.unbindListeners();
|
|
26887
|
+
this.target = null;
|
|
26888
|
+
};
|
|
26889
|
+
_proto.handleNativeMouseDown = function handleNativeMouseDown(event) {
|
|
26890
|
+
if (!this.enabled || !this.target) {
|
|
26891
|
+
return;
|
|
26892
|
+
}
|
|
26893
|
+
var position = this.getCanvasPosition(event.clientX, event.clientY);
|
|
26894
|
+
this.focusTarget();
|
|
26895
|
+
var state = this.createPointerState(position);
|
|
26896
|
+
this.mouseState = state;
|
|
26897
|
+
state.pressed = true;
|
|
26898
|
+
var handled = this.pushNativeMouseButton(event, position, true);
|
|
26899
|
+
state.controlHandled = handled;
|
|
26900
|
+
if (!handled) {
|
|
26901
|
+
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26902
|
+
this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
26903
|
+
}
|
|
26904
|
+
this.consumeNativeEvent(event, handled);
|
|
26905
|
+
};
|
|
26906
|
+
_proto.handleNativeKey = function handleNativeKey(event, pressed) {
|
|
26907
|
+
if (!this.enabled) {
|
|
26908
|
+
return;
|
|
26909
|
+
}
|
|
26910
|
+
var input = new InputEventKey();
|
|
26911
|
+
input.device = InputEvent.deviceIdKeyboard;
|
|
26912
|
+
input.pressed = pressed;
|
|
26913
|
+
input.echo = pressed && event.repeat;
|
|
26914
|
+
input.keycode = event.key;
|
|
26915
|
+
input.physicalKeycode = event.code;
|
|
26916
|
+
input.keyLabel = event.key;
|
|
26917
|
+
input.unicode = getUnicode(event.key);
|
|
26918
|
+
input.location = getKeyLocation(event.location);
|
|
26919
|
+
input.shiftPressed = event.shiftKey;
|
|
26920
|
+
input.altPressed = event.altKey;
|
|
26921
|
+
input.metaPressed = event.metaKey;
|
|
26922
|
+
input.ctrlPressed = event.ctrlKey;
|
|
26923
|
+
this.engine.windowRoot.pushInput(input);
|
|
26924
|
+
this.consumeNativeEvent(event, this.engine.windowRoot.isInputHandled());
|
|
26925
|
+
};
|
|
26926
|
+
_proto.handleNativeTouchEnd = function handleNativeTouchEnd(event, canceled) {
|
|
26927
|
+
if (!this.enabled) {
|
|
26928
|
+
return;
|
|
26929
|
+
}
|
|
26930
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26931
|
+
var touch = _step.value;
|
|
26932
|
+
var position = this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26933
|
+
var state = this.touchStates.get(touch.identifier);
|
|
26934
|
+
if (!(state == null ? void 0 : state.pressed)) {
|
|
26935
|
+
continue;
|
|
26936
|
+
}
|
|
26937
|
+
var handled = this.pushNativeScreenTouch(touch.identifier, position, false, canceled, false);
|
|
26938
|
+
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26939
|
+
if (!canceled && !state.controlHandled && !handled && this.isClick(state, position)) {
|
|
26940
|
+
this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26941
|
+
}
|
|
26942
|
+
if (!handled && !canceled && !state.controlHandled) {
|
|
26943
|
+
this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26944
|
+
}
|
|
26945
|
+
this.touchStates.delete(touch.identifier);
|
|
26946
|
+
this.consumeNativeEvent(event, handled || state.controlHandled || !this.allowPropagation);
|
|
26947
|
+
}
|
|
26948
|
+
this.preventTouchDefaults(event);
|
|
26949
|
+
};
|
|
26950
|
+
_proto.pushNativeMouseButton = function pushNativeMouseButton(event, position, pressed) {
|
|
26951
|
+
var handled = false;
|
|
26952
|
+
var button = getMouseButton(event.button);
|
|
26953
|
+
if (pressed && this.emulateTouchFromMouse && button === MouseButton.Left) {
|
|
26954
|
+
this.touchFromMousePressed = true;
|
|
26955
|
+
}
|
|
26956
|
+
if (this.touchFromMousePressed && button === MouseButton.Left) {
|
|
26957
|
+
handled = this.pushScreenTouch(0, position, pressed, false, event.detail > 1, InputEvent.deviceIdEmulation);
|
|
26958
|
+
if (!pressed) {
|
|
26959
|
+
this.touchFromMousePressed = false;
|
|
26960
|
+
}
|
|
26961
|
+
}
|
|
26962
|
+
return this.pushMouseButton(event, position, pressed) || handled;
|
|
26963
|
+
};
|
|
26964
|
+
_proto.pushNativeMouseMotion = function pushNativeMouseMotion(event, position, relative, velocity) {
|
|
26965
|
+
var handled = false;
|
|
26966
|
+
if (this.touchFromMousePressed && (event.buttons & 1) !== 0) {
|
|
26967
|
+
handled = this.pushScreenDrag(0, position, relative, velocity, InputEvent.deviceIdEmulation);
|
|
26968
|
+
}
|
|
26969
|
+
return this.pushMouseMotion(event, position, relative, velocity) || handled;
|
|
26970
|
+
};
|
|
26971
|
+
_proto.pushNativeScreenTouch = function pushNativeScreenTouch(index, position, pressed, canceled, doubleTap) {
|
|
26972
|
+
var handled = false;
|
|
26973
|
+
var emulateMouse = false;
|
|
26974
|
+
if (pressed && this.emulateMouseFromTouch && this.mouseFromTouchIndex === null) {
|
|
26975
|
+
this.mouseFromTouchIndex = index;
|
|
26976
|
+
emulateMouse = true;
|
|
26977
|
+
} else if (!pressed && this.mouseFromTouchIndex === index) {
|
|
26978
|
+
emulateMouse = true;
|
|
26979
|
+
this.mouseFromTouchIndex = null;
|
|
26980
|
+
}
|
|
26981
|
+
if (emulateMouse) {
|
|
26982
|
+
handled = this.pushEmulatedMouseButton(position, pressed, canceled, doubleTap);
|
|
26983
|
+
}
|
|
26984
|
+
return this.pushScreenTouch(index, position, pressed, canceled, doubleTap, 0) || handled;
|
|
26985
|
+
};
|
|
26986
|
+
_proto.pushNativeScreenDrag = function pushNativeScreenDrag(index, position, relative, velocity) {
|
|
26987
|
+
var handled = false;
|
|
26988
|
+
if (this.emulateMouseFromTouch && this.mouseFromTouchIndex === index) {
|
|
26989
|
+
handled = this.pushEmulatedMouseMotion(position, relative, velocity);
|
|
26990
|
+
}
|
|
26991
|
+
return this.pushScreenDrag(index, position, relative, velocity, 0) || handled;
|
|
26992
|
+
};
|
|
26993
|
+
_proto.pushEmulatedMouseButton = function pushEmulatedMouseButton(position, pressed, canceled, doubleClick) {
|
|
26994
|
+
var input = new InputEventMouseButton();
|
|
26995
|
+
input.device = InputEvent.deviceIdEmulation;
|
|
26996
|
+
input.position.copyFrom(position);
|
|
26997
|
+
input.globalPosition.copyFrom(position);
|
|
26998
|
+
input.buttonIndex = MouseButton.Left;
|
|
26999
|
+
input.buttonMask = pressed ? MouseButtonMask.Left : MouseButtonMask.None;
|
|
27000
|
+
input.pressed = pressed;
|
|
27001
|
+
input.canceled = canceled;
|
|
27002
|
+
input.doubleClick = doubleClick;
|
|
27003
|
+
this.engine.windowRoot.pushInput(input);
|
|
27004
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27005
|
+
};
|
|
27006
|
+
_proto.pushEmulatedMouseMotion = function pushEmulatedMouseMotion(position, relative, velocity) {
|
|
27007
|
+
var input = new InputEventMouseMotion();
|
|
27008
|
+
input.device = InputEvent.deviceIdEmulation;
|
|
27009
|
+
input.position.copyFrom(position);
|
|
27010
|
+
input.globalPosition.copyFrom(position);
|
|
27011
|
+
input.buttonMask = MouseButtonMask.Left;
|
|
27012
|
+
input.pressed = true;
|
|
27013
|
+
input.relative.copyFrom(relative);
|
|
27014
|
+
input.screenRelative.copyFrom(relative);
|
|
27015
|
+
input.velocity.copyFrom(velocity);
|
|
27016
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27017
|
+
this.engine.windowRoot.pushInput(input);
|
|
27018
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27019
|
+
};
|
|
27020
|
+
_proto.pushMouseButton = function pushMouseButton(event, position, pressed) {
|
|
27021
|
+
var input = new InputEventMouseButton();
|
|
27022
|
+
this.copyMouseFields(input, event, position);
|
|
27023
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27024
|
+
input.buttonIndex = getMouseButton(event.button);
|
|
27025
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27026
|
+
if (pressed) {
|
|
27027
|
+
input.buttonMask |= getMouseButtonBit(input.buttonIndex);
|
|
27028
|
+
} else {
|
|
27029
|
+
input.buttonMask &= ~getMouseButtonBit(input.buttonIndex);
|
|
27030
|
+
}
|
|
27031
|
+
input.pressed = pressed;
|
|
27032
|
+
input.doubleClick = event.detail > 1;
|
|
27033
|
+
this.engine.windowRoot.pushInput(input);
|
|
27034
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27035
|
+
};
|
|
27036
|
+
_proto.pushWheelButton = function pushWheelButton(button, factor, position, event) {
|
|
27037
|
+
var input = new InputEventMouseButton();
|
|
27038
|
+
this.copyMouseFields(input, event, position);
|
|
27039
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27040
|
+
input.buttonIndex = button;
|
|
27041
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27042
|
+
input.factor = factor;
|
|
27043
|
+
input.pressed = true;
|
|
27044
|
+
this.engine.windowRoot.pushInput(input);
|
|
27045
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27046
|
+
};
|
|
27047
|
+
_proto.pushMouseMotion = function pushMouseMotion(event, position, relative, velocity) {
|
|
27048
|
+
var input = new InputEventMouseMotion();
|
|
27049
|
+
this.copyMouseFields(input, event, position);
|
|
27050
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27051
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27052
|
+
input.pressed = event.buttons !== 0;
|
|
27053
|
+
input.relative.copyFrom(relative);
|
|
27054
|
+
input.screenRelative.copyFrom(relative);
|
|
27055
|
+
input.velocity.copyFrom(velocity);
|
|
27056
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27057
|
+
if ("pressure" in event) {
|
|
27058
|
+
input.pressure = event.pressure;
|
|
27059
|
+
input.tilt.set(event.tiltX, event.tiltY);
|
|
27060
|
+
}
|
|
27061
|
+
this.engine.windowRoot.pushInput(input);
|
|
27062
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27063
|
+
};
|
|
27064
|
+
_proto.pushScreenTouch = function pushScreenTouch(index, position, pressed, canceled, doubleTap, device) {
|
|
27065
|
+
var input = new InputEventScreenTouch();
|
|
27066
|
+
input.index = index;
|
|
27067
|
+
input.device = device;
|
|
27068
|
+
input.position.copyFrom(position);
|
|
27069
|
+
input.pressed = pressed;
|
|
27070
|
+
input.canceled = canceled;
|
|
27071
|
+
input.doubleTap = doubleTap;
|
|
27072
|
+
this.engine.windowRoot.pushInput(input);
|
|
27073
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27074
|
+
};
|
|
27075
|
+
_proto.pushScreenDrag = function pushScreenDrag(index, position, relative, velocity, device) {
|
|
27076
|
+
var input = new InputEventScreenDrag();
|
|
27077
|
+
input.index = index;
|
|
27078
|
+
input.device = device;
|
|
27079
|
+
input.position.copyFrom(position);
|
|
27080
|
+
input.relative.copyFrom(relative);
|
|
27081
|
+
input.screenRelative.copyFrom(relative);
|
|
27082
|
+
input.velocity.copyFrom(velocity);
|
|
27083
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27084
|
+
input.pressed = true;
|
|
27085
|
+
this.engine.windowRoot.pushInput(input);
|
|
27086
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27087
|
+
};
|
|
27088
|
+
_proto.copyMouseFields = function copyMouseFields(input, event, position) {
|
|
27089
|
+
input.position.copyFrom(position);
|
|
27090
|
+
input.globalPosition.copyFrom(position);
|
|
27091
|
+
input.shiftPressed = event.shiftKey;
|
|
27092
|
+
input.altPressed = event.altKey;
|
|
27093
|
+
input.metaPressed = event.metaKey;
|
|
27094
|
+
input.ctrlPressed = event.ctrlKey;
|
|
27095
|
+
};
|
|
27096
|
+
_proto.onClick = function onClick(event) {
|
|
25571
27097
|
var hitResults = [];
|
|
25572
|
-
// 收集所有的点击测试结果,click 回调执行可能会对 composition 点击结果有影响,放在点击测试执行完后再统一触发。
|
|
25573
27098
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.engine.compositions), _step; !(_step = _iterator()).done;){
|
|
25574
27099
|
var composition = _step.value;
|
|
25575
27100
|
var _hitResults;
|
|
25576
|
-
(_hitResults = hitResults).push.apply(_hitResults, [].concat(composition.hitTest(x, y)));
|
|
27101
|
+
(_hitResults = hitResults).push.apply(_hitResults, [].concat(composition.hitTest(event.x, event.y)));
|
|
25577
27102
|
}
|
|
25578
27103
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(hitResults), _step1; !(_step1 = _iterator1()).done;){
|
|
25579
27104
|
var hitResult = _step1.value;
|
|
@@ -25590,49 +27115,36 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25590
27115
|
this.engine.emit("click", clickInfo);
|
|
25591
27116
|
}
|
|
25592
27117
|
};
|
|
25593
|
-
_proto.onPointerDown = function onPointerDown(
|
|
25594
|
-
this.handlePointerEvent(
|
|
27118
|
+
_proto.onPointerDown = function onPointerDown(event) {
|
|
27119
|
+
this.handlePointerEvent(event, 0);
|
|
25595
27120
|
};
|
|
25596
|
-
_proto.onPointerUp = function onPointerUp(
|
|
25597
|
-
this.handlePointerEvent(
|
|
27121
|
+
_proto.onPointerUp = function onPointerUp(event) {
|
|
27122
|
+
this.handlePointerEvent(event, 1);
|
|
25598
27123
|
};
|
|
25599
|
-
_proto.onPointerMove = function onPointerMove(
|
|
25600
|
-
this.handlePointerEvent(
|
|
27124
|
+
_proto.onPointerMove = function onPointerMove(event) {
|
|
27125
|
+
this.handlePointerEvent(event, 2);
|
|
25601
27126
|
};
|
|
25602
|
-
_proto.handlePointerEvent = function handlePointerEvent(
|
|
27127
|
+
_proto.handlePointerEvent = function handlePointerEvent(event, type) {
|
|
25603
27128
|
var hitRegion = null;
|
|
25604
|
-
var x = e.x, y = e.y, width = e.width, height = e.height;
|
|
25605
27129
|
if (!(type === 2 && this.skipPointerMovePicking)) {
|
|
25606
27130
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.engine.compositions), _step; !(_step = _iterator()).done;){
|
|
25607
27131
|
var composition = _step.value;
|
|
25608
|
-
var regions = composition.hitTest(x, y);
|
|
27132
|
+
var regions = composition.hitTest(event.x, event.y);
|
|
25609
27133
|
if (regions.length > 0) {
|
|
25610
27134
|
hitRegion = regions[regions.length - 1];
|
|
25611
27135
|
}
|
|
25612
27136
|
}
|
|
25613
27137
|
}
|
|
25614
27138
|
var eventData = new PointerEventData();
|
|
25615
|
-
eventData.position.x = (x + 1) / 2 * width;
|
|
25616
|
-
eventData.position.y = (y + 1) / 2 * height;
|
|
25617
|
-
eventData.delta.x =
|
|
25618
|
-
eventData.delta.y =
|
|
25619
|
-
var raycast = eventData.pointerCurrentRaycast;
|
|
27139
|
+
eventData.position.x = (event.x + 1) / 2 * event.width;
|
|
27140
|
+
eventData.position.y = (event.y + 1) / 2 * event.height;
|
|
27141
|
+
eventData.delta.x = event.vx * event.width;
|
|
27142
|
+
eventData.delta.y = event.vy * event.height;
|
|
25620
27143
|
if (hitRegion) {
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
}
|
|
25624
|
-
var eventName = "pointerdown";
|
|
25625
|
-
switch(type){
|
|
25626
|
-
case 0:
|
|
25627
|
-
eventName = "pointerdown";
|
|
25628
|
-
break;
|
|
25629
|
-
case 1:
|
|
25630
|
-
eventName = "pointerup";
|
|
25631
|
-
break;
|
|
25632
|
-
case 2:
|
|
25633
|
-
eventName = "pointermove";
|
|
25634
|
-
break;
|
|
27144
|
+
eventData.pointerCurrentRaycast.point = hitRegion.position;
|
|
27145
|
+
eventData.pointerCurrentRaycast.item = hitRegion.item;
|
|
25635
27146
|
}
|
|
27147
|
+
var eventName = type === 0 ? "pointerdown" : type === 1 ? "pointerup" : "pointermove";
|
|
25636
27148
|
if (hitRegion) {
|
|
25637
27149
|
var hitItem = hitRegion.item;
|
|
25638
27150
|
var hitComposition = hitItem.composition;
|
|
@@ -25641,29 +27153,185 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25641
27153
|
this.engine.emit(eventName, eventData);
|
|
25642
27154
|
}
|
|
25643
27155
|
};
|
|
25644
|
-
_proto.
|
|
25645
|
-
var
|
|
25646
|
-
|
|
25647
|
-
|
|
25648
|
-
|
|
25649
|
-
|
|
25650
|
-
|
|
25651
|
-
|
|
25652
|
-
|
|
27156
|
+
_proto.createPointerState = function createPointerState(position) {
|
|
27157
|
+
var state = {
|
|
27158
|
+
start: position.clone(),
|
|
27159
|
+
last: position.clone(),
|
|
27160
|
+
lastTime: performance.now(),
|
|
27161
|
+
controlHandled: false,
|
|
27162
|
+
pressed: false
|
|
27163
|
+
};
|
|
27164
|
+
return state;
|
|
27165
|
+
};
|
|
27166
|
+
_proto.updatePointerState = function updatePointerState(state, position) {
|
|
27167
|
+
state.last.copyFrom(position);
|
|
27168
|
+
state.lastTime = performance.now();
|
|
27169
|
+
};
|
|
27170
|
+
_proto.getVelocity = function getVelocity(state, position) {
|
|
27171
|
+
var elapsed = Math.max(performance.now() - state.lastTime, 1);
|
|
27172
|
+
return new Vector2((position.x - state.last.x) / elapsed, (position.y - state.last.y) / elapsed);
|
|
27173
|
+
};
|
|
27174
|
+
_proto.isClick = function isClick(state, position) {
|
|
27175
|
+
return Math.abs(position.x - state.start.x) + Math.abs(position.y - state.start.y) < 4;
|
|
27176
|
+
};
|
|
27177
|
+
_proto.createPointerEvent = function createPointerEvent(origin, position, state, velocity) {
|
|
27178
|
+
if (velocity === void 0) velocity = new Vector2();
|
|
27179
|
+
var target = this.target;
|
|
27180
|
+
var rect = target == null ? void 0 : target.getBoundingClientRect();
|
|
27181
|
+
var cssWidth = (rect == null ? void 0 : rect.width) || 1;
|
|
27182
|
+
var cssHeight = (rect == null ? void 0 : rect.height) || 1;
|
|
27183
|
+
var _target_width, _target_height;
|
|
27184
|
+
return {
|
|
27185
|
+
x: position.x / cssWidth * 2 - 1,
|
|
27186
|
+
// Legacy composition picking uses bottom-left, Y-up NDC even though GUI
|
|
27187
|
+
// input follows the DOM convention of top-left, Y-down pixels.
|
|
27188
|
+
y: 1 - position.y / cssHeight * 2,
|
|
27189
|
+
vx: velocity.x / cssWidth * 2,
|
|
27190
|
+
vy: -velocity.y / cssHeight * 2,
|
|
27191
|
+
ts: performance.now(),
|
|
27192
|
+
dx: (position.x - state.start.x) / cssWidth * 2,
|
|
27193
|
+
dy: -(position.y - state.start.y) / cssHeight * 2,
|
|
27194
|
+
width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
|
|
27195
|
+
height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
|
|
27196
|
+
origin: origin
|
|
27197
|
+
};
|
|
27198
|
+
};
|
|
27199
|
+
_proto.getCanvasPosition = function getCanvasPosition(clientX, clientY) {
|
|
27200
|
+
var _this_target;
|
|
27201
|
+
var rect = (_this_target = this.target) == null ? void 0 : _this_target.getBoundingClientRect();
|
|
27202
|
+
if (!rect) {
|
|
27203
|
+
return new Vector2();
|
|
25653
27204
|
}
|
|
27205
|
+
return new Vector2(clientX - rect.left, clientY - rect.top);
|
|
25654
27206
|
};
|
|
27207
|
+
_proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
|
|
27208
|
+
if (handled && !this.allowPropagation) {
|
|
27209
|
+
if (event.cancelable) {
|
|
27210
|
+
event.preventDefault();
|
|
27211
|
+
}
|
|
27212
|
+
event.stopPropagation();
|
|
27213
|
+
}
|
|
27214
|
+
};
|
|
27215
|
+
_proto.preventTouchDefaults = function preventTouchDefaults(event) {
|
|
27216
|
+
if (event.cancelable) {
|
|
27217
|
+
event.preventDefault();
|
|
27218
|
+
}
|
|
27219
|
+
};
|
|
27220
|
+
_proto.focusTarget = function focusTarget() {
|
|
27221
|
+
var _this_target;
|
|
27222
|
+
(_this_target = this.target) == null ? void 0 : _this_target.focus();
|
|
27223
|
+
};
|
|
27224
|
+
_proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
|
|
27225
|
+
target.addEventListener(name, handler, options);
|
|
27226
|
+
this.nativeHandlers.push({
|
|
27227
|
+
target: target,
|
|
27228
|
+
name: name,
|
|
27229
|
+
handler: handler,
|
|
27230
|
+
options: options
|
|
27231
|
+
});
|
|
27232
|
+
};
|
|
27233
|
+
_proto.unbindListeners = function unbindListeners() {
|
|
27234
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.nativeHandlers), _step; !(_step = _iterator()).done;){
|
|
27235
|
+
var nativeHandler = _step.value;
|
|
27236
|
+
nativeHandler.target.removeEventListener(nativeHandler.name, nativeHandler.handler, nativeHandler.options);
|
|
27237
|
+
}
|
|
27238
|
+
this.nativeHandlers = [];
|
|
27239
|
+
if (this.addedTabIndex && this.target) {
|
|
27240
|
+
this.target.removeAttribute("tabindex");
|
|
27241
|
+
}
|
|
27242
|
+
if (this.addedOutlineStyle && this.target) {
|
|
27243
|
+
this.target.style.removeProperty("outline");
|
|
27244
|
+
}
|
|
27245
|
+
this.addedTabIndex = false;
|
|
27246
|
+
this.addedOutlineStyle = false;
|
|
27247
|
+
};
|
|
27248
|
+
_create_class(EventSystem, [
|
|
27249
|
+
{
|
|
27250
|
+
key: "enabled",
|
|
27251
|
+
get: function get() {
|
|
27252
|
+
return this._enabled;
|
|
27253
|
+
},
|
|
27254
|
+
set: function set(value) {
|
|
27255
|
+
if (this._enabled === value) {
|
|
27256
|
+
return;
|
|
27257
|
+
}
|
|
27258
|
+
this._enabled = value;
|
|
27259
|
+
if (!value) {
|
|
27260
|
+
this.mouseState = null;
|
|
27261
|
+
this.touchStates.clear();
|
|
27262
|
+
this.mouseFromTouchIndex = null;
|
|
27263
|
+
this.touchFromMousePressed = false;
|
|
27264
|
+
this.engine.windowRoot.cancelPointerInput();
|
|
27265
|
+
}
|
|
27266
|
+
}
|
|
27267
|
+
}
|
|
27268
|
+
]);
|
|
25655
27269
|
return EventSystem;
|
|
25656
27270
|
}();
|
|
25657
|
-
function
|
|
25658
|
-
|
|
25659
|
-
|
|
25660
|
-
|
|
25661
|
-
|
|
25662
|
-
|
|
25663
|
-
|
|
25664
|
-
|
|
25665
|
-
|
|
25666
|
-
|
|
27271
|
+
function getKeyLocation(location) {
|
|
27272
|
+
if (location === 1) {
|
|
27273
|
+
return KeyLocation.Left;
|
|
27274
|
+
}
|
|
27275
|
+
if (location === 2) {
|
|
27276
|
+
return KeyLocation.Right;
|
|
27277
|
+
}
|
|
27278
|
+
return KeyLocation.Unspecified;
|
|
27279
|
+
}
|
|
27280
|
+
function getUnicode(key) {
|
|
27281
|
+
var characters = Array.from(key);
|
|
27282
|
+
var _characters__codePointAt;
|
|
27283
|
+
return characters.length === 1 ? (_characters__codePointAt = characters[0].codePointAt(0)) != null ? _characters__codePointAt : 0 : 0;
|
|
27284
|
+
}
|
|
27285
|
+
function getMouseButton(button) {
|
|
27286
|
+
switch(button){
|
|
27287
|
+
case 0:
|
|
27288
|
+
return MouseButton.Left;
|
|
27289
|
+
case 1:
|
|
27290
|
+
return MouseButton.Middle;
|
|
27291
|
+
case 2:
|
|
27292
|
+
return MouseButton.Right;
|
|
27293
|
+
case 3:
|
|
27294
|
+
return MouseButton.Xbutton1;
|
|
27295
|
+
case 4:
|
|
27296
|
+
return MouseButton.Xbutton2;
|
|
27297
|
+
default:
|
|
27298
|
+
return MouseButton.None;
|
|
27299
|
+
}
|
|
27300
|
+
}
|
|
27301
|
+
function getMouseButtonMask(buttons) {
|
|
27302
|
+
var mask = MouseButtonMask.None;
|
|
27303
|
+
if ((buttons & 1) !== 0) {
|
|
27304
|
+
mask |= MouseButtonMask.Left;
|
|
27305
|
+
}
|
|
27306
|
+
if ((buttons & 2) !== 0) {
|
|
27307
|
+
mask |= MouseButtonMask.Right;
|
|
27308
|
+
}
|
|
27309
|
+
if ((buttons & 4) !== 0) {
|
|
27310
|
+
mask |= MouseButtonMask.Middle;
|
|
27311
|
+
}
|
|
27312
|
+
if ((buttons & 8) !== 0) {
|
|
27313
|
+
mask |= MouseButtonMask.Xbutton1;
|
|
27314
|
+
}
|
|
27315
|
+
if ((buttons & 16) !== 0) {
|
|
27316
|
+
mask |= MouseButtonMask.Xbutton2;
|
|
27317
|
+
}
|
|
27318
|
+
return mask;
|
|
27319
|
+
}
|
|
27320
|
+
function getMouseButtonBit(button) {
|
|
27321
|
+
switch(button){
|
|
27322
|
+
case MouseButton.Left:
|
|
27323
|
+
return MouseButtonMask.Left;
|
|
27324
|
+
case MouseButton.Right:
|
|
27325
|
+
return MouseButtonMask.Right;
|
|
27326
|
+
case MouseButton.Middle:
|
|
27327
|
+
return MouseButtonMask.Middle;
|
|
27328
|
+
case MouseButton.Xbutton1:
|
|
27329
|
+
return MouseButtonMask.Xbutton1;
|
|
27330
|
+
case MouseButton.Xbutton2:
|
|
27331
|
+
return MouseButtonMask.Xbutton2;
|
|
27332
|
+
default:
|
|
27333
|
+
return MouseButtonMask.None;
|
|
27334
|
+
}
|
|
25667
27335
|
}
|
|
25668
27336
|
|
|
25669
27337
|
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
@@ -27684,11 +29352,6 @@ SpritePropertyTrack = __decorate([
|
|
|
27684
29352
|
effectsClass("SpritePropertyTrack")
|
|
27685
29353
|
], SpritePropertyTrack);
|
|
27686
29354
|
|
|
27687
|
-
function _assert_this_initialized(self) {
|
|
27688
|
-
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
27689
|
-
return self;
|
|
27690
|
-
}
|
|
27691
|
-
|
|
27692
29355
|
var Cone = /*#__PURE__*/ function() {
|
|
27693
29356
|
function Cone(props) {
|
|
27694
29357
|
var _this = this;
|
|
@@ -37693,7 +39356,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
37693
39356
|
return ret;
|
|
37694
39357
|
}
|
|
37695
39358
|
|
|
37696
|
-
var version$2 = "2.10.0-alpha.
|
|
39359
|
+
var version$2 = "2.10.0-alpha.4";
|
|
37697
39360
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
37698
39361
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
37699
39362
|
var reverseParticle = false;
|
|
@@ -39645,10 +41308,11 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39645
41308
|
_this./**
|
|
39646
41309
|
* 是否开启后处理
|
|
39647
41310
|
*/ postProcessingEnabled = false;
|
|
39648
|
-
_this.canvasLayers = [];
|
|
39649
41311
|
_this.destroyed = false;
|
|
39650
41312
|
_this.paused = true;
|
|
39651
41313
|
_this.isEndCalled = false;
|
|
41314
|
+
_this._renderOrder = 0;
|
|
41315
|
+
_this._interactive = true;
|
|
39652
41316
|
_this._textures = [];
|
|
39653
41317
|
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;
|
|
39654
41318
|
_this.engine.addComposition(_assert_this_initialized(_this));
|
|
@@ -39681,13 +41345,14 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39681
41345
|
_this.root = new VFXItem(_this.engine);
|
|
39682
41346
|
_this.root.name = "root";
|
|
39683
41347
|
_this.root.composition = _assert_this_initialized(_this);
|
|
41348
|
+
_this.root.setParent(_this.engine.root);
|
|
39684
41349
|
_this.pluginRoot = new VFXItem(_this.engine);
|
|
39685
41350
|
_this.pluginRoot.name = "pluginRoot";
|
|
39686
41351
|
_this.pluginRoot.setParent(_this.root);
|
|
39687
|
-
_this.pluginRoot.addComponent(CanvasLayer);
|
|
39688
41352
|
// Instantiate composition rootItem
|
|
39689
41353
|
_this.sceneRoot = new VFXItem(_this.engine);
|
|
39690
41354
|
_this.sceneRoot.setParent(_this.root);
|
|
41355
|
+
_this.uiCanvas = _this.sceneRoot.addComponent(UICanvas);
|
|
39691
41356
|
if (sourceContent) {
|
|
39692
41357
|
_this.sceneRoot.setInstanceId(sourceContent.id);
|
|
39693
41358
|
_this.sceneRoot.instantiatePreComposition(sourceContent, false);
|
|
@@ -39886,9 +41551,13 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39886
41551
|
this.isEndCalled = false;
|
|
39887
41552
|
this.rootComposition.setTime(0);
|
|
39888
41553
|
};
|
|
39889
|
-
_proto.render = function render() {
|
|
41554
|
+
/** Renders this Composition content. Screen-space UI is rendered by Engine. */ _proto.render = function render() {
|
|
41555
|
+
this.renderContent();
|
|
41556
|
+
};
|
|
41557
|
+
/**
|
|
41558
|
+
* Renders only the Composition scene content.
|
|
41559
|
+
*/ _proto.renderContent = function renderContent() {
|
|
39890
41560
|
this.renderer.renderRenderFrame(this.renderFrame);
|
|
39891
|
-
this.renderCanvasLayers();
|
|
39892
41561
|
};
|
|
39893
41562
|
/**
|
|
39894
41563
|
* 合成更新,针对所有 item 的更新
|
|
@@ -39977,17 +41646,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39977
41646
|
}
|
|
39978
41647
|
}
|
|
39979
41648
|
};
|
|
39980
|
-
_proto.renderCanvasLayers = function renderCanvasLayers() {
|
|
39981
|
-
this.engine.graphics.begin();
|
|
39982
|
-
this.canvasLayers.sort(function(leftLayer, rightLayer) {
|
|
39983
|
-
return leftLayer.layer - rightLayer.layer;
|
|
39984
|
-
});
|
|
39985
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvasLayers), _step; !(_step = _iterator()).done;){
|
|
39986
|
-
var canvasLayer = _step.value;
|
|
39987
|
-
canvasLayer.draw();
|
|
39988
|
-
}
|
|
39989
|
-
this.engine.graphics.end();
|
|
39990
|
-
};
|
|
39991
41649
|
/**
|
|
39992
41650
|
* @internal
|
|
39993
41651
|
*/ _proto.createTexturesFromData = function createTexturesFromData(textureDataList) {
|
|
@@ -40256,6 +41914,35 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
40256
41914
|
})();
|
|
40257
41915
|
};
|
|
40258
41916
|
_create_class(Composition, [
|
|
41917
|
+
{
|
|
41918
|
+
key: "renderOrder",
|
|
41919
|
+
get: /**
|
|
41920
|
+
* 合成渲染顺序,默认按升序渲染
|
|
41921
|
+
*/ function get() {
|
|
41922
|
+
return this._renderOrder;
|
|
41923
|
+
},
|
|
41924
|
+
set: function set(value) {
|
|
41925
|
+
this._renderOrder = value;
|
|
41926
|
+
if (this.uiCanvas) {
|
|
41927
|
+
this.uiCanvas.order = value;
|
|
41928
|
+
}
|
|
41929
|
+
}
|
|
41930
|
+
},
|
|
41931
|
+
{
|
|
41932
|
+
key: "interactive",
|
|
41933
|
+
get: /**
|
|
41934
|
+
* 合成内的元素否允许点击、拖拽交互
|
|
41935
|
+
* @since 1.6.0
|
|
41936
|
+
*/ function get() {
|
|
41937
|
+
return this._interactive;
|
|
41938
|
+
},
|
|
41939
|
+
set: function set(value) {
|
|
41940
|
+
this._interactive = !!value;
|
|
41941
|
+
if (this.uiCanvas) {
|
|
41942
|
+
this.uiCanvas.receivesEvents = this._interactive;
|
|
41943
|
+
}
|
|
41944
|
+
}
|
|
41945
|
+
},
|
|
40259
41946
|
{
|
|
40260
41947
|
key: "width",
|
|
40261
41948
|
get: /**
|
|
@@ -42033,7 +43720,6 @@ var DEFAULT_FPS = 60;
|
|
|
42033
43720
|
/**
|
|
42034
43721
|
* 渲染过程中错误队列
|
|
42035
43722
|
*/ _this.renderErrors = new Set();
|
|
42036
|
-
_this.compositions = [];
|
|
42037
43723
|
_this.assetManagers = [];
|
|
42038
43724
|
_this.env = "";
|
|
42039
43725
|
/**
|
|
@@ -42055,6 +43741,7 @@ var DEFAULT_FPS = 60;
|
|
|
42055
43741
|
_this.framebuffers = [];
|
|
42056
43742
|
_this.renderbuffers = [];
|
|
42057
43743
|
_this.particleSystems = [];
|
|
43744
|
+
_this._compositions = [];
|
|
42058
43745
|
_this.clearAction = {
|
|
42059
43746
|
stencilAction: TextureLoadAction.clear,
|
|
42060
43747
|
clearStencil: 0,
|
|
@@ -42079,6 +43766,9 @@ var DEFAULT_FPS = 60;
|
|
|
42079
43766
|
_this.pixelRatio = (_options_pixelRatio = options == null ? void 0 : options.pixelRatio) != null ? _options_pixelRatio : getPixelRatio();
|
|
42080
43767
|
_this.jsonSceneData = {};
|
|
42081
43768
|
_this.objectInstance = {};
|
|
43769
|
+
_this.root = new VFXItem(_assert_this_initialized(_this));
|
|
43770
|
+
_this.root.name = "root";
|
|
43771
|
+
_this.windowRoot = new WindowRootControl(_assert_this_initialized(_this));
|
|
42082
43772
|
_this.whiteTexture = generateWhiteTexture(_assert_this_initialized(_this));
|
|
42083
43773
|
_this.transparentTexture = generateEmptyTexture(_assert_this_initialized(_this));
|
|
42084
43774
|
if (!(options == null ? void 0 : options.manualRender)) {
|
|
@@ -42213,9 +43903,6 @@ var DEFAULT_FPS = 60;
|
|
|
42213
43903
|
// Sort compositions by index
|
|
42214
43904
|
//-------------------------------------------------------------------------
|
|
42215
43905
|
var compositions = this.compositions;
|
|
42216
|
-
compositions.sort(function(a, b) {
|
|
42217
|
-
return a.getIndex() - b.getIndex();
|
|
42218
|
-
});
|
|
42219
43906
|
var skipRender = false;
|
|
42220
43907
|
// Update Compositions
|
|
42221
43908
|
//-------------------------------------------------------------------------
|
|
@@ -42234,6 +43921,7 @@ var DEFAULT_FPS = 60;
|
|
|
42234
43921
|
(_this_ticker1 = this.ticker) == null ? void 0 : _this_ticker1.pause();
|
|
42235
43922
|
return;
|
|
42236
43923
|
}
|
|
43924
|
+
this.windowRoot.update(dt);
|
|
42237
43925
|
// Tick compositions onPreRender
|
|
42238
43926
|
//-------------------------------------------------------------------------
|
|
42239
43927
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -42246,8 +43934,9 @@ var DEFAULT_FPS = 60;
|
|
|
42246
43934
|
this.renderer.clear(this.clearAction);
|
|
42247
43935
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(compositions), _step2; !(_step2 = _iterator2()).done;){
|
|
42248
43936
|
var composition2 = _step2.value;
|
|
42249
|
-
composition2.
|
|
43937
|
+
composition2.renderContent();
|
|
42250
43938
|
}
|
|
43939
|
+
this.windowRoot.render();
|
|
42251
43940
|
this.renderTargetPool.flush();
|
|
42252
43941
|
};
|
|
42253
43942
|
/**
|
|
@@ -42289,6 +43978,7 @@ var DEFAULT_FPS = 60;
|
|
|
42289
43978
|
this.canvas.style.height = containerHeight + "px";
|
|
42290
43979
|
logger.info("Resize engine " + this.name + " [" + canvasWidth + "," + canvasHeight + "," + containerWidth + "," + containerHeight + "].");
|
|
42291
43980
|
this.setSize(canvasWidth, canvasHeight);
|
|
43981
|
+
this.windowRoot.resize(canvasWidth, canvasHeight);
|
|
42292
43982
|
}
|
|
42293
43983
|
};
|
|
42294
43984
|
_proto.setSize = function setSize(width, height) {
|
|
@@ -42296,7 +43986,7 @@ var DEFAULT_FPS = 60;
|
|
|
42296
43986
|
if (this.getWidth() !== width || this.getHeight() !== height) {
|
|
42297
43987
|
this.canvas.width = width;
|
|
42298
43988
|
this.canvas.height = height;
|
|
42299
|
-
this.
|
|
43989
|
+
this.setViewport(0, 0, width, height);
|
|
42300
43990
|
}
|
|
42301
43991
|
(_this_compositions = this.compositions) == null ? void 0 : _this_compositions.forEach(function(comp) {
|
|
42302
43992
|
comp.camera.aspect = width / height;
|
|
@@ -42325,6 +44015,26 @@ var DEFAULT_FPS = 60;
|
|
|
42325
44015
|
/** @hide */ _proto.bindBuffers = function bindBuffers(vertexBuffers, indexBuffer, effect) {
|
|
42326
44016
|
throw new Error("The active rendering backend cannot bind geometry buffers.");
|
|
42327
44017
|
};
|
|
44018
|
+
/**
|
|
44019
|
+
* 使用当前绑定的顶点和索引缓冲区绘制图元。
|
|
44020
|
+
* @param mode - 图元类型
|
|
44021
|
+
* @param indexOffset - 索引缓冲区中的字节偏移
|
|
44022
|
+
* @param indexCount - 索引数量
|
|
44023
|
+
* @param instanceCount - 实例数量
|
|
44024
|
+
* @hide
|
|
44025
|
+
*/ _proto.drawElementsType = function drawElementsType(mode, indexOffset, indexCount, instanceCount) {
|
|
44026
|
+
throw new Error("The active rendering backend cannot draw indexed primitives.");
|
|
44027
|
+
};
|
|
44028
|
+
/**
|
|
44029
|
+
* 使用当前绑定的顶点缓冲区绘制图元。
|
|
44030
|
+
* @param mode - 图元类型
|
|
44031
|
+
* @param vertexStart - 起始顶点
|
|
44032
|
+
* @param vertexCount - 顶点数量
|
|
44033
|
+
* @param instanceCount - 实例数量
|
|
44034
|
+
* @hide
|
|
44035
|
+
*/ _proto.drawArraysType = function drawArraysType(mode, vertexStart, vertexCount, instanceCount) {
|
|
44036
|
+
throw new Error("The active rendering backend cannot draw primitives.");
|
|
44037
|
+
};
|
|
42328
44038
|
_proto.addTexture = function addTexture(tex) {
|
|
42329
44039
|
if (this.disposed) {
|
|
42330
44040
|
return;
|
|
@@ -42456,15 +44166,12 @@ var DEFAULT_FPS = 60;
|
|
|
42456
44166
|
* @param height
|
|
42457
44167
|
* example:
|
|
42458
44168
|
* gl.viewport(0, 0, width, height);
|
|
42459
|
-
*/ _proto.
|
|
44169
|
+
*/ _proto.setViewport = function setViewport(x, y, width, height) {
|
|
42460
44170
|
// OVERRIDE
|
|
42461
44171
|
};
|
|
42462
44172
|
_proto.clear = function clear(action) {
|
|
42463
44173
|
// OVERRIDE
|
|
42464
44174
|
};
|
|
42465
|
-
_proto.drawGeometry = function drawGeometry(geometry, matrix, material, subMeshIndex) {
|
|
42466
|
-
// OVERRIDE
|
|
42467
|
-
};
|
|
42468
44175
|
/*** 渲染状态控制 ***/ _proto.setSampleAlphaToCoverage = function setSampleAlphaToCoverage(enable) {
|
|
42469
44176
|
// OVERRIDE
|
|
42470
44177
|
};
|
|
@@ -42549,6 +44256,12 @@ var DEFAULT_FPS = 60;
|
|
|
42549
44256
|
}
|
|
42550
44257
|
(_this_ticker = this.ticker) == null ? void 0 : _this_ticker.stop();
|
|
42551
44258
|
(_this_eventSystem = this.eventSystem) == null ? void 0 : _this_eventSystem.dispose();
|
|
44259
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this._compositions.slice()), _step; !(_step = _iterator()).done;){
|
|
44260
|
+
var composition = _step.value;
|
|
44261
|
+
composition.dispose();
|
|
44262
|
+
}
|
|
44263
|
+
this.root.dispose();
|
|
44264
|
+
this.windowRoot.dispose();
|
|
42552
44265
|
(_this_assetService = this.assetService) == null ? void 0 : _this_assetService.dispose();
|
|
42553
44266
|
(_this__graphics = this._graphics) == null ? void 0 : _this__graphics.dispose();
|
|
42554
44267
|
this.renderPasses.forEach(function(pass) {
|
|
@@ -42569,16 +44282,13 @@ var DEFAULT_FPS = 60;
|
|
|
42569
44282
|
this.assetManagers.forEach(function(assetManager) {
|
|
42570
44283
|
return assetManager.dispose();
|
|
42571
44284
|
});
|
|
42572
|
-
this.compositions.forEach(function(comp) {
|
|
42573
|
-
return comp.dispose();
|
|
42574
|
-
});
|
|
42575
44285
|
this.textures = [];
|
|
42576
44286
|
this.materials = [];
|
|
42577
44287
|
this.geometries = [];
|
|
42578
44288
|
this.meshes = [];
|
|
42579
44289
|
this.renderPasses = [];
|
|
42580
|
-
this.compositions = [];
|
|
42581
44290
|
this.particleSystems = [];
|
|
44291
|
+
this._compositions = [];
|
|
42582
44292
|
};
|
|
42583
44293
|
_proto.getTargetSize = function getTargetSize(parentEle) {
|
|
42584
44294
|
if (parentEle === undefined || parentEle === null) {
|
|
@@ -42631,6 +44341,14 @@ var DEFAULT_FPS = 60;
|
|
|
42631
44341
|
];
|
|
42632
44342
|
};
|
|
42633
44343
|
_create_class(Engine, [
|
|
44344
|
+
{
|
|
44345
|
+
key: "compositions",
|
|
44346
|
+
get: function get() {
|
|
44347
|
+
return this._compositions.sort(function(a, b) {
|
|
44348
|
+
return a.getIndex() - b.getIndex();
|
|
44349
|
+
});
|
|
44350
|
+
}
|
|
44351
|
+
},
|
|
42634
44352
|
{
|
|
42635
44353
|
key: "graphics",
|
|
42636
44354
|
get: function get() {
|
|
@@ -42868,7 +44586,7 @@ registerPlugin("text", TextLoader);
|
|
|
42868
44586
|
registerPlugin("sprite", SpriteLoader);
|
|
42869
44587
|
registerPlugin("particle", ParticleLoader);
|
|
42870
44588
|
registerPlugin("interact", InteractLoader);
|
|
42871
|
-
var version$1 = "2.10.0-alpha.
|
|
44589
|
+
var version$1 = "2.10.0-alpha.4";
|
|
42872
44590
|
logger.info("Core version: " + version$1 + ".");
|
|
42873
44591
|
|
|
42874
44592
|
var _obj;
|
|
@@ -43815,7 +45533,7 @@ function disposeThreeGeometry(source) {
|
|
|
43815
45533
|
return Composition.call(this, engine, props, scene);
|
|
43816
45534
|
}
|
|
43817
45535
|
var _proto = ThreeComposition.prototype;
|
|
43818
|
-
_proto.
|
|
45536
|
+
_proto.renderContent = function renderContent() {
|
|
43819
45537
|
var render = this.renderer;
|
|
43820
45538
|
var frame = this.renderFrame;
|
|
43821
45539
|
frame.renderPasses[0].meshes.length = 0;
|
|
@@ -43850,6 +45568,8 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
43850
45568
|
_proto.getHeight = function getHeight() {
|
|
43851
45569
|
return this.engine.canvas.height;
|
|
43852
45570
|
};
|
|
45571
|
+
_proto.drawGeometry = function drawGeometry(geometry, matrix, material, subMeshIndex) {
|
|
45572
|
+
};
|
|
43853
45573
|
return ThreeRenderer;
|
|
43854
45574
|
}(Renderer);
|
|
43855
45575
|
|
|
@@ -44359,8 +46079,8 @@ applyMixins(ThreeTextComponent, [
|
|
|
44359
46079
|
*/ Mesh.create = function(engine, props) {
|
|
44360
46080
|
return new ThreeMesh(engine, props);
|
|
44361
46081
|
};
|
|
44362
|
-
var version = "2.10.0-alpha.
|
|
46082
|
+
var version = "2.10.0-alpha.4";
|
|
44363
46083
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
44364
46084
|
|
|
44365
|
-
export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader,
|
|
46085
|
+
export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader, CanvasContainer, CanvasRenderMode, CanvasRootControl, Circle$1 as Circle, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ContainerControl, Control, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, CursorShape, DEFAULT_FONTS, DEFAULT_FPS, DataBuffer, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, FocusBehaviorRecursive, FocusMode, FrameComponent, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GlyphAtlas, GradientValue, GraphInstance, GraphNode, GraphNodeData, Graphics, GreaterNodeData, HELP_LINK, HitTestType, InputEvent, InputEventKey, InputEventMouse, InputEventMouseButton, InputEventMouseMotion, InputEventScreenDrag, InputEventScreenTouch, InputEventWithModifiers, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, KeyLocation, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialState, MaterialTrack, Mesh, MouseBehaviorRecursive, MouseButton, MouseButtonMask, MouseFilter, NodeTransform, NotNode, NotNodeData, NotifyEvent, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, Plugin, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, Precomposition, PrecompositionManager, PropertyClipPlayable, PropertyTrack, REFERENCE_CURVE, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, Rectangle$1 as Rectangle, ReferenceCurve, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RootControl, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SourceType, Sprite, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, SpritePropertyMixerPlayable, SpritePropertyPlayableAsset, SpritePropertyTrack, SpriteRotation, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TangentMode, TextCache, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, Triangle, TrimPath, TrimPathMode, UICanvas, UIControl, UpdateModes, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, VertexBuffer, WeightedMode, WindowRootControl, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, breakOpportunityAfter, buildBezierData, buildEasingCurve, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createTypedArray, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, extractMinAndMax, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTexture, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateWhiteTexture, getBackgroundImage, getBytesPerElement, getClass, getColorFromGradientStops, getConfig, getControlPoints, getDataByteLength, getDataType, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isBreakChar, isCJKLike, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSafeFontFamily, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, setUniformValue, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, toBufferView, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
44366
46086
|
//# sourceMappingURL=index.mjs.map
|