@galacean/effects-core 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/components/component.d.ts +4 -0
- package/dist/components/index.d.ts +2 -3
- package/dist/components/ui-canvas.d.ts +28 -0
- package/dist/components/ui-control.d.ts +38 -0
- package/dist/composition.d.ts +15 -5
- package/dist/engine.d.ts +30 -5
- package/dist/gui/control.d.ts +188 -0
- package/dist/gui/index.d.ts +2 -0
- package/dist/gui/roots.d.ts +79 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2812 -1083
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2798 -1080
- package/dist/index.mjs.map +1 -1
- package/dist/input/enums.d.ts +67 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/input-event.d.ts +78 -0
- package/dist/plugins/interact/event-system.d.ts +49 -2
- package/dist/render/graphics.d.ts +11 -10
- package/dist/render/text-cache.d.ts +8 -9
- package/dist/transform.d.ts +7 -0
- package/dist/vfx-item.d.ts +4 -0
- package/package.json +1 -1
- package/dist/components/canvas-item.d.ts +0 -131
- package/dist/components/canvas-layer.d.ts +0 -23
- package/dist/components/control.d.ts +0 -18
- package/dist/rect-transform.d.ts +0 -145
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.10.0-alpha.
|
|
6
|
+
* Version: v2.10.0-alpha.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -7052,6 +7052,11 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
7052
7052
|
// OVERRIDE
|
|
7053
7053
|
};
|
|
7054
7054
|
/**
|
|
7055
|
+
* Called when the owning item's sibling order changes.
|
|
7056
|
+
*/ _proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
7057
|
+
// OVERRIDE
|
|
7058
|
+
};
|
|
7059
|
+
/**
|
|
7055
7060
|
* @internal
|
|
7056
7061
|
*/ _proto.enable = function enable() {
|
|
7057
7062
|
if (this.item.composition) {
|
|
@@ -14009,6 +14014,7 @@ var seed$7 = 1;
|
|
|
14009
14014
|
quat: new Quaternion(0, 0, 0, 1),
|
|
14010
14015
|
scale: new Vector3(1, 1, 1)
|
|
14011
14016
|
};
|
|
14017
|
+
this.eventEmitter = new EventEmitter();
|
|
14012
14018
|
this.name = "transform_" + seed$7++;
|
|
14013
14019
|
if (props) {
|
|
14014
14020
|
this.setTransform(props);
|
|
@@ -14021,6 +14027,12 @@ var seed$7 = 1;
|
|
|
14021
14027
|
}
|
|
14022
14028
|
}
|
|
14023
14029
|
var _proto = Transform.prototype;
|
|
14030
|
+
_proto.on = function on(eventName, listener, options) {
|
|
14031
|
+
this.eventEmitter.on(eventName, listener, options);
|
|
14032
|
+
};
|
|
14033
|
+
_proto.off = function off(eventName, listener) {
|
|
14034
|
+
this.eventEmitter.off(eventName, listener);
|
|
14035
|
+
};
|
|
14024
14036
|
/**
|
|
14025
14037
|
* 父 transform 切换时的 hook。子类可重写以接管订阅 / 解算等逻辑
|
|
14026
14038
|
* @param oldParent - 切换前的父 transform(若没有则为 null)
|
|
@@ -14439,6 +14451,7 @@ var seed$7 = 1;
|
|
|
14439
14451
|
this.children.forEach(function(c) {
|
|
14440
14452
|
c.worldMatrixDirty = true;
|
|
14441
14453
|
});
|
|
14454
|
+
this.eventEmitter.emit("changed", this);
|
|
14442
14455
|
};
|
|
14443
14456
|
/**
|
|
14444
14457
|
* 转换右手坐标系左手螺旋对应的四元数到对应的旋转角
|
|
@@ -14457,14 +14470,16 @@ var seed$7 = 1;
|
|
|
14457
14470
|
return this.parent;
|
|
14458
14471
|
},
|
|
14459
14472
|
set: function set(transform) {
|
|
14460
|
-
if (
|
|
14473
|
+
if (this.parent === transform || this === transform) {
|
|
14461
14474
|
return;
|
|
14462
14475
|
}
|
|
14463
14476
|
var oldParent = this.parent;
|
|
14464
14477
|
if (this.parent) {
|
|
14465
14478
|
this.parent.removeChild(this);
|
|
14466
14479
|
}
|
|
14467
|
-
transform
|
|
14480
|
+
if (transform) {
|
|
14481
|
+
transform.addChild(this);
|
|
14482
|
+
}
|
|
14468
14483
|
this.parent = transform;
|
|
14469
14484
|
this.worldMatrixDirty = true;
|
|
14470
14485
|
this.onParentTransformChanged(oldParent, transform);
|
|
@@ -14647,7 +14662,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
14647
14662
|
return results;
|
|
14648
14663
|
};
|
|
14649
14664
|
_proto.setParent = function setParent(vfxItem) {
|
|
14650
|
-
if (vfxItem === this
|
|
14665
|
+
if (vfxItem === this || this.parent === vfxItem) {
|
|
14651
14666
|
return;
|
|
14652
14667
|
}
|
|
14653
14668
|
if (this.parent) {
|
|
@@ -15034,6 +15049,12 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15034
15049
|
child.onParentChanged();
|
|
15035
15050
|
}
|
|
15036
15051
|
};
|
|
15052
|
+
_proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
15053
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
15054
|
+
var component = _step.value;
|
|
15055
|
+
component.onOrderInParentChanged();
|
|
15056
|
+
}
|
|
15057
|
+
};
|
|
15037
15058
|
/**
|
|
15038
15059
|
* @internal
|
|
15039
15060
|
*/ _proto.setRendererComponentOrder = function setRendererComponentOrder(renderOrder) {
|
|
@@ -15118,15 +15139,16 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15118
15139
|
*/ _proto.dispose = function dispose() {
|
|
15119
15140
|
if (this.composition) {
|
|
15120
15141
|
this.composition.destroyItem(this);
|
|
15121
|
-
// component 调用 dispose() 会将自身从 this.components 数组删除,slice() 避免迭代错误
|
|
15122
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.components.slice()), _step; !(_step = _iterator()).done;){
|
|
15123
|
-
var component = _step.value;
|
|
15124
|
-
component.dispose();
|
|
15125
|
-
}
|
|
15126
|
-
this.components = [];
|
|
15127
|
-
this._composition = null;
|
|
15128
|
-
this.transform.setValid(false);
|
|
15129
15142
|
}
|
|
15143
|
+
// component.dispose() removes itself from this.components. Use a snapshot
|
|
15144
|
+
// so Engine.root components are also disposed even without a Composition.
|
|
15145
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components.slice()), _step; !(_step = _iterator()).done;){
|
|
15146
|
+
var component = _step.value;
|
|
15147
|
+
component.dispose();
|
|
15148
|
+
}
|
|
15149
|
+
this.components = [];
|
|
15150
|
+
this._composition = null;
|
|
15151
|
+
this.transform.setValid(false);
|
|
15130
15152
|
this.resetChildrenParent();
|
|
15131
15153
|
EffectsObject.prototype.dispose.call(this);
|
|
15132
15154
|
};
|
|
@@ -15322,6 +15344,33 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
15322
15344
|
this.setRendererComponentOrder(value);
|
|
15323
15345
|
}
|
|
15324
15346
|
},
|
|
15347
|
+
{
|
|
15348
|
+
key: "orderInParent",
|
|
15349
|
+
get: /** Zero-based sibling order within the parent item. */ function get() {
|
|
15350
|
+
var _this_parent;
|
|
15351
|
+
var _this_parent_children_indexOf;
|
|
15352
|
+
return (_this_parent_children_indexOf = (_this_parent = this.parent) == null ? void 0 : _this_parent.children.indexOf(this)) != null ? _this_parent_children_indexOf : -1;
|
|
15353
|
+
},
|
|
15354
|
+
set: function set(value) {
|
|
15355
|
+
var _this_parent;
|
|
15356
|
+
var siblings = (_this_parent = this.parent) == null ? void 0 : _this_parent.children;
|
|
15357
|
+
var _siblings_indexOf;
|
|
15358
|
+
var oldIndex = (_siblings_indexOf = siblings == null ? void 0 : siblings.indexOf(this)) != null ? _siblings_indexOf : -1;
|
|
15359
|
+
if (!siblings || oldIndex === -1) {
|
|
15360
|
+
return;
|
|
15361
|
+
}
|
|
15362
|
+
var newIndex = Math.max(0, Math.min(Math.trunc(value), siblings.length - 1));
|
|
15363
|
+
if (oldIndex === newIndex) {
|
|
15364
|
+
return;
|
|
15365
|
+
}
|
|
15366
|
+
siblings.splice(oldIndex, 1);
|
|
15367
|
+
siblings.splice(newIndex, 0, this);
|
|
15368
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(siblings), _step; !(_step = _iterator()).done;){
|
|
15369
|
+
var sibling = _step.value;
|
|
15370
|
+
sibling.onOrderInParentChanged();
|
|
15371
|
+
}
|
|
15372
|
+
}
|
|
15373
|
+
},
|
|
15325
15374
|
{
|
|
15326
15375
|
key: "isActive",
|
|
15327
15376
|
get: /**
|
|
@@ -15578,35 +15627,35 @@ function vecMulCombine(out, a, b) {
|
|
|
15578
15627
|
}
|
|
15579
15628
|
return out;
|
|
15580
15629
|
}
|
|
15581
|
-
var _obj$
|
|
15582
|
-
var particleOriginTranslateMap$1 = (_obj$
|
|
15630
|
+
var _obj$6;
|
|
15631
|
+
var particleOriginTranslateMap$1 = (_obj$6 = {}, _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
15583
15632
|
0,
|
|
15584
15633
|
0
|
|
15585
|
-
], _obj$
|
|
15634
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
15586
15635
|
0,
|
|
15587
15636
|
-0.5
|
|
15588
|
-
], _obj$
|
|
15637
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
15589
15638
|
0,
|
|
15590
15639
|
0.5
|
|
15591
|
-
], _obj$
|
|
15640
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
15592
15641
|
-0.5,
|
|
15593
15642
|
0.5
|
|
15594
|
-
], _obj$
|
|
15643
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
15595
15644
|
-0.5,
|
|
15596
15645
|
0
|
|
15597
|
-
], _obj$
|
|
15646
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
15598
15647
|
-0.5,
|
|
15599
15648
|
-0.5
|
|
15600
|
-
], _obj$
|
|
15649
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
15601
15650
|
0.5,
|
|
15602
15651
|
0
|
|
15603
|
-
], _obj$
|
|
15652
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
15604
15653
|
0.5,
|
|
15605
15654
|
-0.5
|
|
15606
|
-
], _obj$
|
|
15655
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
15607
15656
|
0.5,
|
|
15608
15657
|
0.5
|
|
15609
|
-
], _obj$
|
|
15658
|
+
], _obj$6);
|
|
15610
15659
|
function nearestPowerOfTwo(value) {
|
|
15611
15660
|
return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
|
|
15612
15661
|
}
|
|
@@ -17344,27 +17393,27 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
17344
17393
|
* 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
|
|
17345
17394
|
* props 为 [[time, value], ...],value 为已解析的对象引用实例。
|
|
17346
17395
|
*/ var REFERENCE_CURVE = 28;
|
|
17347
|
-
var _obj$
|
|
17348
|
-
var map$1 = (_obj$
|
|
17396
|
+
var _obj$5;
|
|
17397
|
+
var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
|
|
17349
17398
|
if (_instanceof1(props[0], Array)) {
|
|
17350
17399
|
return new RandomVectorValue(props);
|
|
17351
17400
|
}
|
|
17352
17401
|
return new RandomValue(props);
|
|
17353
|
-
}, _obj$
|
|
17402
|
+
}, _obj$5[ValueType.CONSTANT] = function(props) {
|
|
17354
17403
|
return new StaticValue(props);
|
|
17355
|
-
}, _obj$
|
|
17404
|
+
}, _obj$5[ValueType.CONSTANT_VEC2] = function(props) {
|
|
17356
17405
|
return new StaticValue(props);
|
|
17357
|
-
}, _obj$
|
|
17406
|
+
}, _obj$5[ValueType.CONSTANT_VEC3] = function(props) {
|
|
17358
17407
|
return new StaticValue(props);
|
|
17359
|
-
}, _obj$
|
|
17408
|
+
}, _obj$5[ValueType.CONSTANT_VEC4] = function(props) {
|
|
17360
17409
|
return new StaticValue(props);
|
|
17361
|
-
}, _obj$
|
|
17410
|
+
}, _obj$5[ValueType.RGBA_COLOR] = function(props) {
|
|
17362
17411
|
return new StaticValue(props);
|
|
17363
|
-
}, _obj$
|
|
17412
|
+
}, _obj$5[ValueType.COLORS] = function(props) {
|
|
17364
17413
|
return new RandomSetValue(props.map(function(c) {
|
|
17365
17414
|
return colorToArr$1(c, false);
|
|
17366
17415
|
}));
|
|
17367
|
-
}, _obj$
|
|
17416
|
+
}, _obj$5[ValueType.LINE] = function(props) {
|
|
17368
17417
|
if (props.length === 2 && props[0][0] === 0 && props[1][0] === 1) {
|
|
17369
17418
|
return new LinearValue([
|
|
17370
17419
|
props[0][1],
|
|
@@ -17372,38 +17421,38 @@ var map$1 = (_obj$4 = {}, _obj$4[ValueType.RANDOM] = function(props) {
|
|
|
17372
17421
|
]);
|
|
17373
17422
|
}
|
|
17374
17423
|
return new LineSegments(props);
|
|
17375
|
-
}, _obj$
|
|
17424
|
+
}, _obj$5[ValueType.GRADIENT_COLOR] = function(props) {
|
|
17376
17425
|
return new GradientValue(props);
|
|
17377
|
-
}, _obj$
|
|
17426
|
+
}, _obj$5[ValueType.LINEAR_PATH] = function(pros) {
|
|
17378
17427
|
return new PathSegments(pros);
|
|
17379
|
-
}, _obj$
|
|
17428
|
+
}, _obj$5[ValueType.BEZIER_CURVE] = function(props) {
|
|
17380
17429
|
if (props.length === 1) {
|
|
17381
17430
|
return new StaticValue(props[0][1][1]);
|
|
17382
17431
|
}
|
|
17383
17432
|
return new BezierCurve(props);
|
|
17384
|
-
}, _obj$
|
|
17433
|
+
}, _obj$5[ValueType.BEZIER_CURVE_PATH] = function(props) {
|
|
17385
17434
|
if (props[0].length === 1) {
|
|
17386
17435
|
return new StaticValue(_construct(Vector3, [].concat(props[1][0])));
|
|
17387
17436
|
}
|
|
17388
17437
|
return new BezierCurvePath(props);
|
|
17389
|
-
}, _obj$
|
|
17438
|
+
}, _obj$5[ValueType.BEZIER_CURVE_QUAT] = function(props) {
|
|
17390
17439
|
if (props[0].length === 1) {
|
|
17391
17440
|
return new StaticValue(_construct(Quaternion, [].concat(props[1][0])));
|
|
17392
17441
|
}
|
|
17393
17442
|
return new BezierCurveQuat(props);
|
|
17394
|
-
}, _obj$
|
|
17443
|
+
}, _obj$5[ValueType.COLOR_CURVE] = function(props) {
|
|
17395
17444
|
return new ColorCurve(props);
|
|
17396
|
-
}, _obj$
|
|
17445
|
+
}, _obj$5[ValueType.VECTOR4_CURVE] = function(props) {
|
|
17397
17446
|
return new Vector4Curve(props);
|
|
17398
|
-
}, _obj$
|
|
17447
|
+
}, _obj$5[ValueType.VECTOR2_CURVE] = function(props) {
|
|
17399
17448
|
return new Vector2Curve(props);
|
|
17400
17449
|
}, // TODO: add spec
|
|
17401
|
-
_obj$
|
|
17450
|
+
_obj$5[VECTOR3_CURVE] = function(props) {
|
|
17402
17451
|
return new Vector3Curve(props);
|
|
17403
17452
|
}, // 对象引用阶梯曲线(不插值):props.data 为 [time, value][],value 已解析为 EffectsObject
|
|
17404
|
-
_obj$
|
|
17453
|
+
_obj$5[REFERENCE_CURVE] = function(props) {
|
|
17405
17454
|
return new ReferenceCurve(props);
|
|
17406
|
-
}, _obj$
|
|
17455
|
+
}, _obj$5);
|
|
17407
17456
|
function createValueGetter(args) {
|
|
17408
17457
|
if (!args || !isNaN(+args)) {
|
|
17409
17458
|
return new StaticValue(args || 0);
|
|
@@ -20920,20 +20969,24 @@ var geometryId = 1;
|
|
|
20920
20969
|
var vertexArrayObjects = this.vertexArrayObjects;
|
|
20921
20970
|
var engine = this.engine;
|
|
20922
20971
|
if (!vertexArrayObjects || !supportsVertexArrayObjects(engine)) {
|
|
20923
|
-
|
|
20972
|
+
var _this_indexBuffer;
|
|
20973
|
+
engine.bindBuffers(this.vertexBuffers, (_this_indexBuffer = this.indexBuffer) != null ? _this_indexBuffer : null, shader);
|
|
20924
20974
|
return;
|
|
20925
20975
|
}
|
|
20926
20976
|
var vertexArrayObject = vertexArrayObjects[shader.key];
|
|
20927
20977
|
if (!vertexArrayObject) {
|
|
20928
|
-
|
|
20978
|
+
var _this_indexBuffer1;
|
|
20979
|
+
vertexArrayObject = engine.recordVertexArrayObject(this.vertexBuffers, (_this_indexBuffer1 = this.indexBuffer) != null ? _this_indexBuffer1 : null, shader);
|
|
20929
20980
|
if (vertexArrayObject) {
|
|
20930
20981
|
vertexArrayObjects[shader.key] = vertexArrayObject;
|
|
20931
20982
|
}
|
|
20932
20983
|
}
|
|
20933
20984
|
if (vertexArrayObject) {
|
|
20934
|
-
|
|
20985
|
+
var _this_indexBuffer2;
|
|
20986
|
+
engine.bindVertexArrayObject(vertexArrayObject, (_this_indexBuffer2 = this.indexBuffer) != null ? _this_indexBuffer2 : null);
|
|
20935
20987
|
} else {
|
|
20936
|
-
|
|
20988
|
+
var _this_indexBuffer3;
|
|
20989
|
+
engine.bindBuffers(this.vertexBuffers, (_this_indexBuffer3 = this.indexBuffer) != null ? _this_indexBuffer3 : null, shader);
|
|
20937
20990
|
}
|
|
20938
20991
|
};
|
|
20939
20992
|
_proto.releaseVertexArrayObject = function releaseVertexArrayObject(key) {
|
|
@@ -21340,8 +21393,8 @@ var vertexBufferSemanticMap = {
|
|
|
21340
21393
|
TANGENT_BS2: "aTargetTangent2",
|
|
21341
21394
|
TANGENT_BS3: "aTargetTangent3"
|
|
21342
21395
|
};
|
|
21343
|
-
var _obj$
|
|
21344
|
-
var BYTES_TYPE_MAP = (_obj$
|
|
21396
|
+
var _obj$4;
|
|
21397
|
+
var BYTES_TYPE_MAP = (_obj$4 = {}, _obj$4[BufferDataType.Float] = 4, _obj$4[BufferDataType.Int] = 4, _obj$4[BufferDataType.UnsignedInt] = 4, _obj$4[BufferDataType.Short] = 2, _obj$4[BufferDataType.UnsignedShort] = 2, _obj$4[BufferDataType.Byte] = 1, _obj$4[BufferDataType.UnsignedByte] = 1, _obj$4);
|
|
21345
21398
|
function generateEmptyTypedArray(type) {
|
|
21346
21399
|
return createTypedArray(type, 0);
|
|
21347
21400
|
}
|
|
@@ -22351,7 +22404,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
22351
22404
|
}
|
|
22352
22405
|
};
|
|
22353
22406
|
_proto.setViewport = function setViewport(x, y, width, height) {
|
|
22354
|
-
this.engine.
|
|
22407
|
+
this.engine.setViewport(x, y, width, height);
|
|
22355
22408
|
};
|
|
22356
22409
|
_proto.clear = function clear(action) {
|
|
22357
22410
|
this.engine.clear(action);
|
|
@@ -22414,7 +22467,40 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
22414
22467
|
};
|
|
22415
22468
|
_proto.drawGeometry = function drawGeometry(geometry, matrix, material, subMeshIndex) {
|
|
22416
22469
|
if (subMeshIndex === void 0) subMeshIndex = 0;
|
|
22417
|
-
|
|
22470
|
+
if (!geometry || !material) {
|
|
22471
|
+
return;
|
|
22472
|
+
}
|
|
22473
|
+
material.initialize();
|
|
22474
|
+
geometry.initialize();
|
|
22475
|
+
geometry.flush();
|
|
22476
|
+
material.setMatrix("effects_ObjectToWorld", matrix);
|
|
22477
|
+
try {
|
|
22478
|
+
material.use(this, this.renderingData.currentFrame.globalUniforms);
|
|
22479
|
+
} catch (e) {
|
|
22480
|
+
console.error(e);
|
|
22481
|
+
this.engine.renderErrors.add(e);
|
|
22482
|
+
return;
|
|
22483
|
+
}
|
|
22484
|
+
var indexBuffer = geometry.getIndexBuffer();
|
|
22485
|
+
var offset = geometry.getDrawStart();
|
|
22486
|
+
var count = geometry.getDrawCount();
|
|
22487
|
+
var subMeshes = geometry.subMeshes;
|
|
22488
|
+
if (subMeshes.length > 0) {
|
|
22489
|
+
var subMesh = subMeshes[subMeshIndex];
|
|
22490
|
+
offset = subMesh.offset;
|
|
22491
|
+
var _subMesh_indexCount;
|
|
22492
|
+
count = indexBuffer ? (_subMesh_indexCount = subMesh.indexCount) != null ? _subMesh_indexCount : 0 : subMesh.vertexCount;
|
|
22493
|
+
}
|
|
22494
|
+
if (count <= 0) {
|
|
22495
|
+
return;
|
|
22496
|
+
}
|
|
22497
|
+
geometry.bind(material.shaderVariant);
|
|
22498
|
+
var instanceCount = geometry.instanceCount || undefined;
|
|
22499
|
+
if (indexBuffer) {
|
|
22500
|
+
this.engine.drawElementsType(geometry.mode, offset, count, instanceCount);
|
|
22501
|
+
} else {
|
|
22502
|
+
this.engine.drawArraysType(geometry.mode, offset, count, instanceCount);
|
|
22503
|
+
}
|
|
22418
22504
|
};
|
|
22419
22505
|
_proto.getTemporaryRT = function getTemporaryRT(name, width, height, depthBuffer, filter, format) {
|
|
22420
22506
|
return this.engine.renderTargetPool.get(name, width, height, depthBuffer, filter, format);
|
|
@@ -22682,11 +22768,7 @@ var CanvasPool = /*#__PURE__*/ function() {
|
|
|
22682
22768
|
var canvasPool = new CanvasPool();
|
|
22683
22769
|
|
|
22684
22770
|
/**
|
|
22685
|
-
*
|
|
22686
|
-
* 但 quad 仍按 1x 逻辑尺寸绘制 — 双线性 downsample 后比原 1x 渲染清晰得多
|
|
22687
|
-
*/ var FONT_SCALE = 2;
|
|
22688
|
-
/**
|
|
22689
|
-
* 单张字符 atlas 的边长(像素,scale 后的实际像素,非逻辑尺寸)。
|
|
22771
|
+
* 单张字符 atlas 的逻辑边长。实际 canvas 像素尺寸会乘以渲染 resolution。
|
|
22690
22772
|
* 512×512 在 24px 字号下约可容纳 250+ 字形,常见 demo 文本足够
|
|
22691
22773
|
*/ var ATLAS_SIZE = 512;
|
|
22692
22774
|
/**
|
|
@@ -22708,7 +22790,7 @@ var canvasPool = new CanvasPool();
|
|
|
22708
22790
|
* canvas 内容变更后需要 `uploadIfDirty` 重新上传到纹理 — 由调用方在使用纹理前主动触发,
|
|
22709
22791
|
* 避免每加一字都 upload 一次造成的 GL 开销
|
|
22710
22792
|
*/ var GlyphAtlas = /*#__PURE__*/ function() {
|
|
22711
|
-
function GlyphAtlas(engine, scaledFontString, /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */ ascentPx, /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */ descentPx, fontStyle) {
|
|
22793
|
+
function GlyphAtlas(engine, scaledFontString, /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */ ascentPx, /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */ descentPx, fontStyle, resolution) {
|
|
22712
22794
|
this.engine = engine;
|
|
22713
22795
|
this.scaledFontString = scaledFontString;
|
|
22714
22796
|
this.glyphs = new Map();
|
|
@@ -22716,9 +22798,10 @@ var canvasPool = new CanvasPool();
|
|
|
22716
22798
|
this.currentY = 0;
|
|
22717
22799
|
this.full = false;
|
|
22718
22800
|
this.dirty = true;
|
|
22801
|
+
this.resolution = resolution;
|
|
22719
22802
|
this.canvas = document.createElement("canvas");
|
|
22720
|
-
this.canvas.width = ATLAS_SIZE;
|
|
22721
|
-
this.canvas.height = ATLAS_SIZE;
|
|
22803
|
+
this.canvas.width = Math.ceil(ATLAS_SIZE * resolution);
|
|
22804
|
+
this.canvas.height = Math.ceil(ATLAS_SIZE * resolution);
|
|
22722
22805
|
var ctx = this.canvas.getContext("2d", {
|
|
22723
22806
|
willReadFrequently: false
|
|
22724
22807
|
});
|
|
@@ -22729,14 +22812,14 @@ var canvasPool = new CanvasPool();
|
|
|
22729
22812
|
ctx.font = scaledFontString;
|
|
22730
22813
|
ctx.textBaseline = "alphabetic";
|
|
22731
22814
|
ctx.fillStyle = "#ffffff";
|
|
22732
|
-
this.paddingPx = GLYPH_PADDING *
|
|
22815
|
+
this.paddingPx = GLYPH_PADDING * resolution;
|
|
22733
22816
|
this.italicScale = fontStyle === "italic" ? 2 : 1;
|
|
22734
22817
|
// ascent/descent 由探针 '|ÉqÅM' 测得 actualBoundingBox(重音字已抬高 ink 顶),
|
|
22735
22818
|
// 两者内部保持浮点,仅 cell 高做一次外层 ceil — 与 padding 共同保证 cell 内不裁切
|
|
22736
22819
|
var fontHeightPx = ascentPx + descentPx;
|
|
22737
22820
|
this.baselinePx = this.paddingPx + ascentPx;
|
|
22738
22821
|
this.cellHPx = Math.ceil(fontHeightPx + this.paddingPx * 2);
|
|
22739
|
-
this.lineHeight = this.cellHPx /
|
|
22822
|
+
this.lineHeight = this.cellHPx / resolution;
|
|
22740
22823
|
this.texture = Texture.create(engine, {
|
|
22741
22824
|
sourceType: TextureSourceType.image,
|
|
22742
22825
|
image: this.canvas,
|
|
@@ -22745,7 +22828,8 @@ var canvasPool = new CanvasPool();
|
|
|
22745
22828
|
magFilter: glContext.LINEAR,
|
|
22746
22829
|
minFilter: glContext.LINEAR,
|
|
22747
22830
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
22748
|
-
wrapT: glContext.CLAMP_TO_EDGE
|
|
22831
|
+
wrapT: glContext.CLAMP_TO_EDGE,
|
|
22832
|
+
premultiplyAlpha: true
|
|
22749
22833
|
});
|
|
22750
22834
|
this.texture.initialize();
|
|
22751
22835
|
}
|
|
@@ -22763,19 +22847,19 @@ var canvasPool = new CanvasPool();
|
|
|
22763
22847
|
var ctx = this.ctx;
|
|
22764
22848
|
// 每次重设字体,防御外部潜在污染(虽然 ctx 私有)
|
|
22765
22849
|
ctx.font = this.scaledFontString;
|
|
22766
|
-
// measureText 用的是 scaledFontString,advance 已经是
|
|
22850
|
+
// measureText 用的是 scaledFontString,advance 已经是 resolution 后的像素
|
|
22767
22851
|
var advancePx = ctx.measureText(char).width;
|
|
22768
22852
|
// italic 放大 cell 宽防斜体越界;ceil 对齐像素网格避免相邻字采样重叠
|
|
22769
22853
|
var widthPx = Math.max(1, Math.ceil(advancePx * this.italicScale));
|
|
22770
22854
|
var paddedWidthPx = widthPx + this.paddingPx * 2;
|
|
22771
22855
|
var cellH = this.cellHPx;
|
|
22772
22856
|
// 行尾换行
|
|
22773
|
-
if (this.currentX + paddedWidthPx >
|
|
22857
|
+
if (this.currentX + paddedWidthPx > this.canvas.width) {
|
|
22774
22858
|
this.currentX = 0;
|
|
22775
22859
|
this.currentY += cellH;
|
|
22776
22860
|
}
|
|
22777
22861
|
// atlas 满,后续不再尝试
|
|
22778
|
-
if (this.currentY + cellH >
|
|
22862
|
+
if (this.currentY + cellH > this.canvas.height) {
|
|
22779
22863
|
this.full = true;
|
|
22780
22864
|
console.warn('GlyphAtlas full, dropping char "' + char + '"');
|
|
22781
22865
|
return null;
|
|
@@ -22791,8 +22875,8 @@ var canvasPool = new CanvasPool();
|
|
|
22791
22875
|
py: py,
|
|
22792
22876
|
pw: paddedWidthPx,
|
|
22793
22877
|
ph: cellH,
|
|
22794
|
-
advance: advancePx /
|
|
22795
|
-
paddingLeft: this.paddingPx /
|
|
22878
|
+
advance: advancePx / this.resolution,
|
|
22879
|
+
paddingLeft: this.paddingPx / this.resolution
|
|
22796
22880
|
};
|
|
22797
22881
|
this.glyphs.set(char, info);
|
|
22798
22882
|
return info;
|
|
@@ -22811,7 +22895,8 @@ var canvasPool = new CanvasPool();
|
|
|
22811
22895
|
magFilter: glContext.LINEAR,
|
|
22812
22896
|
minFilter: glContext.LINEAR,
|
|
22813
22897
|
wrapS: glContext.CLAMP_TO_EDGE,
|
|
22814
|
-
wrapT: glContext.CLAMP_TO_EDGE
|
|
22898
|
+
wrapT: glContext.CLAMP_TO_EDGE,
|
|
22899
|
+
premultiplyAlpha: true
|
|
22815
22900
|
});
|
|
22816
22901
|
this.dirty = false;
|
|
22817
22902
|
};
|
|
@@ -22834,26 +22919,33 @@ var canvasPool = new CanvasPool();
|
|
|
22834
22919
|
function TextCache(engine) {
|
|
22835
22920
|
this.engine = engine;
|
|
22836
22921
|
this.atlases = new Map();
|
|
22922
|
+
this.resolution = engine.pixelRatio;
|
|
22837
22923
|
}
|
|
22838
22924
|
var _proto = TextCache.prototype;
|
|
22839
22925
|
/**
|
|
22840
22926
|
* 取(必要时新建)对应字体的字符 atlas
|
|
22841
22927
|
*/ _proto.getAtlas = function getAtlas(fontSize, fontFamily, fontWeight, fontStyle) {
|
|
22842
|
-
|
|
22928
|
+
// Pixi CanvasText 默认跟随 renderer.resolution;这里对应 Engine.pixelRatio。
|
|
22929
|
+
var resolution = this.engine.pixelRatio;
|
|
22930
|
+
if (resolution !== this.resolution) {
|
|
22931
|
+
this.clear();
|
|
22932
|
+
this.resolution = resolution;
|
|
22933
|
+
}
|
|
22934
|
+
var fontKey = fontStyle + "|" + fontWeight + "|" + fontSize + "|" + fontFamily + "|" + resolution;
|
|
22843
22935
|
var cached = this.atlases.get(fontKey);
|
|
22844
22936
|
if (cached) {
|
|
22845
22937
|
return cached;
|
|
22846
22938
|
}
|
|
22847
|
-
var scaledFontString = fontStyle + " " + fontWeight + " " + fontSize *
|
|
22939
|
+
var scaledFontString = fontStyle + " " + fontWeight + " " + fontSize * resolution + "px " + fontFamily;
|
|
22848
22940
|
// 探一次得到字体级 ascent/descent(整张 atlas 共享 cell 高与 baseline,各字对齐)。
|
|
22849
|
-
// 直接在 scaledFontString 下测,得到的就是
|
|
22941
|
+
// 直接在 scaledFontString 下测,得到的就是 resolution 后像素。
|
|
22850
22942
|
// 探针用 '|ÉqÅ' + 'M':带重音符的 ÉÅ 把 ink 顶推到接近字体真实 ascent,
|
|
22851
22943
|
// 单字 'M' 只有 cap height(~0.7em) 太矮,CJK / 带重音字顶部会越过 cell 上界被裁。
|
|
22852
22944
|
// 取 actualBoundingBoxAscent/Descent 度量 ink 边界,跨平台语义稳定
|
|
22853
22945
|
var probeCanvasAndContext = canvasPool.getCanvasAndContext(1, 1);
|
|
22854
22946
|
var probeCtx = probeCanvasAndContext.context;
|
|
22855
|
-
var ascentPx = fontSize * 0.8 *
|
|
22856
|
-
var descentPx = fontSize * 0.2 *
|
|
22947
|
+
var ascentPx = fontSize * 0.8 * resolution;
|
|
22948
|
+
var descentPx = fontSize * 0.2 * resolution;
|
|
22857
22949
|
try {
|
|
22858
22950
|
probeCtx.font = scaledFontString;
|
|
22859
22951
|
var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
|
|
@@ -22862,7 +22954,7 @@ var canvasPool = new CanvasPool();
|
|
|
22862
22954
|
} finally{
|
|
22863
22955
|
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22864
22956
|
}
|
|
22865
|
-
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle);
|
|
22957
|
+
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle, resolution);
|
|
22866
22958
|
this.atlases.set(fontKey, atlas);
|
|
22867
22959
|
return atlas;
|
|
22868
22960
|
};
|
|
@@ -22879,6 +22971,9 @@ var canvasPool = new CanvasPool();
|
|
|
22879
22971
|
/**
|
|
22880
22972
|
* 清空所有 atlas 并 dispose 对应纹理。Engine dispose 时调用
|
|
22881
22973
|
*/ _proto.dispose = function dispose() {
|
|
22974
|
+
this.clear();
|
|
22975
|
+
};
|
|
22976
|
+
_proto.clear = function clear() {
|
|
22882
22977
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.atlases.values()), _step; !(_step = _iterator()).done;){
|
|
22883
22978
|
var atlas = _step.value;
|
|
22884
22979
|
atlas.dispose();
|
|
@@ -23001,6 +23096,17 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23001
23096
|
this.texturedMaterial.depthTest = false;
|
|
23002
23097
|
this.texturedMaterial.depthMask = false;
|
|
23003
23098
|
this.texturedMaterial.blending = true;
|
|
23099
|
+
// 文本 atlas 按 Pixi 的方式在上传时预乘 alpha,因此采样后只需应用顶点色和顶点 alpha。
|
|
23100
|
+
// 单独使用 material,避免改变 drawTexture 对普通非预乘纹理的处理。
|
|
23101
|
+
this.textMaterial = Material.create(this.engine, {
|
|
23102
|
+
shader: {
|
|
23103
|
+
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 }",
|
|
23104
|
+
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 }"
|
|
23105
|
+
}
|
|
23106
|
+
});
|
|
23107
|
+
this.textMaterial.depthTest = false;
|
|
23108
|
+
this.textMaterial.depthMask = false;
|
|
23109
|
+
this.textMaterial.blending = true;
|
|
23004
23110
|
this.textCache = new TextCache(engine);
|
|
23005
23111
|
}
|
|
23006
23112
|
var _proto = Graphics.prototype;
|
|
@@ -23015,13 +23121,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23015
23121
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23016
23122
|
this.currentBatchType = "colored";
|
|
23017
23123
|
this.currentBatchTexture = null;
|
|
23018
|
-
// 创建从屏幕坐标到 NDC
|
|
23124
|
+
// 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
|
|
23019
23125
|
var _this_engine_canvas_getBoundingClientRect = this.engine.canvas.getBoundingClientRect(), width = _this_engine_canvas_getBoundingClientRect.width, height = _this_engine_canvas_getBoundingClientRect.height;
|
|
23020
23126
|
// 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
|
|
23021
|
-
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, -1, 0, -1,
|
|
23127
|
+
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
|
|
23022
23128
|
);
|
|
23023
23129
|
this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23024
23130
|
this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23131
|
+
this.textMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23025
23132
|
};
|
|
23026
23133
|
/**
|
|
23027
23134
|
* 将当前变换压入栈,并设置新的变换
|
|
@@ -23049,7 +23156,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23049
23156
|
* 切换到指定批次类型/纹理。若与当前批次不一致,先 flush 已累积顶点
|
|
23050
23157
|
*/ _proto.ensureBatch = function ensureBatch(type, texture) {
|
|
23051
23158
|
if (texture === void 0) texture = null;
|
|
23052
|
-
var sameBatch = this.currentBatchType === type && (type
|
|
23159
|
+
var sameBatch = this.currentBatchType === type && (type === "colored" || this.currentBatchTexture === texture);
|
|
23053
23160
|
if (!sameBatch && this.currentVertexCount > 0) {
|
|
23054
23161
|
this.flushBatch();
|
|
23055
23162
|
}
|
|
@@ -23075,8 +23182,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23075
23182
|
this.geometry.setIndexData(indicesArray);
|
|
23076
23183
|
this.geometry.setDrawCount(this.currentIndexCount);
|
|
23077
23184
|
var material;
|
|
23078
|
-
if (this.currentBatchType === "textured") {
|
|
23079
|
-
material = this.texturedMaterial;
|
|
23185
|
+
if (this.currentBatchType === "textured" || this.currentBatchType === "text") {
|
|
23186
|
+
material = this.currentBatchType === "text" ? this.textMaterial : this.texturedMaterial;
|
|
23080
23187
|
var _this_currentBatchTexture;
|
|
23081
23188
|
var tex = (_this_currentBatchTexture = this.currentBatchTexture) != null ? _this_currentBatchTexture : this.engine.whiteTexture;
|
|
23082
23189
|
material.setTexture("uMainTexture", tex);
|
|
@@ -23182,8 +23289,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23182
23289
|
};
|
|
23183
23290
|
/**
|
|
23184
23291
|
* 绘制矩形边框
|
|
23185
|
-
* @param x -
|
|
23186
|
-
* @param y -
|
|
23292
|
+
* @param x - 矩形左上角 X 坐标
|
|
23293
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23187
23294
|
* @param width - 矩形宽度
|
|
23188
23295
|
* @param height - 矩形高度
|
|
23189
23296
|
* @param color - 边框颜色,默认白色,范围 0-1
|
|
@@ -23226,8 +23333,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23226
23333
|
};
|
|
23227
23334
|
/**
|
|
23228
23335
|
* 绘制填充矩形
|
|
23229
|
-
* @param x -
|
|
23230
|
-
* @param y -
|
|
23336
|
+
* @param x - 矩形左上角 X 坐标
|
|
23337
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23231
23338
|
* @param width - 矩形宽度
|
|
23232
23339
|
* @param height - 矩形高度
|
|
23233
23340
|
* @param color - 填充颜色,默认白色,范围 0-1
|
|
@@ -23253,9 +23360,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23253
23360
|
this.buildShape(this.circleShape, color);
|
|
23254
23361
|
};
|
|
23255
23362
|
/**
|
|
23256
|
-
* 绘制纹理矩形(本地坐标,Y
|
|
23257
|
-
* @param x -
|
|
23258
|
-
* @param y -
|
|
23363
|
+
* 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
|
|
23364
|
+
* @param x - 矩形左上角 X 坐标
|
|
23365
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23259
23366
|
* @param width - 矩形宽度
|
|
23260
23367
|
* @param height - 矩形高度
|
|
23261
23368
|
* @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
|
|
@@ -23268,14 +23375,14 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23268
23375
|
this.pushQuad(x, y, width, height, color, region);
|
|
23269
23376
|
};
|
|
23270
23377
|
/**
|
|
23271
|
-
* 绘制文本(本地坐标,Y
|
|
23378
|
+
* 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
|
|
23272
23379
|
*
|
|
23273
23380
|
* 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
|
|
23274
23381
|
* `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
|
|
23275
23382
|
*
|
|
23276
23383
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
23277
|
-
* @param x -
|
|
23278
|
-
* @param y -
|
|
23384
|
+
* @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
23385
|
+
* @param y - 文本 cell 顶部 Y 坐标
|
|
23279
23386
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
23280
23387
|
* @param fontSize - 字号(逻辑像素)
|
|
23281
23388
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -23291,7 +23398,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23291
23398
|
return;
|
|
23292
23399
|
}
|
|
23293
23400
|
var atlas = this.textCache.getAtlas(fontSize, fontFamily, fontWeight, fontStyle);
|
|
23294
|
-
this.ensureBatch("
|
|
23401
|
+
this.ensureBatch("text", atlas.texture);
|
|
23295
23402
|
var lineHeight = atlas.lineHeight;
|
|
23296
23403
|
var cursorX = x;
|
|
23297
23404
|
// ensureChar 可能往 atlas canvas 写新字并打 dirty 标;实际 upload 推迟到
|
|
@@ -23302,13 +23409,15 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23302
23409
|
continue;
|
|
23303
23410
|
}
|
|
23304
23411
|
// atlas 像素坐标 → UV(纹理 flipY 后,canvas 顶 → v=1,canvas 底 → v=0)
|
|
23305
|
-
var
|
|
23306
|
-
var
|
|
23307
|
-
var
|
|
23308
|
-
var
|
|
23412
|
+
var atlasWidth = atlas.canvas.width;
|
|
23413
|
+
var atlasHeight = atlas.canvas.height;
|
|
23414
|
+
var u0 = info.px / atlasWidth;
|
|
23415
|
+
var u1 = (info.px + info.pw) / atlasWidth;
|
|
23416
|
+
var v0 = 1 - (info.py + info.ph) / atlasHeight;
|
|
23417
|
+
var v1 = 1 - info.py / atlasHeight;
|
|
23309
23418
|
// quad 宽与采样区都含四周 padding(cell 留白透明);但光标只按 advance 前进,
|
|
23310
23419
|
// quad 起点左偏 paddingLeft 使字形 ink 落在 cursorX — padding 区重叠无妨
|
|
23311
|
-
this.pushQuad(cursorX - info.paddingLeft, y, info.pw /
|
|
23420
|
+
this.pushQuad(cursorX - info.paddingLeft, y, info.pw / atlas.resolution, lineHeight, color, {
|
|
23312
23421
|
u0: u0,
|
|
23313
23422
|
v0: v0,
|
|
23314
23423
|
u1: u1,
|
|
@@ -23321,6 +23430,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23321
23430
|
this.geometry.dispose();
|
|
23322
23431
|
this.coloredMaterial.dispose();
|
|
23323
23432
|
this.texturedMaterial.dispose();
|
|
23433
|
+
this.textMaterial.dispose();
|
|
23324
23434
|
this.textCache.dispose();
|
|
23325
23435
|
};
|
|
23326
23436
|
_proto.buildShape = function buildShape(shape, color) {
|
|
@@ -23387,7 +23497,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23387
23497
|
* 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
|
|
23388
23498
|
*/ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
|
|
23389
23499
|
var vertexOffset = this.vertices.length / 2;
|
|
23390
|
-
// 4
|
|
23500
|
+
// 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
|
|
23391
23501
|
var corners = [
|
|
23392
23502
|
[
|
|
23393
23503
|
x,
|
|
@@ -23413,19 +23523,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23413
23523
|
var cornerUVs = [
|
|
23414
23524
|
[
|
|
23415
23525
|
u0,
|
|
23416
|
-
|
|
23526
|
+
v1
|
|
23417
23527
|
],
|
|
23418
23528
|
[
|
|
23419
23529
|
u1,
|
|
23420
|
-
|
|
23530
|
+
v1
|
|
23421
23531
|
],
|
|
23422
23532
|
[
|
|
23423
23533
|
u0,
|
|
23424
|
-
|
|
23534
|
+
v0
|
|
23425
23535
|
],
|
|
23426
23536
|
[
|
|
23427
23537
|
u1,
|
|
23428
|
-
|
|
23538
|
+
v0
|
|
23429
23539
|
]
|
|
23430
23540
|
];
|
|
23431
23541
|
for(var i = 0; i < 4; i++){
|
|
@@ -24391,433 +24501,365 @@ FrameComponent = __decorate([
|
|
|
24391
24501
|
// 第四列 (位移) 乘 1,无需修改
|
|
24392
24502
|
}
|
|
24393
24503
|
|
|
24394
|
-
|
|
24395
|
-
|
|
24396
|
-
|
|
24397
|
-
|
|
24398
|
-
|
|
24399
|
-
|
|
24400
|
-
|
|
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
|
-
|
|
24504
|
+
function _assert_this_initialized(self) {
|
|
24505
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
24506
|
+
return self;
|
|
24507
|
+
}
|
|
24508
|
+
|
|
24509
|
+
var MouseFilter;
|
|
24510
|
+
(function(MouseFilter) {
|
|
24511
|
+
MouseFilter[MouseFilter["Stop"] = 0] = "Stop";
|
|
24512
|
+
MouseFilter[MouseFilter["Pass"] = 1] = "Pass";
|
|
24513
|
+
MouseFilter[MouseFilter["Ignore"] = 2] = "Ignore";
|
|
24514
|
+
})(MouseFilter || (MouseFilter = {}));
|
|
24515
|
+
var MouseBehaviorRecursive;
|
|
24516
|
+
(function(MouseBehaviorRecursive) {
|
|
24517
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Inherited"] = 0] = "Inherited";
|
|
24518
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Disabled"] = 1] = "Disabled";
|
|
24519
|
+
MouseBehaviorRecursive[MouseBehaviorRecursive["Enabled"] = 2] = "Enabled";
|
|
24520
|
+
})(MouseBehaviorRecursive || (MouseBehaviorRecursive = {}));
|
|
24521
|
+
var MouseButton;
|
|
24522
|
+
(function(MouseButton) {
|
|
24523
|
+
MouseButton[MouseButton["None"] = 0] = "None";
|
|
24524
|
+
MouseButton[MouseButton["Left"] = 1] = "Left";
|
|
24525
|
+
MouseButton[MouseButton["Right"] = 2] = "Right";
|
|
24526
|
+
MouseButton[MouseButton["Middle"] = 3] = "Middle";
|
|
24527
|
+
MouseButton[MouseButton["WheelUp"] = 4] = "WheelUp";
|
|
24528
|
+
MouseButton[MouseButton["WheelDown"] = 5] = "WheelDown";
|
|
24529
|
+
MouseButton[MouseButton["WheelLeft"] = 6] = "WheelLeft";
|
|
24530
|
+
MouseButton[MouseButton["WheelRight"] = 7] = "WheelRight";
|
|
24531
|
+
MouseButton[MouseButton["Xbutton1"] = 8] = "Xbutton1";
|
|
24532
|
+
MouseButton[MouseButton["Xbutton2"] = 9] = "Xbutton2";
|
|
24533
|
+
})(MouseButton || (MouseButton = {}));
|
|
24534
|
+
var MouseButtonMask;
|
|
24535
|
+
(function(MouseButtonMask) {
|
|
24536
|
+
MouseButtonMask[MouseButtonMask["None"] = 0] = "None";
|
|
24537
|
+
MouseButtonMask[MouseButtonMask["Left"] = 1] = "Left";
|
|
24538
|
+
MouseButtonMask[MouseButtonMask["Right"] = 2] = "Right";
|
|
24539
|
+
MouseButtonMask[MouseButtonMask["Middle"] = 4] = "Middle";
|
|
24540
|
+
MouseButtonMask[MouseButtonMask["Xbutton1"] = 128] = "Xbutton1";
|
|
24541
|
+
MouseButtonMask[MouseButtonMask["Xbutton2"] = 256] = "Xbutton2";
|
|
24542
|
+
})(MouseButtonMask || (MouseButtonMask = {}));
|
|
24543
|
+
var FocusMode;
|
|
24544
|
+
(function(FocusMode) {
|
|
24545
|
+
FocusMode[FocusMode["None"] = 0] = "None";
|
|
24546
|
+
FocusMode[FocusMode["Click"] = 1] = "Click";
|
|
24547
|
+
FocusMode[FocusMode["All"] = 2] = "All";
|
|
24548
|
+
FocusMode[FocusMode["Accessibility"] = 3] = "Accessibility";
|
|
24549
|
+
})(FocusMode || (FocusMode = {}));
|
|
24550
|
+
var FocusBehaviorRecursive;
|
|
24551
|
+
(function(FocusBehaviorRecursive) {
|
|
24552
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Inherited"] = 0] = "Inherited";
|
|
24553
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Disabled"] = 1] = "Disabled";
|
|
24554
|
+
FocusBehaviorRecursive[FocusBehaviorRecursive["Enabled"] = 2] = "Enabled";
|
|
24555
|
+
})(FocusBehaviorRecursive || (FocusBehaviorRecursive = {}));
|
|
24556
|
+
var KeyLocation;
|
|
24557
|
+
(function(KeyLocation) {
|
|
24558
|
+
KeyLocation[KeyLocation["Unspecified"] = 0] = "Unspecified";
|
|
24559
|
+
KeyLocation[KeyLocation["Left"] = 1] = "Left";
|
|
24560
|
+
KeyLocation[KeyLocation["Right"] = 2] = "Right";
|
|
24561
|
+
})(KeyLocation || (KeyLocation = {}));
|
|
24562
|
+
var CursorShape;
|
|
24563
|
+
(function(CursorShape) {
|
|
24564
|
+
CursorShape[CursorShape["Arrow"] = 0] = "Arrow";
|
|
24565
|
+
CursorShape[CursorShape["Ibeam"] = 1] = "Ibeam";
|
|
24566
|
+
CursorShape[CursorShape["PointingHand"] = 2] = "PointingHand";
|
|
24567
|
+
CursorShape[CursorShape["Cross"] = 3] = "Cross";
|
|
24568
|
+
CursorShape[CursorShape["Wait"] = 4] = "Wait";
|
|
24569
|
+
CursorShape[CursorShape["Busy"] = 5] = "Busy";
|
|
24570
|
+
CursorShape[CursorShape["Drag"] = 6] = "Drag";
|
|
24571
|
+
CursorShape[CursorShape["CanDrop"] = 7] = "CanDrop";
|
|
24572
|
+
CursorShape[CursorShape["Forbidden"] = 8] = "Forbidden";
|
|
24573
|
+
CursorShape[CursorShape["Vsize"] = 9] = "Vsize";
|
|
24574
|
+
CursorShape[CursorShape["Hsize"] = 10] = "Hsize";
|
|
24575
|
+
CursorShape[CursorShape["Bdiagsize"] = 11] = "Bdiagsize";
|
|
24576
|
+
CursorShape[CursorShape["Fdiagsize"] = 12] = "Fdiagsize";
|
|
24577
|
+
CursorShape[CursorShape["Move"] = 13] = "Move";
|
|
24578
|
+
CursorShape[CursorShape["Vsplit"] = 14] = "Vsplit";
|
|
24579
|
+
CursorShape[CursorShape["Hsplit"] = 15] = "Hsplit";
|
|
24580
|
+
CursorShape[CursorShape["Help"] = 16] = "Help";
|
|
24581
|
+
})(CursorShape || (CursorShape = {}));
|
|
24582
|
+
|
|
24583
|
+
function _get_prototype_of(o) {
|
|
24584
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
24585
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
24439
24586
|
};
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24587
|
+
return _get_prototype_of(o);
|
|
24588
|
+
}
|
|
24589
|
+
|
|
24590
|
+
function _is_native_function(fn) {
|
|
24591
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
24592
|
+
}
|
|
24593
|
+
|
|
24594
|
+
function _wrap_native_super(Class) {
|
|
24595
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
24596
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
24597
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
24598
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
24599
|
+
if (typeof _cache !== "undefined") {
|
|
24600
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
24601
|
+
_cache.set(Class, Wrapper);
|
|
24445
24602
|
}
|
|
24446
|
-
|
|
24447
|
-
|
|
24448
|
-
// CanvasLayer 失效时,让其下挂的 CanvasItem 重新查找归属层
|
|
24449
|
-
// 拷贝一份避免迭代过程中数组被修改
|
|
24450
|
-
var items = this.canvasItems.slice();
|
|
24451
|
-
this.canvasItems.length = 0;
|
|
24452
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
24453
|
-
var canvasItem = _step.value;
|
|
24454
|
-
canvasItem.updateCanvasLayer();
|
|
24603
|
+
function Wrapper() {
|
|
24604
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
24455
24605
|
}
|
|
24456
|
-
|
|
24457
|
-
|
|
24458
|
-
|
|
24459
|
-
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
*
|
|
24463
|
-
* 注:画布尺寸到 RectTransform.size 的同步目前未在此处处理(由 RectTransform 自身按需 resolve);
|
|
24464
|
-
* 后续若需要在每帧强制刷新顶层 size,可在此处补回写入与 sizeChanged 传播
|
|
24465
|
-
*
|
|
24466
|
-
* @internal
|
|
24467
|
-
*/ _proto.draw = function draw() {
|
|
24468
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvasItems), _step; !(_step = _iterator()).done;){
|
|
24469
|
-
var canvasItem = _step.value;
|
|
24470
|
-
if (!canvasItem.item.isActive) {
|
|
24471
|
-
continue;
|
|
24606
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
24607
|
+
constructor: {
|
|
24608
|
+
value: Wrapper,
|
|
24609
|
+
enumerable: false,
|
|
24610
|
+
writable: true,
|
|
24611
|
+
configurable: true
|
|
24472
24612
|
}
|
|
24473
|
-
|
|
24474
|
-
|
|
24613
|
+
});
|
|
24614
|
+
return _set_prototype_of(Wrapper, Class);
|
|
24475
24615
|
};
|
|
24476
|
-
return
|
|
24477
|
-
}
|
|
24616
|
+
return _wrap_native_super(Class);
|
|
24617
|
+
}
|
|
24478
24618
|
|
|
24479
|
-
|
|
24480
|
-
|
|
24481
|
-
*
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
/**
|
|
24494
|
-
* 父 CanvasItem
|
|
24495
|
-
* 沿 VFXItem 父链向上查找到的最近的 CanvasItem(只看类型,不看 active/enabled — 拓扑跟激活状态解耦)。
|
|
24496
|
-
* 若不存在 CanvasItem 祖先(即直属于 CanvasLayer 或处于游离状态),该值为 null。
|
|
24497
|
-
*/ _this.parent = null;
|
|
24498
|
-
/**
|
|
24499
|
-
* 子 CanvasItem 列表(按注册顺序)
|
|
24500
|
-
* 由子节点在维护自身 parent 时反向写入,draw 时按数组顺序递归绘制
|
|
24501
|
-
*/ _this.children = [];
|
|
24502
|
-
/**
|
|
24503
|
-
* 当前所属的 CanvasLayer,未注册到任何 CanvasLayer 时为 null
|
|
24504
|
-
*/ _this.canvasLayerNode = null;
|
|
24505
|
-
return _this;
|
|
24619
|
+
function transformPoint(transform, value) {
|
|
24620
|
+
var elements = transform.elements;
|
|
24621
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y + elements[6], elements[1] * value.x + elements[4] * value.y + elements[7]);
|
|
24622
|
+
}
|
|
24623
|
+
function transformVector(transform, value) {
|
|
24624
|
+
var elements = transform.elements;
|
|
24625
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y, elements[1] * value.x + elements[4] * value.y);
|
|
24626
|
+
}
|
|
24627
|
+
var InputEvent = /*#__PURE__*/ function() {
|
|
24628
|
+
function InputEvent() {
|
|
24629
|
+
this.device = 0;
|
|
24630
|
+
this.pressed = false;
|
|
24631
|
+
this.canceled = false;
|
|
24632
|
+
this._accepted = false;
|
|
24506
24633
|
}
|
|
24507
|
-
var _proto =
|
|
24508
|
-
_proto.
|
|
24509
|
-
|
|
24510
|
-
// 注意 enable/disable 不再改变 CanvasItem 父子拓扑 — 拓扑由 VFXItem 父链(setParent / onParentChanged)维护,
|
|
24511
|
-
// enable 在这里只是兜底首次入树
|
|
24512
|
-
this.updateCanvasLayer();
|
|
24513
|
-
this.updateParentItem();
|
|
24634
|
+
var _proto = InputEvent.prototype;
|
|
24635
|
+
_proto.accept = function accept() {
|
|
24636
|
+
this._accepted = true;
|
|
24514
24637
|
};
|
|
24515
|
-
_proto.
|
|
24516
|
-
|
|
24517
|
-
// 整棵子树的隐藏由 `vfxItem.setActive(false)` 配合 drawInternal 中的 `item.isActive` 检查处理
|
|
24638
|
+
_proto.clearAccepted = function clearAccepted() {
|
|
24639
|
+
this._accepted = false;
|
|
24518
24640
|
};
|
|
24519
|
-
_proto.
|
|
24520
|
-
|
|
24521
|
-
this.updateCanvasLayer();
|
|
24522
|
-
this.updateParentItem();
|
|
24641
|
+
_proto.isAccepted = function isAccepted() {
|
|
24642
|
+
return this._accepted;
|
|
24523
24643
|
};
|
|
24524
|
-
_proto.
|
|
24525
|
-
this.
|
|
24526
|
-
this.removeFromCanvasLayer();
|
|
24527
|
-
// 防止子 canvasItem updateParentItem 的时候继续找到当前已销毁的 canvasItem
|
|
24528
|
-
this.enabled = false;
|
|
24529
|
-
this.updateChildrenParentItems();
|
|
24644
|
+
_proto.isPressed = function isPressed() {
|
|
24645
|
+
return this.pressed && !this.canceled;
|
|
24530
24646
|
};
|
|
24531
|
-
|
|
24532
|
-
|
|
24533
|
-
* 在父级变化、所在 CanvasLayer 失效等场景中调用
|
|
24534
|
-
*
|
|
24535
|
-
* 仅当自身是顶层 CanvasItem(parent 为 null)时才会登记到 CanvasLayer.canvasItems;
|
|
24536
|
-
* 嵌套的子 CanvasItem 仅记录 canvasLayerNode 引用,不进入 layer 的顶层列表。
|
|
24537
|
-
* @internal
|
|
24538
|
-
*/ _proto.updateCanvasLayer = function updateCanvasLayer() {
|
|
24539
|
-
// 拓扑跟 enabled/active 解耦,只看 item 是否还在
|
|
24540
|
-
if (!this.item) {
|
|
24541
|
-
this.removeFromCanvasLayer();
|
|
24542
|
-
return;
|
|
24543
|
-
}
|
|
24544
|
-
var newLayer = this.getCanvasLayerNode();
|
|
24545
|
-
if (newLayer === this.canvasLayerNode) {
|
|
24546
|
-
return;
|
|
24547
|
-
}
|
|
24548
|
-
// 仅当自身是顶层 CanvasItem 时,才需要在 layer 的 canvasItems 中迁移
|
|
24549
|
-
if (this.parent === null && this.canvasLayerNode) {
|
|
24550
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24551
|
-
}
|
|
24552
|
-
this.canvasLayerNode = newLayer;
|
|
24553
|
-
if (this.parent === null && newLayer) {
|
|
24554
|
-
newLayer.addCanvasItem(this);
|
|
24555
|
-
}
|
|
24647
|
+
_proto.isReleased = function isReleased() {
|
|
24648
|
+
return !this.pressed && !this.canceled;
|
|
24556
24649
|
};
|
|
24557
|
-
|
|
24558
|
-
|
|
24559
|
-
* 在 VFXItem 父级变化、自身启用/禁用、父 CanvasItem 失效等场景中调用
|
|
24560
|
-
*
|
|
24561
|
-
* parent 的变化会同步影响在 CanvasLayer.canvasItems 中的归属:
|
|
24562
|
-
* - 由有 parent 变成无 parent 且仍归属某 layer:加入 layer.canvasItems
|
|
24563
|
-
* - 由无 parent 变成有 parent:从 layer.canvasItems 中移除
|
|
24564
|
-
* @internal
|
|
24565
|
-
*/ _proto.updateParentItem = function updateParentItem() {
|
|
24566
|
-
// 拓扑跟 enabled/active 解耦,只看 item 是否还在
|
|
24567
|
-
if (!this.item) {
|
|
24568
|
-
this.removeFromParent();
|
|
24569
|
-
return;
|
|
24570
|
-
}
|
|
24571
|
-
var newParent = this.getParentItem();
|
|
24572
|
-
if (newParent === this.parent) {
|
|
24573
|
-
return;
|
|
24574
|
-
}
|
|
24575
|
-
var wasTopLevel = this.parent === null;
|
|
24576
|
-
this.removeFromParent();
|
|
24577
|
-
if (newParent) {
|
|
24578
|
-
this.parent = newParent;
|
|
24579
|
-
newParent.children.push(this);
|
|
24580
|
-
// 由顶层变成嵌套:从 layer 的顶层列表中移除
|
|
24581
|
-
if (wasTopLevel && this.canvasLayerNode) {
|
|
24582
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24583
|
-
}
|
|
24584
|
-
} else if (!wasTopLevel && this.canvasLayerNode) {
|
|
24585
|
-
// 由嵌套变成顶层:加入 layer 的顶层列表
|
|
24586
|
-
this.canvasLayerNode.addCanvasItem(this);
|
|
24587
|
-
}
|
|
24588
|
-
};
|
|
24589
|
-
/**
|
|
24590
|
-
* 绘制函数
|
|
24591
|
-
* 子类重写此方法以输出实际的绘制内容;调用时 graphics 的变换栈顶已经累积了从根到当前节点的所有父变换,
|
|
24592
|
-
* 子类直接使用 this.drawXxx / this.fillXxx 系列封装方法绘制即可,绘制坐标视为本地坐标。
|
|
24593
|
-
*/ _proto.draw = function draw() {
|
|
24594
|
-
// OVERRIDE
|
|
24595
|
-
};
|
|
24596
|
-
/**
|
|
24597
|
-
* 绘制单条线段
|
|
24598
|
-
* @param x1 - 起点 x
|
|
24599
|
-
* @param y1 - 起点 y
|
|
24600
|
-
* @param x2 - 终点 x
|
|
24601
|
-
* @param y2 - 终点 y
|
|
24602
|
-
* @param color - 线条颜色
|
|
24603
|
-
* @param thickness - 线宽
|
|
24604
|
-
*/ _proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
|
|
24605
|
-
this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
|
|
24606
|
-
};
|
|
24607
|
-
/**
|
|
24608
|
-
* 按顺序连接所有点绘制折线(首尾相同则视为闭合)
|
|
24609
|
-
* @param points - 点数组,格式 [x1,y1,x2,y2,...]
|
|
24610
|
-
* @param color - 线条颜色
|
|
24611
|
-
* @param thickness - 线宽
|
|
24612
|
-
*/ _proto.drawPolyline = function drawPolyline(points, color, thickness) {
|
|
24613
|
-
this.engine.graphics.drawLines(points, color, thickness);
|
|
24614
|
-
};
|
|
24615
|
-
/**
|
|
24616
|
-
* 绘制三次贝塞尔曲线
|
|
24617
|
-
*/ _proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
|
|
24618
|
-
this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
|
|
24619
|
-
};
|
|
24620
|
-
/**
|
|
24621
|
-
* 绘制三角形边框
|
|
24622
|
-
*/ _proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
|
|
24623
|
-
this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
|
|
24624
|
-
};
|
|
24625
|
-
/**
|
|
24626
|
-
* 绘制矩形边框
|
|
24627
|
-
* @param x - 矩形左下角 x 坐标
|
|
24628
|
-
* @param y - 矩形左下角 y 坐标
|
|
24629
|
-
*/ _proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
|
|
24630
|
-
this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
|
|
24631
|
-
};
|
|
24632
|
-
/**
|
|
24633
|
-
* 绘制圆形边框
|
|
24634
|
-
*/ _proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
|
|
24635
|
-
this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
|
|
24636
|
-
};
|
|
24637
|
-
/**
|
|
24638
|
-
* 绘制填充三角形
|
|
24639
|
-
*/ _proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
|
|
24640
|
-
this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
|
|
24641
|
-
};
|
|
24642
|
-
/**
|
|
24643
|
-
* 绘制填充矩形
|
|
24644
|
-
* @param x - 矩形左下角 x 坐标
|
|
24645
|
-
* @param y - 矩形左下角 y 坐标
|
|
24646
|
-
*/ _proto.fillRect = function fillRect(x, y, width, height, color) {
|
|
24647
|
-
this.engine.graphics.fillRectangle(x, y, width, height, color);
|
|
24648
|
-
};
|
|
24649
|
-
/**
|
|
24650
|
-
* 绘制填充圆形
|
|
24651
|
-
*/ _proto.fillCircle = function fillCircle(cx, cy, radius, color) {
|
|
24652
|
-
this.engine.graphics.fillCircle(cx, cy, radius, color);
|
|
24653
|
-
};
|
|
24654
|
-
/**
|
|
24655
|
-
* 绘制纹理矩形(本地坐标,Y 向上,(x, y) 为左下角)
|
|
24656
|
-
* @param region - 纹理 UV 子矩形,默认全图。Y 向上,(u0, v0) 为左下角 UV
|
|
24657
|
-
* @param color - 乘色,默认白色
|
|
24658
|
-
*/ _proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
|
|
24659
|
-
this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
|
|
24660
|
-
};
|
|
24661
|
-
/**
|
|
24662
|
-
* 绘制文本(本地坐标,Y 向上,(x, y) 为文本左下角)。
|
|
24663
|
-
*
|
|
24664
|
-
* 同一段文本不同颜色不会重复 upload — 颜色由 `color` 参数透传作为乘色,纹理只缓存白色字形。
|
|
24665
|
-
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
24666
|
-
*/ _proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
|
|
24667
|
-
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
24668
|
-
};
|
|
24669
|
-
/**
|
|
24670
|
-
* 绘制自身并按 children 数组顺序递归绘制所有子 CanvasItem。
|
|
24671
|
-
* @internal
|
|
24672
|
-
*/ _proto.drawInternal = function drawInternal() {
|
|
24673
|
-
var graphics = this.engine.graphics;
|
|
24674
|
-
var localMatrix2D = this.transform.getMatrix2D();
|
|
24675
|
-
graphics.pushTransform(localMatrix2D);
|
|
24676
|
-
// self 是否绘制只看 component.enabled — 其它都不影响。
|
|
24677
|
-
// transform 始终被 push,children 始终被遍历,这样 component.enabled=false 时 self 隐藏
|
|
24678
|
-
// 但 children 的位置不受影响
|
|
24679
|
-
if (this.enabled) {
|
|
24680
|
-
this.draw();
|
|
24681
|
-
}
|
|
24682
|
-
// 子是否参与绘制看 VFXItem.isActive(整棵跳过的语义)。
|
|
24683
|
-
// 子自身的 component.enabled 在它自己的 drawInternal 里再判断
|
|
24684
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
24685
|
-
var child = _step.value;
|
|
24686
|
-
if (!child.item.isActive) {
|
|
24687
|
-
continue;
|
|
24688
|
-
}
|
|
24689
|
-
child.drawInternal();
|
|
24690
|
-
}
|
|
24691
|
-
graphics.popTransform();
|
|
24692
|
-
};
|
|
24693
|
-
/**
|
|
24694
|
-
* 从当前所属的 CanvasLayer 注销自身(如果有)
|
|
24695
|
-
* 仅当自身是顶层 CanvasItem 时,才会触发 layer 顶层列表的移除
|
|
24696
|
-
*/ _proto.removeFromCanvasLayer = function removeFromCanvasLayer() {
|
|
24697
|
-
if (!this.canvasLayerNode) {
|
|
24698
|
-
return;
|
|
24699
|
-
}
|
|
24700
|
-
if (this.parent === null) {
|
|
24701
|
-
this.canvasLayerNode.removeCanvasItem(this);
|
|
24702
|
-
}
|
|
24703
|
-
this.canvasLayerNode = null;
|
|
24704
|
-
};
|
|
24705
|
-
/**
|
|
24706
|
-
* 从当前父 CanvasItem 的 children 中移除自身(如果有)
|
|
24707
|
-
*/ _proto.removeFromParent = function removeFromParent() {
|
|
24708
|
-
if (!this.parent) {
|
|
24709
|
-
return;
|
|
24710
|
-
}
|
|
24711
|
-
removeItem(this.parent.children, this);
|
|
24712
|
-
this.parent = null;
|
|
24650
|
+
_proto.isCanceled = function isCanceled() {
|
|
24651
|
+
return this.canceled;
|
|
24713
24652
|
};
|
|
24714
|
-
|
|
24715
|
-
|
|
24716
|
-
* 自身失效时调用,子节点会跳过自己向上找到新的父 CanvasItem(可能为 null)。
|
|
24717
|
-
*/ _proto.updateChildrenParentItems = function updateChildrenParentItems() {
|
|
24718
|
-
if (this.children.length === 0) {
|
|
24719
|
-
return;
|
|
24720
|
-
}
|
|
24721
|
-
// 拷贝避免迭代过程中数组被 removeFromParent 修改
|
|
24722
|
-
var snapshot = this.children.slice();
|
|
24723
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(snapshot), _step; !(_step = _iterator()).done;){
|
|
24724
|
-
var child = _step.value;
|
|
24725
|
-
child.updateParentItem();
|
|
24726
|
-
}
|
|
24653
|
+
_proto.isEcho = function isEcho() {
|
|
24654
|
+
return false;
|
|
24727
24655
|
};
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
* 注意:自身所在 VFXItem 上的 CanvasLayer 也参与查找(同节点上可能并存 CanvasLayer 与 CanvasItem)
|
|
24731
|
-
*/ _proto.getCanvasLayerNode = function getCanvasLayerNode() {
|
|
24732
|
-
var current = this.item;
|
|
24733
|
-
while(current){
|
|
24734
|
-
var layer = getCanvasLayerFromItem(current);
|
|
24735
|
-
if (layer) {
|
|
24736
|
-
return layer;
|
|
24737
|
-
}
|
|
24738
|
-
var _current_parent;
|
|
24739
|
-
current = (_current_parent = current.parent) != null ? _current_parent : null;
|
|
24740
|
-
}
|
|
24741
|
-
return null;
|
|
24656
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24657
|
+
return this;
|
|
24742
24658
|
};
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24659
|
+
return InputEvent;
|
|
24660
|
+
}();
|
|
24661
|
+
InputEvent.deviceIdEmulation = -1;
|
|
24662
|
+
InputEvent.deviceIdInternal = -2;
|
|
24663
|
+
InputEvent.deviceIdKeyboard = 16;
|
|
24664
|
+
InputEvent.deviceIdMouse = 32;
|
|
24665
|
+
var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
24666
|
+
_inherits(InputEventWithModifiers, InputEvent);
|
|
24667
|
+
function InputEventWithModifiers() {
|
|
24668
|
+
var _this;
|
|
24669
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24670
|
+
_this.commandOrControlAutoremap = false;
|
|
24671
|
+
_this.shiftPressed = false;
|
|
24672
|
+
_this.altPressed = false;
|
|
24673
|
+
_this.metaPressed = false;
|
|
24674
|
+
_this.ctrlPressed = false;
|
|
24675
|
+
return _this;
|
|
24676
|
+
}
|
|
24677
|
+
var _proto = InputEventWithModifiers.prototype;
|
|
24678
|
+
_proto.copyModifiersTo = function copyModifiersTo(event) {
|
|
24679
|
+
event.device = this.device;
|
|
24680
|
+
event.pressed = this.pressed;
|
|
24681
|
+
event.canceled = this.canceled;
|
|
24682
|
+
event.commandOrControlAutoremap = this.commandOrControlAutoremap;
|
|
24683
|
+
event.shiftPressed = this.shiftPressed;
|
|
24684
|
+
event.altPressed = this.altPressed;
|
|
24685
|
+
event.metaPressed = this.metaPressed;
|
|
24686
|
+
event.ctrlPressed = this.ctrlPressed;
|
|
24687
|
+
};
|
|
24688
|
+
return InputEventWithModifiers;
|
|
24689
|
+
}(_wrap_native_super(InputEvent));
|
|
24690
|
+
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24691
|
+
_inherits(InputEventKey, InputEventWithModifiers);
|
|
24692
|
+
function InputEventKey() {
|
|
24693
|
+
var _this;
|
|
24694
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24695
|
+
_this.keycode = "";
|
|
24696
|
+
_this.physicalKeycode = "";
|
|
24697
|
+
_this.keyLabel = "";
|
|
24698
|
+
_this.unicode = 0;
|
|
24699
|
+
_this.location = KeyLocation.Unspecified;
|
|
24700
|
+
_this.echo = false;
|
|
24701
|
+
return _this;
|
|
24702
|
+
}
|
|
24703
|
+
var _proto = InputEventKey.prototype;
|
|
24704
|
+
_proto.isEcho = function isEcho() {
|
|
24705
|
+
return this.echo;
|
|
24758
24706
|
};
|
|
24759
|
-
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24763
|
-
|
|
24764
|
-
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
}(Component);
|
|
24771
|
-
/**
|
|
24772
|
-
* 在指定 VFXItem 上查找一个激活的 CanvasLayer 组件
|
|
24773
|
-
*/ function getCanvasLayerFromItem(item) {
|
|
24774
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
24775
|
-
var component = _step.value;
|
|
24776
|
-
if (_instanceof1(component, CanvasLayer) && component.isActiveAndEnabled) {
|
|
24777
|
-
return component;
|
|
24778
|
-
}
|
|
24707
|
+
return InputEventKey;
|
|
24708
|
+
}(InputEventWithModifiers);
|
|
24709
|
+
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24710
|
+
_inherits(InputEventMouse, InputEventWithModifiers);
|
|
24711
|
+
function InputEventMouse() {
|
|
24712
|
+
var _this;
|
|
24713
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24714
|
+
_this.buttonMask = MouseButtonMask.None;
|
|
24715
|
+
_this.position = new Vector2();
|
|
24716
|
+
_this.globalPosition = new Vector2();
|
|
24717
|
+
return _this;
|
|
24779
24718
|
}
|
|
24780
|
-
|
|
24781
|
-
|
|
24782
|
-
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24719
|
+
var _proto = InputEventMouse.prototype;
|
|
24720
|
+
_proto.copyMouseTo = function copyMouseTo(event) {
|
|
24721
|
+
this.copyModifiersTo(event);
|
|
24722
|
+
event.buttonMask = this.buttonMask;
|
|
24723
|
+
event.position.copyFrom(this.position);
|
|
24724
|
+
event.globalPosition.copyFrom(this.globalPosition);
|
|
24725
|
+
};
|
|
24726
|
+
return InputEventMouse;
|
|
24727
|
+
}(InputEventWithModifiers);
|
|
24728
|
+
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
24729
|
+
_inherits(InputEventMouseButton, InputEventMouse);
|
|
24730
|
+
function InputEventMouseButton() {
|
|
24731
|
+
var _this;
|
|
24732
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24733
|
+
_this.factor = 1;
|
|
24734
|
+
_this.buttonIndex = MouseButton.None;
|
|
24735
|
+
_this.doubleClick = false;
|
|
24736
|
+
return _this;
|
|
24790
24737
|
}
|
|
24791
|
-
|
|
24792
|
-
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24738
|
+
var _proto = InputEventMouseButton.prototype;
|
|
24739
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24740
|
+
var event = new InputEventMouseButton();
|
|
24741
|
+
this.copyMouseTo(event);
|
|
24742
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24743
|
+
event.factor = this.factor;
|
|
24744
|
+
event.buttonIndex = this.buttonIndex;
|
|
24745
|
+
event.doubleClick = this.doubleClick;
|
|
24746
|
+
return event;
|
|
24747
|
+
};
|
|
24748
|
+
return InputEventMouseButton;
|
|
24749
|
+
}(InputEventMouse);
|
|
24750
|
+
var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
|
|
24751
|
+
_inherits(InputEventMouseMotion, InputEventMouse);
|
|
24752
|
+
function InputEventMouseMotion() {
|
|
24753
|
+
var _this;
|
|
24754
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24755
|
+
_this.tilt = new Vector2();
|
|
24756
|
+
_this.pressure = 0;
|
|
24757
|
+
_this.relative = new Vector2();
|
|
24758
|
+
_this.screenRelative = new Vector2();
|
|
24759
|
+
_this.velocity = new Vector2();
|
|
24760
|
+
_this.screenVelocity = new Vector2();
|
|
24761
|
+
_this.penInverted = false;
|
|
24762
|
+
return _this;
|
|
24763
|
+
}
|
|
24764
|
+
var _proto = InputEventMouseMotion.prototype;
|
|
24765
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24766
|
+
var event = new InputEventMouseMotion();
|
|
24767
|
+
this.copyMouseTo(event);
|
|
24768
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24769
|
+
event.tilt.copyFrom(this.tilt);
|
|
24770
|
+
event.pressure = this.pressure;
|
|
24771
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24772
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
24773
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24774
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24775
|
+
event.penInverted = this.penInverted;
|
|
24776
|
+
return event;
|
|
24777
|
+
};
|
|
24778
|
+
return InputEventMouseMotion;
|
|
24779
|
+
}(InputEventMouse);
|
|
24780
|
+
var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
|
|
24781
|
+
_inherits(InputEventScreenTouch, InputEvent);
|
|
24782
|
+
function InputEventScreenTouch() {
|
|
24783
|
+
var _this;
|
|
24784
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24785
|
+
_this.index = 0;
|
|
24786
|
+
_this.position = new Vector2();
|
|
24787
|
+
_this.doubleTap = false;
|
|
24788
|
+
return _this;
|
|
24789
|
+
}
|
|
24790
|
+
var _proto = InputEventScreenTouch.prototype;
|
|
24791
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24792
|
+
var event = new InputEventScreenTouch();
|
|
24793
|
+
event.device = this.device;
|
|
24794
|
+
event.pressed = this.pressed;
|
|
24795
|
+
event.canceled = this.canceled;
|
|
24796
|
+
event.index = this.index;
|
|
24797
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24798
|
+
event.doubleTap = this.doubleTap;
|
|
24799
|
+
return event;
|
|
24800
|
+
};
|
|
24801
|
+
return InputEventScreenTouch;
|
|
24802
|
+
}(_wrap_native_super(InputEvent));
|
|
24803
|
+
var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
24804
|
+
_inherits(InputEventScreenDrag, InputEvent);
|
|
24805
|
+
function InputEventScreenDrag() {
|
|
24806
|
+
var _this;
|
|
24807
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24808
|
+
_this.index = 0;
|
|
24809
|
+
_this.position = new Vector2();
|
|
24810
|
+
_this.relative = new Vector2();
|
|
24811
|
+
_this.screenRelative = new Vector2();
|
|
24812
|
+
_this.velocity = new Vector2();
|
|
24813
|
+
_this.screenVelocity = new Vector2();
|
|
24814
|
+
_this.pressure = 0;
|
|
24815
|
+
_this.tilt = new Vector2();
|
|
24816
|
+
_this.penInverted = false;
|
|
24817
|
+
return _this;
|
|
24818
|
+
}
|
|
24819
|
+
var _proto = InputEventScreenDrag.prototype;
|
|
24820
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24821
|
+
var event = new InputEventScreenDrag();
|
|
24822
|
+
event.device = this.device;
|
|
24823
|
+
event.pressed = this.pressed;
|
|
24824
|
+
event.canceled = this.canceled;
|
|
24825
|
+
event.index = this.index;
|
|
24826
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24827
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24828
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
24829
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24830
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24831
|
+
event.pressure = this.pressure;
|
|
24832
|
+
event.tilt.copyFrom(this.tilt);
|
|
24833
|
+
event.penInverted = this.penInverted;
|
|
24834
|
+
return event;
|
|
24835
|
+
};
|
|
24836
|
+
return InputEventScreenDrag;
|
|
24837
|
+
}(_wrap_native_super(InputEvent));
|
|
24838
|
+
|
|
24839
|
+
var ANCHOR_PRESET_TABLE = {
|
|
24798
24840
|
topLeft: [
|
|
24799
24841
|
0,
|
|
24800
|
-
1,
|
|
24801
24842
|
0,
|
|
24802
|
-
|
|
24843
|
+
0,
|
|
24844
|
+
0
|
|
24803
24845
|
],
|
|
24804
24846
|
topRight: [
|
|
24805
24847
|
1,
|
|
24848
|
+
0,
|
|
24806
24849
|
1,
|
|
24807
|
-
|
|
24808
|
-
1
|
|
24850
|
+
0
|
|
24809
24851
|
],
|
|
24810
24852
|
bottomLeft: [
|
|
24811
24853
|
0,
|
|
24854
|
+
1,
|
|
24812
24855
|
0,
|
|
24813
|
-
|
|
24814
|
-
0
|
|
24856
|
+
1
|
|
24815
24857
|
],
|
|
24816
24858
|
bottomRight: [
|
|
24817
24859
|
1,
|
|
24818
|
-
0,
|
|
24819
24860
|
1,
|
|
24820
|
-
|
|
24861
|
+
1,
|
|
24862
|
+
1
|
|
24821
24863
|
],
|
|
24822
24864
|
centerLeft: [
|
|
24823
24865
|
0,
|
|
@@ -24827,9 +24869,9 @@ FrameComponent = __decorate([
|
|
|
24827
24869
|
],
|
|
24828
24870
|
centerTop: [
|
|
24829
24871
|
0.5,
|
|
24830
|
-
|
|
24872
|
+
0,
|
|
24831
24873
|
0.5,
|
|
24832
|
-
|
|
24874
|
+
0
|
|
24833
24875
|
],
|
|
24834
24876
|
centerRight: [
|
|
24835
24877
|
1,
|
|
@@ -24839,9 +24881,9 @@ FrameComponent = __decorate([
|
|
|
24839
24881
|
],
|
|
24840
24882
|
centerBottom: [
|
|
24841
24883
|
0.5,
|
|
24842
|
-
|
|
24884
|
+
1,
|
|
24843
24885
|
0.5,
|
|
24844
|
-
|
|
24886
|
+
1
|
|
24845
24887
|
],
|
|
24846
24888
|
center: [
|
|
24847
24889
|
0.5,
|
|
@@ -24856,10 +24898,10 @@ FrameComponent = __decorate([
|
|
|
24856
24898
|
1
|
|
24857
24899
|
],
|
|
24858
24900
|
topWide: [
|
|
24901
|
+
0,
|
|
24859
24902
|
0,
|
|
24860
24903
|
1,
|
|
24861
|
-
|
|
24862
|
-
1
|
|
24904
|
+
0
|
|
24863
24905
|
],
|
|
24864
24906
|
rightWide: [
|
|
24865
24907
|
1,
|
|
@@ -24868,10 +24910,10 @@ FrameComponent = __decorate([
|
|
|
24868
24910
|
1
|
|
24869
24911
|
],
|
|
24870
24912
|
bottomWide: [
|
|
24871
|
-
0,
|
|
24872
24913
|
0,
|
|
24873
24914
|
1,
|
|
24874
|
-
|
|
24915
|
+
1,
|
|
24916
|
+
1
|
|
24875
24917
|
],
|
|
24876
24918
|
vcenterWide: [
|
|
24877
24919
|
0.5,
|
|
@@ -24893,306 +24935,171 @@ FrameComponent = __decorate([
|
|
|
24893
24935
|
]
|
|
24894
24936
|
};
|
|
24895
24937
|
/**
|
|
24896
|
-
*
|
|
24897
|
-
*
|
|
24898
|
-
|
|
24899
|
-
|
|
24900
|
-
|
|
24901
|
-
|
|
24902
|
-
|
|
24903
|
-
|
|
24904
|
-
|
|
24905
|
-
|
|
24906
|
-
|
|
24907
|
-
|
|
24908
|
-
|
|
24909
|
-
|
|
24910
|
-
|
|
24911
|
-
|
|
24912
|
-
|
|
24913
|
-
|
|
24914
|
-
|
|
24915
|
-
|
|
24916
|
-
|
|
24917
|
-
|
|
24918
|
-
|
|
24919
|
-
|
|
24920
|
-
|
|
24921
|
-
|
|
24922
|
-
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
* 父 rect 上的归一化最小角 `(anchorLeft, anchorBottom)`
|
|
24927
|
-
*/ _this.anchorMin = new Vector2(0, 0);
|
|
24928
|
-
/**
|
|
24929
|
-
* 父 rect 上的归一化最大角 `(anchorRight, anchorTop)`
|
|
24930
|
-
*/ _this.anchorMax = new Vector2(0, 0);
|
|
24931
|
-
/**
|
|
24932
|
-
* rect 左/下边相对 anchorMin 锚点的像素偏移 `(offsetLeft, offsetBottom)`
|
|
24933
|
-
*/ _this.offsetMin = new Vector2(0, 0);
|
|
24934
|
-
/**
|
|
24935
|
-
* rect 右/上边相对 anchorMax 锚点的像素偏移 `(offsetRight, offsetTop)`
|
|
24936
|
-
*/ _this.offsetMax = new Vector2(0, 0);
|
|
24937
|
-
/**
|
|
24938
|
-
* 自身 rect 上的归一化轴心 `(0..1)`,默认 `(0.5, 0.5)`(中心)。两层效果:
|
|
24939
|
-
* 1. **Layout**:`setSize` 时 rect 围绕此点对称缩放(pivot=(0.5, 0.5) → 居中扩展;pivot=(0, 0) → 从左下扩展;pivot=(1, 1) → 向左下缩)
|
|
24940
|
-
* 2. **矩阵**:`pivot` 自动同步到 `transform.anchor = pivot * size`(像素值,矩阵旋转/缩放中心),
|
|
24941
|
-
* 所以旋转/缩放也围绕同一点。`setPivot` 和每次 `sizeChanged`(size 重算后)都会刷新 `transform.anchor`
|
|
24942
|
-
*/ _this.pivot = new Vector2(0.5, 0.5);
|
|
24943
|
-
return _this;
|
|
24938
|
+
* A drawable GUI object. Controls form a tree independent from the VFXItem
|
|
24939
|
+
* scene tree. UIControl is the bridge between both trees.
|
|
24940
|
+
*/ var Control = /*#__PURE__*/ function() {
|
|
24941
|
+
function Control(engine) {
|
|
24942
|
+
this.engine = engine;
|
|
24943
|
+
this._parent = null;
|
|
24944
|
+
this._visible = true;
|
|
24945
|
+
this._enabled = true;
|
|
24946
|
+
this._mouseFilter = MouseFilter.Stop;
|
|
24947
|
+
this._mouseBehaviorRecursive = MouseBehaviorRecursive.Inherited;
|
|
24948
|
+
this._focusMode = FocusMode.None;
|
|
24949
|
+
this._focusBehaviorRecursive = FocusBehaviorRecursive.Inherited;
|
|
24950
|
+
this._defaultCursorShape = CursorShape.Arrow;
|
|
24951
|
+
this._rotation = 0;
|
|
24952
|
+
this.transformDirty = true;
|
|
24953
|
+
this.cachedTransform = new Matrix3();
|
|
24954
|
+
this.eventEmitter = new EventEmitter();
|
|
24955
|
+
this.disposed = false;
|
|
24956
|
+
this./** Scene-tree bridge that owns this GUI object, if any. */ owner = null;
|
|
24957
|
+
this.position = new Vector2();
|
|
24958
|
+
this.size = new Vector2(1, 1);
|
|
24959
|
+
this.anchorMin = new Vector2();
|
|
24960
|
+
this.anchorMax = new Vector2();
|
|
24961
|
+
this.offsetMin = new Vector2();
|
|
24962
|
+
this.offsetMax = new Vector2(1, 1);
|
|
24963
|
+
this.pivot = new Vector2(0.5, 0.5);
|
|
24964
|
+
this.scale = new Vector2(1, 1);
|
|
24965
|
+
this.shear = new Vector2();
|
|
24966
|
+
this.mouseForcePassScrollEvents = true;
|
|
24967
|
+
this.clipContents = false;
|
|
24944
24968
|
}
|
|
24945
|
-
var _proto =
|
|
24946
|
-
|
|
24947
|
-
|
|
24948
|
-
|
|
24949
|
-
|
|
24950
|
-
|
|
24951
|
-
|
|
24952
|
-
|
|
24953
|
-
|
|
24954
|
-
|
|
24955
|
-
|
|
24956
|
-
Transform.prototype.fromData.call(this, data);
|
|
24957
|
-
if (this.size.x !== 0 && this.size.y !== 0) {
|
|
24958
|
-
this.pivot.set(this.anchor.x / this.size.x, this.anchor.y / this.size.y);
|
|
24969
|
+
var _proto = Control.prototype;
|
|
24970
|
+
_proto.on = function on(eventName, listener, options) {
|
|
24971
|
+
this.eventEmitter.on(eventName, listener, options);
|
|
24972
|
+
};
|
|
24973
|
+
_proto.off = function off(eventName, listener) {
|
|
24974
|
+
this.eventEmitter.off(eventName, listener);
|
|
24975
|
+
};
|
|
24976
|
+
_proto.setPosition = function setPosition(x, y, keepOffsets) {
|
|
24977
|
+
if (keepOffsets === void 0) keepOffsets = false;
|
|
24978
|
+
if (this.position.x === x && this.position.y === y) {
|
|
24979
|
+
return;
|
|
24959
24980
|
}
|
|
24960
|
-
|
|
24961
|
-
|
|
24962
|
-
|
|
24963
|
-
|
|
24981
|
+
var rect = {
|
|
24982
|
+
position: new Vector2(x, y),
|
|
24983
|
+
size: this.size.clone()
|
|
24984
|
+
};
|
|
24985
|
+
if (keepOffsets && this.parent) {
|
|
24986
|
+
this.computeAnchors(rect, this.getParentRect());
|
|
24987
|
+
} else {
|
|
24988
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
24964
24989
|
}
|
|
24965
|
-
|
|
24966
|
-
|
|
24967
|
-
|
|
24968
|
-
|
|
24990
|
+
this.updateLayout();
|
|
24991
|
+
};
|
|
24992
|
+
_proto.setSize = function setSize(width, height) {
|
|
24993
|
+
if (this.size.x === width && this.size.y === height) {
|
|
24994
|
+
return;
|
|
24969
24995
|
}
|
|
24970
|
-
|
|
24971
|
-
|
|
24972
|
-
|
|
24973
|
-
|
|
24996
|
+
var rect = {
|
|
24997
|
+
position: this.position.clone(),
|
|
24998
|
+
size: new Vector2(width, height)
|
|
24999
|
+
};
|
|
25000
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
25001
|
+
this.updateLayout();
|
|
25002
|
+
};
|
|
25003
|
+
_proto.setScale = function setScale(x, y) {
|
|
25004
|
+
if (this.scale.x !== x || this.scale.y !== y) {
|
|
25005
|
+
this.scale.set(x, y);
|
|
25006
|
+
this.markTransformDirty();
|
|
24974
25007
|
}
|
|
24975
|
-
|
|
24976
|
-
|
|
24977
|
-
|
|
24978
|
-
this.
|
|
25008
|
+
};
|
|
25009
|
+
_proto.setRotation = function setRotation(degrees) {
|
|
25010
|
+
if (this._rotation !== degrees) {
|
|
25011
|
+
this._rotation = degrees;
|
|
25012
|
+
this.markTransformDirty();
|
|
25013
|
+
}
|
|
25014
|
+
};
|
|
25015
|
+
_proto.setShear = function setShear(x, y) {
|
|
25016
|
+
if (this.shear.x !== x || this.shear.y !== y) {
|
|
25017
|
+
this.shear.set(x, y);
|
|
25018
|
+
this.markTransformDirty();
|
|
25019
|
+
}
|
|
25020
|
+
};
|
|
25021
|
+
_proto.setPivot = function setPivot(x, y) {
|
|
25022
|
+
if (this.pivot.x !== x || this.pivot.y !== y) {
|
|
25023
|
+
this.pivot.set(x, y);
|
|
25024
|
+
this.markTransformDirty();
|
|
24979
25025
|
}
|
|
24980
25026
|
};
|
|
24981
|
-
// ── layout-input setters(改完 → sizeChanged 重算)──────
|
|
24982
25027
|
_proto.setAnchorMin = function setAnchorMin(x, y) {
|
|
24983
25028
|
if (this.anchorMin.x !== x || this.anchorMin.y !== y) {
|
|
24984
|
-
this.anchorMin.x
|
|
24985
|
-
this.
|
|
24986
|
-
this.sizeChanged();
|
|
25029
|
+
this.anchorMin.set(x, y);
|
|
25030
|
+
this.updateLayout();
|
|
24987
25031
|
}
|
|
24988
25032
|
};
|
|
24989
25033
|
_proto.setAnchorMax = function setAnchorMax(x, y) {
|
|
24990
25034
|
if (this.anchorMax.x !== x || this.anchorMax.y !== y) {
|
|
24991
|
-
this.anchorMax.x
|
|
24992
|
-
this.
|
|
24993
|
-
this.sizeChanged();
|
|
25035
|
+
this.anchorMax.set(x, y);
|
|
25036
|
+
this.updateLayout();
|
|
24994
25037
|
}
|
|
24995
25038
|
};
|
|
24996
25039
|
_proto.setOffsetMin = function setOffsetMin(x, y) {
|
|
24997
25040
|
if (this.offsetMin.x !== x || this.offsetMin.y !== y) {
|
|
24998
|
-
this.offsetMin.x
|
|
24999
|
-
this.
|
|
25000
|
-
this.sizeChanged();
|
|
25041
|
+
this.offsetMin.set(x, y);
|
|
25042
|
+
this.updateLayout();
|
|
25001
25043
|
}
|
|
25002
25044
|
};
|
|
25003
25045
|
_proto.setOffsetMax = function setOffsetMax(x, y) {
|
|
25004
25046
|
if (this.offsetMax.x !== x || this.offsetMax.y !== y) {
|
|
25005
|
-
this.offsetMax.x
|
|
25006
|
-
this.
|
|
25007
|
-
this.sizeChanged();
|
|
25008
|
-
}
|
|
25009
|
-
};
|
|
25010
|
-
/**
|
|
25011
|
-
* 设置 rect 内的归一化轴心 `(0..1)`,同时把 `transform.anchor`(矩阵旋转/缩放中心)同步到 `pivot * size`。
|
|
25012
|
-
* 不重算 rect(pivot 只决定 setSize 行为,不直接影响当前 rect 位置 / 尺寸)
|
|
25013
|
-
*/ _proto.setPivot = function setPivot(x, y) {
|
|
25014
|
-
if (this.pivot.x !== x || this.pivot.y !== y) {
|
|
25015
|
-
this.pivot.x = x;
|
|
25016
|
-
this.pivot.y = y;
|
|
25017
|
-
// 同步 transform.anchor(像素 pivot)= pivot * size,让旋转/缩放绕同一点
|
|
25018
|
-
this.anchor.set(this.pivot.x * this.size.x, this.pivot.y * this.size.y, this.anchor.z);
|
|
25047
|
+
this.offsetMax.set(x, y);
|
|
25048
|
+
this.updateLayout();
|
|
25019
25049
|
}
|
|
25020
25050
|
};
|
|
25021
|
-
|
|
25022
|
-
* 重写父类 `setPosition`:
|
|
25023
|
-
* - 顶层(无 RectTransform 父):直接 `super.setPosition` 写位置,触发 `sizeChanged` 传播
|
|
25024
|
-
* - 非顶层:语义为"设置 rect 左下角到 (x, y)",反推 offset 维持当前 anchor,然后 `sizeChanged` 重算
|
|
25025
|
-
*
|
|
25026
|
-
* @param keepOffsets - 默认 false。true 时反推 anchor 而非 offset(rect 在屏幕上不动,但 anchor 比例改变)
|
|
25027
|
-
*/ _proto.setPosition = function setPosition(x, y, z, keepOffsets) {
|
|
25028
|
-
if (keepOffsets === void 0) keepOffsets = false;
|
|
25029
|
-
if (!_instanceof1(this.parentTransform, RectTransform)) {
|
|
25030
|
-
// 顶层:直接写,然后传播给子节点
|
|
25031
|
-
Transform.prototype.setPosition.call(this, x, y, z);
|
|
25032
|
-
this.sizeChanged();
|
|
25033
|
-
return;
|
|
25034
|
-
}
|
|
25035
|
-
var parentRect = {
|
|
25036
|
-
position: new Vector2(0, 0),
|
|
25037
|
-
size: this.parentTransform.size.clone()
|
|
25038
|
-
};
|
|
25039
|
-
var newRect = {
|
|
25040
|
-
position: new Vector2(x, y),
|
|
25041
|
-
size: this.size.clone()
|
|
25042
|
-
};
|
|
25043
|
-
if (keepOffsets) {
|
|
25044
|
-
this.computeAnchors(newRect, parentRect);
|
|
25045
|
-
} else {
|
|
25046
|
-
this.computeOffsets(newRect, parentRect);
|
|
25047
|
-
}
|
|
25048
|
-
this.sizeChanged();
|
|
25049
|
-
if (this.position.z !== z) {
|
|
25050
|
-
Transform.prototype.setPosition.call(this, this.position.x, this.position.y, z);
|
|
25051
|
-
}
|
|
25052
|
-
};
|
|
25053
|
-
/**
|
|
25054
|
-
* 重写父类 `setSize`:
|
|
25055
|
-
* - 顶层:直接 `super.setSize`,触发 `sizeChanged` 传播
|
|
25056
|
-
* - 非顶层:反推 offset 维持当前 anchor,然后 `sizeChanged` 重算
|
|
25057
|
-
*/ _proto.setSize = function setSize(x, y) {
|
|
25058
|
-
if (this.size.x === x && this.size.y === y) {
|
|
25059
|
-
return;
|
|
25060
|
-
}
|
|
25061
|
-
if (!_instanceof1(this.parentTransform, RectTransform)) {
|
|
25062
|
-
Transform.prototype.setSize.call(this, x, y);
|
|
25063
|
-
this.sizeChanged();
|
|
25064
|
-
return;
|
|
25065
|
-
}
|
|
25066
|
-
// 围绕 pivot 对称缩放:Δsize 在 offsetMin / offsetMax 上按 pivot / (1-pivot) 比例分配。
|
|
25067
|
-
// 例如 pivot=(0.5, 0.5) → 两边各 ±Δ/2,rect 居中扩展;pivot=(0, 0) → offsetMin 不动、offsetMax 全吃,rect 从左下扩展
|
|
25068
|
-
var dw = x - this.size.x;
|
|
25069
|
-
var dh = y - this.size.y;
|
|
25070
|
-
this.offsetMin.set(this.offsetMin.x - this.pivot.x * dw, this.offsetMin.y - this.pivot.y * dh);
|
|
25071
|
-
this.offsetMax.set(this.offsetMax.x + (1 - this.pivot.x) * dw, this.offsetMax.y + (1 - this.pivot.y) * dh);
|
|
25072
|
-
this.sizeChanged();
|
|
25073
|
-
};
|
|
25074
|
-
// ── rect query ───────────────────────────────────────
|
|
25075
|
-
/**
|
|
25076
|
-
* 当前自身 rect(在父 vertex 坐标下,Y 向上)。`sizeChanged` 之后才有意义
|
|
25077
|
-
*/ _proto.getRect = function getRect() {
|
|
25051
|
+
_proto.getRect = function getRect() {
|
|
25078
25052
|
return {
|
|
25079
|
-
position:
|
|
25053
|
+
position: this.position.clone(),
|
|
25080
25054
|
size: this.size.clone()
|
|
25081
25055
|
};
|
|
25082
25056
|
};
|
|
25083
|
-
|
|
25084
|
-
|
|
25085
|
-
|
|
25086
|
-
|
|
25087
|
-
|
|
25088
|
-
|
|
25089
|
-
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
this.
|
|
25093
|
-
this.
|
|
25094
|
-
|
|
25095
|
-
|
|
25096
|
-
|
|
25097
|
-
|
|
25098
|
-
|
|
25099
|
-
|
|
25100
|
-
|
|
25101
|
-
|
|
25102
|
-
|
|
25103
|
-
|
|
25104
|
-
*
|
|
25105
|
-
* 1. 父是 RectTransform → 从 `parent.size` 求自身 rect,通过 `super.setPosition / super.setSize` 写回
|
|
25106
|
-
* (避免触发本类 setPosition / setSize 重写)
|
|
25107
|
-
* 2. 顶层(无 RectTransform 父):自身 size 视为权威值(由 CanvasLayer 等外部直接写),不自解算
|
|
25108
|
-
* 3. 遍历 `children` 中所有 RectTransform 子节点,直接调它们的 `sizeChanged()` 链式传播
|
|
25109
|
-
*/ _proto.sizeChanged = function sizeChanged() {
|
|
25110
|
-
if (_instanceof1(this.parentTransform, RectTransform)) {
|
|
25111
|
-
var parentSize = this.parentTransform.size;
|
|
25112
|
-
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25113
|
-
var bottom = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25114
|
-
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25115
|
-
var top = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25116
|
-
Transform.prototype.setPosition.call(this, left, bottom, this.position.z);
|
|
25117
|
-
Transform.prototype.setSize.call(this, right - left, top - bottom);
|
|
25118
|
-
}
|
|
25119
|
-
// size 更新后同步 transform.anchor(矩阵旋转/缩放中心)= pivot * size,跟 setPivot 保持统一
|
|
25120
|
-
this.anchor.set(this.pivot.x * this.size.x, this.pivot.y * this.size.y, this.anchor.z);
|
|
25121
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25122
|
-
var child = _step.value;
|
|
25123
|
-
if (_instanceof1(child, RectTransform)) {
|
|
25124
|
-
child.sizeChanged();
|
|
25125
|
-
}
|
|
25126
|
-
}
|
|
25127
|
-
};
|
|
25128
|
-
/**
|
|
25129
|
-
* 给定目标 rect 反推 offsetMin/Max,保持当前 anchor 不变
|
|
25130
|
-
*/ _proto.computeOffsets = function computeOffsets(rect, parentRect) {
|
|
25131
|
-
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);
|
|
25132
|
-
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);
|
|
25133
|
-
};
|
|
25134
|
-
/**
|
|
25135
|
-
* 给定目标 rect 反推 anchorMin/Max,保持当前 offset 不变。父 size 为 0 的方向不修改
|
|
25136
|
-
*/ _proto.computeAnchors = function computeAnchors(rect, parentRect) {
|
|
25137
|
-
if (parentRect.size.x !== 0) {
|
|
25138
|
-
var aMinX = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
|
|
25139
|
-
var aMaxX = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
|
|
25140
|
-
this.anchorMin.x = aMinX;
|
|
25141
|
-
this.anchorMax.x = aMaxX;
|
|
25142
|
-
}
|
|
25143
|
-
if (parentRect.size.y !== 0) {
|
|
25144
|
-
var aMinY = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
|
|
25145
|
-
var aMaxY = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
|
|
25146
|
-
this.anchorMin.y = aMinY;
|
|
25147
|
-
this.anchorMax.y = aMaxY;
|
|
25148
|
-
}
|
|
25149
|
-
};
|
|
25150
|
-
// ── preset API ───────────────────────────────────────
|
|
25151
|
-
/**
|
|
25152
|
-
* 把 anchorMin/Max 设为内建预设。
|
|
25153
|
-
* @param keepOffsets - 默认 true:offset 不动,rect 实际位置会跳到新 anchor 计算的位置(要求保留视觉位置请用 setAnchorsAndOffsetsPreset)
|
|
25154
|
-
*/ _proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
|
|
25057
|
+
_proto.getTransform2D = function getTransform2D() {
|
|
25058
|
+
if (this.transformDirty) {
|
|
25059
|
+
var radians = this._rotation * Math.PI / 180;
|
|
25060
|
+
var sin = Math.sin(radians);
|
|
25061
|
+
var cos = Math.cos(radians);
|
|
25062
|
+
var shearX = Math.tan(Math.max(-89, Math.min(89, this.shear.x)) * Math.PI / 180);
|
|
25063
|
+
var shearY = Math.tan(Math.max(-89, Math.min(89, this.shear.y)) * Math.PI / 180);
|
|
25064
|
+
var a = this.scale.x * (cos - sin * shearY);
|
|
25065
|
+
var b = this.scale.x * (sin + cos * shearY);
|
|
25066
|
+
var c = this.scale.y * (cos * shearX - sin);
|
|
25067
|
+
var d = this.scale.y * (sin * shearX + cos);
|
|
25068
|
+
var pivotX = this.pivot.x * this.size.x;
|
|
25069
|
+
var pivotY = this.pivot.y * this.size.y;
|
|
25070
|
+
var tx = this.position.x + pivotX - a * pivotX - c * pivotY;
|
|
25071
|
+
var ty = this.position.y + pivotY - b * pivotX - d * pivotY;
|
|
25072
|
+
this.cachedTransform.set(a, b, 0, c, d, 0, tx, ty, 1);
|
|
25073
|
+
this.transformDirty = false;
|
|
25074
|
+
}
|
|
25075
|
+
return this.cachedTransform;
|
|
25076
|
+
};
|
|
25077
|
+
_proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
|
|
25155
25078
|
if (keepOffsets === void 0) keepOffsets = true;
|
|
25156
|
-
var _ANCHOR_PRESET_TABLE_preset = ANCHOR_PRESET_TABLE[preset],
|
|
25079
|
+
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];
|
|
25157
25080
|
if (keepOffsets) {
|
|
25158
|
-
this.anchorMin.set(
|
|
25159
|
-
this.anchorMax.set(
|
|
25160
|
-
} else if (_instanceof1(this.parentTransform, RectTransform)) {
|
|
25161
|
-
var parentRect = {
|
|
25162
|
-
position: new Vector2(0, 0),
|
|
25163
|
-
size: this.parentTransform.size.clone()
|
|
25164
|
-
};
|
|
25165
|
-
var rect = this.getRect();
|
|
25166
|
-
this.anchorMin.set(aMinX, aMinY);
|
|
25167
|
-
this.anchorMax.set(aMaxX, aMaxY);
|
|
25168
|
-
this.computeOffsets(rect, parentRect);
|
|
25081
|
+
this.anchorMin.set(minX, minY);
|
|
25082
|
+
this.anchorMax.set(maxX, maxY);
|
|
25169
25083
|
} else {
|
|
25170
|
-
|
|
25171
|
-
this.anchorMin.set(
|
|
25172
|
-
this.anchorMax.set(
|
|
25084
|
+
var rect = this.getRect();
|
|
25085
|
+
this.anchorMin.set(minX, minY);
|
|
25086
|
+
this.anchorMax.set(maxX, maxY);
|
|
25087
|
+
this.computeOffsets(rect, this.getParentRect());
|
|
25173
25088
|
}
|
|
25174
|
-
this.
|
|
25089
|
+
this.updateLayout();
|
|
25175
25090
|
};
|
|
25176
|
-
|
|
25177
|
-
* 把 offsetMin/Max 设为预设值,使 rect 在父 rect 内落在视觉上对应的位置(留 margin 像素边距)。
|
|
25178
|
-
* 当 anchor 已经按相同 preset 设定时,等价于“贴边放置带 margin 的 rect”。
|
|
25179
|
-
* 使用当前 size 作为 rect 尺寸。
|
|
25180
|
-
*/ _proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
|
|
25091
|
+
_proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
|
|
25181
25092
|
if (margin === void 0) margin = 0;
|
|
25182
|
-
if (!
|
|
25093
|
+
if (!this.parent) {
|
|
25183
25094
|
return;
|
|
25184
25095
|
}
|
|
25185
|
-
var
|
|
25186
|
-
var
|
|
25096
|
+
var parentSize = this.parent.size;
|
|
25097
|
+
var width = this.size.x;
|
|
25098
|
+
var height = this.size.y;
|
|
25187
25099
|
var a = this.anchorMin;
|
|
25188
25100
|
var b = this.anchorMax;
|
|
25189
|
-
var
|
|
25190
|
-
|
|
25191
|
-
var offMinX = 0;
|
|
25192
|
-
var offMaxX = 0;
|
|
25193
|
-
var offMinY = 0;
|
|
25194
|
-
var offMaxY = 0;
|
|
25195
|
-
// X 方向(left / right)
|
|
25101
|
+
var minX = 0, maxX = 0, minY = 0, maxY = 0;
|
|
25102
|
+
// Left edge.
|
|
25196
25103
|
switch(preset){
|
|
25197
25104
|
case "topLeft":
|
|
25198
25105
|
case "bottomLeft":
|
|
@@ -25202,119 +25109,1498 @@ FrameComponent = __decorate([
|
|
|
25202
25109
|
case "leftWide":
|
|
25203
25110
|
case "hcenterWide":
|
|
25204
25111
|
case "fullRect":
|
|
25205
|
-
|
|
25206
|
-
offMaxX = margin + newSizeX - b.x * pw;
|
|
25112
|
+
minX = margin - a.x * parentSize.x;
|
|
25207
25113
|
break;
|
|
25208
25114
|
case "centerTop":
|
|
25209
25115
|
case "centerBottom":
|
|
25210
25116
|
case "center":
|
|
25211
25117
|
case "vcenterWide":
|
|
25212
|
-
|
|
25213
|
-
offMaxX = 0.5 * pw + newSizeX / 2 - b.x * pw;
|
|
25118
|
+
minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
|
|
25214
25119
|
break;
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
case "centerRight":
|
|
25218
|
-
case "rightWide":
|
|
25219
|
-
offMinX = pw - margin - newSizeX - a.x * pw;
|
|
25220
|
-
offMaxX = pw - margin - b.x * pw;
|
|
25120
|
+
default:
|
|
25121
|
+
minX = parentSize.x - margin - width - a.x * parentSize.x;
|
|
25221
25122
|
break;
|
|
25222
25123
|
}
|
|
25223
|
-
// Y 方向(bottom / top)— Y 向上
|
|
25224
25124
|
switch(preset){
|
|
25125
|
+
case "topLeft":
|
|
25225
25126
|
case "bottomLeft":
|
|
25226
|
-
case "
|
|
25127
|
+
case "centerLeft":
|
|
25128
|
+
case "leftWide":
|
|
25129
|
+
maxX = margin + width - b.x * parentSize.x;
|
|
25130
|
+
break;
|
|
25131
|
+
case "centerTop":
|
|
25227
25132
|
case "centerBottom":
|
|
25133
|
+
case "center":
|
|
25134
|
+
case "vcenterWide":
|
|
25135
|
+
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25136
|
+
break;
|
|
25137
|
+
default:
|
|
25138
|
+
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25139
|
+
break;
|
|
25140
|
+
}
|
|
25141
|
+
// Top edge.
|
|
25142
|
+
switch(preset){
|
|
25143
|
+
case "topLeft":
|
|
25144
|
+
case "topRight":
|
|
25145
|
+
case "centerTop":
|
|
25228
25146
|
case "leftWide":
|
|
25229
25147
|
case "rightWide":
|
|
25230
|
-
case "
|
|
25148
|
+
case "topWide":
|
|
25231
25149
|
case "vcenterWide":
|
|
25232
25150
|
case "fullRect":
|
|
25233
|
-
|
|
25234
|
-
offMaxY = margin + newSizeY - b.y * ph;
|
|
25151
|
+
minY = margin - a.y * parentSize.y;
|
|
25235
25152
|
break;
|
|
25236
25153
|
case "centerLeft":
|
|
25237
25154
|
case "centerRight":
|
|
25238
25155
|
case "center":
|
|
25239
25156
|
case "hcenterWide":
|
|
25240
|
-
|
|
25241
|
-
|
|
25157
|
+
minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
|
|
25158
|
+
break;
|
|
25159
|
+
default:
|
|
25160
|
+
minY = parentSize.y - margin - height - a.y * parentSize.y;
|
|
25242
25161
|
break;
|
|
25162
|
+
}
|
|
25163
|
+
// Bottom edge.
|
|
25164
|
+
switch(preset){
|
|
25243
25165
|
case "topLeft":
|
|
25244
25166
|
case "topRight":
|
|
25245
25167
|
case "centerTop":
|
|
25246
25168
|
case "topWide":
|
|
25247
|
-
|
|
25248
|
-
|
|
25169
|
+
maxY = margin + height - b.y * parentSize.y;
|
|
25170
|
+
break;
|
|
25171
|
+
case "centerLeft":
|
|
25172
|
+
case "centerRight":
|
|
25173
|
+
case "center":
|
|
25174
|
+
case "hcenterWide":
|
|
25175
|
+
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25176
|
+
break;
|
|
25177
|
+
default:
|
|
25178
|
+
maxY = parentSize.y - margin - b.y * parentSize.y;
|
|
25249
25179
|
break;
|
|
25250
25180
|
}
|
|
25251
|
-
this.offsetMin.set(
|
|
25252
|
-
this.offsetMax.set(
|
|
25253
|
-
this.
|
|
25181
|
+
this.offsetMin.set(minX, minY);
|
|
25182
|
+
this.offsetMax.set(maxX, maxY);
|
|
25183
|
+
this.updateLayout();
|
|
25254
25184
|
};
|
|
25255
|
-
|
|
25256
|
-
* 同时设置 anchor 和 offset,达到“按 preset 摆放并贴边带 margin”的效果。
|
|
25257
|
-
*
|
|
25258
|
-
* 注意第一步用 `keepOffsets=false`(反推 offset 维持 rect 视觉位置),不能用默认 `true`:
|
|
25259
|
-
* 后者会让 rect 的 size 在中间步先跳到错值(因为 anchor 改了 offset 没改),
|
|
25260
|
-
* 第二步 `setOffsetsPreset` 又用这个错 size 算 offset,最终 rect size 不对
|
|
25261
|
-
*/ _proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
|
|
25185
|
+
_proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
|
|
25262
25186
|
if (margin === void 0) margin = 0;
|
|
25263
25187
|
this.setAnchorsPreset(preset, false);
|
|
25264
25188
|
this.setOffsetsPreset(preset, margin);
|
|
25265
25189
|
};
|
|
25266
|
-
|
|
25267
|
-
|
|
25268
|
-
|
|
25269
|
-
|
|
25270
|
-
|
|
25271
|
-
|
|
25190
|
+
_proto.getGlobalTransform2D = function getGlobalTransform2D() {
|
|
25191
|
+
var local = this.getTransform2D();
|
|
25192
|
+
return this.parent ? new Matrix3().multiplyMatrices(this.parent.getGlobalTransform2D(), local) : local.clone();
|
|
25193
|
+
};
|
|
25194
|
+
_proto.hasPoint = function hasPoint(point) {
|
|
25195
|
+
return point.x >= 0 && point.y >= 0 && point.x <= this.size.x && point.y <= this.size.y;
|
|
25196
|
+
};
|
|
25197
|
+
_proto.getEffectiveMouseFilter = function getEffectiveMouseFilter() {
|
|
25198
|
+
return this.enabledInHierarchy && this.isMouseRecursiveEnabled() ? this.mouseFilter : MouseFilter.Ignore;
|
|
25199
|
+
};
|
|
25200
|
+
_proto.getFocusModeWithOverride = function getFocusModeWithOverride() {
|
|
25201
|
+
return this.enabledInHierarchy && this.isFocusRecursiveEnabled() ? this.focusMode : FocusMode.None;
|
|
25202
|
+
};
|
|
25203
|
+
_proto.getCursorShape = function getCursorShape(position) {
|
|
25204
|
+
return this.defaultCursorShape;
|
|
25205
|
+
};
|
|
25206
|
+
_proto.focus = function focus() {
|
|
25207
|
+
var _this_root;
|
|
25208
|
+
(_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
|
|
25209
|
+
};
|
|
25210
|
+
_proto.grabFocus = function grabFocus() {
|
|
25211
|
+
this.focus();
|
|
25212
|
+
};
|
|
25213
|
+
_proto.grabClickFocus = function grabClickFocus() {
|
|
25214
|
+
var _this_root;
|
|
25215
|
+
(_this_root = this.root) == null ? void 0 : _this_root.grabControlClickFocus(this);
|
|
25216
|
+
};
|
|
25217
|
+
_proto.releaseFocus = function releaseFocus() {
|
|
25218
|
+
var _this_root;
|
|
25219
|
+
(_this_root = this.root) == null ? void 0 : _this_root.releaseControlFocus(this);
|
|
25220
|
+
};
|
|
25221
|
+
_proto.warpMouse = function warpMouse(position) {
|
|
25222
|
+
var _this_root;
|
|
25223
|
+
var matrix = this.getGlobalTransform2D().elements;
|
|
25224
|
+
(_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]));
|
|
25225
|
+
};
|
|
25226
|
+
/** Converts a window-space position into this control's local coordinates. */ _proto.makePositionLocal = function makePositionLocal(position) {
|
|
25227
|
+
var transform = this.getGlobalTransform2D().clone();
|
|
25228
|
+
if (Math.abs(transform.determinant()) < 1e-12) {
|
|
25229
|
+
return new Vector2();
|
|
25230
|
+
}
|
|
25231
|
+
var elements = transform.invert().elements;
|
|
25232
|
+
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
25233
|
+
};
|
|
25234
|
+
/** Gets the current mouse position transformed into this control's coordinates. */ _proto.getLocalMousePosition = function getLocalMousePosition() {
|
|
25235
|
+
var root = this.root;
|
|
25236
|
+
return root ? this.makePositionLocal(root.getMousePosition()) : new Vector2();
|
|
25237
|
+
};
|
|
25238
|
+
_proto.update = function update(deltaTime) {};
|
|
25239
|
+
_proto.draw = function draw() {
|
|
25240
|
+
// OVERRIDE
|
|
25241
|
+
};
|
|
25242
|
+
_proto.onDestroy = function onDestroy() {};
|
|
25243
|
+
/** @internal */ _proto.drawInternal = function drawInternal() {
|
|
25244
|
+
if (!this.visibleInHierarchy || this.disposed) {
|
|
25245
|
+
return;
|
|
25246
|
+
}
|
|
25247
|
+
var graphics = this.engine.graphics;
|
|
25248
|
+
graphics.pushTransform(this.getTransform2D());
|
|
25249
|
+
this.draw();
|
|
25250
|
+
graphics.popTransform();
|
|
25251
|
+
};
|
|
25252
|
+
_proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
|
|
25253
|
+
this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
|
|
25254
|
+
};
|
|
25255
|
+
_proto.drawPolyline = function drawPolyline(points, color, thickness) {
|
|
25256
|
+
this.engine.graphics.drawLines(points, color, thickness);
|
|
25257
|
+
};
|
|
25258
|
+
_proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
|
|
25259
|
+
this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
|
|
25260
|
+
};
|
|
25261
|
+
_proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
|
|
25262
|
+
this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
|
|
25263
|
+
};
|
|
25264
|
+
_proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
|
|
25265
|
+
this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
|
|
25266
|
+
};
|
|
25267
|
+
_proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
|
|
25268
|
+
this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
|
|
25269
|
+
};
|
|
25270
|
+
_proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
|
|
25271
|
+
this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
|
|
25272
|
+
};
|
|
25273
|
+
_proto.fillRect = function fillRect(x, y, width, height, color) {
|
|
25274
|
+
this.engine.graphics.fillRectangle(x, y, width, height, color);
|
|
25275
|
+
};
|
|
25276
|
+
_proto.fillCircle = function fillCircle(cx, cy, radius, color) {
|
|
25277
|
+
this.engine.graphics.fillCircle(cx, cy, radius, color);
|
|
25278
|
+
};
|
|
25279
|
+
_proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
|
|
25280
|
+
this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
|
|
25281
|
+
};
|
|
25282
|
+
_proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
|
|
25283
|
+
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
25284
|
+
};
|
|
25285
|
+
_proto.onMouseEnter = function onMouseEnter(location) {};
|
|
25286
|
+
_proto.onMouseMove = function onMouseMove(event) {};
|
|
25287
|
+
_proto.onMouseLeave = function onMouseLeave() {};
|
|
25288
|
+
_proto.onMouseWheel = function onMouseWheel(event) {};
|
|
25289
|
+
_proto.onMouseDown = function onMouseDown(event) {};
|
|
25290
|
+
_proto.onMouseUp = function onMouseUp(event) {};
|
|
25291
|
+
_proto.onTouchDown = function onTouchDown(event) {};
|
|
25292
|
+
_proto.onTouchMove = function onTouchMove(event) {};
|
|
25293
|
+
_proto.onTouchUp = function onTouchUp(event) {};
|
|
25294
|
+
_proto.onKeyDown = function onKeyDown(event) {};
|
|
25295
|
+
_proto.onKeyUp = function onKeyUp(event) {};
|
|
25296
|
+
_proto.onGotFocus = function onGotFocus() {};
|
|
25297
|
+
_proto.onLostFocus = function onLostFocus() {};
|
|
25298
|
+
/** @internal */ _proto.invokeGetDragData = function invokeGetDragData(position) {
|
|
25299
|
+
return this.getDragData(position);
|
|
25300
|
+
};
|
|
25301
|
+
/** @internal */ _proto.invokeCanDropData = function invokeCanDropData(position, data) {
|
|
25302
|
+
return this.canDropData(position, data);
|
|
25303
|
+
};
|
|
25304
|
+
/** @internal */ _proto.invokeDropData = function invokeDropData(position, data) {
|
|
25305
|
+
this.dropData(position, data);
|
|
25306
|
+
};
|
|
25307
|
+
_proto.getDragData = function getDragData(position) {
|
|
25308
|
+
return null;
|
|
25309
|
+
};
|
|
25310
|
+
_proto.canDropData = function canDropData(position, data) {
|
|
25311
|
+
return false;
|
|
25312
|
+
};
|
|
25313
|
+
_proto.dropData = function dropData(position, data) {};
|
|
25314
|
+
_proto.dispose = function dispose() {
|
|
25315
|
+
if (this.disposed) {
|
|
25316
|
+
return;
|
|
25317
|
+
}
|
|
25318
|
+
this.disposed = true;
|
|
25319
|
+
this.onDestroy();
|
|
25320
|
+
this.parent = null;
|
|
25321
|
+
this.owner = null;
|
|
25322
|
+
};
|
|
25323
|
+
/** @internal */ _proto.updateLayout = function updateLayout() {
|
|
25324
|
+
var _this_parent;
|
|
25325
|
+
var _this_parent_size;
|
|
25326
|
+
var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
|
|
25327
|
+
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25328
|
+
var top = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25329
|
+
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25330
|
+
var bottom = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25331
|
+
this.applyBounds(left, top, right - left, bottom - top);
|
|
25332
|
+
};
|
|
25333
|
+
_proto.applyBounds = function applyBounds(x, y, width, height) {
|
|
25334
|
+
var locationChanged = this.position.x !== x || this.position.y !== y;
|
|
25335
|
+
var sizeChanged = this.size.x !== width || this.size.y !== height;
|
|
25336
|
+
if (!locationChanged && !sizeChanged) {
|
|
25337
|
+
return;
|
|
25338
|
+
}
|
|
25339
|
+
this.position.set(x, y);
|
|
25340
|
+
this.size.set(width, height);
|
|
25341
|
+
this.markTransformDirty();
|
|
25342
|
+
if (locationChanged) {
|
|
25343
|
+
this.eventEmitter.emit("locationChanged", this);
|
|
25344
|
+
}
|
|
25345
|
+
if (sizeChanged) {
|
|
25346
|
+
this.eventEmitter.emit("sizeChanged", this);
|
|
25347
|
+
if (_instanceof1(this, ContainerControl)) {
|
|
25348
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25349
|
+
var child = _step.value;
|
|
25350
|
+
child.updateLayout();
|
|
25351
|
+
}
|
|
25352
|
+
}
|
|
25353
|
+
}
|
|
25354
|
+
};
|
|
25355
|
+
_proto.markTransformDirty = function markTransformDirty() {
|
|
25356
|
+
var _this_root;
|
|
25357
|
+
this.transformDirty = true;
|
|
25358
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25359
|
+
};
|
|
25360
|
+
_proto.getParentRect = function getParentRect() {
|
|
25361
|
+
var _this_parent;
|
|
25362
|
+
var _this_parent_size_clone;
|
|
25363
|
+
return {
|
|
25364
|
+
position: new Vector2(),
|
|
25365
|
+
size: (_this_parent_size_clone = (_this_parent = this.parent) == null ? void 0 : _this_parent.size.clone()) != null ? _this_parent_size_clone : new Vector2()
|
|
25366
|
+
};
|
|
25367
|
+
};
|
|
25368
|
+
_proto.computeOffsets = function computeOffsets(rect, parentRect) {
|
|
25369
|
+
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);
|
|
25370
|
+
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);
|
|
25371
|
+
};
|
|
25372
|
+
_proto.computeAnchors = function computeAnchors(rect, parentRect) {
|
|
25373
|
+
if (parentRect.size.x !== 0) {
|
|
25374
|
+
this.anchorMin.x = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
|
|
25375
|
+
this.anchorMax.x = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
|
|
25376
|
+
}
|
|
25377
|
+
if (parentRect.size.y !== 0) {
|
|
25378
|
+
this.anchorMin.y = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
|
|
25379
|
+
this.anchorMax.y = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
|
|
25380
|
+
}
|
|
25381
|
+
};
|
|
25382
|
+
_proto.isMouseRecursiveEnabled = function isMouseRecursiveEnabled() {
|
|
25383
|
+
if (this.mouseBehaviorRecursive === MouseBehaviorRecursive.Inherited) {
|
|
25384
|
+
var _this_parent;
|
|
25385
|
+
var _this_parent_isMouseRecursiveEnabled;
|
|
25386
|
+
return (_this_parent_isMouseRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isMouseRecursiveEnabled()) != null ? _this_parent_isMouseRecursiveEnabled : true;
|
|
25387
|
+
}
|
|
25388
|
+
return this.mouseBehaviorRecursive === MouseBehaviorRecursive.Enabled;
|
|
25389
|
+
};
|
|
25390
|
+
_proto.isFocusRecursiveEnabled = function isFocusRecursiveEnabled() {
|
|
25391
|
+
if (this.focusBehaviorRecursive === FocusBehaviorRecursive.Inherited) {
|
|
25392
|
+
var _this_parent;
|
|
25393
|
+
var _this_parent_isFocusRecursiveEnabled;
|
|
25394
|
+
return (_this_parent_isFocusRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isFocusRecursiveEnabled()) != null ? _this_parent_isFocusRecursiveEnabled : true;
|
|
25395
|
+
}
|
|
25396
|
+
return this.focusBehaviorRecursive === FocusBehaviorRecursive.Enabled;
|
|
25397
|
+
};
|
|
25398
|
+
_create_class(Control, [
|
|
25399
|
+
{
|
|
25400
|
+
key: "parent",
|
|
25401
|
+
get: function get() {
|
|
25402
|
+
return this._parent;
|
|
25403
|
+
},
|
|
25404
|
+
set: function set(value) {
|
|
25405
|
+
var _this__parent;
|
|
25406
|
+
if (value === this._parent) {
|
|
25407
|
+
return;
|
|
25408
|
+
}
|
|
25409
|
+
var previousRoot = this.root;
|
|
25410
|
+
(_this__parent = this._parent) == null ? void 0 : _this__parent.removeChildInternal(this);
|
|
25411
|
+
this._parent = value;
|
|
25412
|
+
value == null ? void 0 : value.addChildInternal(this);
|
|
25413
|
+
this.updateLayout();
|
|
25414
|
+
var nextRoot = this.root;
|
|
25415
|
+
if (previousRoot && previousRoot !== nextRoot) {
|
|
25416
|
+
previousRoot.controlRemoved(this);
|
|
25417
|
+
}
|
|
25418
|
+
nextRoot == null ? void 0 : nextRoot.controlTreeChanged();
|
|
25419
|
+
this.eventEmitter.emit("parentChanged", this);
|
|
25420
|
+
}
|
|
25421
|
+
},
|
|
25422
|
+
{
|
|
25423
|
+
key: "item",
|
|
25424
|
+
get: /** Scene item exposed through the optional UIControl bridge. */ function get() {
|
|
25425
|
+
var _this_owner;
|
|
25426
|
+
var _this_owner_item;
|
|
25427
|
+
return (_this_owner_item = (_this_owner = this.owner) == null ? void 0 : _this_owner.item) != null ? _this_owner_item : null;
|
|
25428
|
+
}
|
|
25429
|
+
},
|
|
25430
|
+
{
|
|
25431
|
+
key: "indexInParent",
|
|
25432
|
+
get: function get() {
|
|
25433
|
+
var _this_parent;
|
|
25434
|
+
var _this_parent_getChildIndex;
|
|
25435
|
+
return (_this_parent_getChildIndex = (_this_parent = this.parent) == null ? void 0 : _this_parent.getChildIndex(this)) != null ? _this_parent_getChildIndex : -1;
|
|
25436
|
+
},
|
|
25437
|
+
set: function set(value) {
|
|
25438
|
+
var _this_parent;
|
|
25439
|
+
(_this_parent = this.parent) == null ? void 0 : _this_parent.changeChildIndex(this, value);
|
|
25440
|
+
}
|
|
25441
|
+
},
|
|
25442
|
+
{
|
|
25443
|
+
key: "visible",
|
|
25444
|
+
get: function get() {
|
|
25445
|
+
return this._visible;
|
|
25446
|
+
},
|
|
25447
|
+
set: function set(value) {
|
|
25448
|
+
if (this._visible !== value) {
|
|
25449
|
+
var _this_root;
|
|
25450
|
+
this._visible = value;
|
|
25451
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25452
|
+
}
|
|
25453
|
+
}
|
|
25454
|
+
},
|
|
25455
|
+
{
|
|
25456
|
+
key: "visibleInHierarchy",
|
|
25457
|
+
get: function get() {
|
|
25458
|
+
var _this_parent;
|
|
25459
|
+
var _this_parent_visibleInHierarchy;
|
|
25460
|
+
return this.visible && ((_this_parent_visibleInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.visibleInHierarchy) != null ? _this_parent_visibleInHierarchy : true);
|
|
25461
|
+
}
|
|
25462
|
+
},
|
|
25463
|
+
{
|
|
25464
|
+
key: "enabled",
|
|
25465
|
+
get: function get() {
|
|
25466
|
+
return this._enabled;
|
|
25467
|
+
},
|
|
25468
|
+
set: function set(value) {
|
|
25469
|
+
if (this._enabled !== value) {
|
|
25470
|
+
var _this_root;
|
|
25471
|
+
this._enabled = value;
|
|
25472
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25473
|
+
}
|
|
25474
|
+
}
|
|
25475
|
+
},
|
|
25476
|
+
{
|
|
25477
|
+
key: "enabledInHierarchy",
|
|
25478
|
+
get: function get() {
|
|
25479
|
+
var _this_parent;
|
|
25480
|
+
var _this_parent_enabledInHierarchy;
|
|
25481
|
+
return this.enabled && ((_this_parent_enabledInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.enabledInHierarchy) != null ? _this_parent_enabledInHierarchy : true);
|
|
25482
|
+
}
|
|
25483
|
+
},
|
|
25484
|
+
{
|
|
25485
|
+
key: "mouseFilter",
|
|
25486
|
+
get: function get() {
|
|
25487
|
+
return this._mouseFilter;
|
|
25488
|
+
},
|
|
25489
|
+
set: function set(value) {
|
|
25490
|
+
if (this._mouseFilter !== value) {
|
|
25491
|
+
var _this_root;
|
|
25492
|
+
this._mouseFilter = value;
|
|
25493
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25494
|
+
}
|
|
25495
|
+
}
|
|
25496
|
+
},
|
|
25497
|
+
{
|
|
25498
|
+
key: "mouseBehaviorRecursive",
|
|
25499
|
+
get: function get() {
|
|
25500
|
+
return this._mouseBehaviorRecursive;
|
|
25501
|
+
},
|
|
25502
|
+
set: function set(value) {
|
|
25503
|
+
if (this._mouseBehaviorRecursive !== value) {
|
|
25504
|
+
var _this_root;
|
|
25505
|
+
this._mouseBehaviorRecursive = value;
|
|
25506
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25507
|
+
}
|
|
25508
|
+
}
|
|
25509
|
+
},
|
|
25510
|
+
{
|
|
25511
|
+
key: "focusMode",
|
|
25512
|
+
get: function get() {
|
|
25513
|
+
return this._focusMode;
|
|
25514
|
+
},
|
|
25515
|
+
set: function set(value) {
|
|
25516
|
+
if (this._focusMode !== value) {
|
|
25517
|
+
var _this_root;
|
|
25518
|
+
this._focusMode = value;
|
|
25519
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25520
|
+
}
|
|
25521
|
+
}
|
|
25522
|
+
},
|
|
25523
|
+
{
|
|
25524
|
+
key: "focusBehaviorRecursive",
|
|
25525
|
+
get: function get() {
|
|
25526
|
+
return this._focusBehaviorRecursive;
|
|
25527
|
+
},
|
|
25528
|
+
set: function set(value) {
|
|
25529
|
+
if (this._focusBehaviorRecursive !== value) {
|
|
25530
|
+
var _this_root;
|
|
25531
|
+
this._focusBehaviorRecursive = value;
|
|
25532
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25533
|
+
}
|
|
25534
|
+
}
|
|
25535
|
+
},
|
|
25536
|
+
{
|
|
25537
|
+
key: "defaultCursorShape",
|
|
25538
|
+
get: function get() {
|
|
25539
|
+
return this._defaultCursorShape;
|
|
25540
|
+
},
|
|
25541
|
+
set: function set(value) {
|
|
25542
|
+
var _this_root;
|
|
25543
|
+
if (this._defaultCursorShape === value) {
|
|
25544
|
+
return;
|
|
25545
|
+
}
|
|
25546
|
+
this._defaultCursorShape = value;
|
|
25547
|
+
(_this_root = this.root) == null ? void 0 : _this_root.updateMouseCursorState();
|
|
25548
|
+
}
|
|
25549
|
+
},
|
|
25550
|
+
{
|
|
25551
|
+
key: "location",
|
|
25552
|
+
get: function get() {
|
|
25553
|
+
return this.position;
|
|
25554
|
+
},
|
|
25555
|
+
set: function set(value) {
|
|
25556
|
+
this.setPosition(value.x, value.y);
|
|
25557
|
+
}
|
|
25558
|
+
},
|
|
25559
|
+
{
|
|
25560
|
+
key: "rotation",
|
|
25561
|
+
get: function get() {
|
|
25562
|
+
return this._rotation;
|
|
25563
|
+
}
|
|
25564
|
+
},
|
|
25565
|
+
{
|
|
25566
|
+
key: "x",
|
|
25567
|
+
get: function get() {
|
|
25568
|
+
return this.position.x;
|
|
25569
|
+
},
|
|
25570
|
+
set: function set(value) {
|
|
25571
|
+
this.setPosition(value, this.position.y);
|
|
25572
|
+
}
|
|
25573
|
+
},
|
|
25574
|
+
{
|
|
25575
|
+
key: "y",
|
|
25576
|
+
get: function get() {
|
|
25577
|
+
return this.position.y;
|
|
25578
|
+
},
|
|
25579
|
+
set: function set(value) {
|
|
25580
|
+
this.setPosition(this.position.x, value);
|
|
25581
|
+
}
|
|
25582
|
+
},
|
|
25583
|
+
{
|
|
25584
|
+
key: "width",
|
|
25585
|
+
get: function get() {
|
|
25586
|
+
return this.size.x;
|
|
25587
|
+
},
|
|
25588
|
+
set: function set(value) {
|
|
25589
|
+
this.setSize(value, this.size.y);
|
|
25590
|
+
}
|
|
25591
|
+
},
|
|
25592
|
+
{
|
|
25593
|
+
key: "height",
|
|
25594
|
+
get: function get() {
|
|
25595
|
+
return this.size.y;
|
|
25596
|
+
},
|
|
25597
|
+
set: function set(value) {
|
|
25598
|
+
this.setSize(this.size.x, value);
|
|
25599
|
+
}
|
|
25600
|
+
},
|
|
25601
|
+
{
|
|
25602
|
+
key: "root",
|
|
25603
|
+
get: function get() {
|
|
25604
|
+
var _this_parent;
|
|
25605
|
+
var _this_parent_root;
|
|
25606
|
+
return _instanceof1(this, RootControl) ? this : (_this_parent_root = (_this_parent = this.parent) == null ? void 0 : _this_parent.root) != null ? _this_parent_root : null;
|
|
25607
|
+
}
|
|
25608
|
+
},
|
|
25609
|
+
{
|
|
25610
|
+
key: "isDisposed",
|
|
25611
|
+
get: function get() {
|
|
25612
|
+
return this.disposed;
|
|
25613
|
+
}
|
|
25614
|
+
}
|
|
25615
|
+
]);
|
|
25616
|
+
return Control;
|
|
25617
|
+
}();
|
|
25618
|
+
/** A Control that owns child Controls. */ var ContainerControl = /*#__PURE__*/ function(Control) {
|
|
25619
|
+
_inherits(ContainerControl, Control);
|
|
25620
|
+
function ContainerControl() {
|
|
25621
|
+
var _this;
|
|
25622
|
+
_this = Control.apply(this, arguments) || this;
|
|
25623
|
+
_this.children = [];
|
|
25624
|
+
return _this;
|
|
25625
|
+
}
|
|
25626
|
+
var _proto = ContainerControl.prototype;
|
|
25627
|
+
_proto.addChild = function addChild(child) {
|
|
25628
|
+
child.parent = this;
|
|
25629
|
+
return child;
|
|
25630
|
+
};
|
|
25631
|
+
_proto.removeChild = function removeChild(child) {
|
|
25632
|
+
if (child.parent === this) {
|
|
25633
|
+
child.parent = null;
|
|
25634
|
+
}
|
|
25635
|
+
};
|
|
25636
|
+
_proto.getChildIndex = function getChildIndex(child) {
|
|
25637
|
+
return this.children.indexOf(child);
|
|
25638
|
+
};
|
|
25639
|
+
/** @internal */ _proto.changeChildIndex = function changeChildIndex(child, newIndex) {
|
|
25640
|
+
var _this_root;
|
|
25641
|
+
var oldIndex = this.children.indexOf(child);
|
|
25642
|
+
if (oldIndex === newIndex || oldIndex === -1) {
|
|
25643
|
+
return;
|
|
25644
|
+
}
|
|
25645
|
+
this.children.splice(oldIndex, 1);
|
|
25646
|
+
if (newIndex < 0 || newIndex >= this.children.length) {
|
|
25647
|
+
this.children.push(child);
|
|
25648
|
+
} else {
|
|
25649
|
+
this.children.splice(newIndex, 0, child);
|
|
25650
|
+
}
|
|
25651
|
+
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25652
|
+
};
|
|
25653
|
+
/** @internal */ _proto.addChildInternal = function addChildInternal(child) {
|
|
25654
|
+
if (!this.children.includes(child)) {
|
|
25655
|
+
this.children.push(child);
|
|
25656
|
+
}
|
|
25657
|
+
};
|
|
25658
|
+
/** @internal */ _proto.removeChildInternal = function removeChildInternal(child) {
|
|
25659
|
+
var index = this.children.indexOf(child);
|
|
25660
|
+
if (index !== -1) {
|
|
25661
|
+
this.children.splice(index, 1);
|
|
25662
|
+
}
|
|
25663
|
+
};
|
|
25664
|
+
_proto.drawSelf = function drawSelf() {
|
|
25665
|
+
Control.prototype.draw.call(this);
|
|
25666
|
+
};
|
|
25667
|
+
_proto.draw = function draw() {
|
|
25668
|
+
this.drawSelf();
|
|
25669
|
+
this.drawChildren();
|
|
25670
|
+
};
|
|
25671
|
+
_proto.drawChildren = function drawChildren() {
|
|
25672
|
+
var graphics = this.engine.graphics;
|
|
25673
|
+
if (this.clipContents) ;
|
|
25674
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25675
|
+
var child = _step.value;
|
|
25676
|
+
if (!child.visible || child.isDisposed) {
|
|
25677
|
+
continue;
|
|
25678
|
+
}
|
|
25679
|
+
graphics.pushTransform(child.getTransform2D());
|
|
25680
|
+
child.draw();
|
|
25681
|
+
graphics.popTransform();
|
|
25682
|
+
}
|
|
25683
|
+
};
|
|
25684
|
+
_proto.update = function update(deltaTime) {
|
|
25685
|
+
Control.prototype.update.call(this, deltaTime);
|
|
25686
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25687
|
+
var child = _step.value;
|
|
25688
|
+
if (child.enabled && !child.isDisposed) {
|
|
25689
|
+
child.update(deltaTime);
|
|
25690
|
+
}
|
|
25691
|
+
}
|
|
25692
|
+
};
|
|
25693
|
+
_proto.dispose = function dispose() {
|
|
25694
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25695
|
+
var child = _step.value;
|
|
25696
|
+
child.dispose();
|
|
25697
|
+
}
|
|
25698
|
+
Control.prototype.dispose.call(this);
|
|
25699
|
+
};
|
|
25700
|
+
return ContainerControl;
|
|
25701
|
+
}(Control);
|
|
25702
|
+
/** Base class for GUI tree roots and input dispatchers. */ var RootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25703
|
+
_inherits(RootControl, ContainerControl);
|
|
25704
|
+
function RootControl() {
|
|
25705
|
+
return ContainerControl.apply(this, arguments);
|
|
25706
|
+
}
|
|
25707
|
+
return RootControl;
|
|
25708
|
+
}(ContainerControl);
|
|
25709
|
+
|
|
25710
|
+
var _obj$3;
|
|
25711
|
+
var cursorNames = (_obj$3 = {}, _obj$3[CursorShape.Arrow] = "default", _obj$3[CursorShape.Ibeam] = "text", _obj$3[CursorShape.PointingHand] = "pointer", _obj$3[CursorShape.Cross] = "crosshair", _obj$3[CursorShape.Wait] = "wait", _obj$3[CursorShape.Busy] = "progress", _obj$3[CursorShape.Drag] = "grab", _obj$3[CursorShape.CanDrop] = "copy", _obj$3[CursorShape.Forbidden] = "not-allowed", _obj$3[CursorShape.Vsize] = "ns-resize", _obj$3[CursorShape.Hsize] = "ew-resize", _obj$3[CursorShape.Bdiagsize] = "nesw-resize", _obj$3[CursorShape.Fdiagsize] = "nwse-resize", _obj$3[CursorShape.Move] = "move", _obj$3[CursorShape.Vsplit] = "row-resize", _obj$3[CursorShape.Hsplit] = "col-resize", _obj$3[CursorShape.Help] = "help", _obj$3);
|
|
25712
|
+
function getButtonMask(button) {
|
|
25713
|
+
switch(button){
|
|
25714
|
+
case MouseButton.Left:
|
|
25715
|
+
return MouseButtonMask.Left;
|
|
25716
|
+
case MouseButton.Right:
|
|
25717
|
+
return MouseButtonMask.Right;
|
|
25718
|
+
case MouseButton.Middle:
|
|
25719
|
+
return MouseButtonMask.Middle;
|
|
25720
|
+
case MouseButton.Xbutton1:
|
|
25721
|
+
return MouseButtonMask.Xbutton1;
|
|
25722
|
+
case MouseButton.Xbutton2:
|
|
25723
|
+
return MouseButtonMask.Xbutton2;
|
|
25724
|
+
default:
|
|
25725
|
+
return MouseButtonMask.None;
|
|
25726
|
+
}
|
|
25727
|
+
}
|
|
25728
|
+
function isWheelButton(button) {
|
|
25729
|
+
return button >= MouseButton.WheelUp && button <= MouseButton.WheelRight;
|
|
25730
|
+
}
|
|
25731
|
+
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25732
|
+
_inherits(CanvasRootControl, ContainerControl);
|
|
25733
|
+
function CanvasRootControl(engine, canvas) {
|
|
25734
|
+
var _this;
|
|
25735
|
+
_this = ContainerControl.call(this, engine) || this;
|
|
25736
|
+
_this.canvas = canvas;
|
|
25737
|
+
_this.mouseFilter = MouseFilter.Ignore;
|
|
25738
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25739
|
+
return _this;
|
|
25740
|
+
}
|
|
25741
|
+
_create_class(CanvasRootControl, [
|
|
25742
|
+
{
|
|
25743
|
+
key: "inputDisabled",
|
|
25744
|
+
get: function get() {
|
|
25745
|
+
var _this_canvas_item;
|
|
25746
|
+
return !this.canvas.receivesEvents || !this.canvas.enabled || !((_this_canvas_item = this.canvas.item) == null ? void 0 : _this_canvas_item.isActive);
|
|
25747
|
+
}
|
|
25748
|
+
}
|
|
25749
|
+
]);
|
|
25750
|
+
return CanvasRootControl;
|
|
25751
|
+
}(ContainerControl);
|
|
25752
|
+
/** Global ordered collection of UICanvas roots. */ var CanvasContainer = /*#__PURE__*/ function(ContainerControl) {
|
|
25753
|
+
_inherits(CanvasContainer, ContainerControl);
|
|
25754
|
+
function CanvasContainer(engine) {
|
|
25755
|
+
var _this;
|
|
25756
|
+
_this = ContainerControl.call(this, engine) || this;
|
|
25757
|
+
_this.mouseFilter = MouseFilter.Ignore;
|
|
25758
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25759
|
+
return _this;
|
|
25760
|
+
}
|
|
25761
|
+
var _proto = CanvasContainer.prototype;
|
|
25762
|
+
_proto.sortCanvases = function sortCanvases() {
|
|
25763
|
+
this.children.sort(function(left, right) {
|
|
25764
|
+
return left.canvas.order - right.canvas.order;
|
|
25765
|
+
});
|
|
25766
|
+
};
|
|
25767
|
+
_proto.addChildInternal = function addChildInternal(child) {
|
|
25768
|
+
ContainerControl.prototype.addChildInternal.call(this, child);
|
|
25769
|
+
this.sortCanvases();
|
|
25770
|
+
};
|
|
25771
|
+
_proto.draw = function draw() {
|
|
25772
|
+
this.sortCanvases();
|
|
25773
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25774
|
+
var child = _step.value;
|
|
25775
|
+
var root = child;
|
|
25776
|
+
if (root.canvas.isVisible) {
|
|
25777
|
+
root.draw();
|
|
25778
|
+
}
|
|
25779
|
+
}
|
|
25780
|
+
};
|
|
25781
|
+
return CanvasContainer;
|
|
25782
|
+
}(ContainerControl);
|
|
25783
|
+
/** Engine window GUI root. Routes events across all UICanvas roots. */ var WindowRootControl = /*#__PURE__*/ function(RootControl) {
|
|
25784
|
+
_inherits(WindowRootControl, RootControl);
|
|
25785
|
+
function WindowRootControl(engine) {
|
|
25786
|
+
var _this;
|
|
25787
|
+
_this = RootControl.call(this, engine) || this;
|
|
25788
|
+
_this.dragThreshold = 10;
|
|
25789
|
+
_this.lastInput = null;
|
|
25790
|
+
_this.gui = {
|
|
25791
|
+
mouseFocus: null,
|
|
25792
|
+
mouseClickGrabber: null,
|
|
25793
|
+
mouseFocusMask: MouseButtonMask.None,
|
|
25794
|
+
mouseOver: null,
|
|
25795
|
+
mouseOverHierarchy: [],
|
|
25796
|
+
touchFocus: new Map(),
|
|
25797
|
+
keyFocus: null,
|
|
25798
|
+
dragAccum: new Vector2(),
|
|
25799
|
+
dragAttempted: false,
|
|
25800
|
+
dragging: false,
|
|
25801
|
+
dragData: null,
|
|
25802
|
+
dragMouseOver: null,
|
|
25803
|
+
dragSuccessful: false,
|
|
25804
|
+
lastMousePosition: new Vector2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY),
|
|
25805
|
+
sendingMouseEnterExit: false,
|
|
25806
|
+
mouseOverUpdatePending: false
|
|
25807
|
+
};
|
|
25808
|
+
_this.mouseFilter = MouseFilter.Ignore;
|
|
25809
|
+
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25810
|
+
_this.canvases = new CanvasContainer(engine);
|
|
25811
|
+
_this.canvases.parent = _assert_this_initialized(_this);
|
|
25812
|
+
return _this;
|
|
25813
|
+
}
|
|
25814
|
+
var _proto = WindowRootControl.prototype;
|
|
25815
|
+
_proto.pushInput = function pushInput(event) {
|
|
25816
|
+
event.clearAccepted();
|
|
25817
|
+
this.lastInput = event;
|
|
25818
|
+
this.cleanupInternalState();
|
|
25819
|
+
this.processGUIInput(event);
|
|
25820
|
+
this.postGrabClickFocus();
|
|
25821
|
+
};
|
|
25822
|
+
_proto.isInputHandled = function isInputHandled() {
|
|
25823
|
+
var _this_lastInput;
|
|
25824
|
+
var _this_lastInput_isAccepted;
|
|
25825
|
+
return (_this_lastInput_isAccepted = (_this_lastInput = this.lastInput) == null ? void 0 : _this_lastInput.isAccepted()) != null ? _this_lastInput_isAccepted : false;
|
|
25826
|
+
};
|
|
25827
|
+
_proto.getMousePosition = function getMousePosition() {
|
|
25828
|
+
return this.gui.lastMousePosition.clone();
|
|
25829
|
+
};
|
|
25830
|
+
_proto.guiGetFocusOwner = function guiGetFocusOwner() {
|
|
25831
|
+
return this.isFocusTargetUsable(this.gui.keyFocus) ? this.gui.keyFocus : null;
|
|
25832
|
+
};
|
|
25833
|
+
_proto.guiReleaseFocus = function guiReleaseFocus() {
|
|
25834
|
+
this.releaseControlFocus();
|
|
25835
|
+
};
|
|
25836
|
+
_proto.guiIsDragging = function guiIsDragging() {
|
|
25837
|
+
return this.gui.dragging;
|
|
25838
|
+
};
|
|
25839
|
+
_proto.guiGetDragData = function guiGetDragData() {
|
|
25840
|
+
return this.gui.dragData;
|
|
25841
|
+
};
|
|
25842
|
+
_proto.guiIsDragSuccessful = function guiIsDragSuccessful() {
|
|
25843
|
+
return this.gui.dragSuccessful;
|
|
25844
|
+
};
|
|
25845
|
+
_proto.guiCancelDrag = function guiCancelDrag() {
|
|
25846
|
+
this.endDragging(false);
|
|
25847
|
+
};
|
|
25848
|
+
_proto.grabControlFocus = function grabControlFocus(control) {
|
|
25849
|
+
if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
|
|
25850
|
+
return;
|
|
25851
|
+
}
|
|
25852
|
+
var previous = this.gui.keyFocus;
|
|
25853
|
+
this.gui.keyFocus = control;
|
|
25854
|
+
if (previous && !previous.isDisposed) {
|
|
25855
|
+
previous.onLostFocus();
|
|
25856
|
+
}
|
|
25857
|
+
control.onGotFocus();
|
|
25858
|
+
};
|
|
25859
|
+
_proto.grabControlClickFocus = function grabControlClickFocus(control) {
|
|
25860
|
+
var _this = this;
|
|
25861
|
+
if (this.isControlValid(control)) {
|
|
25862
|
+
this.gui.mouseClickGrabber = control;
|
|
25863
|
+
queueMicrotask(function() {
|
|
25864
|
+
return _this.postGrabClickFocus();
|
|
25865
|
+
});
|
|
25866
|
+
}
|
|
25867
|
+
};
|
|
25868
|
+
_proto.releaseControlFocus = function releaseControlFocus(control) {
|
|
25869
|
+
var previous = this.gui.keyFocus;
|
|
25870
|
+
if (!previous || control && previous !== control) {
|
|
25871
|
+
return;
|
|
25872
|
+
}
|
|
25873
|
+
this.gui.keyFocus = null;
|
|
25874
|
+
if (!previous.isDisposed) {
|
|
25875
|
+
previous.onLostFocus();
|
|
25876
|
+
}
|
|
25877
|
+
};
|
|
25878
|
+
_proto.warpControlMouse = function warpControlMouse(position) {
|
|
25879
|
+
this.gui.lastMousePosition.copyFrom(position);
|
|
25880
|
+
this.updateMouseOver(position);
|
|
25881
|
+
this.updateMouseCursorState();
|
|
25882
|
+
};
|
|
25883
|
+
_proto.updateMouseCursorState = function updateMouseCursorState() {
|
|
25884
|
+
var position = this.gui.lastMousePosition;
|
|
25885
|
+
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.isControlUsable(this.gui.mouseOver) ? this.gui.mouseOver : null;
|
|
25886
|
+
this.updateCursor(target, position);
|
|
25887
|
+
};
|
|
25888
|
+
_proto.controlStateChanged = function controlStateChanged(control) {
|
|
25889
|
+
if (!this.isControlUsable(control)) {
|
|
25890
|
+
this.dropControlState(control);
|
|
25891
|
+
}
|
|
25892
|
+
this.requestMouseOverUpdate();
|
|
25893
|
+
};
|
|
25894
|
+
_proto.controlRemoved = function controlRemoved(control) {
|
|
25895
|
+
this.dropControlState(control);
|
|
25896
|
+
this.cleanupInternalState();
|
|
25897
|
+
this.requestMouseOverUpdate();
|
|
25898
|
+
};
|
|
25899
|
+
_proto.controlTreeChanged = function controlTreeChanged() {
|
|
25900
|
+
this.requestMouseOverUpdate();
|
|
25901
|
+
};
|
|
25902
|
+
_proto.cancelPointerInput = function cancelPointerInput() {
|
|
25903
|
+
this.dropMouseFocus();
|
|
25904
|
+
this.dropMouseOver();
|
|
25905
|
+
this.gui.touchFocus.clear();
|
|
25906
|
+
this.endDragging(false);
|
|
25907
|
+
this.releaseControlFocus();
|
|
25908
|
+
};
|
|
25909
|
+
_proto.resize = function resize(width, height) {
|
|
25910
|
+
this.setSize(width, height);
|
|
25911
|
+
this.canvases.setSize(width, height);
|
|
25912
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvases.children), _step; !(_step = _iterator()).done;){
|
|
25913
|
+
var root = _step.value;
|
|
25914
|
+
root.setSize(width, height);
|
|
25915
|
+
}
|
|
25916
|
+
};
|
|
25917
|
+
_proto.render = function render() {
|
|
25918
|
+
if (this.canvases.children.length === 0) {
|
|
25919
|
+
return;
|
|
25920
|
+
}
|
|
25921
|
+
this.engine.graphics.begin();
|
|
25922
|
+
this.draw();
|
|
25923
|
+
this.engine.graphics.end();
|
|
25924
|
+
};
|
|
25925
|
+
_proto.update = function update(deltaTime) {
|
|
25926
|
+
if (this.gui.mouseOverUpdatePending) {
|
|
25927
|
+
this.gui.mouseOverUpdatePending = false;
|
|
25928
|
+
this.updateMouseOver(this.gui.lastMousePosition);
|
|
25272
25929
|
}
|
|
25273
|
-
|
|
25274
|
-
|
|
25275
|
-
|
|
25276
|
-
|
|
25277
|
-
|
|
25278
|
-
|
|
25279
|
-
|
|
25280
|
-
|
|
25281
|
-
|
|
25282
|
-
|
|
25283
|
-
|
|
25284
|
-
|
|
25285
|
-
|
|
25930
|
+
RootControl.prototype.update.call(this, deltaTime);
|
|
25931
|
+
};
|
|
25932
|
+
_proto.dispose = function dispose() {
|
|
25933
|
+
this.cancelPointerInput();
|
|
25934
|
+
RootControl.prototype.dispose.call(this);
|
|
25935
|
+
};
|
|
25936
|
+
_proto.processGUIInput = function processGUIInput(event) {
|
|
25937
|
+
if (_instanceof1(event, InputEventKey)) {
|
|
25938
|
+
var target = this.guiGetFocusOwner();
|
|
25939
|
+
if (target) {
|
|
25940
|
+
this.callControlInput(target, event);
|
|
25941
|
+
}
|
|
25942
|
+
} else if (_instanceof1(event, InputEventMouse)) {
|
|
25943
|
+
this.gui.lastMousePosition.copyFrom(event.globalPosition);
|
|
25944
|
+
this.updateMouseOver(event.globalPosition);
|
|
25945
|
+
if (_instanceof1(event, InputEventMouseButton)) {
|
|
25946
|
+
this.processMouseButton(event);
|
|
25947
|
+
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
25948
|
+
this.processMouseMotion(event);
|
|
25949
|
+
}
|
|
25950
|
+
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
25951
|
+
this.processScreenTouch(event);
|
|
25952
|
+
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
25953
|
+
this.processScreenDrag(event);
|
|
25954
|
+
}
|
|
25955
|
+
};
|
|
25956
|
+
_proto.processMouseButton = function processMouseButton(event) {
|
|
25957
|
+
if (isWheelButton(event.buttonIndex)) {
|
|
25958
|
+
var target = this.findInputControl(event.globalPosition);
|
|
25959
|
+
if (target) {
|
|
25960
|
+
this.callGUIInput(target, event);
|
|
25961
|
+
}
|
|
25962
|
+
return;
|
|
25963
|
+
}
|
|
25964
|
+
var mask = getButtonMask(event.buttonIndex);
|
|
25965
|
+
if (event.isPressed()) {
|
|
25966
|
+
var target1 = this.gui.mouseFocusMask !== 0 ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
25967
|
+
this.gui.mouseFocus = target1;
|
|
25968
|
+
if (!target1) {
|
|
25969
|
+
return;
|
|
25970
|
+
}
|
|
25971
|
+
this.gui.mouseFocusMask |= mask;
|
|
25972
|
+
if (event.buttonIndex === MouseButton.Left) {
|
|
25973
|
+
this.gui.dragAccum.setZero();
|
|
25974
|
+
this.gui.dragAttempted = false;
|
|
25975
|
+
this.findClickFocus(target1);
|
|
25976
|
+
}
|
|
25977
|
+
this.callGUIInput(target1, event);
|
|
25978
|
+
} else {
|
|
25979
|
+
if (event.buttonIndex === MouseButton.Left && this.gui.dragging) {
|
|
25980
|
+
this.finishDrop(event.globalPosition);
|
|
25981
|
+
}
|
|
25982
|
+
this.gui.mouseFocusMask &= ~mask;
|
|
25983
|
+
var target2 = this.gui.mouseFocus;
|
|
25984
|
+
if (this.gui.mouseFocusMask === 0) {
|
|
25985
|
+
this.gui.mouseFocus = null;
|
|
25986
|
+
}
|
|
25987
|
+
if (this.isControlUsable(target2)) {
|
|
25988
|
+
this.callGUIInput(target2, event);
|
|
25989
|
+
}
|
|
25286
25990
|
}
|
|
25287
|
-
return rt;
|
|
25288
25991
|
};
|
|
25289
|
-
|
|
25290
|
-
|
|
25992
|
+
_proto.processMouseMotion = function processMouseMotion(event) {
|
|
25993
|
+
if (!this.gui.dragging && !this.gui.dragAttempted && this.gui.mouseFocus && (this.gui.mouseFocusMask & MouseButtonMask.Left) !== 0) {
|
|
25994
|
+
this.gui.dragAccum.add(event.relative);
|
|
25995
|
+
if (this.gui.dragAccum.length() > this.dragThreshold) {
|
|
25996
|
+
var origin = event.globalPosition.clone().subtract(this.gui.dragAccum);
|
|
25997
|
+
this.beginDragging(this.gui.mouseFocus, origin);
|
|
25998
|
+
this.gui.dragAttempted = true;
|
|
25999
|
+
}
|
|
26000
|
+
}
|
|
26001
|
+
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
26002
|
+
if (target) {
|
|
26003
|
+
this.callGUIInput(target, event);
|
|
26004
|
+
}
|
|
26005
|
+
if (this.gui.dragging) {
|
|
26006
|
+
this.gui.dragMouseOver = this.findDropTarget(this.findInputControl(event.globalPosition), event.globalPosition);
|
|
26007
|
+
}
|
|
26008
|
+
this.updateCursor(target, event.globalPosition);
|
|
26009
|
+
};
|
|
26010
|
+
_proto.processScreenTouch = function processScreenTouch(event) {
|
|
26011
|
+
var target;
|
|
26012
|
+
if (event.isPressed()) {
|
|
26013
|
+
target = this.findInputControl(event.position);
|
|
26014
|
+
if (target) {
|
|
26015
|
+
this.gui.touchFocus.set(event.index, target);
|
|
26016
|
+
}
|
|
26017
|
+
} else {
|
|
26018
|
+
var _this_gui_touchFocus_get;
|
|
26019
|
+
target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : null;
|
|
26020
|
+
this.gui.touchFocus.delete(event.index);
|
|
26021
|
+
}
|
|
26022
|
+
if (this.isControlUsable(target)) {
|
|
26023
|
+
this.callGUIInput(target, event);
|
|
26024
|
+
}
|
|
26025
|
+
};
|
|
26026
|
+
_proto.processScreenDrag = function processScreenDrag(event) {
|
|
26027
|
+
var _this_gui_touchFocus_get;
|
|
26028
|
+
var target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : this.findInputControl(event.position);
|
|
26029
|
+
if (this.isControlUsable(target)) {
|
|
26030
|
+
this.callGUIInput(target, event);
|
|
26031
|
+
}
|
|
26032
|
+
};
|
|
26033
|
+
_proto.callGUIInput = function callGUIInput(target, event) {
|
|
26034
|
+
var current = target;
|
|
26035
|
+
var pointerEvent = _instanceof1(event, InputEventMouse) || _instanceof1(event, InputEventScreenTouch) || _instanceof1(event, InputEventScreenDrag);
|
|
26036
|
+
while(current && current !== this && this.isControlUsable(current)){
|
|
26037
|
+
var filter = current.getEffectiveMouseFilter();
|
|
26038
|
+
if (filter !== MouseFilter.Ignore) {
|
|
26039
|
+
var localEvent = event.xformedBy(this.getGlobalInverse(current));
|
|
26040
|
+
this.callControlInput(current, localEvent);
|
|
26041
|
+
if (localEvent.isAccepted()) {
|
|
26042
|
+
event.accept();
|
|
26043
|
+
}
|
|
26044
|
+
}
|
|
26045
|
+
var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
|
|
26046
|
+
if (event.isAccepted() || filter === MouseFilter.Stop && pointerEvent && !forcePassWheel) {
|
|
26047
|
+
event.accept();
|
|
26048
|
+
return;
|
|
26049
|
+
}
|
|
26050
|
+
current = current.parent;
|
|
26051
|
+
}
|
|
26052
|
+
};
|
|
26053
|
+
_proto.callControlInput = function callControlInput(control, event) {
|
|
26054
|
+
if (_instanceof1(event, InputEventMouseButton)) {
|
|
26055
|
+
if (isWheelButton(event.buttonIndex)) {
|
|
26056
|
+
control.onMouseWheel(event);
|
|
26057
|
+
} else if (event.isPressed()) {
|
|
26058
|
+
control.onMouseDown(event);
|
|
26059
|
+
} else {
|
|
26060
|
+
control.onMouseUp(event);
|
|
26061
|
+
}
|
|
26062
|
+
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
26063
|
+
control.onMouseMove(event);
|
|
26064
|
+
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
26065
|
+
if (event.isPressed()) {
|
|
26066
|
+
control.onTouchDown(event);
|
|
26067
|
+
} else {
|
|
26068
|
+
control.onTouchUp(event);
|
|
26069
|
+
}
|
|
26070
|
+
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
26071
|
+
control.onTouchMove(event);
|
|
26072
|
+
} else if (_instanceof1(event, InputEventKey)) {
|
|
26073
|
+
if (event.isPressed()) {
|
|
26074
|
+
control.onKeyDown(event);
|
|
26075
|
+
} else if (event.isReleased()) {
|
|
26076
|
+
control.onKeyUp(event);
|
|
26077
|
+
}
|
|
26078
|
+
}
|
|
26079
|
+
};
|
|
26080
|
+
_proto.findInputControl = function findInputControl(position) {
|
|
26081
|
+
this.canvases.sortCanvases();
|
|
26082
|
+
for(var index = this.canvases.children.length - 1; index >= 0; index--){
|
|
26083
|
+
var root = this.canvases.children[index];
|
|
26084
|
+
if (!root.canvas.isVisible || root.inputDisabled) {
|
|
26085
|
+
continue;
|
|
26086
|
+
}
|
|
26087
|
+
var target = this.findControlAtPosition(root, position, true);
|
|
26088
|
+
if (target) {
|
|
26089
|
+
return target;
|
|
26090
|
+
}
|
|
26091
|
+
}
|
|
26092
|
+
return null;
|
|
26093
|
+
};
|
|
26094
|
+
_proto.findControlAtPosition = function findControlAtPosition(container, position, skipSelf) {
|
|
26095
|
+
if (skipSelf === void 0) skipSelf = false;
|
|
26096
|
+
if (!container.visibleInHierarchy || container.isDisposed) {
|
|
26097
|
+
return null;
|
|
26098
|
+
}
|
|
26099
|
+
var localPosition = this.toLocal(container, position);
|
|
26100
|
+
if (container.clipContents && !container.hasPoint(localPosition)) {
|
|
26101
|
+
return null;
|
|
26102
|
+
}
|
|
26103
|
+
for(var index = container.children.length - 1; index >= 0; index--){
|
|
26104
|
+
var child = container.children[index];
|
|
26105
|
+
if (!child.visibleInHierarchy || child.isDisposed) {
|
|
26106
|
+
continue;
|
|
26107
|
+
}
|
|
26108
|
+
if (_instanceof1(child, ContainerControl)) {
|
|
26109
|
+
var found = this.findControlAtPosition(child, position);
|
|
26110
|
+
if (found) {
|
|
26111
|
+
return found;
|
|
26112
|
+
}
|
|
26113
|
+
} else if (child.getEffectiveMouseFilter() !== MouseFilter.Ignore && child.hasPoint(this.toLocal(child, position))) {
|
|
26114
|
+
return child;
|
|
26115
|
+
}
|
|
26116
|
+
}
|
|
26117
|
+
if (!skipSelf && container.getEffectiveMouseFilter() !== MouseFilter.Ignore && container.hasPoint(localPosition)) {
|
|
26118
|
+
return container;
|
|
26119
|
+
}
|
|
26120
|
+
return null;
|
|
26121
|
+
};
|
|
26122
|
+
_proto.updateMouseOver = function updateMouseOver(position) {
|
|
26123
|
+
if (this.gui.sendingMouseEnterExit) {
|
|
26124
|
+
this.gui.mouseOverUpdatePending = true;
|
|
26125
|
+
return;
|
|
26126
|
+
}
|
|
26127
|
+
this.gui.mouseOverUpdatePending = false;
|
|
26128
|
+
var target = this.findInputControl(position);
|
|
26129
|
+
var next = this.buildHoverHierarchy(target);
|
|
26130
|
+
var previous = this.gui.mouseOverHierarchy;
|
|
26131
|
+
var common = 0;
|
|
26132
|
+
while(common < previous.length && common < next.length && previous[common] === next[common]){
|
|
26133
|
+
common++;
|
|
26134
|
+
}
|
|
26135
|
+
this.gui.sendingMouseEnterExit = true;
|
|
26136
|
+
for(var index = previous.length - 1; index >= common; index--){
|
|
26137
|
+
if (!previous[index].isDisposed) {
|
|
26138
|
+
previous[index].onMouseLeave();
|
|
26139
|
+
}
|
|
26140
|
+
}
|
|
26141
|
+
for(var index1 = common; index1 < next.length; index1++){
|
|
26142
|
+
next[index1].onMouseEnter(this.toLocal(next[index1], position));
|
|
26143
|
+
}
|
|
26144
|
+
this.gui.sendingMouseEnterExit = false;
|
|
26145
|
+
this.gui.mouseOver = target;
|
|
26146
|
+
this.gui.mouseOverHierarchy = next;
|
|
26147
|
+
};
|
|
26148
|
+
_proto.buildHoverHierarchy = function buildHoverHierarchy(target) {
|
|
26149
|
+
var hierarchy = [];
|
|
26150
|
+
var current = target;
|
|
26151
|
+
while(current && current !== this){
|
|
26152
|
+
if (current.getEffectiveMouseFilter() !== MouseFilter.Ignore) {
|
|
26153
|
+
hierarchy.push(current);
|
|
26154
|
+
}
|
|
26155
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26156
|
+
break;
|
|
26157
|
+
}
|
|
26158
|
+
current = current.parent;
|
|
26159
|
+
}
|
|
26160
|
+
hierarchy.reverse();
|
|
26161
|
+
return hierarchy;
|
|
26162
|
+
};
|
|
26163
|
+
_proto.findClickFocus = function findClickFocus(target) {
|
|
26164
|
+
var current = target;
|
|
26165
|
+
while(current && current !== this){
|
|
26166
|
+
var mode = current.getFocusModeWithOverride();
|
|
26167
|
+
if (mode === FocusMode.Click || mode === FocusMode.All) {
|
|
26168
|
+
this.grabControlFocus(current);
|
|
26169
|
+
return;
|
|
26170
|
+
}
|
|
26171
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26172
|
+
return;
|
|
26173
|
+
}
|
|
26174
|
+
current = current.parent;
|
|
26175
|
+
}
|
|
26176
|
+
};
|
|
26177
|
+
_proto.beginDragging = function beginDragging(source, position) {
|
|
26178
|
+
var current = source;
|
|
26179
|
+
while(current && current !== this){
|
|
26180
|
+
var data = current.invokeGetDragData(this.toLocal(current, position));
|
|
26181
|
+
if (data !== null && data !== undefined) {
|
|
26182
|
+
this.gui.dragging = true;
|
|
26183
|
+
this.gui.dragData = data;
|
|
26184
|
+
this.gui.mouseFocus = null;
|
|
26185
|
+
this.gui.mouseFocusMask = MouseButtonMask.None;
|
|
26186
|
+
return;
|
|
26187
|
+
}
|
|
26188
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26189
|
+
return;
|
|
26190
|
+
}
|
|
26191
|
+
current = current.parent;
|
|
26192
|
+
}
|
|
26193
|
+
};
|
|
26194
|
+
_proto.finishDrop = function finishDrop(position) {
|
|
26195
|
+
var target = this.findDropTarget(this.findInputControl(position), position);
|
|
26196
|
+
if (target) {
|
|
26197
|
+
target.invokeDropData(this.toLocal(target, position), this.gui.dragData);
|
|
26198
|
+
}
|
|
26199
|
+
this.endDragging(!!target);
|
|
26200
|
+
};
|
|
26201
|
+
_proto.findDropTarget = function findDropTarget(target, position) {
|
|
26202
|
+
var current = target;
|
|
26203
|
+
while(current && current !== this){
|
|
26204
|
+
if (current.invokeCanDropData(this.toLocal(current, position), this.gui.dragData)) {
|
|
26205
|
+
return current;
|
|
26206
|
+
}
|
|
26207
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26208
|
+
return null;
|
|
26209
|
+
}
|
|
26210
|
+
current = current.parent;
|
|
26211
|
+
}
|
|
26212
|
+
return null;
|
|
26213
|
+
};
|
|
26214
|
+
_proto.endDragging = function endDragging(successful) {
|
|
26215
|
+
this.gui.dragSuccessful = successful;
|
|
26216
|
+
this.gui.dragging = false;
|
|
26217
|
+
this.gui.dragData = null;
|
|
26218
|
+
this.gui.dragMouseOver = null;
|
|
26219
|
+
};
|
|
26220
|
+
_proto.updateCursor = function updateCursor(target, position) {
|
|
26221
|
+
var current = target;
|
|
26222
|
+
var cursor = CursorShape.Arrow;
|
|
26223
|
+
while(current && current !== this){
|
|
26224
|
+
var candidate = current.getCursorShape(this.toLocal(current, position));
|
|
26225
|
+
if (candidate !== CursorShape.Arrow) {
|
|
26226
|
+
cursor = candidate;
|
|
26227
|
+
break;
|
|
26228
|
+
}
|
|
26229
|
+
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26230
|
+
break;
|
|
26231
|
+
}
|
|
26232
|
+
current = current.parent;
|
|
26233
|
+
}
|
|
26234
|
+
this.engine.canvas.style.cursor = typeof cursor === "string" ? cursor : cursorNames[cursor];
|
|
26235
|
+
};
|
|
26236
|
+
_proto.postGrabClickFocus = function postGrabClickFocus() {
|
|
26237
|
+
var target = this.gui.mouseClickGrabber;
|
|
26238
|
+
this.gui.mouseClickGrabber = null;
|
|
26239
|
+
if (this.isControlUsable(target)) {
|
|
26240
|
+
this.gui.mouseFocus = target;
|
|
26241
|
+
}
|
|
26242
|
+
};
|
|
26243
|
+
_proto.cleanupInternalState = function cleanupInternalState() {
|
|
26244
|
+
if (!this.isControlUsable(this.gui.mouseFocus)) {
|
|
26245
|
+
this.dropMouseFocus();
|
|
26246
|
+
}
|
|
26247
|
+
if (this.gui.keyFocus && !this.isFocusTargetUsable(this.gui.keyFocus)) {
|
|
26248
|
+
this.releaseControlFocus(this.gui.keyFocus);
|
|
26249
|
+
}
|
|
26250
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26251
|
+
var _step_value = _step.value, index = _step_value[0], control = _step_value[1];
|
|
26252
|
+
if (!this.isControlUsable(control)) {
|
|
26253
|
+
this.gui.touchFocus.delete(index);
|
|
26254
|
+
}
|
|
26255
|
+
}
|
|
26256
|
+
};
|
|
26257
|
+
_proto.dropMouseFocus = function dropMouseFocus() {
|
|
26258
|
+
this.gui.mouseFocus = null;
|
|
26259
|
+
this.gui.mouseFocusMask = MouseButtonMask.None;
|
|
26260
|
+
};
|
|
26261
|
+
_proto.dropMouseOver = function dropMouseOver() {
|
|
26262
|
+
for(var index = this.gui.mouseOverHierarchy.length - 1; index >= 0; index--){
|
|
26263
|
+
var control = this.gui.mouseOverHierarchy[index];
|
|
26264
|
+
if (!control.isDisposed) {
|
|
26265
|
+
control.onMouseLeave();
|
|
26266
|
+
}
|
|
26267
|
+
}
|
|
26268
|
+
this.gui.mouseOver = null;
|
|
26269
|
+
this.gui.mouseOverHierarchy = [];
|
|
26270
|
+
};
|
|
26271
|
+
_proto.dropControlState = function dropControlState(control) {
|
|
26272
|
+
if (this.controlBelongsToSubtree(this.gui.mouseFocus, control)) {
|
|
26273
|
+
this.dropMouseFocus();
|
|
26274
|
+
}
|
|
26275
|
+
if (this.controlBelongsToSubtree(this.gui.mouseClickGrabber, control)) {
|
|
26276
|
+
this.gui.mouseClickGrabber = null;
|
|
26277
|
+
}
|
|
26278
|
+
if (this.controlBelongsToSubtree(this.gui.keyFocus, control)) {
|
|
26279
|
+
var _this_gui_keyFocus;
|
|
26280
|
+
this.releaseControlFocus((_this_gui_keyFocus = this.gui.keyFocus) != null ? _this_gui_keyFocus : undefined);
|
|
26281
|
+
}
|
|
26282
|
+
if (this.controlBelongsToSubtree(this.gui.mouseOver, control)) {
|
|
26283
|
+
this.dropMouseOver();
|
|
26284
|
+
}
|
|
26285
|
+
if (this.controlBelongsToSubtree(this.gui.dragMouseOver, control)) {
|
|
26286
|
+
this.gui.dragMouseOver = null;
|
|
26287
|
+
}
|
|
26288
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26289
|
+
var _step_value = _step.value, index = _step_value[0], target = _step_value[1];
|
|
26290
|
+
if (this.controlBelongsToSubtree(target, control)) {
|
|
26291
|
+
this.gui.touchFocus.delete(index);
|
|
26292
|
+
}
|
|
26293
|
+
}
|
|
26294
|
+
};
|
|
26295
|
+
_proto.requestMouseOverUpdate = function requestMouseOverUpdate() {
|
|
26296
|
+
if (Number.isFinite(this.gui.lastMousePosition.x)) {
|
|
26297
|
+
this.updateMouseOver(this.gui.lastMousePosition);
|
|
26298
|
+
}
|
|
26299
|
+
};
|
|
26300
|
+
_proto.getGlobalInverse = function getGlobalInverse(control) {
|
|
26301
|
+
var transform = control.getGlobalTransform2D().clone();
|
|
26302
|
+
return Math.abs(transform.determinant()) < 1e-12 ? new Matrix3() : transform.invert();
|
|
26303
|
+
};
|
|
26304
|
+
_proto.toLocal = function toLocal(control, position) {
|
|
26305
|
+
var elements = this.getGlobalInverse(control).elements;
|
|
26306
|
+
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
26307
|
+
};
|
|
26308
|
+
_proto.controlBelongsToSubtree = function controlBelongsToSubtree(control, subtree) {
|
|
26309
|
+
var current = control;
|
|
26310
|
+
while(current){
|
|
26311
|
+
if (current === subtree) {
|
|
26312
|
+
return true;
|
|
26313
|
+
}
|
|
26314
|
+
current = current.parent;
|
|
26315
|
+
}
|
|
26316
|
+
return false;
|
|
26317
|
+
};
|
|
26318
|
+
_proto.isControlValid = function isControlValid(control) {
|
|
26319
|
+
return !!control && !control.isDisposed && control.root === this;
|
|
26320
|
+
};
|
|
26321
|
+
_proto.isControlUsable = function isControlUsable(control) {
|
|
26322
|
+
if (!this.isControlValid(control) || !control.visibleInHierarchy || !control.enabledInHierarchy) {
|
|
26323
|
+
return false;
|
|
26324
|
+
}
|
|
26325
|
+
var root = this.findCanvasRoot(control);
|
|
26326
|
+
return !root || !root.inputDisabled;
|
|
26327
|
+
};
|
|
26328
|
+
_proto.findCanvasRoot = function findCanvasRoot(control) {
|
|
26329
|
+
var current = control;
|
|
26330
|
+
while(current && current !== this){
|
|
26331
|
+
if (_instanceof1(current, CanvasRootControl)) {
|
|
26332
|
+
return current;
|
|
26333
|
+
}
|
|
26334
|
+
current = current.parent;
|
|
26335
|
+
}
|
|
26336
|
+
return null;
|
|
26337
|
+
};
|
|
26338
|
+
_proto.isFocusTargetUsable = function isFocusTargetUsable(control) {
|
|
26339
|
+
return this.isControlUsable(control) && control.getFocusModeWithOverride() !== FocusMode.None;
|
|
26340
|
+
};
|
|
26341
|
+
return WindowRootControl;
|
|
26342
|
+
}(RootControl);
|
|
26343
|
+
|
|
26344
|
+
var CanvasRenderMode;
|
|
26345
|
+
(function(CanvasRenderMode) {
|
|
26346
|
+
CanvasRenderMode[CanvasRenderMode["ScreenSpace"] = 0] = "ScreenSpace";
|
|
26347
|
+
CanvasRenderMode[CanvasRenderMode["CameraSpace"] = 1] = "CameraSpace";
|
|
26348
|
+
CanvasRenderMode[CanvasRenderMode["WorldSpace"] = 2] = "WorldSpace";
|
|
26349
|
+
CanvasRenderMode[CanvasRenderMode["WorldSpaceFaceCamera"] = 3] = "WorldSpaceFaceCamera";
|
|
26350
|
+
})(CanvasRenderMode || (CanvasRenderMode = {}));
|
|
26351
|
+
/** Canvas-layer boundary attached to a VFXItem. Input state remains owned by the window root. */ var UICanvas = /*#__PURE__*/ function(Component) {
|
|
26352
|
+
_inherits(UICanvas, Component);
|
|
26353
|
+
function UICanvas(engine) {
|
|
26354
|
+
var _this;
|
|
26355
|
+
_this = Component.call(this, engine) || this;
|
|
26356
|
+
_this.renderMode = 0;
|
|
26357
|
+
_this.receivesEvents = true;
|
|
26358
|
+
_this._order = 0;
|
|
26359
|
+
_this.registered = false;
|
|
26360
|
+
_this.rootControl = new CanvasRootControl(engine, _assert_this_initialized(_this));
|
|
26361
|
+
return _this;
|
|
26362
|
+
}
|
|
26363
|
+
var _proto = UICanvas.prototype;
|
|
26364
|
+
_proto.onEnable = function onEnable() {
|
|
26365
|
+
this.register();
|
|
26366
|
+
};
|
|
26367
|
+
_proto.onDisable = function onDisable() {
|
|
26368
|
+
this.unregister();
|
|
26369
|
+
};
|
|
26370
|
+
_proto.onDestroy = function onDestroy() {
|
|
26371
|
+
this.destroyCanvas();
|
|
26372
|
+
};
|
|
26373
|
+
_proto.dispose = function dispose() {
|
|
26374
|
+
this.destroyCanvas();
|
|
26375
|
+
Component.prototype.dispose.call(this);
|
|
26376
|
+
};
|
|
26377
|
+
_proto.register = function register() {
|
|
26378
|
+
if (!this.registered) {
|
|
26379
|
+
this.rootControl.parent = this.engine.windowRoot.canvases;
|
|
26380
|
+
this.registered = true;
|
|
26381
|
+
}
|
|
26382
|
+
};
|
|
26383
|
+
_proto.unregister = function unregister() {
|
|
26384
|
+
if (this.registered) {
|
|
26385
|
+
this.rootControl.parent = null;
|
|
26386
|
+
this.registered = false;
|
|
26387
|
+
}
|
|
26388
|
+
};
|
|
26389
|
+
_proto.destroyCanvas = function destroyCanvas() {
|
|
26390
|
+
this.unregister();
|
|
26391
|
+
if (!this.rootControl.isDisposed) {
|
|
26392
|
+
this.rootControl.dispose();
|
|
26393
|
+
}
|
|
26394
|
+
};
|
|
26395
|
+
_create_class(UICanvas, [
|
|
26396
|
+
{
|
|
26397
|
+
key: "order",
|
|
26398
|
+
get: function get() {
|
|
26399
|
+
return this._order;
|
|
26400
|
+
},
|
|
26401
|
+
set: function set(value) {
|
|
26402
|
+
if (this._order !== value) {
|
|
26403
|
+
this._order = value;
|
|
26404
|
+
this.engine.windowRoot.canvases.sortCanvases();
|
|
26405
|
+
}
|
|
26406
|
+
}
|
|
26407
|
+
},
|
|
26408
|
+
{
|
|
26409
|
+
key: "isVisible",
|
|
26410
|
+
get: function get() {
|
|
26411
|
+
var _this_item;
|
|
26412
|
+
return this.renderMode === 0 && this.enabled && !!((_this_item = this.item) == null ? void 0 : _this_item.isActive);
|
|
26413
|
+
}
|
|
26414
|
+
}
|
|
26415
|
+
]);
|
|
26416
|
+
return UICanvas;
|
|
26417
|
+
}(Component);
|
|
25291
26418
|
|
|
25292
26419
|
/**
|
|
25293
|
-
*
|
|
25294
|
-
*
|
|
25295
|
-
|
|
25296
|
-
|
|
25297
|
-
|
|
25298
|
-
|
|
25299
|
-
|
|
25300
|
-
|
|
25301
|
-
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
|
|
26420
|
+
* Scene-tree bridge for a GUI Control. The VFXItem tree owns lifecycle and
|
|
26421
|
+
* serialization while the Control tree owns layout, drawing and input.
|
|
26422
|
+
*/ var UIControl = /*#__PURE__*/ function(Component) {
|
|
26423
|
+
_inherits(UIControl, Component);
|
|
26424
|
+
function UIControl(engine) {
|
|
26425
|
+
var _this;
|
|
26426
|
+
_this = Component.call(this, engine) || this;
|
|
26427
|
+
_this.controlNode = null;
|
|
26428
|
+
_this.linkedItemTransform = null;
|
|
26429
|
+
_this.linkedControl = null;
|
|
26430
|
+
_this.syncingLocation = false;
|
|
26431
|
+
_this.itemTransformChanged = function() {
|
|
26432
|
+
return _this.syncItemLocationToControl();
|
|
26433
|
+
};
|
|
26434
|
+
_this.controlLocationChanged = function() {
|
|
26435
|
+
return _this.syncControlLocationToItem();
|
|
26436
|
+
};
|
|
26437
|
+
return _this;
|
|
25305
26438
|
}
|
|
25306
|
-
var _proto =
|
|
25307
|
-
|
|
25308
|
-
|
|
25309
|
-
|
|
25310
|
-
|
|
25311
|
-
|
|
25312
|
-
|
|
25313
|
-
|
|
26439
|
+
var _proto = UIControl.prototype;
|
|
26440
|
+
_proto.onAwake = function onAwake() {
|
|
26441
|
+
this.syncControl();
|
|
26442
|
+
};
|
|
26443
|
+
_proto.onEnable = function onEnable() {
|
|
26444
|
+
if (this.controlNode) {
|
|
26445
|
+
this.controlNode.visible = this.item.isActive;
|
|
26446
|
+
this.controlNode.enabled = true;
|
|
25314
26447
|
}
|
|
25315
26448
|
};
|
|
25316
|
-
|
|
25317
|
-
|
|
26449
|
+
_proto.onDisable = function onDisable() {
|
|
26450
|
+
if (this.controlNode) {
|
|
26451
|
+
this.controlNode.visible = this.item.isActive;
|
|
26452
|
+
this.controlNode.enabled = false;
|
|
26453
|
+
}
|
|
26454
|
+
};
|
|
26455
|
+
_proto.onParentChanged = function onParentChanged() {
|
|
26456
|
+
this.syncControl();
|
|
26457
|
+
};
|
|
26458
|
+
_proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
26459
|
+
this.syncControlOrder();
|
|
26460
|
+
};
|
|
26461
|
+
_proto.onDestroy = function onDestroy() {
|
|
26462
|
+
this.disposeControl();
|
|
26463
|
+
};
|
|
26464
|
+
_proto.dispose = function dispose() {
|
|
26465
|
+
this.disposeControl();
|
|
26466
|
+
Component.prototype.dispose.call(this);
|
|
26467
|
+
};
|
|
26468
|
+
/** Unlinks the GUI object without disposing or modifying it. */ _proto.unlinkControl = function unlinkControl() {
|
|
26469
|
+
if (this.controlNode) {
|
|
26470
|
+
this.unbindLocationSync();
|
|
26471
|
+
this.controlNode = null;
|
|
26472
|
+
}
|
|
26473
|
+
};
|
|
26474
|
+
_proto.disposeControl = function disposeControl() {
|
|
26475
|
+
var control = this.controlNode;
|
|
26476
|
+
if (control) {
|
|
26477
|
+
this.unbindLocationSync();
|
|
26478
|
+
this.controlNode = null;
|
|
26479
|
+
control.dispose();
|
|
26480
|
+
}
|
|
26481
|
+
};
|
|
26482
|
+
_proto.syncControl = function syncControl() {
|
|
26483
|
+
var control = this.controlNode;
|
|
26484
|
+
if (!control || !this.item) {
|
|
26485
|
+
return;
|
|
26486
|
+
}
|
|
26487
|
+
this.syncingLocation = true;
|
|
26488
|
+
try {
|
|
26489
|
+
control.visible = this.item.isActive;
|
|
26490
|
+
control.enabled = this.enabled;
|
|
26491
|
+
control.parent = this.resolveParent();
|
|
26492
|
+
this.syncControlOrder();
|
|
26493
|
+
this.copyItemLocationToControl();
|
|
26494
|
+
} finally{
|
|
26495
|
+
this.syncingLocation = false;
|
|
26496
|
+
}
|
|
26497
|
+
this.bindLocationSync();
|
|
26498
|
+
};
|
|
26499
|
+
_proto.syncControlOrder = function syncControlOrder() {
|
|
26500
|
+
if (this.controlNode && this.item) {
|
|
26501
|
+
this.controlNode.indexInParent = this.item.orderInParent;
|
|
26502
|
+
}
|
|
26503
|
+
};
|
|
26504
|
+
_proto.resolveParent = function resolveParent() {
|
|
26505
|
+
var parentItem = this.item.parent;
|
|
26506
|
+
if (!parentItem) {
|
|
26507
|
+
var _UIControl_fallbackParentGetDelegate;
|
|
26508
|
+
return (_UIControl_fallbackParentGetDelegate = UIControl.fallbackParentGetDelegate == null ? void 0 : UIControl.fallbackParentGetDelegate.call(UIControl, this)) != null ? _UIControl_fallbackParentGetDelegate : null;
|
|
26509
|
+
}
|
|
26510
|
+
var uiControl = parentItem.getComponent(UIControl);
|
|
26511
|
+
if ((uiControl == null ? void 0 : uiControl.control) && "children" in uiControl.control) {
|
|
26512
|
+
return uiControl.control;
|
|
26513
|
+
}
|
|
26514
|
+
var canvas = parentItem.getComponent(UICanvas);
|
|
26515
|
+
var _canvas_rootControl, _ref;
|
|
26516
|
+
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;
|
|
26517
|
+
};
|
|
26518
|
+
_proto.bindLocationSync = function bindLocationSync() {
|
|
26519
|
+
var itemTransform = this.item.transform;
|
|
26520
|
+
var control = this.controlNode;
|
|
26521
|
+
if (this.linkedItemTransform === itemTransform && this.linkedControl === control) {
|
|
26522
|
+
return;
|
|
26523
|
+
}
|
|
26524
|
+
this.unbindLocationSync();
|
|
26525
|
+
if (control) {
|
|
26526
|
+
this.linkedItemTransform = itemTransform;
|
|
26527
|
+
this.linkedControl = control;
|
|
26528
|
+
itemTransform.on("changed", this.itemTransformChanged);
|
|
26529
|
+
control.on("locationChanged", this.controlLocationChanged);
|
|
26530
|
+
}
|
|
26531
|
+
};
|
|
26532
|
+
_proto.unbindLocationSync = function unbindLocationSync() {
|
|
26533
|
+
var _this_linkedItemTransform, _this_linkedControl;
|
|
26534
|
+
(_this_linkedItemTransform = this.linkedItemTransform) == null ? void 0 : _this_linkedItemTransform.off("changed", this.itemTransformChanged);
|
|
26535
|
+
(_this_linkedControl = this.linkedControl) == null ? void 0 : _this_linkedControl.off("locationChanged", this.controlLocationChanged);
|
|
26536
|
+
this.linkedItemTransform = null;
|
|
26537
|
+
this.linkedControl = null;
|
|
26538
|
+
};
|
|
26539
|
+
_proto.syncItemLocationToControl = function syncItemLocationToControl() {
|
|
26540
|
+
if (!this.syncingLocation && this.controlNode) {
|
|
26541
|
+
this.syncingLocation = true;
|
|
26542
|
+
try {
|
|
26543
|
+
this.copyItemLocationToControl();
|
|
26544
|
+
} finally{
|
|
26545
|
+
this.syncingLocation = false;
|
|
26546
|
+
}
|
|
26547
|
+
}
|
|
26548
|
+
};
|
|
26549
|
+
_proto.syncControlLocationToItem = function syncControlLocationToItem() {
|
|
26550
|
+
var control = this.controlNode;
|
|
26551
|
+
if (!this.syncingLocation && control) {
|
|
26552
|
+
var source = control.location;
|
|
26553
|
+
var target = this.item.transform.position;
|
|
26554
|
+
if (source.x !== target.x || source.y !== target.y) {
|
|
26555
|
+
this.syncingLocation = true;
|
|
26556
|
+
try {
|
|
26557
|
+
this.item.transform.setPosition(source.x, source.y, target.z);
|
|
26558
|
+
} finally{
|
|
26559
|
+
this.syncingLocation = false;
|
|
26560
|
+
}
|
|
26561
|
+
}
|
|
26562
|
+
}
|
|
26563
|
+
};
|
|
26564
|
+
_proto.copyItemLocationToControl = function copyItemLocationToControl() {
|
|
26565
|
+
var control = this.controlNode;
|
|
26566
|
+
if (control) {
|
|
26567
|
+
var source = this.item.transform.position;
|
|
26568
|
+
var target = control.location;
|
|
26569
|
+
if (source.x !== target.x || source.y !== target.y) {
|
|
26570
|
+
control.setPosition(source.x, source.y);
|
|
26571
|
+
}
|
|
26572
|
+
}
|
|
26573
|
+
};
|
|
26574
|
+
_create_class(UIControl, [
|
|
26575
|
+
{
|
|
26576
|
+
key: "control",
|
|
26577
|
+
get: function get() {
|
|
26578
|
+
return this.controlNode;
|
|
26579
|
+
},
|
|
26580
|
+
set: function set(value) {
|
|
26581
|
+
if (value === this.controlNode) {
|
|
26582
|
+
return;
|
|
26583
|
+
}
|
|
26584
|
+
this.disposeControl();
|
|
26585
|
+
if (value) {
|
|
26586
|
+
if (value.owner && value.owner !== this && value.owner.control === value) {
|
|
26587
|
+
throw new Error("A Control can only be owned by one UIControl.");
|
|
26588
|
+
}
|
|
26589
|
+
this.controlNode = value;
|
|
26590
|
+
value.owner = this;
|
|
26591
|
+
this.syncControl();
|
|
26592
|
+
}
|
|
26593
|
+
}
|
|
26594
|
+
},
|
|
26595
|
+
{
|
|
26596
|
+
key: "hasControl",
|
|
26597
|
+
get: function get() {
|
|
26598
|
+
return this.controlNode !== null;
|
|
26599
|
+
}
|
|
26600
|
+
}
|
|
26601
|
+
]);
|
|
26602
|
+
return UIControl;
|
|
26603
|
+
}(Component);
|
|
25318
26604
|
|
|
25319
26605
|
var CameraController = /*#__PURE__*/ function(Component) {
|
|
25320
26606
|
_inherits(CameraController, Component);
|
|
@@ -25350,42 +26636,6 @@ CameraController = __decorate([
|
|
|
25350
26636
|
effectsClass(DataType.CameraController)
|
|
25351
26637
|
], CameraController);
|
|
25352
26638
|
|
|
25353
|
-
function _get_prototype_of(o) {
|
|
25354
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
25355
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
25356
|
-
};
|
|
25357
|
-
return _get_prototype_of(o);
|
|
25358
|
-
}
|
|
25359
|
-
|
|
25360
|
-
function _is_native_function(fn) {
|
|
25361
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
25362
|
-
}
|
|
25363
|
-
|
|
25364
|
-
function _wrap_native_super(Class) {
|
|
25365
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
25366
|
-
_wrap_native_super = function _wrap_native_super(Class) {
|
|
25367
|
-
if (Class === null || !_is_native_function(Class)) return Class;
|
|
25368
|
-
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
25369
|
-
if (typeof _cache !== "undefined") {
|
|
25370
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
25371
|
-
_cache.set(Class, Wrapper);
|
|
25372
|
-
}
|
|
25373
|
-
function Wrapper() {
|
|
25374
|
-
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
25375
|
-
}
|
|
25376
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
25377
|
-
constructor: {
|
|
25378
|
-
value: Wrapper,
|
|
25379
|
-
enumerable: false,
|
|
25380
|
-
writable: true,
|
|
25381
|
-
configurable: true
|
|
25382
|
-
}
|
|
25383
|
-
});
|
|
25384
|
-
return _set_prototype_of(Wrapper, Class);
|
|
25385
|
-
};
|
|
25386
|
-
return _wrap_native_super(Class);
|
|
25387
|
-
}
|
|
25388
|
-
|
|
25389
26639
|
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
25390
26640
|
_inherits(CameraVFXItemLoader, Plugin);
|
|
25391
26641
|
function CameraVFXItemLoader() {
|
|
@@ -25406,142 +26656,202 @@ var PointerEventType;
|
|
|
25406
26656
|
})(PointerEventType || (PointerEventType = {}));
|
|
25407
26657
|
var EventSystem = /*#__PURE__*/ function() {
|
|
25408
26658
|
function EventSystem(engine, allowPropagation) {
|
|
26659
|
+
var _this = this;
|
|
25409
26660
|
if (allowPropagation === void 0) allowPropagation = false;
|
|
25410
26661
|
this.engine = engine;
|
|
25411
26662
|
this.allowPropagation = allowPropagation;
|
|
25412
|
-
this.enabled = true;
|
|
25413
26663
|
this.skipPointerMovePicking = true;
|
|
26664
|
+
this.emulateMouseFromTouch = true;
|
|
26665
|
+
this.emulateTouchFromMouse = false;
|
|
26666
|
+
this._enabled = true;
|
|
25414
26667
|
this.handlers = {};
|
|
25415
|
-
this.nativeHandlers =
|
|
26668
|
+
this.nativeHandlers = [];
|
|
25416
26669
|
this.target = null;
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
this.
|
|
25422
|
-
|
|
25423
|
-
|
|
25424
|
-
|
|
25425
|
-
|
|
25426
|
-
|
|
25427
|
-
|
|
25428
|
-
|
|
26670
|
+
this.mouseState = null;
|
|
26671
|
+
this.touchStates = new Map();
|
|
26672
|
+
this.mouseFromTouchIndex = null;
|
|
26673
|
+
this.touchFromMousePressed = false;
|
|
26674
|
+
this.addedTabIndex = false;
|
|
26675
|
+
this.addedOutlineStyle = false;
|
|
26676
|
+
this.onNativeWheel = function(event) {
|
|
26677
|
+
if (!_this.enabled || !_this.target) {
|
|
26678
|
+
return;
|
|
26679
|
+
}
|
|
26680
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26681
|
+
var handled = false;
|
|
26682
|
+
if (event.deltaY !== 0) {
|
|
26683
|
+
handled = _this.pushWheelButton(event.deltaY < 0 ? MouseButton.WheelUp : MouseButton.WheelDown, Math.abs(event.deltaY), position, event) || handled;
|
|
26684
|
+
}
|
|
26685
|
+
if (event.deltaX !== 0) {
|
|
26686
|
+
handled = _this.pushWheelButton(event.deltaX < 0 ? MouseButton.WheelLeft : MouseButton.WheelRight, Math.abs(event.deltaX), position, event) || handled;
|
|
26687
|
+
}
|
|
26688
|
+
_this.consumeNativeEvent(event, handled);
|
|
25429
26689
|
};
|
|
25430
|
-
|
|
25431
|
-
|
|
25432
|
-
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
|
|
25437
|
-
|
|
25438
|
-
|
|
25439
|
-
|
|
25440
|
-
|
|
25441
|
-
|
|
25442
|
-
return
|
|
25443
|
-
x: x,
|
|
25444
|
-
y: y,
|
|
25445
|
-
vx: 0,
|
|
25446
|
-
vy: vy,
|
|
25447
|
-
dx: dx,
|
|
25448
|
-
dy: dy,
|
|
25449
|
-
ts: ts,
|
|
25450
|
-
width: 0,
|
|
25451
|
-
height: 0,
|
|
25452
|
-
origin: event
|
|
25453
|
-
};
|
|
26690
|
+
this.onNativeKeyDown = function(event) {
|
|
26691
|
+
_this.handleNativeKey(event, true);
|
|
26692
|
+
};
|
|
26693
|
+
this.onNativeKeyUp = function(event) {
|
|
26694
|
+
_this.handleNativeKey(event, false);
|
|
26695
|
+
};
|
|
26696
|
+
this.onNativeMouseDown = function(event) {
|
|
26697
|
+
_this.handleNativeMouseDown(event);
|
|
26698
|
+
};
|
|
26699
|
+
this.onNativeMouseMove = function(event) {
|
|
26700
|
+
var _state;
|
|
26701
|
+
if (!_this.enabled || !_this.target) {
|
|
26702
|
+
return;
|
|
25454
26703
|
}
|
|
25455
|
-
var
|
|
25456
|
-
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
|
|
25460
|
-
|
|
25461
|
-
|
|
25462
|
-
|
|
25463
|
-
|
|
25464
|
-
|
|
26704
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26705
|
+
var _this_mouseState;
|
|
26706
|
+
var state = (_this_mouseState = _this.mouseState) != null ? _this_mouseState : _this.createPointerState(position);
|
|
26707
|
+
_this.mouseState = state;
|
|
26708
|
+
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26709
|
+
var velocity = _this.getVelocity(state, position);
|
|
26710
|
+
var handled = _this.pushNativeMouseMotion(event, position, relative, velocity);
|
|
26711
|
+
(_state = state).controlHandled || (_state.controlHandled = handled);
|
|
26712
|
+
if (!handled && (!state.pressed || !state.controlHandled)) {
|
|
26713
|
+
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26714
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
26715
|
+
}
|
|
26716
|
+
_this.updatePointerState(state, position);
|
|
26717
|
+
_this.consumeNativeEvent(event, handled);
|
|
26718
|
+
};
|
|
26719
|
+
this.onNativeMouseUp = function(event) {
|
|
26720
|
+
if (!_this.enabled || !_this.target) {
|
|
26721
|
+
return;
|
|
25465
26722
|
}
|
|
25466
|
-
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
|
|
25477
|
-
|
|
26723
|
+
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26724
|
+
var existingState = _this.mouseState;
|
|
26725
|
+
if (!(existingState == null ? void 0 : existingState.pressed)) {
|
|
26726
|
+
return;
|
|
26727
|
+
}
|
|
26728
|
+
var state = existingState;
|
|
26729
|
+
var handled = _this.pushNativeMouseButton(event, position, false);
|
|
26730
|
+
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26731
|
+
if (!state.controlHandled && !handled && _this.isClick(state, position)) {
|
|
26732
|
+
_this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26733
|
+
}
|
|
26734
|
+
if (!handled && !state.controlHandled) {
|
|
26735
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26736
|
+
}
|
|
26737
|
+
_this.mouseState = null;
|
|
26738
|
+
_this.consumeNativeEvent(event, handled || state.controlHandled || !_this.allowPropagation);
|
|
25478
26739
|
};
|
|
25479
|
-
|
|
25480
|
-
|
|
25481
|
-
|
|
25482
|
-
|
|
25483
|
-
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
y = cood.y;
|
|
25496
|
-
lastTouch = currentTouch = {
|
|
25497
|
-
clientX: touch.clientX,
|
|
25498
|
-
clientY: touch.clientY,
|
|
25499
|
-
ts: performance.now(),
|
|
25500
|
-
x: x,
|
|
25501
|
-
y: y
|
|
25502
|
-
};
|
|
25503
|
-
_this.dispatchEvent(EVENT_TYPE_TOUCH_START, getTouchEventValue(event, x, y));
|
|
25504
|
-
}
|
|
25505
|
-
}, _obj[touchmove] = function(event) {
|
|
25506
|
-
if (currentTouch && _this.enabled) {
|
|
25507
|
-
var cood = getCoord(getTouch(event));
|
|
25508
|
-
x = cood.x;
|
|
25509
|
-
y = cood.y;
|
|
25510
|
-
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, getTouchEventValue(event, x, y, x - currentTouch.x, y - currentTouch.y));
|
|
25511
|
-
}
|
|
25512
|
-
}, _obj[touchend] = function(event) {
|
|
25513
|
-
if (currentTouch && _this.enabled) {
|
|
25514
|
-
if (!_this.allowPropagation && event.cancelable) {
|
|
25515
|
-
event.preventDefault();
|
|
25516
|
-
event.stopPropagation();
|
|
26740
|
+
this.onNativeTouchStart = function(event) {
|
|
26741
|
+
if (!_this.enabled) {
|
|
26742
|
+
return;
|
|
26743
|
+
}
|
|
26744
|
+
_this.focusTarget();
|
|
26745
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26746
|
+
var touch = _step.value;
|
|
26747
|
+
var position = _this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26748
|
+
var state = _this.createPointerState(position);
|
|
26749
|
+
_this.touchStates.set(touch.identifier, state);
|
|
26750
|
+
state.pressed = true;
|
|
26751
|
+
var handled = _this.pushNativeScreenTouch(touch.identifier, position, true, false, false);
|
|
26752
|
+
state.controlHandled = handled;
|
|
26753
|
+
if (!handled) {
|
|
26754
|
+
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26755
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
25517
26756
|
}
|
|
25518
|
-
|
|
25519
|
-
|
|
25520
|
-
|
|
25521
|
-
|
|
25522
|
-
|
|
25523
|
-
|
|
25524
|
-
|
|
26757
|
+
_this.consumeNativeEvent(event, handled);
|
|
26758
|
+
}
|
|
26759
|
+
_this.preventTouchDefaults(event);
|
|
26760
|
+
};
|
|
26761
|
+
this.onNativeTouchMove = function(event) {
|
|
26762
|
+
if (!_this.enabled) {
|
|
26763
|
+
return;
|
|
26764
|
+
}
|
|
26765
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26766
|
+
var touch = _step.value;
|
|
26767
|
+
var _state;
|
|
26768
|
+
var position = _this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26769
|
+
var _this_touchStates_get;
|
|
26770
|
+
var state = (_this_touchStates_get = _this.touchStates.get(touch.identifier)) != null ? _this_touchStates_get : _this.createPointerState(position);
|
|
26771
|
+
_this.touchStates.set(touch.identifier, state);
|
|
26772
|
+
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26773
|
+
var velocity = _this.getVelocity(state, position);
|
|
26774
|
+
var handled = _this.pushNativeScreenDrag(touch.identifier, position, relative, velocity);
|
|
26775
|
+
(_state = state).controlHandled || (_state.controlHandled = handled);
|
|
26776
|
+
if (!handled && !state.controlHandled) {
|
|
26777
|
+
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26778
|
+
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
25525
26779
|
}
|
|
25526
|
-
_this.
|
|
25527
|
-
|
|
25528
|
-
|
|
25529
|
-
|
|
25530
|
-
|
|
25531
|
-
|
|
25532
|
-
|
|
25533
|
-
|
|
26780
|
+
_this.updatePointerState(state, position);
|
|
26781
|
+
_this.consumeNativeEvent(event, handled);
|
|
26782
|
+
}
|
|
26783
|
+
_this.preventTouchDefaults(event);
|
|
26784
|
+
};
|
|
26785
|
+
this.onNativeTouchEnd = function(event) {
|
|
26786
|
+
_this.handleNativeTouchEnd(event, false);
|
|
26787
|
+
};
|
|
26788
|
+
this.onNativeTouchCancel = function(event) {
|
|
26789
|
+
_this.handleNativeTouchEnd(event, true);
|
|
26790
|
+
};
|
|
26791
|
+
this.onWindowBlur = function() {
|
|
26792
|
+
if (_this.enabled) {
|
|
26793
|
+
_this.mouseState = null;
|
|
26794
|
+
_this.touchStates.clear();
|
|
26795
|
+
_this.mouseFromTouchIndex = null;
|
|
26796
|
+
_this.touchFromMousePressed = false;
|
|
26797
|
+
_this.engine.windowRoot.cancelPointerInput();
|
|
26798
|
+
}
|
|
26799
|
+
};
|
|
26800
|
+
}
|
|
26801
|
+
var _proto = EventSystem.prototype;
|
|
26802
|
+
_proto.bindListeners = function bindListeners(target) {
|
|
26803
|
+
this.unbindListeners();
|
|
26804
|
+
this.target = target;
|
|
26805
|
+
if (!target || typeof window === "undefined") {
|
|
26806
|
+
return;
|
|
26807
|
+
}
|
|
26808
|
+
if (!target.hasAttribute("tabindex")) {
|
|
26809
|
+
target.tabIndex = 0;
|
|
26810
|
+
this.addedTabIndex = true;
|
|
26811
|
+
}
|
|
26812
|
+
if (!target.style.outline) {
|
|
26813
|
+
target.style.outline = "none";
|
|
26814
|
+
this.addedOutlineStyle = true;
|
|
26815
|
+
}
|
|
26816
|
+
this.addNativeHandler(target, "mousedown", this.onNativeMouseDown);
|
|
26817
|
+
// The Window listener runs after the event reaches the host container, so keep a
|
|
26818
|
+
// target listener to preserve notifyTouch/allowPropagation for in-canvas releases.
|
|
26819
|
+
this.addNativeHandler(target, "mouseup", this.onNativeMouseUp);
|
|
26820
|
+
this.addNativeHandler(window, "mouseup", this.onNativeMouseUp);
|
|
26821
|
+
this.addNativeHandler(window, "pointermove", this.onNativeMouseMove);
|
|
26822
|
+
this.addNativeHandler(target, "touchstart", this.onNativeTouchStart, {
|
|
26823
|
+
passive: false
|
|
26824
|
+
});
|
|
26825
|
+
this.addNativeHandler(target, "touchmove", this.onNativeTouchMove, {
|
|
26826
|
+
passive: false
|
|
26827
|
+
});
|
|
26828
|
+
this.addNativeHandler(target, "touchend", this.onNativeTouchEnd, {
|
|
26829
|
+
passive: false
|
|
26830
|
+
});
|
|
26831
|
+
this.addNativeHandler(target, "touchcancel", this.onNativeTouchCancel, {
|
|
26832
|
+
passive: false
|
|
25534
26833
|
});
|
|
25535
|
-
this.
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
this.
|
|
26834
|
+
this.addNativeHandler(target, "wheel", this.onNativeWheel, {
|
|
26835
|
+
passive: false
|
|
26836
|
+
});
|
|
26837
|
+
this.addNativeHandler(target, "keydown", this.onNativeKeyDown);
|
|
26838
|
+
this.addNativeHandler(target, "keyup", this.onNativeKeyUp);
|
|
26839
|
+
this.addNativeHandler(window, "blur", this.onWindowBlur);
|
|
25539
26840
|
};
|
|
25540
26841
|
_proto.dispatchEvent = function dispatchEvent(type, event) {
|
|
25541
26842
|
var handlers = this.handlers[type];
|
|
25542
|
-
handlers == null ? void 0 : handlers.forEach(function(fn) {
|
|
26843
|
+
handlers == null ? void 0 : handlers.slice().forEach(function(fn) {
|
|
25543
26844
|
return fn(event);
|
|
25544
26845
|
});
|
|
26846
|
+
if (type === EVENT_TYPE_CLICK) {
|
|
26847
|
+
this.onClick(event);
|
|
26848
|
+
} else if (type === EVENT_TYPE_TOUCH_START) {
|
|
26849
|
+
this.onPointerDown(event);
|
|
26850
|
+
} else if (type === EVENT_TYPE_TOUCH_END) {
|
|
26851
|
+
this.onPointerUp(event);
|
|
26852
|
+
} else if (type === EVENT_TYPE_TOUCH_MOVE) {
|
|
26853
|
+
this.onPointerMove(event);
|
|
26854
|
+
}
|
|
25545
26855
|
};
|
|
25546
26856
|
_proto.addEventListener = function addEventListener(type, callback) {
|
|
25547
26857
|
var handlers = this.handlers[type];
|
|
@@ -25559,14 +26869,229 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25559
26869
|
removeItem(handlers, callback);
|
|
25560
26870
|
}
|
|
25561
26871
|
};
|
|
25562
|
-
_proto.
|
|
25563
|
-
|
|
26872
|
+
_proto.dispose = function dispose() {
|
|
26873
|
+
this.engine.windowRoot.cancelPointerInput();
|
|
26874
|
+
this.mouseState = null;
|
|
26875
|
+
this.touchStates.clear();
|
|
26876
|
+
this.mouseFromTouchIndex = null;
|
|
26877
|
+
this.touchFromMousePressed = false;
|
|
26878
|
+
this.handlers = {};
|
|
26879
|
+
this.unbindListeners();
|
|
26880
|
+
this.target = null;
|
|
26881
|
+
};
|
|
26882
|
+
_proto.handleNativeMouseDown = function handleNativeMouseDown(event) {
|
|
26883
|
+
if (!this.enabled || !this.target) {
|
|
26884
|
+
return;
|
|
26885
|
+
}
|
|
26886
|
+
var position = this.getCanvasPosition(event.clientX, event.clientY);
|
|
26887
|
+
this.focusTarget();
|
|
26888
|
+
var state = this.createPointerState(position);
|
|
26889
|
+
this.mouseState = state;
|
|
26890
|
+
state.pressed = true;
|
|
26891
|
+
var handled = this.pushNativeMouseButton(event, position, true);
|
|
26892
|
+
state.controlHandled = handled;
|
|
26893
|
+
if (!handled) {
|
|
26894
|
+
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26895
|
+
this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
26896
|
+
}
|
|
26897
|
+
this.consumeNativeEvent(event, handled);
|
|
26898
|
+
};
|
|
26899
|
+
_proto.handleNativeKey = function handleNativeKey(event, pressed) {
|
|
26900
|
+
if (!this.enabled) {
|
|
26901
|
+
return;
|
|
26902
|
+
}
|
|
26903
|
+
var input = new InputEventKey();
|
|
26904
|
+
input.device = InputEvent.deviceIdKeyboard;
|
|
26905
|
+
input.pressed = pressed;
|
|
26906
|
+
input.echo = pressed && event.repeat;
|
|
26907
|
+
input.keycode = event.key;
|
|
26908
|
+
input.physicalKeycode = event.code;
|
|
26909
|
+
input.keyLabel = event.key;
|
|
26910
|
+
input.unicode = getUnicode(event.key);
|
|
26911
|
+
input.location = getKeyLocation(event.location);
|
|
26912
|
+
input.shiftPressed = event.shiftKey;
|
|
26913
|
+
input.altPressed = event.altKey;
|
|
26914
|
+
input.metaPressed = event.metaKey;
|
|
26915
|
+
input.ctrlPressed = event.ctrlKey;
|
|
26916
|
+
this.engine.windowRoot.pushInput(input);
|
|
26917
|
+
this.consumeNativeEvent(event, this.engine.windowRoot.isInputHandled());
|
|
26918
|
+
};
|
|
26919
|
+
_proto.handleNativeTouchEnd = function handleNativeTouchEnd(event, canceled) {
|
|
26920
|
+
if (!this.enabled) {
|
|
26921
|
+
return;
|
|
26922
|
+
}
|
|
26923
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Array.from(event.changedTouches)), _step; !(_step = _iterator()).done;){
|
|
26924
|
+
var touch = _step.value;
|
|
26925
|
+
var position = this.getCanvasPosition(touch.clientX, touch.clientY);
|
|
26926
|
+
var state = this.touchStates.get(touch.identifier);
|
|
26927
|
+
if (!(state == null ? void 0 : state.pressed)) {
|
|
26928
|
+
continue;
|
|
26929
|
+
}
|
|
26930
|
+
var handled = this.pushNativeScreenTouch(touch.identifier, position, false, canceled, false);
|
|
26931
|
+
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26932
|
+
if (!canceled && !state.controlHandled && !handled && this.isClick(state, position)) {
|
|
26933
|
+
this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26934
|
+
}
|
|
26935
|
+
if (!handled && !canceled && !state.controlHandled) {
|
|
26936
|
+
this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26937
|
+
}
|
|
26938
|
+
this.touchStates.delete(touch.identifier);
|
|
26939
|
+
this.consumeNativeEvent(event, handled || state.controlHandled || !this.allowPropagation);
|
|
26940
|
+
}
|
|
26941
|
+
this.preventTouchDefaults(event);
|
|
26942
|
+
};
|
|
26943
|
+
_proto.pushNativeMouseButton = function pushNativeMouseButton(event, position, pressed) {
|
|
26944
|
+
var handled = false;
|
|
26945
|
+
var button = getMouseButton(event.button);
|
|
26946
|
+
if (pressed && this.emulateTouchFromMouse && button === MouseButton.Left) {
|
|
26947
|
+
this.touchFromMousePressed = true;
|
|
26948
|
+
}
|
|
26949
|
+
if (this.touchFromMousePressed && button === MouseButton.Left) {
|
|
26950
|
+
handled = this.pushScreenTouch(0, position, pressed, false, event.detail > 1, InputEvent.deviceIdEmulation);
|
|
26951
|
+
if (!pressed) {
|
|
26952
|
+
this.touchFromMousePressed = false;
|
|
26953
|
+
}
|
|
26954
|
+
}
|
|
26955
|
+
return this.pushMouseButton(event, position, pressed) || handled;
|
|
26956
|
+
};
|
|
26957
|
+
_proto.pushNativeMouseMotion = function pushNativeMouseMotion(event, position, relative, velocity) {
|
|
26958
|
+
var handled = false;
|
|
26959
|
+
if (this.touchFromMousePressed && (event.buttons & 1) !== 0) {
|
|
26960
|
+
handled = this.pushScreenDrag(0, position, relative, velocity, InputEvent.deviceIdEmulation);
|
|
26961
|
+
}
|
|
26962
|
+
return this.pushMouseMotion(event, position, relative, velocity) || handled;
|
|
26963
|
+
};
|
|
26964
|
+
_proto.pushNativeScreenTouch = function pushNativeScreenTouch(index, position, pressed, canceled, doubleTap) {
|
|
26965
|
+
var handled = false;
|
|
26966
|
+
var emulateMouse = false;
|
|
26967
|
+
if (pressed && this.emulateMouseFromTouch && this.mouseFromTouchIndex === null) {
|
|
26968
|
+
this.mouseFromTouchIndex = index;
|
|
26969
|
+
emulateMouse = true;
|
|
26970
|
+
} else if (!pressed && this.mouseFromTouchIndex === index) {
|
|
26971
|
+
emulateMouse = true;
|
|
26972
|
+
this.mouseFromTouchIndex = null;
|
|
26973
|
+
}
|
|
26974
|
+
if (emulateMouse) {
|
|
26975
|
+
handled = this.pushEmulatedMouseButton(position, pressed, canceled, doubleTap);
|
|
26976
|
+
}
|
|
26977
|
+
return this.pushScreenTouch(index, position, pressed, canceled, doubleTap, 0) || handled;
|
|
26978
|
+
};
|
|
26979
|
+
_proto.pushNativeScreenDrag = function pushNativeScreenDrag(index, position, relative, velocity) {
|
|
26980
|
+
var handled = false;
|
|
26981
|
+
if (this.emulateMouseFromTouch && this.mouseFromTouchIndex === index) {
|
|
26982
|
+
handled = this.pushEmulatedMouseMotion(position, relative, velocity);
|
|
26983
|
+
}
|
|
26984
|
+
return this.pushScreenDrag(index, position, relative, velocity, 0) || handled;
|
|
26985
|
+
};
|
|
26986
|
+
_proto.pushEmulatedMouseButton = function pushEmulatedMouseButton(position, pressed, canceled, doubleClick) {
|
|
26987
|
+
var input = new InputEventMouseButton();
|
|
26988
|
+
input.device = InputEvent.deviceIdEmulation;
|
|
26989
|
+
input.position.copyFrom(position);
|
|
26990
|
+
input.globalPosition.copyFrom(position);
|
|
26991
|
+
input.buttonIndex = MouseButton.Left;
|
|
26992
|
+
input.buttonMask = pressed ? MouseButtonMask.Left : MouseButtonMask.None;
|
|
26993
|
+
input.pressed = pressed;
|
|
26994
|
+
input.canceled = canceled;
|
|
26995
|
+
input.doubleClick = doubleClick;
|
|
26996
|
+
this.engine.windowRoot.pushInput(input);
|
|
26997
|
+
return this.engine.windowRoot.isInputHandled();
|
|
26998
|
+
};
|
|
26999
|
+
_proto.pushEmulatedMouseMotion = function pushEmulatedMouseMotion(position, relative, velocity) {
|
|
27000
|
+
var input = new InputEventMouseMotion();
|
|
27001
|
+
input.device = InputEvent.deviceIdEmulation;
|
|
27002
|
+
input.position.copyFrom(position);
|
|
27003
|
+
input.globalPosition.copyFrom(position);
|
|
27004
|
+
input.buttonMask = MouseButtonMask.Left;
|
|
27005
|
+
input.pressed = true;
|
|
27006
|
+
input.relative.copyFrom(relative);
|
|
27007
|
+
input.screenRelative.copyFrom(relative);
|
|
27008
|
+
input.velocity.copyFrom(velocity);
|
|
27009
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27010
|
+
this.engine.windowRoot.pushInput(input);
|
|
27011
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27012
|
+
};
|
|
27013
|
+
_proto.pushMouseButton = function pushMouseButton(event, position, pressed) {
|
|
27014
|
+
var input = new InputEventMouseButton();
|
|
27015
|
+
this.copyMouseFields(input, event, position);
|
|
27016
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27017
|
+
input.buttonIndex = getMouseButton(event.button);
|
|
27018
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27019
|
+
if (pressed) {
|
|
27020
|
+
input.buttonMask |= getMouseButtonBit(input.buttonIndex);
|
|
27021
|
+
} else {
|
|
27022
|
+
input.buttonMask &= ~getMouseButtonBit(input.buttonIndex);
|
|
27023
|
+
}
|
|
27024
|
+
input.pressed = pressed;
|
|
27025
|
+
input.doubleClick = event.detail > 1;
|
|
27026
|
+
this.engine.windowRoot.pushInput(input);
|
|
27027
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27028
|
+
};
|
|
27029
|
+
_proto.pushWheelButton = function pushWheelButton(button, factor, position, event) {
|
|
27030
|
+
var input = new InputEventMouseButton();
|
|
27031
|
+
this.copyMouseFields(input, event, position);
|
|
27032
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27033
|
+
input.buttonIndex = button;
|
|
27034
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27035
|
+
input.factor = factor;
|
|
27036
|
+
input.pressed = true;
|
|
27037
|
+
this.engine.windowRoot.pushInput(input);
|
|
27038
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27039
|
+
};
|
|
27040
|
+
_proto.pushMouseMotion = function pushMouseMotion(event, position, relative, velocity) {
|
|
27041
|
+
var input = new InputEventMouseMotion();
|
|
27042
|
+
this.copyMouseFields(input, event, position);
|
|
27043
|
+
input.device = InputEvent.deviceIdMouse;
|
|
27044
|
+
input.buttonMask = getMouseButtonMask(event.buttons);
|
|
27045
|
+
input.pressed = event.buttons !== 0;
|
|
27046
|
+
input.relative.copyFrom(relative);
|
|
27047
|
+
input.screenRelative.copyFrom(relative);
|
|
27048
|
+
input.velocity.copyFrom(velocity);
|
|
27049
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27050
|
+
if ("pressure" in event) {
|
|
27051
|
+
input.pressure = event.pressure;
|
|
27052
|
+
input.tilt.set(event.tiltX, event.tiltY);
|
|
27053
|
+
}
|
|
27054
|
+
this.engine.windowRoot.pushInput(input);
|
|
27055
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27056
|
+
};
|
|
27057
|
+
_proto.pushScreenTouch = function pushScreenTouch(index, position, pressed, canceled, doubleTap, device) {
|
|
27058
|
+
var input = new InputEventScreenTouch();
|
|
27059
|
+
input.index = index;
|
|
27060
|
+
input.device = device;
|
|
27061
|
+
input.position.copyFrom(position);
|
|
27062
|
+
input.pressed = pressed;
|
|
27063
|
+
input.canceled = canceled;
|
|
27064
|
+
input.doubleTap = doubleTap;
|
|
27065
|
+
this.engine.windowRoot.pushInput(input);
|
|
27066
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27067
|
+
};
|
|
27068
|
+
_proto.pushScreenDrag = function pushScreenDrag(index, position, relative, velocity, device) {
|
|
27069
|
+
var input = new InputEventScreenDrag();
|
|
27070
|
+
input.index = index;
|
|
27071
|
+
input.device = device;
|
|
27072
|
+
input.position.copyFrom(position);
|
|
27073
|
+
input.relative.copyFrom(relative);
|
|
27074
|
+
input.screenRelative.copyFrom(relative);
|
|
27075
|
+
input.velocity.copyFrom(velocity);
|
|
27076
|
+
input.screenVelocity.copyFrom(velocity);
|
|
27077
|
+
input.pressed = true;
|
|
27078
|
+
this.engine.windowRoot.pushInput(input);
|
|
27079
|
+
return this.engine.windowRoot.isInputHandled();
|
|
27080
|
+
};
|
|
27081
|
+
_proto.copyMouseFields = function copyMouseFields(input, event, position) {
|
|
27082
|
+
input.position.copyFrom(position);
|
|
27083
|
+
input.globalPosition.copyFrom(position);
|
|
27084
|
+
input.shiftPressed = event.shiftKey;
|
|
27085
|
+
input.altPressed = event.altKey;
|
|
27086
|
+
input.metaPressed = event.metaKey;
|
|
27087
|
+
input.ctrlPressed = event.ctrlKey;
|
|
27088
|
+
};
|
|
27089
|
+
_proto.onClick = function onClick(event) {
|
|
25564
27090
|
var hitResults = [];
|
|
25565
|
-
// 收集所有的点击测试结果,click 回调执行可能会对 composition 点击结果有影响,放在点击测试执行完后再统一触发。
|
|
25566
27091
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.engine.compositions), _step; !(_step = _iterator()).done;){
|
|
25567
27092
|
var composition = _step.value;
|
|
25568
27093
|
var _hitResults;
|
|
25569
|
-
(_hitResults = hitResults).push.apply(_hitResults, [].concat(composition.hitTest(x, y)));
|
|
27094
|
+
(_hitResults = hitResults).push.apply(_hitResults, [].concat(composition.hitTest(event.x, event.y)));
|
|
25570
27095
|
}
|
|
25571
27096
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(hitResults), _step1; !(_step1 = _iterator1()).done;){
|
|
25572
27097
|
var hitResult = _step1.value;
|
|
@@ -25583,49 +27108,36 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25583
27108
|
this.engine.emit("click", clickInfo);
|
|
25584
27109
|
}
|
|
25585
27110
|
};
|
|
25586
|
-
_proto.onPointerDown = function onPointerDown(
|
|
25587
|
-
this.handlePointerEvent(
|
|
27111
|
+
_proto.onPointerDown = function onPointerDown(event) {
|
|
27112
|
+
this.handlePointerEvent(event, 0);
|
|
25588
27113
|
};
|
|
25589
|
-
_proto.onPointerUp = function onPointerUp(
|
|
25590
|
-
this.handlePointerEvent(
|
|
27114
|
+
_proto.onPointerUp = function onPointerUp(event) {
|
|
27115
|
+
this.handlePointerEvent(event, 1);
|
|
25591
27116
|
};
|
|
25592
|
-
_proto.onPointerMove = function onPointerMove(
|
|
25593
|
-
this.handlePointerEvent(
|
|
27117
|
+
_proto.onPointerMove = function onPointerMove(event) {
|
|
27118
|
+
this.handlePointerEvent(event, 2);
|
|
25594
27119
|
};
|
|
25595
|
-
_proto.handlePointerEvent = function handlePointerEvent(
|
|
27120
|
+
_proto.handlePointerEvent = function handlePointerEvent(event, type) {
|
|
25596
27121
|
var hitRegion = null;
|
|
25597
|
-
var x = e.x, y = e.y, width = e.width, height = e.height;
|
|
25598
27122
|
if (!(type === 2 && this.skipPointerMovePicking)) {
|
|
25599
27123
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.engine.compositions), _step; !(_step = _iterator()).done;){
|
|
25600
27124
|
var composition = _step.value;
|
|
25601
|
-
var regions = composition.hitTest(x, y);
|
|
27125
|
+
var regions = composition.hitTest(event.x, event.y);
|
|
25602
27126
|
if (regions.length > 0) {
|
|
25603
27127
|
hitRegion = regions[regions.length - 1];
|
|
25604
27128
|
}
|
|
25605
27129
|
}
|
|
25606
27130
|
}
|
|
25607
27131
|
var eventData = new PointerEventData();
|
|
25608
|
-
eventData.position.x = (x + 1) / 2 * width;
|
|
25609
|
-
eventData.position.y = (y + 1) / 2 * height;
|
|
25610
|
-
eventData.delta.x =
|
|
25611
|
-
eventData.delta.y =
|
|
25612
|
-
var raycast = eventData.pointerCurrentRaycast;
|
|
27132
|
+
eventData.position.x = (event.x + 1) / 2 * event.width;
|
|
27133
|
+
eventData.position.y = (event.y + 1) / 2 * event.height;
|
|
27134
|
+
eventData.delta.x = event.vx * event.width;
|
|
27135
|
+
eventData.delta.y = event.vy * event.height;
|
|
25613
27136
|
if (hitRegion) {
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
}
|
|
25617
|
-
var eventName = "pointerdown";
|
|
25618
|
-
switch(type){
|
|
25619
|
-
case 0:
|
|
25620
|
-
eventName = "pointerdown";
|
|
25621
|
-
break;
|
|
25622
|
-
case 1:
|
|
25623
|
-
eventName = "pointerup";
|
|
25624
|
-
break;
|
|
25625
|
-
case 2:
|
|
25626
|
-
eventName = "pointermove";
|
|
25627
|
-
break;
|
|
27137
|
+
eventData.pointerCurrentRaycast.point = hitRegion.position;
|
|
27138
|
+
eventData.pointerCurrentRaycast.item = hitRegion.item;
|
|
25628
27139
|
}
|
|
27140
|
+
var eventName = type === 0 ? "pointerdown" : type === 1 ? "pointerup" : "pointermove";
|
|
25629
27141
|
if (hitRegion) {
|
|
25630
27142
|
var hitItem = hitRegion.item;
|
|
25631
27143
|
var hitComposition = hitItem.composition;
|
|
@@ -25634,29 +27146,185 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
25634
27146
|
this.engine.emit(eventName, eventData);
|
|
25635
27147
|
}
|
|
25636
27148
|
};
|
|
25637
|
-
_proto.
|
|
25638
|
-
var
|
|
25639
|
-
|
|
25640
|
-
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
|
|
25644
|
-
|
|
25645
|
-
|
|
27149
|
+
_proto.createPointerState = function createPointerState(position) {
|
|
27150
|
+
var state = {
|
|
27151
|
+
start: position.clone(),
|
|
27152
|
+
last: position.clone(),
|
|
27153
|
+
lastTime: performance.now(),
|
|
27154
|
+
controlHandled: false,
|
|
27155
|
+
pressed: false
|
|
27156
|
+
};
|
|
27157
|
+
return state;
|
|
27158
|
+
};
|
|
27159
|
+
_proto.updatePointerState = function updatePointerState(state, position) {
|
|
27160
|
+
state.last.copyFrom(position);
|
|
27161
|
+
state.lastTime = performance.now();
|
|
27162
|
+
};
|
|
27163
|
+
_proto.getVelocity = function getVelocity(state, position) {
|
|
27164
|
+
var elapsed = Math.max(performance.now() - state.lastTime, 1);
|
|
27165
|
+
return new Vector2((position.x - state.last.x) / elapsed, (position.y - state.last.y) / elapsed);
|
|
27166
|
+
};
|
|
27167
|
+
_proto.isClick = function isClick(state, position) {
|
|
27168
|
+
return Math.abs(position.x - state.start.x) + Math.abs(position.y - state.start.y) < 4;
|
|
27169
|
+
};
|
|
27170
|
+
_proto.createPointerEvent = function createPointerEvent(origin, position, state, velocity) {
|
|
27171
|
+
if (velocity === void 0) velocity = new Vector2();
|
|
27172
|
+
var target = this.target;
|
|
27173
|
+
var rect = target == null ? void 0 : target.getBoundingClientRect();
|
|
27174
|
+
var cssWidth = (rect == null ? void 0 : rect.width) || 1;
|
|
27175
|
+
var cssHeight = (rect == null ? void 0 : rect.height) || 1;
|
|
27176
|
+
var _target_width, _target_height;
|
|
27177
|
+
return {
|
|
27178
|
+
x: position.x / cssWidth * 2 - 1,
|
|
27179
|
+
// Legacy composition picking uses bottom-left, Y-up NDC even though GUI
|
|
27180
|
+
// input follows the DOM convention of top-left, Y-down pixels.
|
|
27181
|
+
y: 1 - position.y / cssHeight * 2,
|
|
27182
|
+
vx: velocity.x / cssWidth * 2,
|
|
27183
|
+
vy: -velocity.y / cssHeight * 2,
|
|
27184
|
+
ts: performance.now(),
|
|
27185
|
+
dx: (position.x - state.start.x) / cssWidth * 2,
|
|
27186
|
+
dy: -(position.y - state.start.y) / cssHeight * 2,
|
|
27187
|
+
width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
|
|
27188
|
+
height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
|
|
27189
|
+
origin: origin
|
|
27190
|
+
};
|
|
27191
|
+
};
|
|
27192
|
+
_proto.getCanvasPosition = function getCanvasPosition(clientX, clientY) {
|
|
27193
|
+
var _this_target;
|
|
27194
|
+
var rect = (_this_target = this.target) == null ? void 0 : _this_target.getBoundingClientRect();
|
|
27195
|
+
if (!rect) {
|
|
27196
|
+
return new Vector2();
|
|
27197
|
+
}
|
|
27198
|
+
return new Vector2(clientX - rect.left, clientY - rect.top);
|
|
27199
|
+
};
|
|
27200
|
+
_proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
|
|
27201
|
+
if (handled && !this.allowPropagation) {
|
|
27202
|
+
if (event.cancelable) {
|
|
27203
|
+
event.preventDefault();
|
|
27204
|
+
}
|
|
27205
|
+
event.stopPropagation();
|
|
27206
|
+
}
|
|
27207
|
+
};
|
|
27208
|
+
_proto.preventTouchDefaults = function preventTouchDefaults(event) {
|
|
27209
|
+
if (event.cancelable) {
|
|
27210
|
+
event.preventDefault();
|
|
27211
|
+
}
|
|
27212
|
+
};
|
|
27213
|
+
_proto.focusTarget = function focusTarget() {
|
|
27214
|
+
var _this_target;
|
|
27215
|
+
(_this_target = this.target) == null ? void 0 : _this_target.focus();
|
|
27216
|
+
};
|
|
27217
|
+
_proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
|
|
27218
|
+
target.addEventListener(name, handler, options);
|
|
27219
|
+
this.nativeHandlers.push({
|
|
27220
|
+
target: target,
|
|
27221
|
+
name: name,
|
|
27222
|
+
handler: handler,
|
|
27223
|
+
options: options
|
|
27224
|
+
});
|
|
27225
|
+
};
|
|
27226
|
+
_proto.unbindListeners = function unbindListeners() {
|
|
27227
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.nativeHandlers), _step; !(_step = _iterator()).done;){
|
|
27228
|
+
var nativeHandler = _step.value;
|
|
27229
|
+
nativeHandler.target.removeEventListener(nativeHandler.name, nativeHandler.handler, nativeHandler.options);
|
|
27230
|
+
}
|
|
27231
|
+
this.nativeHandlers = [];
|
|
27232
|
+
if (this.addedTabIndex && this.target) {
|
|
27233
|
+
this.target.removeAttribute("tabindex");
|
|
25646
27234
|
}
|
|
27235
|
+
if (this.addedOutlineStyle && this.target) {
|
|
27236
|
+
this.target.style.removeProperty("outline");
|
|
27237
|
+
}
|
|
27238
|
+
this.addedTabIndex = false;
|
|
27239
|
+
this.addedOutlineStyle = false;
|
|
25647
27240
|
};
|
|
27241
|
+
_create_class(EventSystem, [
|
|
27242
|
+
{
|
|
27243
|
+
key: "enabled",
|
|
27244
|
+
get: function get() {
|
|
27245
|
+
return this._enabled;
|
|
27246
|
+
},
|
|
27247
|
+
set: function set(value) {
|
|
27248
|
+
if (this._enabled === value) {
|
|
27249
|
+
return;
|
|
27250
|
+
}
|
|
27251
|
+
this._enabled = value;
|
|
27252
|
+
if (!value) {
|
|
27253
|
+
this.mouseState = null;
|
|
27254
|
+
this.touchStates.clear();
|
|
27255
|
+
this.mouseFromTouchIndex = null;
|
|
27256
|
+
this.touchFromMousePressed = false;
|
|
27257
|
+
this.engine.windowRoot.cancelPointerInput();
|
|
27258
|
+
}
|
|
27259
|
+
}
|
|
27260
|
+
}
|
|
27261
|
+
]);
|
|
25648
27262
|
return EventSystem;
|
|
25649
27263
|
}();
|
|
25650
|
-
function
|
|
25651
|
-
|
|
25652
|
-
|
|
25653
|
-
|
|
25654
|
-
|
|
25655
|
-
|
|
25656
|
-
|
|
25657
|
-
|
|
25658
|
-
|
|
25659
|
-
|
|
27264
|
+
function getKeyLocation(location) {
|
|
27265
|
+
if (location === 1) {
|
|
27266
|
+
return KeyLocation.Left;
|
|
27267
|
+
}
|
|
27268
|
+
if (location === 2) {
|
|
27269
|
+
return KeyLocation.Right;
|
|
27270
|
+
}
|
|
27271
|
+
return KeyLocation.Unspecified;
|
|
27272
|
+
}
|
|
27273
|
+
function getUnicode(key) {
|
|
27274
|
+
var characters = Array.from(key);
|
|
27275
|
+
var _characters__codePointAt;
|
|
27276
|
+
return characters.length === 1 ? (_characters__codePointAt = characters[0].codePointAt(0)) != null ? _characters__codePointAt : 0 : 0;
|
|
27277
|
+
}
|
|
27278
|
+
function getMouseButton(button) {
|
|
27279
|
+
switch(button){
|
|
27280
|
+
case 0:
|
|
27281
|
+
return MouseButton.Left;
|
|
27282
|
+
case 1:
|
|
27283
|
+
return MouseButton.Middle;
|
|
27284
|
+
case 2:
|
|
27285
|
+
return MouseButton.Right;
|
|
27286
|
+
case 3:
|
|
27287
|
+
return MouseButton.Xbutton1;
|
|
27288
|
+
case 4:
|
|
27289
|
+
return MouseButton.Xbutton2;
|
|
27290
|
+
default:
|
|
27291
|
+
return MouseButton.None;
|
|
27292
|
+
}
|
|
27293
|
+
}
|
|
27294
|
+
function getMouseButtonMask(buttons) {
|
|
27295
|
+
var mask = MouseButtonMask.None;
|
|
27296
|
+
if ((buttons & 1) !== 0) {
|
|
27297
|
+
mask |= MouseButtonMask.Left;
|
|
27298
|
+
}
|
|
27299
|
+
if ((buttons & 2) !== 0) {
|
|
27300
|
+
mask |= MouseButtonMask.Right;
|
|
27301
|
+
}
|
|
27302
|
+
if ((buttons & 4) !== 0) {
|
|
27303
|
+
mask |= MouseButtonMask.Middle;
|
|
27304
|
+
}
|
|
27305
|
+
if ((buttons & 8) !== 0) {
|
|
27306
|
+
mask |= MouseButtonMask.Xbutton1;
|
|
27307
|
+
}
|
|
27308
|
+
if ((buttons & 16) !== 0) {
|
|
27309
|
+
mask |= MouseButtonMask.Xbutton2;
|
|
27310
|
+
}
|
|
27311
|
+
return mask;
|
|
27312
|
+
}
|
|
27313
|
+
function getMouseButtonBit(button) {
|
|
27314
|
+
switch(button){
|
|
27315
|
+
case MouseButton.Left:
|
|
27316
|
+
return MouseButtonMask.Left;
|
|
27317
|
+
case MouseButton.Right:
|
|
27318
|
+
return MouseButtonMask.Right;
|
|
27319
|
+
case MouseButton.Middle:
|
|
27320
|
+
return MouseButtonMask.Middle;
|
|
27321
|
+
case MouseButton.Xbutton1:
|
|
27322
|
+
return MouseButtonMask.Xbutton1;
|
|
27323
|
+
case MouseButton.Xbutton2:
|
|
27324
|
+
return MouseButtonMask.Xbutton2;
|
|
27325
|
+
default:
|
|
27326
|
+
return MouseButtonMask.None;
|
|
27327
|
+
}
|
|
25660
27328
|
}
|
|
25661
27329
|
|
|
25662
27330
|
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
@@ -27677,11 +29345,6 @@ SpritePropertyTrack = __decorate([
|
|
|
27677
29345
|
effectsClass("SpritePropertyTrack")
|
|
27678
29346
|
], SpritePropertyTrack);
|
|
27679
29347
|
|
|
27680
|
-
function _assert_this_initialized(self) {
|
|
27681
|
-
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
27682
|
-
return self;
|
|
27683
|
-
}
|
|
27684
|
-
|
|
27685
29348
|
var Cone = /*#__PURE__*/ function() {
|
|
27686
29349
|
function Cone(props) {
|
|
27687
29350
|
var _this = this;
|
|
@@ -37686,7 +39349,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
37686
39349
|
return ret;
|
|
37687
39350
|
}
|
|
37688
39351
|
|
|
37689
|
-
var version$1 = "2.10.0-alpha.
|
|
39352
|
+
var version$1 = "2.10.0-alpha.4";
|
|
37690
39353
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
37691
39354
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
37692
39355
|
var reverseParticle = false;
|
|
@@ -39638,10 +41301,11 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39638
41301
|
_this./**
|
|
39639
41302
|
* 是否开启后处理
|
|
39640
41303
|
*/ postProcessingEnabled = false;
|
|
39641
|
-
_this.canvasLayers = [];
|
|
39642
41304
|
_this.destroyed = false;
|
|
39643
41305
|
_this.paused = true;
|
|
39644
41306
|
_this.isEndCalled = false;
|
|
41307
|
+
_this._renderOrder = 0;
|
|
41308
|
+
_this._interactive = true;
|
|
39645
41309
|
_this._textures = [];
|
|
39646
41310
|
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;
|
|
39647
41311
|
_this.engine.addComposition(_assert_this_initialized(_this));
|
|
@@ -39674,13 +41338,14 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39674
41338
|
_this.root = new VFXItem(_this.engine);
|
|
39675
41339
|
_this.root.name = "root";
|
|
39676
41340
|
_this.root.composition = _assert_this_initialized(_this);
|
|
41341
|
+
_this.root.setParent(_this.engine.root);
|
|
39677
41342
|
_this.pluginRoot = new VFXItem(_this.engine);
|
|
39678
41343
|
_this.pluginRoot.name = "pluginRoot";
|
|
39679
41344
|
_this.pluginRoot.setParent(_this.root);
|
|
39680
|
-
_this.pluginRoot.addComponent(CanvasLayer);
|
|
39681
41345
|
// Instantiate composition rootItem
|
|
39682
41346
|
_this.sceneRoot = new VFXItem(_this.engine);
|
|
39683
41347
|
_this.sceneRoot.setParent(_this.root);
|
|
41348
|
+
_this.uiCanvas = _this.sceneRoot.addComponent(UICanvas);
|
|
39684
41349
|
if (sourceContent) {
|
|
39685
41350
|
_this.sceneRoot.setInstanceId(sourceContent.id);
|
|
39686
41351
|
_this.sceneRoot.instantiatePreComposition(sourceContent, false);
|
|
@@ -39879,9 +41544,13 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39879
41544
|
this.isEndCalled = false;
|
|
39880
41545
|
this.rootComposition.setTime(0);
|
|
39881
41546
|
};
|
|
39882
|
-
_proto.render = function render() {
|
|
41547
|
+
/** Renders this Composition content. Screen-space UI is rendered by Engine. */ _proto.render = function render() {
|
|
41548
|
+
this.renderContent();
|
|
41549
|
+
};
|
|
41550
|
+
/**
|
|
41551
|
+
* Renders only the Composition scene content.
|
|
41552
|
+
*/ _proto.renderContent = function renderContent() {
|
|
39883
41553
|
this.renderer.renderRenderFrame(this.renderFrame);
|
|
39884
|
-
this.renderCanvasLayers();
|
|
39885
41554
|
};
|
|
39886
41555
|
/**
|
|
39887
41556
|
* 合成更新,针对所有 item 的更新
|
|
@@ -39970,17 +41639,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
39970
41639
|
}
|
|
39971
41640
|
}
|
|
39972
41641
|
};
|
|
39973
|
-
_proto.renderCanvasLayers = function renderCanvasLayers() {
|
|
39974
|
-
this.engine.graphics.begin();
|
|
39975
|
-
this.canvasLayers.sort(function(leftLayer, rightLayer) {
|
|
39976
|
-
return leftLayer.layer - rightLayer.layer;
|
|
39977
|
-
});
|
|
39978
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvasLayers), _step; !(_step = _iterator()).done;){
|
|
39979
|
-
var canvasLayer = _step.value;
|
|
39980
|
-
canvasLayer.draw();
|
|
39981
|
-
}
|
|
39982
|
-
this.engine.graphics.end();
|
|
39983
|
-
};
|
|
39984
41642
|
/**
|
|
39985
41643
|
* @internal
|
|
39986
41644
|
*/ _proto.createTexturesFromData = function createTexturesFromData(textureDataList) {
|
|
@@ -40249,6 +41907,35 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
40249
41907
|
})();
|
|
40250
41908
|
};
|
|
40251
41909
|
_create_class(Composition, [
|
|
41910
|
+
{
|
|
41911
|
+
key: "renderOrder",
|
|
41912
|
+
get: /**
|
|
41913
|
+
* 合成渲染顺序,默认按升序渲染
|
|
41914
|
+
*/ function get() {
|
|
41915
|
+
return this._renderOrder;
|
|
41916
|
+
},
|
|
41917
|
+
set: function set(value) {
|
|
41918
|
+
this._renderOrder = value;
|
|
41919
|
+
if (this.uiCanvas) {
|
|
41920
|
+
this.uiCanvas.order = value;
|
|
41921
|
+
}
|
|
41922
|
+
}
|
|
41923
|
+
},
|
|
41924
|
+
{
|
|
41925
|
+
key: "interactive",
|
|
41926
|
+
get: /**
|
|
41927
|
+
* 合成内的元素否允许点击、拖拽交互
|
|
41928
|
+
* @since 1.6.0
|
|
41929
|
+
*/ function get() {
|
|
41930
|
+
return this._interactive;
|
|
41931
|
+
},
|
|
41932
|
+
set: function set(value) {
|
|
41933
|
+
this._interactive = !!value;
|
|
41934
|
+
if (this.uiCanvas) {
|
|
41935
|
+
this.uiCanvas.receivesEvents = this._interactive;
|
|
41936
|
+
}
|
|
41937
|
+
}
|
|
41938
|
+
},
|
|
40252
41939
|
{
|
|
40253
41940
|
key: "width",
|
|
40254
41941
|
get: /**
|
|
@@ -42026,7 +43713,6 @@ var DEFAULT_FPS = 60;
|
|
|
42026
43713
|
/**
|
|
42027
43714
|
* 渲染过程中错误队列
|
|
42028
43715
|
*/ _this.renderErrors = new Set();
|
|
42029
|
-
_this.compositions = [];
|
|
42030
43716
|
_this.assetManagers = [];
|
|
42031
43717
|
_this.env = "";
|
|
42032
43718
|
/**
|
|
@@ -42048,6 +43734,7 @@ var DEFAULT_FPS = 60;
|
|
|
42048
43734
|
_this.framebuffers = [];
|
|
42049
43735
|
_this.renderbuffers = [];
|
|
42050
43736
|
_this.particleSystems = [];
|
|
43737
|
+
_this._compositions = [];
|
|
42051
43738
|
_this.clearAction = {
|
|
42052
43739
|
stencilAction: TextureLoadAction.clear,
|
|
42053
43740
|
clearStencil: 0,
|
|
@@ -42072,6 +43759,9 @@ var DEFAULT_FPS = 60;
|
|
|
42072
43759
|
_this.pixelRatio = (_options_pixelRatio = options == null ? void 0 : options.pixelRatio) != null ? _options_pixelRatio : getPixelRatio();
|
|
42073
43760
|
_this.jsonSceneData = {};
|
|
42074
43761
|
_this.objectInstance = {};
|
|
43762
|
+
_this.root = new VFXItem(_assert_this_initialized(_this));
|
|
43763
|
+
_this.root.name = "root";
|
|
43764
|
+
_this.windowRoot = new WindowRootControl(_assert_this_initialized(_this));
|
|
42075
43765
|
_this.whiteTexture = generateWhiteTexture(_assert_this_initialized(_this));
|
|
42076
43766
|
_this.transparentTexture = generateEmptyTexture(_assert_this_initialized(_this));
|
|
42077
43767
|
if (!(options == null ? void 0 : options.manualRender)) {
|
|
@@ -42206,9 +43896,6 @@ var DEFAULT_FPS = 60;
|
|
|
42206
43896
|
// Sort compositions by index
|
|
42207
43897
|
//-------------------------------------------------------------------------
|
|
42208
43898
|
var compositions = this.compositions;
|
|
42209
|
-
compositions.sort(function(a, b) {
|
|
42210
|
-
return a.getIndex() - b.getIndex();
|
|
42211
|
-
});
|
|
42212
43899
|
var skipRender = false;
|
|
42213
43900
|
// Update Compositions
|
|
42214
43901
|
//-------------------------------------------------------------------------
|
|
@@ -42227,6 +43914,7 @@ var DEFAULT_FPS = 60;
|
|
|
42227
43914
|
(_this_ticker1 = this.ticker) == null ? void 0 : _this_ticker1.pause();
|
|
42228
43915
|
return;
|
|
42229
43916
|
}
|
|
43917
|
+
this.windowRoot.update(dt);
|
|
42230
43918
|
// Tick compositions onPreRender
|
|
42231
43919
|
//-------------------------------------------------------------------------
|
|
42232
43920
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -42239,8 +43927,9 @@ var DEFAULT_FPS = 60;
|
|
|
42239
43927
|
this.renderer.clear(this.clearAction);
|
|
42240
43928
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(compositions), _step2; !(_step2 = _iterator2()).done;){
|
|
42241
43929
|
var composition2 = _step2.value;
|
|
42242
|
-
composition2.
|
|
43930
|
+
composition2.renderContent();
|
|
42243
43931
|
}
|
|
43932
|
+
this.windowRoot.render();
|
|
42244
43933
|
this.renderTargetPool.flush();
|
|
42245
43934
|
};
|
|
42246
43935
|
/**
|
|
@@ -42282,6 +43971,7 @@ var DEFAULT_FPS = 60;
|
|
|
42282
43971
|
this.canvas.style.height = containerHeight + "px";
|
|
42283
43972
|
logger.info("Resize engine " + this.name + " [" + canvasWidth + "," + canvasHeight + "," + containerWidth + "," + containerHeight + "].");
|
|
42284
43973
|
this.setSize(canvasWidth, canvasHeight);
|
|
43974
|
+
this.windowRoot.resize(canvasWidth, canvasHeight);
|
|
42285
43975
|
}
|
|
42286
43976
|
};
|
|
42287
43977
|
_proto.setSize = function setSize(width, height) {
|
|
@@ -42289,7 +43979,7 @@ var DEFAULT_FPS = 60;
|
|
|
42289
43979
|
if (this.getWidth() !== width || this.getHeight() !== height) {
|
|
42290
43980
|
this.canvas.width = width;
|
|
42291
43981
|
this.canvas.height = height;
|
|
42292
|
-
this.
|
|
43982
|
+
this.setViewport(0, 0, width, height);
|
|
42293
43983
|
}
|
|
42294
43984
|
(_this_compositions = this.compositions) == null ? void 0 : _this_compositions.forEach(function(comp) {
|
|
42295
43985
|
comp.camera.aspect = width / height;
|
|
@@ -42318,6 +44008,26 @@ var DEFAULT_FPS = 60;
|
|
|
42318
44008
|
/** @hide */ _proto.bindBuffers = function bindBuffers(vertexBuffers, indexBuffer, effect) {
|
|
42319
44009
|
throw new Error("The active rendering backend cannot bind geometry buffers.");
|
|
42320
44010
|
};
|
|
44011
|
+
/**
|
|
44012
|
+
* 使用当前绑定的顶点和索引缓冲区绘制图元。
|
|
44013
|
+
* @param mode - 图元类型
|
|
44014
|
+
* @param indexOffset - 索引缓冲区中的字节偏移
|
|
44015
|
+
* @param indexCount - 索引数量
|
|
44016
|
+
* @param instanceCount - 实例数量
|
|
44017
|
+
* @hide
|
|
44018
|
+
*/ _proto.drawElementsType = function drawElementsType(mode, indexOffset, indexCount, instanceCount) {
|
|
44019
|
+
throw new Error("The active rendering backend cannot draw indexed primitives.");
|
|
44020
|
+
};
|
|
44021
|
+
/**
|
|
44022
|
+
* 使用当前绑定的顶点缓冲区绘制图元。
|
|
44023
|
+
* @param mode - 图元类型
|
|
44024
|
+
* @param vertexStart - 起始顶点
|
|
44025
|
+
* @param vertexCount - 顶点数量
|
|
44026
|
+
* @param instanceCount - 实例数量
|
|
44027
|
+
* @hide
|
|
44028
|
+
*/ _proto.drawArraysType = function drawArraysType(mode, vertexStart, vertexCount, instanceCount) {
|
|
44029
|
+
throw new Error("The active rendering backend cannot draw primitives.");
|
|
44030
|
+
};
|
|
42321
44031
|
_proto.addTexture = function addTexture(tex) {
|
|
42322
44032
|
if (this.disposed) {
|
|
42323
44033
|
return;
|
|
@@ -42449,15 +44159,12 @@ var DEFAULT_FPS = 60;
|
|
|
42449
44159
|
* @param height
|
|
42450
44160
|
* example:
|
|
42451
44161
|
* gl.viewport(0, 0, width, height);
|
|
42452
|
-
*/ _proto.
|
|
44162
|
+
*/ _proto.setViewport = function setViewport(x, y, width, height) {
|
|
42453
44163
|
// OVERRIDE
|
|
42454
44164
|
};
|
|
42455
44165
|
_proto.clear = function clear(action) {
|
|
42456
44166
|
// OVERRIDE
|
|
42457
44167
|
};
|
|
42458
|
-
_proto.drawGeometry = function drawGeometry(geometry, matrix, material, subMeshIndex) {
|
|
42459
|
-
// OVERRIDE
|
|
42460
|
-
};
|
|
42461
44168
|
/*** 渲染状态控制 ***/ _proto.setSampleAlphaToCoverage = function setSampleAlphaToCoverage(enable) {
|
|
42462
44169
|
// OVERRIDE
|
|
42463
44170
|
};
|
|
@@ -42542,6 +44249,12 @@ var DEFAULT_FPS = 60;
|
|
|
42542
44249
|
}
|
|
42543
44250
|
(_this_ticker = this.ticker) == null ? void 0 : _this_ticker.stop();
|
|
42544
44251
|
(_this_eventSystem = this.eventSystem) == null ? void 0 : _this_eventSystem.dispose();
|
|
44252
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this._compositions.slice()), _step; !(_step = _iterator()).done;){
|
|
44253
|
+
var composition = _step.value;
|
|
44254
|
+
composition.dispose();
|
|
44255
|
+
}
|
|
44256
|
+
this.root.dispose();
|
|
44257
|
+
this.windowRoot.dispose();
|
|
42545
44258
|
(_this_assetService = this.assetService) == null ? void 0 : _this_assetService.dispose();
|
|
42546
44259
|
(_this__graphics = this._graphics) == null ? void 0 : _this__graphics.dispose();
|
|
42547
44260
|
this.renderPasses.forEach(function(pass) {
|
|
@@ -42562,16 +44275,13 @@ var DEFAULT_FPS = 60;
|
|
|
42562
44275
|
this.assetManagers.forEach(function(assetManager) {
|
|
42563
44276
|
return assetManager.dispose();
|
|
42564
44277
|
});
|
|
42565
|
-
this.compositions.forEach(function(comp) {
|
|
42566
|
-
return comp.dispose();
|
|
42567
|
-
});
|
|
42568
44278
|
this.textures = [];
|
|
42569
44279
|
this.materials = [];
|
|
42570
44280
|
this.geometries = [];
|
|
42571
44281
|
this.meshes = [];
|
|
42572
44282
|
this.renderPasses = [];
|
|
42573
|
-
this.compositions = [];
|
|
42574
44283
|
this.particleSystems = [];
|
|
44284
|
+
this._compositions = [];
|
|
42575
44285
|
};
|
|
42576
44286
|
_proto.getTargetSize = function getTargetSize(parentEle) {
|
|
42577
44287
|
if (parentEle === undefined || parentEle === null) {
|
|
@@ -42624,6 +44334,14 @@ var DEFAULT_FPS = 60;
|
|
|
42624
44334
|
];
|
|
42625
44335
|
};
|
|
42626
44336
|
_create_class(Engine, [
|
|
44337
|
+
{
|
|
44338
|
+
key: "compositions",
|
|
44339
|
+
get: function get() {
|
|
44340
|
+
return this._compositions.sort(function(a, b) {
|
|
44341
|
+
return a.getIndex() - b.getIndex();
|
|
44342
|
+
});
|
|
44343
|
+
}
|
|
44344
|
+
},
|
|
42627
44345
|
{
|
|
42628
44346
|
key: "graphics",
|
|
42629
44347
|
get: function get() {
|
|
@@ -42861,8 +44579,8 @@ registerPlugin("text", TextLoader);
|
|
|
42861
44579
|
registerPlugin("sprite", SpriteLoader);
|
|
42862
44580
|
registerPlugin("particle", ParticleLoader);
|
|
42863
44581
|
registerPlugin("interact", InteractLoader);
|
|
42864
|
-
var version = "2.10.0-alpha.
|
|
44582
|
+
var version = "2.10.0-alpha.4";
|
|
42865
44583
|
logger.info("Core version: " + version + ".");
|
|
42866
44584
|
|
|
42867
|
-
export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader,
|
|
44585
|
+
export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader, CanvasContainer, CanvasRenderMode, CanvasRootControl, Circle$1 as Circle, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ContainerControl, Control, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, CursorShape, DEFAULT_FONTS, DEFAULT_FPS, DataBuffer, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, FocusBehaviorRecursive, FocusMode, FrameComponent, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GlyphAtlas, GradientValue, GraphInstance, GraphNode, GraphNodeData, Graphics, GreaterNodeData, HELP_LINK, HitTestType, InputEvent, InputEventKey, InputEventMouse, InputEventMouseButton, InputEventMouseMotion, InputEventScreenDrag, InputEventScreenTouch, InputEventWithModifiers, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, KeyLocation, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialState, MaterialTrack, Mesh, MouseBehaviorRecursive, MouseButton, MouseButtonMask, MouseFilter, NodeTransform, NotNode, NotNodeData, NotifyEvent, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, Plugin, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, Precomposition, PrecompositionManager, PropertyClipPlayable, PropertyTrack, REFERENCE_CURVE, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, Rectangle$1 as Rectangle, ReferenceCurve, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RootControl, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SourceType, Sprite, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, SpritePropertyMixerPlayable, SpritePropertyPlayableAsset, SpritePropertyTrack, SpriteRotation, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TangentMode, TextCache, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, Triangle, TrimPath, TrimPathMode, UICanvas, UIControl, UpdateModes, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, VertexBuffer, WeightedMode, WindowRootControl, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, breakOpportunityAfter, buildBezierData, buildEasingCurve, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createTypedArray, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, extractMinAndMax, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTexture, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateWhiteTexture, getBackgroundImage, getBytesPerElement, getClass, getColorFromGradientStops, getConfig, getControlPoints, getDataByteLength, getDataType, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isBreakChar, isCJKLike, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSafeFontFamily, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, toBufferView, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
42868
44586
|
//# sourceMappingURL=index.mjs.map
|