@galacean/effects-core 2.10.0-alpha.3 → 2.10.0-alpha.5
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/index.d.ts +0 -2
- package/dist/composition.d.ts +1 -3
- package/dist/engine.d.ts +5 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.js +752 -2304
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +753 -2297
- package/dist/index.mjs.map +1 -1
- package/dist/input/enums.d.ts +0 -40
- package/dist/input/input-event.d.ts +4 -3
- package/dist/plugin-system.d.ts +1 -0
- package/dist/plugins/interact/event-system.d.ts +31 -2
- package/dist/plugins/plugin.d.ts +7 -0
- package/dist/render/graphics.d.ts +53 -11
- package/dist/render/text-cache.d.ts +2 -2
- package/package.json +1 -1
- package/dist/components/ui-canvas.d.ts +0 -28
- package/dist/components/ui-control.d.ts +0 -38
- package/dist/gui/control.d.ts +0 -189
- package/dist/gui/index.d.ts +0 -2
- package/dist/gui/roots.d.ts +0 -79
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.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -2927,6 +2927,11 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
2927
2927
|
PluginSystem.getPlugins = function getPlugins() {
|
|
2928
2928
|
return plugins;
|
|
2929
2929
|
};
|
|
2930
|
+
PluginSystem.notifyCompositionCreating = function notifyCompositionCreating(composition, scene) {
|
|
2931
|
+
plugins.forEach(function(plugin) {
|
|
2932
|
+
return plugin.onCompositionCreating(composition, scene);
|
|
2933
|
+
});
|
|
2934
|
+
};
|
|
2930
2935
|
PluginSystem.notifyCompositionCreated = function notifyCompositionCreated(composition, scene) {
|
|
2931
2936
|
plugins.forEach(function(plugin) {
|
|
2932
2937
|
return plugin.onCompositionCreated(composition, scene);
|
|
@@ -3019,6 +3024,12 @@ function getPluginUsageInfo(name) {
|
|
|
3019
3024
|
* @param engine - 引擎实例
|
|
3020
3025
|
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
3021
3026
|
/**
|
|
3027
|
+
* 合成内容开始创建前触发。
|
|
3028
|
+
* 此时 root、pluginRoot 和 sceneRoot 已创建,但场景内容尚未实例化。
|
|
3029
|
+
* @param composition - 正在创建的合成对象
|
|
3030
|
+
* @param scene - 场景对象
|
|
3031
|
+
*/ _proto.onCompositionCreating = function onCompositionCreating(composition, scene) {};
|
|
3032
|
+
/**
|
|
3022
3033
|
* 合成创建完成后触发。
|
|
3023
3034
|
* @param composition - 合成对象
|
|
3024
3035
|
* @param scene - 场景对象
|
|
@@ -15627,35 +15638,35 @@ function vecMulCombine(out, a, b) {
|
|
|
15627
15638
|
}
|
|
15628
15639
|
return out;
|
|
15629
15640
|
}
|
|
15630
|
-
var _obj$
|
|
15631
|
-
var particleOriginTranslateMap$1 = (_obj$
|
|
15641
|
+
var _obj$5;
|
|
15642
|
+
var particleOriginTranslateMap$1 = (_obj$5 = {}, _obj$5[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
15632
15643
|
0,
|
|
15633
15644
|
0
|
|
15634
|
-
], _obj$
|
|
15645
|
+
], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
15635
15646
|
0,
|
|
15636
15647
|
-0.5
|
|
15637
|
-
], _obj$
|
|
15648
|
+
], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
15638
15649
|
0,
|
|
15639
15650
|
0.5
|
|
15640
|
-
], _obj$
|
|
15651
|
+
], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
15641
15652
|
-0.5,
|
|
15642
15653
|
0.5
|
|
15643
|
-
], _obj$
|
|
15654
|
+
], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
15644
15655
|
-0.5,
|
|
15645
15656
|
0
|
|
15646
|
-
], _obj$
|
|
15657
|
+
], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
15647
15658
|
-0.5,
|
|
15648
15659
|
-0.5
|
|
15649
|
-
], _obj$
|
|
15660
|
+
], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
15650
15661
|
0.5,
|
|
15651
15662
|
0
|
|
15652
|
-
], _obj$
|
|
15663
|
+
], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
15653
15664
|
0.5,
|
|
15654
15665
|
-0.5
|
|
15655
|
-
], _obj$
|
|
15666
|
+
], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
15656
15667
|
0.5,
|
|
15657
15668
|
0.5
|
|
15658
|
-
], _obj$
|
|
15669
|
+
], _obj$5);
|
|
15659
15670
|
function nearestPowerOfTwo(value) {
|
|
15660
15671
|
return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
|
|
15661
15672
|
}
|
|
@@ -17393,27 +17404,27 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
17393
17404
|
* 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
|
|
17394
17405
|
* props 为 [[time, value], ...],value 为已解析的对象引用实例。
|
|
17395
17406
|
*/ var REFERENCE_CURVE = 28;
|
|
17396
|
-
var _obj$
|
|
17397
|
-
var map$1 = (_obj$
|
|
17407
|
+
var _obj$4;
|
|
17408
|
+
var map$1 = (_obj$4 = {}, _obj$4[ValueType.RANDOM] = function(props) {
|
|
17398
17409
|
if (_instanceof1(props[0], Array)) {
|
|
17399
17410
|
return new RandomVectorValue(props);
|
|
17400
17411
|
}
|
|
17401
17412
|
return new RandomValue(props);
|
|
17402
|
-
}, _obj$
|
|
17413
|
+
}, _obj$4[ValueType.CONSTANT] = function(props) {
|
|
17403
17414
|
return new StaticValue(props);
|
|
17404
|
-
}, _obj$
|
|
17415
|
+
}, _obj$4[ValueType.CONSTANT_VEC2] = function(props) {
|
|
17405
17416
|
return new StaticValue(props);
|
|
17406
|
-
}, _obj$
|
|
17417
|
+
}, _obj$4[ValueType.CONSTANT_VEC3] = function(props) {
|
|
17407
17418
|
return new StaticValue(props);
|
|
17408
|
-
}, _obj$
|
|
17419
|
+
}, _obj$4[ValueType.CONSTANT_VEC4] = function(props) {
|
|
17409
17420
|
return new StaticValue(props);
|
|
17410
|
-
}, _obj$
|
|
17421
|
+
}, _obj$4[ValueType.RGBA_COLOR] = function(props) {
|
|
17411
17422
|
return new StaticValue(props);
|
|
17412
|
-
}, _obj$
|
|
17423
|
+
}, _obj$4[ValueType.COLORS] = function(props) {
|
|
17413
17424
|
return new RandomSetValue(props.map(function(c) {
|
|
17414
17425
|
return colorToArr$1(c, false);
|
|
17415
17426
|
}));
|
|
17416
|
-
}, _obj$
|
|
17427
|
+
}, _obj$4[ValueType.LINE] = function(props) {
|
|
17417
17428
|
if (props.length === 2 && props[0][0] === 0 && props[1][0] === 1) {
|
|
17418
17429
|
return new LinearValue([
|
|
17419
17430
|
props[0][1],
|
|
@@ -17421,38 +17432,38 @@ var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
|
|
|
17421
17432
|
]);
|
|
17422
17433
|
}
|
|
17423
17434
|
return new LineSegments(props);
|
|
17424
|
-
}, _obj$
|
|
17435
|
+
}, _obj$4[ValueType.GRADIENT_COLOR] = function(props) {
|
|
17425
17436
|
return new GradientValue(props);
|
|
17426
|
-
}, _obj$
|
|
17437
|
+
}, _obj$4[ValueType.LINEAR_PATH] = function(pros) {
|
|
17427
17438
|
return new PathSegments(pros);
|
|
17428
|
-
}, _obj$
|
|
17439
|
+
}, _obj$4[ValueType.BEZIER_CURVE] = function(props) {
|
|
17429
17440
|
if (props.length === 1) {
|
|
17430
17441
|
return new StaticValue(props[0][1][1]);
|
|
17431
17442
|
}
|
|
17432
17443
|
return new BezierCurve(props);
|
|
17433
|
-
}, _obj$
|
|
17444
|
+
}, _obj$4[ValueType.BEZIER_CURVE_PATH] = function(props) {
|
|
17434
17445
|
if (props[0].length === 1) {
|
|
17435
17446
|
return new StaticValue(_construct(Vector3, [].concat(props[1][0])));
|
|
17436
17447
|
}
|
|
17437
17448
|
return new BezierCurvePath(props);
|
|
17438
|
-
}, _obj$
|
|
17449
|
+
}, _obj$4[ValueType.BEZIER_CURVE_QUAT] = function(props) {
|
|
17439
17450
|
if (props[0].length === 1) {
|
|
17440
17451
|
return new StaticValue(_construct(Quaternion, [].concat(props[1][0])));
|
|
17441
17452
|
}
|
|
17442
17453
|
return new BezierCurveQuat(props);
|
|
17443
|
-
}, _obj$
|
|
17454
|
+
}, _obj$4[ValueType.COLOR_CURVE] = function(props) {
|
|
17444
17455
|
return new ColorCurve(props);
|
|
17445
|
-
}, _obj$
|
|
17456
|
+
}, _obj$4[ValueType.VECTOR4_CURVE] = function(props) {
|
|
17446
17457
|
return new Vector4Curve(props);
|
|
17447
|
-
}, _obj$
|
|
17458
|
+
}, _obj$4[ValueType.VECTOR2_CURVE] = function(props) {
|
|
17448
17459
|
return new Vector2Curve(props);
|
|
17449
17460
|
}, // TODO: add spec
|
|
17450
|
-
_obj$
|
|
17461
|
+
_obj$4[VECTOR3_CURVE] = function(props) {
|
|
17451
17462
|
return new Vector3Curve(props);
|
|
17452
17463
|
}, // 对象引用阶梯曲线(不插值):props.data 为 [time, value][],value 已解析为 EffectsObject
|
|
17453
|
-
_obj$
|
|
17464
|
+
_obj$4[REFERENCE_CURVE] = function(props) {
|
|
17454
17465
|
return new ReferenceCurve(props);
|
|
17455
|
-
}, _obj$
|
|
17466
|
+
}, _obj$4);
|
|
17456
17467
|
function createValueGetter(args) {
|
|
17457
17468
|
if (!args || !isNaN(+args)) {
|
|
17458
17469
|
return new StaticValue(args || 0);
|
|
@@ -21393,8 +21404,8 @@ var vertexBufferSemanticMap = {
|
|
|
21393
21404
|
TANGENT_BS2: "aTargetTangent2",
|
|
21394
21405
|
TANGENT_BS3: "aTargetTangent3"
|
|
21395
21406
|
};
|
|
21396
|
-
var _obj$
|
|
21397
|
-
var BYTES_TYPE_MAP = (_obj$
|
|
21407
|
+
var _obj$3;
|
|
21408
|
+
var BYTES_TYPE_MAP = (_obj$3 = {}, _obj$3[BufferDataType.Float] = 4, _obj$3[BufferDataType.Int] = 4, _obj$3[BufferDataType.UnsignedInt] = 4, _obj$3[BufferDataType.Short] = 2, _obj$3[BufferDataType.UnsignedShort] = 2, _obj$3[BufferDataType.Byte] = 1, _obj$3[BufferDataType.UnsignedByte] = 1, _obj$3);
|
|
21398
21409
|
function generateEmptyTypedArray(type) {
|
|
21399
21410
|
return createTypedArray(type, 0);
|
|
21400
21411
|
}
|
|
@@ -22911,7 +22922,7 @@ var canvasPool = new CanvasPool();
|
|
|
22911
22922
|
* `ATLAS_SIZE × ATLAS_SIZE` 的离屏 canvas atlas,字符按需逐个绘制并打包,
|
|
22912
22923
|
* `Graphics.drawText` 通过逐字 quad 引用 atlas 子矩形渲染。
|
|
22913
22924
|
*
|
|
22914
|
-
* - 同一段文本不同颜色不会重复 upload(颜色由顶点 `vColor`
|
|
22925
|
+
* - 同一段文本不同颜色不会重复 upload(颜色由顶点 `vColor` 与字形 RGBA 相乘)
|
|
22915
22926
|
* - 同一字体/字号下重复字符只渲染一次,显著减少 canvas → texture 上传次数
|
|
22916
22927
|
*
|
|
22917
22928
|
* 入参全部展开(避免调用方每帧创建临时 style 对象触发 GC)
|
|
@@ -22925,7 +22936,7 @@ var canvasPool = new CanvasPool();
|
|
|
22925
22936
|
/**
|
|
22926
22937
|
* 取(必要时新建)对应字体的字符 atlas
|
|
22927
22938
|
*/ _proto.getAtlas = function getAtlas(fontSize, fontFamily, fontWeight, fontStyle) {
|
|
22928
|
-
//
|
|
22939
|
+
// 字形 atlas 跟随 Engine.pixelRatio。
|
|
22929
22940
|
var resolution = this.engine.pixelRatio;
|
|
22930
22941
|
if (resolution !== this.resolution) {
|
|
22931
22942
|
this.clear();
|
|
@@ -22946,14 +22957,11 @@ var canvasPool = new CanvasPool();
|
|
|
22946
22957
|
var probeCtx = probeCanvasAndContext.context;
|
|
22947
22958
|
var ascentPx = fontSize * 0.8 * resolution;
|
|
22948
22959
|
var descentPx = fontSize * 0.2 * resolution;
|
|
22949
|
-
|
|
22950
|
-
|
|
22951
|
-
|
|
22952
|
-
|
|
22953
|
-
|
|
22954
|
-
} finally{
|
|
22955
|
-
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22956
|
-
}
|
|
22960
|
+
probeCtx.font = scaledFontString;
|
|
22961
|
+
var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
|
|
22962
|
+
ascentPx = m.actualBoundingBoxAscent || ascentPx;
|
|
22963
|
+
descentPx = m.actualBoundingBoxDescent || descentPx;
|
|
22964
|
+
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22957
22965
|
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle, resolution);
|
|
22958
22966
|
this.atlases.set(fontKey, atlas);
|
|
22959
22967
|
return atlas;
|
|
@@ -22989,6 +22997,10 @@ var FULL_REGION = {
|
|
|
22989
22997
|
u1: 1,
|
|
22990
22998
|
v1: 1
|
|
22991
22999
|
};
|
|
23000
|
+
var NINE_PATCH_DRAW_SOURCE_SIZE = "aDrawSourceSize";
|
|
23001
|
+
var NINE_PATCH_SOURCE_RECT = "aSourceRect";
|
|
23002
|
+
var NINE_PATCH_MARGINS = "aMargins";
|
|
23003
|
+
var NINE_PATCH_OPTIONS = "aOptions";
|
|
22992
23004
|
var Graphics = /*#__PURE__*/ function() {
|
|
22993
23005
|
function Graphics(engine) {
|
|
22994
23006
|
this.engine = engine;
|
|
@@ -23002,6 +23014,10 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23002
23014
|
this.colors = [];
|
|
23003
23015
|
this.uvs = [];
|
|
23004
23016
|
this.indices = [];
|
|
23017
|
+
this.ninePatchDrawSourceSizes = [];
|
|
23018
|
+
this.ninePatchSourceRects = [];
|
|
23019
|
+
this.ninePatchMargins = [];
|
|
23020
|
+
this.ninePatchOptions = [];
|
|
23005
23021
|
this.lineStyle = {
|
|
23006
23022
|
width: 1,
|
|
23007
23023
|
alignment: 0.5,
|
|
@@ -23013,6 +23029,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23013
23029
|
this.currentBatchTexture = null;
|
|
23014
23030
|
this.transformStack = [];
|
|
23015
23031
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23032
|
+
this.clipStack = [];
|
|
23033
|
+
this.logicalWidth = 1;
|
|
23034
|
+
this.logicalHeight = 1;
|
|
23016
23035
|
var _obj;
|
|
23017
23036
|
this.geometry = Geometry.create(this.engine, {
|
|
23018
23037
|
attributes: (_obj = {}, _obj[VertexBuffer.PositionKind] = {
|
|
@@ -23078,6 +23097,51 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23078
23097
|
drawCount: 6,
|
|
23079
23098
|
bufferUsage: glContext.DYNAMIC_DRAW
|
|
23080
23099
|
});
|
|
23100
|
+
var _obj1;
|
|
23101
|
+
this.ninePatchGeometry = Geometry.create(this.engine, {
|
|
23102
|
+
attributes: (_obj1 = {}, _obj1[VertexBuffer.PositionKind] = {
|
|
23103
|
+
type: glContext.FLOAT,
|
|
23104
|
+
size: 2,
|
|
23105
|
+
data: new Float32Array(8)
|
|
23106
|
+
}, _obj1[VertexBuffer.ColorKind] = {
|
|
23107
|
+
type: glContext.FLOAT,
|
|
23108
|
+
size: 4,
|
|
23109
|
+
data: new Float32Array(16)
|
|
23110
|
+
}, _obj1[VertexBuffer.UVKind] = {
|
|
23111
|
+
type: glContext.FLOAT,
|
|
23112
|
+
size: 2,
|
|
23113
|
+
data: new Float32Array(8)
|
|
23114
|
+
}, _obj1[NINE_PATCH_DRAW_SOURCE_SIZE] = {
|
|
23115
|
+
type: glContext.FLOAT,
|
|
23116
|
+
size: 4,
|
|
23117
|
+
data: new Float32Array(16)
|
|
23118
|
+
}, _obj1[NINE_PATCH_SOURCE_RECT] = {
|
|
23119
|
+
type: glContext.FLOAT,
|
|
23120
|
+
size: 4,
|
|
23121
|
+
data: new Float32Array(16)
|
|
23122
|
+
}, _obj1[NINE_PATCH_MARGINS] = {
|
|
23123
|
+
type: glContext.FLOAT,
|
|
23124
|
+
size: 4,
|
|
23125
|
+
data: new Float32Array(16)
|
|
23126
|
+
}, _obj1[NINE_PATCH_OPTIONS] = {
|
|
23127
|
+
type: glContext.FLOAT,
|
|
23128
|
+
size: 4,
|
|
23129
|
+
data: new Float32Array(16)
|
|
23130
|
+
}, _obj1),
|
|
23131
|
+
indices: {
|
|
23132
|
+
data: new Uint16Array([
|
|
23133
|
+
0,
|
|
23134
|
+
1,
|
|
23135
|
+
2,
|
|
23136
|
+
2,
|
|
23137
|
+
1,
|
|
23138
|
+
3
|
|
23139
|
+
])
|
|
23140
|
+
},
|
|
23141
|
+
mode: glContext.TRIANGLES,
|
|
23142
|
+
drawCount: 6,
|
|
23143
|
+
bufferUsage: glContext.DYNAMIC_DRAW
|
|
23144
|
+
});
|
|
23081
23145
|
this.coloredMaterial = Material.create(this.engine, {
|
|
23082
23146
|
shader: {
|
|
23083
23147
|
vertex: "precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n varying vec4 vColor;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",
|
|
@@ -23096,12 +23160,21 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23096
23160
|
this.texturedMaterial.depthTest = false;
|
|
23097
23161
|
this.texturedMaterial.depthMask = false;
|
|
23098
23162
|
this.texturedMaterial.blending = true;
|
|
23099
|
-
|
|
23163
|
+
this.ninePatchMaterial = Material.create(this.engine, {
|
|
23164
|
+
shader: {
|
|
23165
|
+
vertex: "precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n attribute vec4 aDrawSourceSize;\n attribute vec4 aSourceRect;\n attribute vec4 aMargins;\n attribute vec4 aOptions;\n varying vec4 vColor;\n varying vec2 vUV;\n varying vec4 vDrawSourceSize;\n varying vec4 vSourceRect;\n varying vec4 vMargins;\n varying vec4 vOptions;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n vDrawSourceSize = aDrawSourceSize;\n vSourceRect = aSourceRect;\n vMargins = aMargins;\n vOptions = aOptions;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",
|
|
23166
|
+
fragment: "precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n varying vec4 vDrawSourceSize;\n varying vec4 vSourceRect;\n varying vec4 vMargins;\n varying vec4 vOptions;\n uniform sampler2D uMainTexture;\n\n float mapNinePatchAxis(\n float pixel,\n float drawSize,\n float sourceSize,\n float marginBegin,\n float marginEnd,\n float repeatMode,\n inout float drawCenter\n ) {\n if (pixel < marginBegin) {\n return pixel / sourceSize;\n } else if (pixel >= drawSize - marginEnd) {\n return (sourceSize - (drawSize - pixel)) / sourceSize;\n } else {\n if (vOptions.z < 0.5) {\n drawCenter -= 1.0;\n }\n\n if (repeatMode < 0.5) {\n float ratio = (pixel - marginBegin) / (drawSize - marginBegin - marginEnd);\n return (marginBegin + ratio * (sourceSize - marginBegin - marginEnd)) / sourceSize;\n } else if (repeatMode < 1.5) {\n float offset = mod(pixel - marginBegin, sourceSize - marginBegin - marginEnd);\n return (marginBegin + offset) / sourceSize;\n } else {\n float drawArea = drawSize - marginBegin - marginEnd;\n float sourceArea = sourceSize - marginBegin - marginEnd;\n float scale = max(1.0, floor(drawArea / max(sourceArea, 0.0000001) + 0.5));\n float ratio = mod((pixel - marginBegin) / drawArea * scale, 1.0);\n return (marginBegin + ratio * sourceArea) / sourceSize;\n }\n }\n }\n\n void main() {\n vec2 pixel = vec2(vUV.x, 1.0 - vUV.y) * vDrawSourceSize.xy;\n float drawCenter = 2.0;\n vec2 sourceUV = vec2(\n mapNinePatchAxis(\n pixel.x, vDrawSourceSize.x, vDrawSourceSize.z,\n vMargins.x, vMargins.z, vOptions.x, drawCenter\n ),\n mapNinePatchAxis(\n pixel.y, vDrawSourceSize.y, vDrawSourceSize.w,\n vMargins.y, vMargins.w, vOptions.y, drawCenter\n )\n );\n\n if (drawCenter < 0.5) {\n discard;\n }\n\n vec2 uv = vec2(\n vSourceRect.x + sourceUV.x * vSourceRect.z,\n vSourceRect.y - sourceUV.y * vSourceRect.w\n );\n vec4 color = texture2D(uMainTexture, uv) * vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"
|
|
23167
|
+
}
|
|
23168
|
+
});
|
|
23169
|
+
this.ninePatchMaterial.depthTest = false;
|
|
23170
|
+
this.ninePatchMaterial.depthMask = false;
|
|
23171
|
+
this.ninePatchMaterial.blending = true;
|
|
23172
|
+
// 文本 atlas 在上传时预乘 alpha,因此纹理 RGB 只需乘顶点色和顶点 alpha。
|
|
23100
23173
|
// 单独使用 material,避免改变 drawTexture 对普通非预乘纹理的处理。
|
|
23101
23174
|
this.textMaterial = Material.create(this.engine, {
|
|
23102
23175
|
shader: {
|
|
23103
23176
|
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
|
|
23177
|
+
fragment: "precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n vec4 textureColor = texture2D(uMainTexture, vUV);\n float alpha = textureColor.a * vColor.a;\n vec3 rgb = textureColor.rgb * vColor.rgb * vColor.a;\n gl_FragColor = vec4(rgb, alpha);\n }"
|
|
23105
23178
|
}
|
|
23106
23179
|
});
|
|
23107
23180
|
this.textMaterial.depthTest = false;
|
|
@@ -23117,25 +23190,36 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23117
23190
|
this.vertices.length = 0;
|
|
23118
23191
|
this.colors.length = 0;
|
|
23119
23192
|
this.uvs.length = 0;
|
|
23193
|
+
this.ninePatchDrawSourceSizes.length = 0;
|
|
23194
|
+
this.ninePatchSourceRects.length = 0;
|
|
23195
|
+
this.ninePatchMargins.length = 0;
|
|
23196
|
+
this.ninePatchOptions.length = 0;
|
|
23120
23197
|
this.transformStack = [];
|
|
23121
23198
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23199
|
+
this.clipStack = [];
|
|
23122
23200
|
this.currentBatchType = "colored";
|
|
23123
23201
|
this.currentBatchTexture = null;
|
|
23124
|
-
|
|
23125
|
-
|
|
23202
|
+
this.engine.setScissorTest(false);
|
|
23203
|
+
// 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
|
|
23204
|
+
var bounds = this.engine.canvas.getBoundingClientRect();
|
|
23205
|
+
var width = bounds.width || this.engine.canvas.width / this.engine.pixelRatio || 1;
|
|
23206
|
+
var height = bounds.height || this.engine.canvas.height / this.engine.pixelRatio || 1;
|
|
23207
|
+
this.logicalWidth = width;
|
|
23208
|
+
this.logicalHeight = height;
|
|
23126
23209
|
// 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
|
|
23127
|
-
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, -1, 0, -1,
|
|
23210
|
+
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
|
|
23128
23211
|
);
|
|
23129
23212
|
this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23130
23213
|
this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23131
23214
|
this.textMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23215
|
+
this.ninePatchMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23132
23216
|
};
|
|
23133
23217
|
/**
|
|
23134
23218
|
* 将当前变换压入栈,并设置新的变换
|
|
23135
23219
|
* @param transform - 新的变换矩阵(会与当前变换相乘)
|
|
23136
23220
|
*/ _proto.pushTransform = function pushTransform(transform) {
|
|
23137
23221
|
this.transformStack.push(this.currentTransform.clone());
|
|
23138
|
-
this.currentTransform = this.currentTransform.
|
|
23222
|
+
this.currentTransform = this.currentTransform.multiply(transform);
|
|
23139
23223
|
};
|
|
23140
23224
|
/**
|
|
23141
23225
|
* 恢复上一个变换
|
|
@@ -23147,10 +23231,81 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23147
23231
|
}
|
|
23148
23232
|
this.currentTransform = transform;
|
|
23149
23233
|
};
|
|
23234
|
+
/** Pushes a local rectangular child clip using a screen-space AABB scissor. */ _proto.pushClipRect = function pushClipRect(x, y, width, height) {
|
|
23235
|
+
var elements = this.currentTransform.elements;
|
|
23236
|
+
var corners = [
|
|
23237
|
+
[
|
|
23238
|
+
x,
|
|
23239
|
+
y
|
|
23240
|
+
],
|
|
23241
|
+
[
|
|
23242
|
+
x + width,
|
|
23243
|
+
y
|
|
23244
|
+
],
|
|
23245
|
+
[
|
|
23246
|
+
x,
|
|
23247
|
+
y + height
|
|
23248
|
+
],
|
|
23249
|
+
[
|
|
23250
|
+
x + width,
|
|
23251
|
+
y + height
|
|
23252
|
+
]
|
|
23253
|
+
];
|
|
23254
|
+
var left = Infinity;
|
|
23255
|
+
var top = Infinity;
|
|
23256
|
+
var right = -Infinity;
|
|
23257
|
+
var bottom = -Infinity;
|
|
23258
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(corners), _step; !(_step = _iterator()).done;){
|
|
23259
|
+
var corner = _step.value;
|
|
23260
|
+
var transformedX = elements[0] * corner[0] + elements[3] * corner[1] + elements[6];
|
|
23261
|
+
var transformedY = elements[1] * corner[0] + elements[4] * corner[1] + elements[7];
|
|
23262
|
+
left = Math.min(left, transformedX);
|
|
23263
|
+
top = Math.min(top, transformedY);
|
|
23264
|
+
right = Math.max(right, transformedX);
|
|
23265
|
+
bottom = Math.max(bottom, transformedY);
|
|
23266
|
+
}
|
|
23267
|
+
var parent = this.clipStack[this.clipStack.length - 1];
|
|
23268
|
+
if (parent) {
|
|
23269
|
+
left = Math.max(left, parent.x);
|
|
23270
|
+
top = Math.max(top, parent.y);
|
|
23271
|
+
right = Math.min(right, parent.x + parent.width);
|
|
23272
|
+
bottom = Math.min(bottom, parent.y + parent.height);
|
|
23273
|
+
}
|
|
23274
|
+
var clip = {
|
|
23275
|
+
x: left,
|
|
23276
|
+
y: top,
|
|
23277
|
+
width: Math.max(0, right - left),
|
|
23278
|
+
height: Math.max(0, bottom - top)
|
|
23279
|
+
};
|
|
23280
|
+
var previous = parent;
|
|
23281
|
+
this.clipStack.push(clip);
|
|
23282
|
+
if (!this.clipRectsEqual(previous, clip)) {
|
|
23283
|
+
this.flushBatch();
|
|
23284
|
+
this.applyClipRect(clip);
|
|
23285
|
+
}
|
|
23286
|
+
};
|
|
23287
|
+
/** Restores the parent rectangular clip. */ _proto.popClipRect = function popClipRect() {
|
|
23288
|
+
var previous = this.clipStack.pop();
|
|
23289
|
+
if (!previous) {
|
|
23290
|
+
console.warn("Graphics: clip stack is empty.");
|
|
23291
|
+
return;
|
|
23292
|
+
}
|
|
23293
|
+
var clip = this.clipStack[this.clipStack.length - 1];
|
|
23294
|
+
if (!this.clipRectsEqual(previous, clip)) {
|
|
23295
|
+
this.flushBatch();
|
|
23296
|
+
if (clip) {
|
|
23297
|
+
this.applyClipRect(clip);
|
|
23298
|
+
} else {
|
|
23299
|
+
this.engine.setScissorTest(false);
|
|
23300
|
+
}
|
|
23301
|
+
}
|
|
23302
|
+
};
|
|
23150
23303
|
/**
|
|
23151
23304
|
* 刷新并渲染所有累积的绘制命令
|
|
23152
23305
|
*/ _proto.end = function end() {
|
|
23153
23306
|
this.flushBatch();
|
|
23307
|
+
this.clipStack = [];
|
|
23308
|
+
this.engine.setScissorTest(false);
|
|
23154
23309
|
};
|
|
23155
23310
|
/**
|
|
23156
23311
|
* 切换到指定批次类型/纹理。若与当前批次不一致,先 flush 已累积顶点
|
|
@@ -23163,6 +23318,24 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23163
23318
|
this.currentBatchType = type;
|
|
23164
23319
|
this.currentBatchTexture = texture;
|
|
23165
23320
|
};
|
|
23321
|
+
_proto.applyClipRect = function applyClipRect(clip) {
|
|
23322
|
+
var framebufferWidth = this.engine.canvas.width;
|
|
23323
|
+
var framebufferHeight = this.engine.canvas.height;
|
|
23324
|
+
var scaleX = framebufferWidth / this.logicalWidth;
|
|
23325
|
+
var scaleY = framebufferHeight / this.logicalHeight;
|
|
23326
|
+
var left = Math.max(0, Math.min(framebufferWidth, Math.floor(clip.x * scaleX)));
|
|
23327
|
+
var top = Math.max(0, Math.min(framebufferHeight, Math.floor(clip.y * scaleY)));
|
|
23328
|
+
var right = Math.max(left, Math.min(framebufferWidth, Math.ceil((clip.x + clip.width) * scaleX)));
|
|
23329
|
+
var bottom = Math.max(top, Math.min(framebufferHeight, Math.ceil((clip.y + clip.height) * scaleY)));
|
|
23330
|
+
this.engine.setScissorTest(true);
|
|
23331
|
+
this.engine.setScissor(left, framebufferHeight - bottom, right - left, bottom - top);
|
|
23332
|
+
};
|
|
23333
|
+
_proto.clipRectsEqual = function clipRectsEqual(left, right) {
|
|
23334
|
+
if (!left || !right) {
|
|
23335
|
+
return left === right;
|
|
23336
|
+
}
|
|
23337
|
+
return left.x === right.x && left.y === right.y && left.width === right.width && left.height === right.height;
|
|
23338
|
+
};
|
|
23166
23339
|
/**
|
|
23167
23340
|
* 提交当前累积的顶点到 renderer,清空缓冲(批次内部 flush 不重置 batchType)
|
|
23168
23341
|
*/ _proto.flushBatch = function flushBatch() {
|
|
@@ -23176,37 +23349,48 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23176
23349
|
var colorsArray = new Float32Array(this.colors);
|
|
23177
23350
|
var uvsArray = new Float32Array(this.uvs);
|
|
23178
23351
|
var indicesArray = new Uint16Array(this.indices);
|
|
23179
|
-
this.
|
|
23180
|
-
this.updateAttributeData(VertexBuffer.
|
|
23181
|
-
this.updateAttributeData(VertexBuffer.
|
|
23182
|
-
this.geometry.
|
|
23183
|
-
|
|
23352
|
+
var geometry = this.currentBatchType === "ninePatch" ? this.ninePatchGeometry : this.geometry;
|
|
23353
|
+
this.updateAttributeData(geometry, VertexBuffer.PositionKind, verticesArray, 2);
|
|
23354
|
+
this.updateAttributeData(geometry, VertexBuffer.ColorKind, colorsArray, 4);
|
|
23355
|
+
this.updateAttributeData(geometry, VertexBuffer.UVKind, uvsArray, 2);
|
|
23356
|
+
if (this.currentBatchType === "ninePatch") {
|
|
23357
|
+
this.updateAttributeData(geometry, NINE_PATCH_DRAW_SOURCE_SIZE, new Float32Array(this.ninePatchDrawSourceSizes), 4);
|
|
23358
|
+
this.updateAttributeData(geometry, NINE_PATCH_SOURCE_RECT, new Float32Array(this.ninePatchSourceRects), 4);
|
|
23359
|
+
this.updateAttributeData(geometry, NINE_PATCH_MARGINS, new Float32Array(this.ninePatchMargins), 4);
|
|
23360
|
+
this.updateAttributeData(geometry, NINE_PATCH_OPTIONS, new Float32Array(this.ninePatchOptions), 4);
|
|
23361
|
+
}
|
|
23362
|
+
geometry.setIndexData(indicesArray);
|
|
23363
|
+
geometry.setDrawCount(this.currentIndexCount);
|
|
23184
23364
|
var material;
|
|
23185
|
-
if (this.currentBatchType === "textured" || this.currentBatchType === "text") {
|
|
23186
|
-
material = this.currentBatchType === "text" ? this.textMaterial : this.texturedMaterial;
|
|
23365
|
+
if (this.currentBatchType === "textured" || this.currentBatchType === "text" || this.currentBatchType === "ninePatch") {
|
|
23366
|
+
material = this.currentBatchType === "text" ? this.textMaterial : this.currentBatchType === "ninePatch" ? this.ninePatchMaterial : this.texturedMaterial;
|
|
23187
23367
|
var _this_currentBatchTexture;
|
|
23188
23368
|
var tex = (_this_currentBatchTexture = this.currentBatchTexture) != null ? _this_currentBatchTexture : this.engine.whiteTexture;
|
|
23189
23369
|
material.setTexture("uMainTexture", tex);
|
|
23190
23370
|
} else {
|
|
23191
23371
|
material = this.coloredMaterial;
|
|
23192
23372
|
}
|
|
23193
|
-
this.engine.renderer.drawGeometry(
|
|
23373
|
+
this.engine.renderer.drawGeometry(geometry, Matrix4.IDENTITY, material);
|
|
23194
23374
|
this.indices.length = 0;
|
|
23195
23375
|
this.vertices.length = 0;
|
|
23196
23376
|
this.colors.length = 0;
|
|
23197
23377
|
this.uvs.length = 0;
|
|
23198
|
-
|
|
23199
|
-
|
|
23200
|
-
|
|
23201
|
-
|
|
23378
|
+
this.ninePatchDrawSourceSizes.length = 0;
|
|
23379
|
+
this.ninePatchSourceRects.length = 0;
|
|
23380
|
+
this.ninePatchMargins.length = 0;
|
|
23381
|
+
this.ninePatchOptions.length = 0;
|
|
23382
|
+
};
|
|
23383
|
+
_proto.updateAttributeData = function updateAttributeData(geometry, name, data, size) {
|
|
23384
|
+
var _geometry_getVertexBuffer;
|
|
23385
|
+
var dataBuffer = (_geometry_getVertexBuffer = geometry.getVertexBuffer(name)) == null ? void 0 : _geometry_getVertexBuffer.getBuffer();
|
|
23202
23386
|
if (dataBuffer && data.byteLength > dataBuffer.capacity) {
|
|
23203
|
-
|
|
23387
|
+
geometry.setVerticesBuffer(new VertexBuffer(this.engine, data, name, {
|
|
23204
23388
|
updatable: true,
|
|
23205
23389
|
size: size
|
|
23206
23390
|
}));
|
|
23207
23391
|
return;
|
|
23208
23392
|
}
|
|
23209
|
-
|
|
23393
|
+
geometry.setAttributeData(name, data);
|
|
23210
23394
|
};
|
|
23211
23395
|
/**
|
|
23212
23396
|
* 线段顶点按顺序连接 (p0-p1, p1-p2, p2-p3, ...)
|
|
@@ -23289,8 +23473,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23289
23473
|
};
|
|
23290
23474
|
/**
|
|
23291
23475
|
* 绘制矩形边框
|
|
23292
|
-
* @param x -
|
|
23293
|
-
* @param y -
|
|
23476
|
+
* @param x - 矩形左上角 X 坐标
|
|
23477
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23294
23478
|
* @param width - 矩形宽度
|
|
23295
23479
|
* @param height - 矩形高度
|
|
23296
23480
|
* @param color - 边框颜色,默认白色,范围 0-1
|
|
@@ -23333,8 +23517,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23333
23517
|
};
|
|
23334
23518
|
/**
|
|
23335
23519
|
* 绘制填充矩形
|
|
23336
|
-
* @param x -
|
|
23337
|
-
* @param y -
|
|
23520
|
+
* @param x - 矩形左上角 X 坐标
|
|
23521
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23338
23522
|
* @param width - 矩形宽度
|
|
23339
23523
|
* @param height - 矩形高度
|
|
23340
23524
|
* @param color - 填充颜色,默认白色,范围 0-1
|
|
@@ -23360,9 +23544,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23360
23544
|
this.buildShape(this.circleShape, color);
|
|
23361
23545
|
};
|
|
23362
23546
|
/**
|
|
23363
|
-
* 绘制纹理矩形(本地坐标,Y
|
|
23364
|
-
* @param x -
|
|
23365
|
-
* @param y -
|
|
23547
|
+
* 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
|
|
23548
|
+
* @param x - 矩形左上角 X 坐标
|
|
23549
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23366
23550
|
* @param width - 矩形宽度
|
|
23367
23551
|
* @param height - 矩形高度
|
|
23368
23552
|
* @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
|
|
@@ -23375,14 +23559,41 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23375
23559
|
this.pushQuad(x, y, width, height, color, region);
|
|
23376
23560
|
};
|
|
23377
23561
|
/**
|
|
23378
|
-
*
|
|
23562
|
+
* Draws a nine-patch as one quad. Stretching and repetition are resolved in the fragment shader,
|
|
23563
|
+
* so Tile and TileFit do not expand into CPU-side geometry.
|
|
23564
|
+
*/ _proto.drawNinePatch = function drawNinePatch(x, y, width, height, texture, options, color) {
|
|
23565
|
+
if (color === void 0) color = Color.WHITE;
|
|
23566
|
+
if (width <= 0 || height <= 0 || options.sourceWidth <= 0 || options.sourceHeight <= 0) {
|
|
23567
|
+
return;
|
|
23568
|
+
}
|
|
23569
|
+
this.ensureBatch("ninePatch", texture);
|
|
23570
|
+
var sourceU = options.sourceX / texture.width;
|
|
23571
|
+
var sourceV = 1 - options.sourceY / texture.height;
|
|
23572
|
+
var sourceUSize = options.sourceWidth / texture.width;
|
|
23573
|
+
var sourceVSize = options.sourceHeight / texture.height;
|
|
23574
|
+
var _options_horizontalMode;
|
|
23575
|
+
var horizontalMode = (_options_horizontalMode = options.horizontalMode) != null ? _options_horizontalMode : 0;
|
|
23576
|
+
var _options_verticalMode;
|
|
23577
|
+
var verticalMode = (_options_verticalMode = options.verticalMode) != null ? _options_verticalMode : 0;
|
|
23578
|
+
var _options_drawCenter;
|
|
23579
|
+
var drawCenter = Number((_options_drawCenter = options.drawCenter) != null ? _options_drawCenter : true);
|
|
23580
|
+
this.pushQuad(x, y, width, height, color, FULL_REGION);
|
|
23581
|
+
for(var i = 0; i < 4; i++){
|
|
23582
|
+
this.ninePatchDrawSourceSizes.push(width, height, options.sourceWidth, options.sourceHeight);
|
|
23583
|
+
this.ninePatchSourceRects.push(sourceU, sourceV, sourceUSize, sourceVSize);
|
|
23584
|
+
this.ninePatchMargins.push(options.marginLeft, options.marginTop, options.marginRight, options.marginBottom);
|
|
23585
|
+
this.ninePatchOptions.push(horizontalMode, verticalMode, drawCenter, 0);
|
|
23586
|
+
}
|
|
23587
|
+
};
|
|
23588
|
+
/**
|
|
23589
|
+
* 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
|
|
23379
23590
|
*
|
|
23380
23591
|
* 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
|
|
23381
|
-
* `color`
|
|
23592
|
+
* `color` 与 atlas 字形 RGBA 相乘,任意颜色都不会污染 atlas。
|
|
23382
23593
|
*
|
|
23383
23594
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
23384
|
-
* @param x -
|
|
23385
|
-
* @param y -
|
|
23595
|
+
* @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
23596
|
+
* @param y - 文本 cell 顶部 Y 坐标
|
|
23386
23597
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
23387
23598
|
* @param fontSize - 字号(逻辑像素)
|
|
23388
23599
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -23401,10 +23612,11 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23401
23612
|
this.ensureBatch("text", atlas.texture);
|
|
23402
23613
|
var lineHeight = atlas.lineHeight;
|
|
23403
23614
|
var cursorX = x;
|
|
23615
|
+
var characters = Array.from(text);
|
|
23404
23616
|
// ensureChar 可能往 atlas canvas 写新字并打 dirty 标;实际 upload 推迟到
|
|
23405
23617
|
// flushBatch 统一处理,这样一帧多次 drawText 共写同一 atlas 只 upload 一次
|
|
23406
|
-
for(var i = 0; i <
|
|
23407
|
-
var info = atlas.ensureChar(
|
|
23618
|
+
for(var i = 0; i < characters.length; i++){
|
|
23619
|
+
var info = atlas.ensureChar(characters[i]);
|
|
23408
23620
|
if (!info) {
|
|
23409
23621
|
continue;
|
|
23410
23622
|
}
|
|
@@ -23426,11 +23638,35 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23426
23638
|
cursorX += info.advance;
|
|
23427
23639
|
}
|
|
23428
23640
|
};
|
|
23641
|
+
/** Measures text with the same glyph metrics used by {@link drawText}. */ _proto.measureText = function measureText(text, fontSize, fontFamily, fontWeight, fontStyle) {
|
|
23642
|
+
if (fontFamily === void 0) fontFamily = "sans-serif";
|
|
23643
|
+
if (fontWeight === void 0) fontWeight = "normal";
|
|
23644
|
+
if (fontStyle === void 0) fontStyle = "normal";
|
|
23645
|
+
var atlas = this.textCache.getAtlas(fontSize, fontFamily, fontWeight, fontStyle);
|
|
23646
|
+
var characters = Array.from(text);
|
|
23647
|
+
var advances = [];
|
|
23648
|
+
var width = 0;
|
|
23649
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(characters), _step; !(_step = _iterator()).done;){
|
|
23650
|
+
var character = _step.value;
|
|
23651
|
+
var _atlas_ensureChar;
|
|
23652
|
+
var _atlas_ensureChar_advance;
|
|
23653
|
+
var advance = (_atlas_ensureChar_advance = (_atlas_ensureChar = atlas.ensureChar(character)) == null ? void 0 : _atlas_ensureChar.advance) != null ? _atlas_ensureChar_advance : 0;
|
|
23654
|
+
advances.push(advance);
|
|
23655
|
+
width += advance;
|
|
23656
|
+
}
|
|
23657
|
+
return {
|
|
23658
|
+
width: width,
|
|
23659
|
+
lineHeight: atlas.lineHeight,
|
|
23660
|
+
advances: advances
|
|
23661
|
+
};
|
|
23662
|
+
};
|
|
23429
23663
|
_proto.dispose = function dispose() {
|
|
23430
23664
|
this.geometry.dispose();
|
|
23665
|
+
this.ninePatchGeometry.dispose();
|
|
23431
23666
|
this.coloredMaterial.dispose();
|
|
23432
23667
|
this.texturedMaterial.dispose();
|
|
23433
23668
|
this.textMaterial.dispose();
|
|
23669
|
+
this.ninePatchMaterial.dispose();
|
|
23434
23670
|
this.textCache.dispose();
|
|
23435
23671
|
};
|
|
23436
23672
|
_proto.buildShape = function buildShape(shape, color) {
|
|
@@ -23438,7 +23674,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23438
23674
|
var indexOffset = this.indices.length;
|
|
23439
23675
|
var vertexOffset = this.vertices.length / 2;
|
|
23440
23676
|
buildPoints.length = 0;
|
|
23441
|
-
shape.build(buildPoints);
|
|
23677
|
+
shape.build(buildPoints, this.getScreenScale());
|
|
23442
23678
|
shape.triangulate(buildPoints, this.vertices, vertexOffset, this.indices, indexOffset);
|
|
23443
23679
|
this.applyTransformAndColor(vertexOffset, this.vertices.length / 2 - vertexOffset, color);
|
|
23444
23680
|
};
|
|
@@ -23448,11 +23684,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23448
23684
|
this.indices.length;
|
|
23449
23685
|
var vertexOffset = this.vertices.length / 2;
|
|
23450
23686
|
buildPoints.length = 0;
|
|
23451
|
-
shape.build(buildPoints);
|
|
23687
|
+
shape.build(buildPoints, this.getScreenScale());
|
|
23452
23688
|
this.lineStyle.width = thickness;
|
|
23453
23689
|
buildLine(buildPoints, this.lineStyle, false, closed, this.vertices, 2, vertexOffset, this.indices);
|
|
23454
23690
|
this.applyTransformAndColor(vertexOffset, this.vertices.length / 2 - vertexOffset, color);
|
|
23455
23691
|
};
|
|
23692
|
+
_proto.getScreenScale = function getScreenScale() {
|
|
23693
|
+
var transform = this.currentTransform.elements;
|
|
23694
|
+
var transformScaleX = Math.hypot(transform[0], transform[1]);
|
|
23695
|
+
var transformScaleY = Math.hypot(transform[3], transform[4]);
|
|
23696
|
+
var framebufferScaleX = this.engine.canvas.width / this.logicalWidth;
|
|
23697
|
+
var framebufferScaleY = this.engine.canvas.height / this.logicalHeight;
|
|
23698
|
+
return Math.max(transformScaleX * framebufferScaleX, transformScaleY * framebufferScaleY, 1);
|
|
23699
|
+
};
|
|
23456
23700
|
_proto.setTriangleShape = function setTriangleShape(x1, y1, x2, y2, x3, y3) {
|
|
23457
23701
|
this.triangleShape.x = x1;
|
|
23458
23702
|
this.triangleShape.y = y1;
|
|
@@ -23497,7 +23741,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23497
23741
|
* 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
|
|
23498
23742
|
*/ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
|
|
23499
23743
|
var vertexOffset = this.vertices.length / 2;
|
|
23500
|
-
// 4
|
|
23744
|
+
// 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
|
|
23501
23745
|
var corners = [
|
|
23502
23746
|
[
|
|
23503
23747
|
x,
|
|
@@ -23523,19 +23767,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23523
23767
|
var cornerUVs = [
|
|
23524
23768
|
[
|
|
23525
23769
|
u0,
|
|
23526
|
-
|
|
23770
|
+
v1
|
|
23527
23771
|
],
|
|
23528
23772
|
[
|
|
23529
23773
|
u1,
|
|
23530
|
-
|
|
23774
|
+
v1
|
|
23531
23775
|
],
|
|
23532
23776
|
[
|
|
23533
23777
|
u0,
|
|
23534
|
-
|
|
23778
|
+
v0
|
|
23535
23779
|
],
|
|
23536
23780
|
[
|
|
23537
23781
|
u1,
|
|
23538
|
-
|
|
23782
|
+
v0
|
|
23539
23783
|
]
|
|
23540
23784
|
];
|
|
23541
23785
|
for(var i = 0; i < 4; i++){
|
|
@@ -24501,2086 +24745,6 @@ FrameComponent = __decorate([
|
|
|
24501
24745
|
// 第四列 (位移) 乘 1,无需修改
|
|
24502
24746
|
}
|
|
24503
24747
|
|
|
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);
|
|
24586
|
-
};
|
|
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);
|
|
24602
|
-
}
|
|
24603
|
-
function Wrapper() {
|
|
24604
|
-
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
24605
|
-
}
|
|
24606
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
24607
|
-
constructor: {
|
|
24608
|
-
value: Wrapper,
|
|
24609
|
-
enumerable: false,
|
|
24610
|
-
writable: true,
|
|
24611
|
-
configurable: true
|
|
24612
|
-
}
|
|
24613
|
-
});
|
|
24614
|
-
return _set_prototype_of(Wrapper, Class);
|
|
24615
|
-
};
|
|
24616
|
-
return _wrap_native_super(Class);
|
|
24617
|
-
}
|
|
24618
|
-
|
|
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
|
-
}
|
|
24633
|
-
var _proto = InputEvent.prototype;
|
|
24634
|
-
_proto.isPressed = function isPressed() {
|
|
24635
|
-
return this.pressed && !this.canceled;
|
|
24636
|
-
};
|
|
24637
|
-
_proto.isReleased = function isReleased() {
|
|
24638
|
-
return !this.pressed && !this.canceled;
|
|
24639
|
-
};
|
|
24640
|
-
_proto.isCanceled = function isCanceled() {
|
|
24641
|
-
return this.canceled;
|
|
24642
|
-
};
|
|
24643
|
-
_proto.isEcho = function isEcho() {
|
|
24644
|
-
return false;
|
|
24645
|
-
};
|
|
24646
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24647
|
-
var event = new InputEvent();
|
|
24648
|
-
event.device = this.device;
|
|
24649
|
-
event.pressed = this.pressed;
|
|
24650
|
-
event.canceled = this.canceled;
|
|
24651
|
-
return event;
|
|
24652
|
-
};
|
|
24653
|
-
return InputEvent;
|
|
24654
|
-
}();
|
|
24655
|
-
InputEvent.deviceIdEmulation = -1;
|
|
24656
|
-
InputEvent.deviceIdInternal = -2;
|
|
24657
|
-
InputEvent.deviceIdKeyboard = 16;
|
|
24658
|
-
InputEvent.deviceIdMouse = 32;
|
|
24659
|
-
var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
24660
|
-
_inherits(InputEventWithModifiers, InputEvent);
|
|
24661
|
-
function InputEventWithModifiers() {
|
|
24662
|
-
var _this;
|
|
24663
|
-
_this = InputEvent.apply(this, arguments) || this;
|
|
24664
|
-
_this.commandOrControlAutoremap = false;
|
|
24665
|
-
_this.shiftPressed = false;
|
|
24666
|
-
_this.altPressed = false;
|
|
24667
|
-
_this.metaPressed = false;
|
|
24668
|
-
_this.ctrlPressed = false;
|
|
24669
|
-
return _this;
|
|
24670
|
-
}
|
|
24671
|
-
var _proto = InputEventWithModifiers.prototype;
|
|
24672
|
-
_proto.copyModifiersTo = function copyModifiersTo(event) {
|
|
24673
|
-
event.device = this.device;
|
|
24674
|
-
event.pressed = this.pressed;
|
|
24675
|
-
event.canceled = this.canceled;
|
|
24676
|
-
event.commandOrControlAutoremap = this.commandOrControlAutoremap;
|
|
24677
|
-
event.shiftPressed = this.shiftPressed;
|
|
24678
|
-
event.altPressed = this.altPressed;
|
|
24679
|
-
event.metaPressed = this.metaPressed;
|
|
24680
|
-
event.ctrlPressed = this.ctrlPressed;
|
|
24681
|
-
};
|
|
24682
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24683
|
-
var event = new InputEventWithModifiers();
|
|
24684
|
-
this.copyModifiersTo(event);
|
|
24685
|
-
return event;
|
|
24686
|
-
};
|
|
24687
|
-
return InputEventWithModifiers;
|
|
24688
|
-
}(_wrap_native_super(InputEvent));
|
|
24689
|
-
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24690
|
-
_inherits(InputEventKey, InputEventWithModifiers);
|
|
24691
|
-
function InputEventKey() {
|
|
24692
|
-
var _this;
|
|
24693
|
-
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24694
|
-
_this.keycode = "";
|
|
24695
|
-
_this.physicalKeycode = "";
|
|
24696
|
-
_this.keyLabel = "";
|
|
24697
|
-
_this.unicode = 0;
|
|
24698
|
-
_this.location = KeyLocation.Unspecified;
|
|
24699
|
-
_this.echo = false;
|
|
24700
|
-
return _this;
|
|
24701
|
-
}
|
|
24702
|
-
var _proto = InputEventKey.prototype;
|
|
24703
|
-
_proto.isEcho = function isEcho() {
|
|
24704
|
-
return this.echo;
|
|
24705
|
-
};
|
|
24706
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24707
|
-
var event = new InputEventKey();
|
|
24708
|
-
this.copyModifiersTo(event);
|
|
24709
|
-
event.keycode = this.keycode;
|
|
24710
|
-
event.physicalKeycode = this.physicalKeycode;
|
|
24711
|
-
event.keyLabel = this.keyLabel;
|
|
24712
|
-
event.unicode = this.unicode;
|
|
24713
|
-
event.location = this.location;
|
|
24714
|
-
event.echo = this.echo;
|
|
24715
|
-
return event;
|
|
24716
|
-
};
|
|
24717
|
-
return InputEventKey;
|
|
24718
|
-
}(InputEventWithModifiers);
|
|
24719
|
-
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24720
|
-
_inherits(InputEventMouse, InputEventWithModifiers);
|
|
24721
|
-
function InputEventMouse() {
|
|
24722
|
-
var _this;
|
|
24723
|
-
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24724
|
-
_this.buttonMask = MouseButtonMask.None;
|
|
24725
|
-
_this.position = new Vector2();
|
|
24726
|
-
_this.globalPosition = new Vector2();
|
|
24727
|
-
return _this;
|
|
24728
|
-
}
|
|
24729
|
-
var _proto = InputEventMouse.prototype;
|
|
24730
|
-
_proto.copyMouseTo = function copyMouseTo(event) {
|
|
24731
|
-
this.copyModifiersTo(event);
|
|
24732
|
-
event.buttonMask = this.buttonMask;
|
|
24733
|
-
event.position.copyFrom(this.position);
|
|
24734
|
-
event.globalPosition.copyFrom(this.globalPosition);
|
|
24735
|
-
};
|
|
24736
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24737
|
-
var event = new InputEventMouse();
|
|
24738
|
-
this.copyMouseTo(event);
|
|
24739
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24740
|
-
return event;
|
|
24741
|
-
};
|
|
24742
|
-
return InputEventMouse;
|
|
24743
|
-
}(InputEventWithModifiers);
|
|
24744
|
-
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
24745
|
-
_inherits(InputEventMouseButton, InputEventMouse);
|
|
24746
|
-
function InputEventMouseButton() {
|
|
24747
|
-
var _this;
|
|
24748
|
-
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24749
|
-
_this.factor = 1;
|
|
24750
|
-
_this.buttonIndex = MouseButton.None;
|
|
24751
|
-
_this.doubleClick = false;
|
|
24752
|
-
return _this;
|
|
24753
|
-
}
|
|
24754
|
-
var _proto = InputEventMouseButton.prototype;
|
|
24755
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24756
|
-
var event = new InputEventMouseButton();
|
|
24757
|
-
this.copyMouseTo(event);
|
|
24758
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24759
|
-
event.factor = this.factor;
|
|
24760
|
-
event.buttonIndex = this.buttonIndex;
|
|
24761
|
-
event.doubleClick = this.doubleClick;
|
|
24762
|
-
return event;
|
|
24763
|
-
};
|
|
24764
|
-
return InputEventMouseButton;
|
|
24765
|
-
}(InputEventMouse);
|
|
24766
|
-
var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
|
|
24767
|
-
_inherits(InputEventMouseMotion, InputEventMouse);
|
|
24768
|
-
function InputEventMouseMotion() {
|
|
24769
|
-
var _this;
|
|
24770
|
-
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24771
|
-
_this.tilt = new Vector2();
|
|
24772
|
-
_this.pressure = 0;
|
|
24773
|
-
_this.relative = new Vector2();
|
|
24774
|
-
_this.screenRelative = new Vector2();
|
|
24775
|
-
_this.velocity = new Vector2();
|
|
24776
|
-
_this.screenVelocity = new Vector2();
|
|
24777
|
-
_this.penInverted = false;
|
|
24778
|
-
return _this;
|
|
24779
|
-
}
|
|
24780
|
-
var _proto = InputEventMouseMotion.prototype;
|
|
24781
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24782
|
-
var event = new InputEventMouseMotion();
|
|
24783
|
-
this.copyMouseTo(event);
|
|
24784
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24785
|
-
event.tilt.copyFrom(this.tilt);
|
|
24786
|
-
event.pressure = this.pressure;
|
|
24787
|
-
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24788
|
-
event.screenRelative.copyFrom(this.screenRelative);
|
|
24789
|
-
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24790
|
-
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24791
|
-
event.penInverted = this.penInverted;
|
|
24792
|
-
return event;
|
|
24793
|
-
};
|
|
24794
|
-
return InputEventMouseMotion;
|
|
24795
|
-
}(InputEventMouse);
|
|
24796
|
-
var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
|
|
24797
|
-
_inherits(InputEventScreenTouch, InputEvent);
|
|
24798
|
-
function InputEventScreenTouch() {
|
|
24799
|
-
var _this;
|
|
24800
|
-
_this = InputEvent.apply(this, arguments) || this;
|
|
24801
|
-
_this.index = 0;
|
|
24802
|
-
_this.position = new Vector2();
|
|
24803
|
-
_this.doubleTap = false;
|
|
24804
|
-
return _this;
|
|
24805
|
-
}
|
|
24806
|
-
var _proto = InputEventScreenTouch.prototype;
|
|
24807
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24808
|
-
var event = new InputEventScreenTouch();
|
|
24809
|
-
event.device = this.device;
|
|
24810
|
-
event.pressed = this.pressed;
|
|
24811
|
-
event.canceled = this.canceled;
|
|
24812
|
-
event.index = this.index;
|
|
24813
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24814
|
-
event.doubleTap = this.doubleTap;
|
|
24815
|
-
return event;
|
|
24816
|
-
};
|
|
24817
|
-
return InputEventScreenTouch;
|
|
24818
|
-
}(_wrap_native_super(InputEvent));
|
|
24819
|
-
var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
24820
|
-
_inherits(InputEventScreenDrag, InputEvent);
|
|
24821
|
-
function InputEventScreenDrag() {
|
|
24822
|
-
var _this;
|
|
24823
|
-
_this = InputEvent.apply(this, arguments) || this;
|
|
24824
|
-
_this.index = 0;
|
|
24825
|
-
_this.position = new Vector2();
|
|
24826
|
-
_this.relative = new Vector2();
|
|
24827
|
-
_this.screenRelative = new Vector2();
|
|
24828
|
-
_this.velocity = new Vector2();
|
|
24829
|
-
_this.screenVelocity = new Vector2();
|
|
24830
|
-
_this.pressure = 0;
|
|
24831
|
-
_this.tilt = new Vector2();
|
|
24832
|
-
_this.penInverted = false;
|
|
24833
|
-
return _this;
|
|
24834
|
-
}
|
|
24835
|
-
var _proto = InputEventScreenDrag.prototype;
|
|
24836
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24837
|
-
var event = new InputEventScreenDrag();
|
|
24838
|
-
event.device = this.device;
|
|
24839
|
-
event.pressed = this.pressed;
|
|
24840
|
-
event.canceled = this.canceled;
|
|
24841
|
-
event.index = this.index;
|
|
24842
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24843
|
-
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24844
|
-
event.screenRelative.copyFrom(this.screenRelative);
|
|
24845
|
-
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24846
|
-
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24847
|
-
event.pressure = this.pressure;
|
|
24848
|
-
event.tilt.copyFrom(this.tilt);
|
|
24849
|
-
event.penInverted = this.penInverted;
|
|
24850
|
-
return event;
|
|
24851
|
-
};
|
|
24852
|
-
return InputEventScreenDrag;
|
|
24853
|
-
}(_wrap_native_super(InputEvent));
|
|
24854
|
-
|
|
24855
|
-
var ANCHOR_PRESET_TABLE = {
|
|
24856
|
-
topLeft: [
|
|
24857
|
-
0,
|
|
24858
|
-
1,
|
|
24859
|
-
0,
|
|
24860
|
-
1
|
|
24861
|
-
],
|
|
24862
|
-
topRight: [
|
|
24863
|
-
1,
|
|
24864
|
-
1,
|
|
24865
|
-
1,
|
|
24866
|
-
1
|
|
24867
|
-
],
|
|
24868
|
-
bottomLeft: [
|
|
24869
|
-
0,
|
|
24870
|
-
0,
|
|
24871
|
-
0,
|
|
24872
|
-
0
|
|
24873
|
-
],
|
|
24874
|
-
bottomRight: [
|
|
24875
|
-
1,
|
|
24876
|
-
0,
|
|
24877
|
-
1,
|
|
24878
|
-
0
|
|
24879
|
-
],
|
|
24880
|
-
centerLeft: [
|
|
24881
|
-
0,
|
|
24882
|
-
0.5,
|
|
24883
|
-
0,
|
|
24884
|
-
0.5
|
|
24885
|
-
],
|
|
24886
|
-
centerTop: [
|
|
24887
|
-
0.5,
|
|
24888
|
-
1,
|
|
24889
|
-
0.5,
|
|
24890
|
-
1
|
|
24891
|
-
],
|
|
24892
|
-
centerRight: [
|
|
24893
|
-
1,
|
|
24894
|
-
0.5,
|
|
24895
|
-
1,
|
|
24896
|
-
0.5
|
|
24897
|
-
],
|
|
24898
|
-
centerBottom: [
|
|
24899
|
-
0.5,
|
|
24900
|
-
0,
|
|
24901
|
-
0.5,
|
|
24902
|
-
0
|
|
24903
|
-
],
|
|
24904
|
-
center: [
|
|
24905
|
-
0.5,
|
|
24906
|
-
0.5,
|
|
24907
|
-
0.5,
|
|
24908
|
-
0.5
|
|
24909
|
-
],
|
|
24910
|
-
leftWide: [
|
|
24911
|
-
0,
|
|
24912
|
-
0,
|
|
24913
|
-
0,
|
|
24914
|
-
1
|
|
24915
|
-
],
|
|
24916
|
-
topWide: [
|
|
24917
|
-
0,
|
|
24918
|
-
1,
|
|
24919
|
-
1,
|
|
24920
|
-
1
|
|
24921
|
-
],
|
|
24922
|
-
rightWide: [
|
|
24923
|
-
1,
|
|
24924
|
-
0,
|
|
24925
|
-
1,
|
|
24926
|
-
1
|
|
24927
|
-
],
|
|
24928
|
-
bottomWide: [
|
|
24929
|
-
0,
|
|
24930
|
-
0,
|
|
24931
|
-
1,
|
|
24932
|
-
0
|
|
24933
|
-
],
|
|
24934
|
-
vcenterWide: [
|
|
24935
|
-
0.5,
|
|
24936
|
-
0,
|
|
24937
|
-
0.5,
|
|
24938
|
-
1
|
|
24939
|
-
],
|
|
24940
|
-
hcenterWide: [
|
|
24941
|
-
0,
|
|
24942
|
-
0.5,
|
|
24943
|
-
1,
|
|
24944
|
-
0.5
|
|
24945
|
-
],
|
|
24946
|
-
fullRect: [
|
|
24947
|
-
0,
|
|
24948
|
-
0,
|
|
24949
|
-
1,
|
|
24950
|
-
1
|
|
24951
|
-
]
|
|
24952
|
-
};
|
|
24953
|
-
/**
|
|
24954
|
-
* A drawable GUI object. Controls form a tree independent from the VFXItem
|
|
24955
|
-
* scene tree. UIControl is the bridge between both trees.
|
|
24956
|
-
*/ var Control = /*#__PURE__*/ function() {
|
|
24957
|
-
function Control(engine) {
|
|
24958
|
-
this.engine = engine;
|
|
24959
|
-
this._parent = null;
|
|
24960
|
-
this._visible = true;
|
|
24961
|
-
this._enabled = true;
|
|
24962
|
-
this._mouseFilter = MouseFilter.Stop;
|
|
24963
|
-
this._mouseBehaviorRecursive = MouseBehaviorRecursive.Inherited;
|
|
24964
|
-
this._focusMode = FocusMode.None;
|
|
24965
|
-
this._focusBehaviorRecursive = FocusBehaviorRecursive.Inherited;
|
|
24966
|
-
this._defaultCursorShape = CursorShape.Arrow;
|
|
24967
|
-
this._rotation = 0;
|
|
24968
|
-
this.transformDirty = true;
|
|
24969
|
-
this.cachedTransform = new Matrix3();
|
|
24970
|
-
this.eventEmitter = new EventEmitter();
|
|
24971
|
-
this.disposed = false;
|
|
24972
|
-
this./** Scene-tree bridge that owns this GUI object, if any. */ owner = null;
|
|
24973
|
-
this.position = new Vector2();
|
|
24974
|
-
this.size = new Vector2(1, 1);
|
|
24975
|
-
this.anchorMin = new Vector2();
|
|
24976
|
-
this.anchorMax = new Vector2();
|
|
24977
|
-
this.offsetMin = new Vector2();
|
|
24978
|
-
this.offsetMax = new Vector2(1, 1);
|
|
24979
|
-
this.pivot = new Vector2(0.5, 0.5);
|
|
24980
|
-
this.scale = new Vector2(1, 1);
|
|
24981
|
-
this.shear = new Vector2();
|
|
24982
|
-
this.mouseForcePassScrollEvents = true;
|
|
24983
|
-
this.clipContents = false;
|
|
24984
|
-
}
|
|
24985
|
-
var _proto = Control.prototype;
|
|
24986
|
-
_proto.on = function on(eventName, listener, options) {
|
|
24987
|
-
this.eventEmitter.on(eventName, listener, options);
|
|
24988
|
-
};
|
|
24989
|
-
_proto.off = function off(eventName, listener) {
|
|
24990
|
-
this.eventEmitter.off(eventName, listener);
|
|
24991
|
-
};
|
|
24992
|
-
_proto.setPosition = function setPosition(x, y, keepOffsets) {
|
|
24993
|
-
if (keepOffsets === void 0) keepOffsets = false;
|
|
24994
|
-
if (this.position.x === x && this.position.y === y) {
|
|
24995
|
-
return;
|
|
24996
|
-
}
|
|
24997
|
-
var rect = {
|
|
24998
|
-
position: new Vector2(x, y),
|
|
24999
|
-
size: this.size.clone()
|
|
25000
|
-
};
|
|
25001
|
-
if (keepOffsets && this.parent) {
|
|
25002
|
-
this.computeAnchors(rect, this.getParentRect());
|
|
25003
|
-
} else {
|
|
25004
|
-
this.computeOffsets(rect, this.getParentRect());
|
|
25005
|
-
}
|
|
25006
|
-
this.updateLayout();
|
|
25007
|
-
};
|
|
25008
|
-
_proto.setSize = function setSize(width, height) {
|
|
25009
|
-
if (this.size.x === width && this.size.y === height) {
|
|
25010
|
-
return;
|
|
25011
|
-
}
|
|
25012
|
-
var rect = {
|
|
25013
|
-
position: this.position.clone(),
|
|
25014
|
-
size: new Vector2(width, height)
|
|
25015
|
-
};
|
|
25016
|
-
this.computeOffsets(rect, this.getParentRect());
|
|
25017
|
-
this.updateLayout();
|
|
25018
|
-
};
|
|
25019
|
-
_proto.setScale = function setScale(x, y) {
|
|
25020
|
-
if (this.scale.x !== x || this.scale.y !== y) {
|
|
25021
|
-
this.scale.set(x, y);
|
|
25022
|
-
this.markTransformDirty();
|
|
25023
|
-
}
|
|
25024
|
-
};
|
|
25025
|
-
_proto.setRotation = function setRotation(degrees) {
|
|
25026
|
-
if (this._rotation !== degrees) {
|
|
25027
|
-
this._rotation = degrees;
|
|
25028
|
-
this.markTransformDirty();
|
|
25029
|
-
}
|
|
25030
|
-
};
|
|
25031
|
-
_proto.setShear = function setShear(x, y) {
|
|
25032
|
-
if (this.shear.x !== x || this.shear.y !== y) {
|
|
25033
|
-
this.shear.set(x, y);
|
|
25034
|
-
this.markTransformDirty();
|
|
25035
|
-
}
|
|
25036
|
-
};
|
|
25037
|
-
_proto.setPivot = function setPivot(x, y) {
|
|
25038
|
-
if (this.pivot.x !== x || this.pivot.y !== y) {
|
|
25039
|
-
this.pivot.set(x, y);
|
|
25040
|
-
this.markTransformDirty();
|
|
25041
|
-
}
|
|
25042
|
-
};
|
|
25043
|
-
_proto.setAnchorMin = function setAnchorMin(x, y) {
|
|
25044
|
-
if (this.anchorMin.x !== x || this.anchorMin.y !== y) {
|
|
25045
|
-
this.anchorMin.set(x, y);
|
|
25046
|
-
this.updateLayout();
|
|
25047
|
-
}
|
|
25048
|
-
};
|
|
25049
|
-
_proto.setAnchorMax = function setAnchorMax(x, y) {
|
|
25050
|
-
if (this.anchorMax.x !== x || this.anchorMax.y !== y) {
|
|
25051
|
-
this.anchorMax.set(x, y);
|
|
25052
|
-
this.updateLayout();
|
|
25053
|
-
}
|
|
25054
|
-
};
|
|
25055
|
-
_proto.setOffsetMin = function setOffsetMin(x, y) {
|
|
25056
|
-
if (this.offsetMin.x !== x || this.offsetMin.y !== y) {
|
|
25057
|
-
this.offsetMin.set(x, y);
|
|
25058
|
-
this.updateLayout();
|
|
25059
|
-
}
|
|
25060
|
-
};
|
|
25061
|
-
_proto.setOffsetMax = function setOffsetMax(x, y) {
|
|
25062
|
-
if (this.offsetMax.x !== x || this.offsetMax.y !== y) {
|
|
25063
|
-
this.offsetMax.set(x, y);
|
|
25064
|
-
this.updateLayout();
|
|
25065
|
-
}
|
|
25066
|
-
};
|
|
25067
|
-
_proto.getRect = function getRect() {
|
|
25068
|
-
return {
|
|
25069
|
-
position: this.position.clone(),
|
|
25070
|
-
size: this.size.clone()
|
|
25071
|
-
};
|
|
25072
|
-
};
|
|
25073
|
-
_proto.getTransform2D = function getTransform2D() {
|
|
25074
|
-
if (this.transformDirty) {
|
|
25075
|
-
var radians = this._rotation * Math.PI / 180;
|
|
25076
|
-
var sin = Math.sin(radians);
|
|
25077
|
-
var cos = Math.cos(radians);
|
|
25078
|
-
var shearX = Math.tan(Math.max(-89, Math.min(89, this.shear.x)) * Math.PI / 180);
|
|
25079
|
-
var shearY = Math.tan(Math.max(-89, Math.min(89, this.shear.y)) * Math.PI / 180);
|
|
25080
|
-
var a = this.scale.x * (cos - sin * shearY);
|
|
25081
|
-
var b = this.scale.x * (sin + cos * shearY);
|
|
25082
|
-
var c = this.scale.y * (cos * shearX - sin);
|
|
25083
|
-
var d = this.scale.y * (sin * shearX + cos);
|
|
25084
|
-
var pivotX = this.pivot.x * this.size.x;
|
|
25085
|
-
var pivotY = this.pivot.y * this.size.y;
|
|
25086
|
-
var tx = this.position.x + pivotX - a * pivotX - c * pivotY;
|
|
25087
|
-
var ty = this.position.y + pivotY - b * pivotX - d * pivotY;
|
|
25088
|
-
this.cachedTransform.set(a, b, 0, c, d, 0, tx, ty, 1);
|
|
25089
|
-
this.transformDirty = false;
|
|
25090
|
-
}
|
|
25091
|
-
return this.cachedTransform;
|
|
25092
|
-
};
|
|
25093
|
-
_proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
|
|
25094
|
-
if (keepOffsets === void 0) keepOffsets = true;
|
|
25095
|
-
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];
|
|
25096
|
-
if (keepOffsets) {
|
|
25097
|
-
this.anchorMin.set(minX, minY);
|
|
25098
|
-
this.anchorMax.set(maxX, maxY);
|
|
25099
|
-
} else {
|
|
25100
|
-
var rect = this.getRect();
|
|
25101
|
-
this.anchorMin.set(minX, minY);
|
|
25102
|
-
this.anchorMax.set(maxX, maxY);
|
|
25103
|
-
this.computeOffsets(rect, this.getParentRect());
|
|
25104
|
-
}
|
|
25105
|
-
this.updateLayout();
|
|
25106
|
-
};
|
|
25107
|
-
_proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
|
|
25108
|
-
if (margin === void 0) margin = 0;
|
|
25109
|
-
if (!this.parent) {
|
|
25110
|
-
return;
|
|
25111
|
-
}
|
|
25112
|
-
var parentSize = this.parent.size;
|
|
25113
|
-
var width = this.size.x;
|
|
25114
|
-
var height = this.size.y;
|
|
25115
|
-
var a = this.anchorMin;
|
|
25116
|
-
var b = this.anchorMax;
|
|
25117
|
-
var minX = 0, maxX = 0, minY = 0, maxY = 0;
|
|
25118
|
-
switch(preset){
|
|
25119
|
-
case "topLeft":
|
|
25120
|
-
case "bottomLeft":
|
|
25121
|
-
case "centerLeft":
|
|
25122
|
-
case "topWide":
|
|
25123
|
-
case "bottomWide":
|
|
25124
|
-
case "leftWide":
|
|
25125
|
-
case "hcenterWide":
|
|
25126
|
-
case "fullRect":
|
|
25127
|
-
minX = margin - a.x * parentSize.x;
|
|
25128
|
-
maxX = margin + width - b.x * parentSize.x;
|
|
25129
|
-
break;
|
|
25130
|
-
case "centerTop":
|
|
25131
|
-
case "centerBottom":
|
|
25132
|
-
case "center":
|
|
25133
|
-
case "vcenterWide":
|
|
25134
|
-
minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
|
|
25135
|
-
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25136
|
-
break;
|
|
25137
|
-
default:
|
|
25138
|
-
minX = parentSize.x - margin - width - a.x * parentSize.x;
|
|
25139
|
-
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25140
|
-
break;
|
|
25141
|
-
}
|
|
25142
|
-
switch(preset){
|
|
25143
|
-
case "bottomLeft":
|
|
25144
|
-
case "bottomRight":
|
|
25145
|
-
case "centerBottom":
|
|
25146
|
-
case "leftWide":
|
|
25147
|
-
case "rightWide":
|
|
25148
|
-
case "bottomWide":
|
|
25149
|
-
case "vcenterWide":
|
|
25150
|
-
case "fullRect":
|
|
25151
|
-
minY = margin - a.y * parentSize.y;
|
|
25152
|
-
maxY = margin + height - b.y * parentSize.y;
|
|
25153
|
-
break;
|
|
25154
|
-
case "centerLeft":
|
|
25155
|
-
case "centerRight":
|
|
25156
|
-
case "center":
|
|
25157
|
-
case "hcenterWide":
|
|
25158
|
-
minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
|
|
25159
|
-
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25160
|
-
break;
|
|
25161
|
-
default:
|
|
25162
|
-
minY = parentSize.y - margin - height - a.y * parentSize.y;
|
|
25163
|
-
maxY = parentSize.y - margin - b.y * parentSize.y;
|
|
25164
|
-
break;
|
|
25165
|
-
}
|
|
25166
|
-
this.offsetMin.set(minX, minY);
|
|
25167
|
-
this.offsetMax.set(maxX, maxY);
|
|
25168
|
-
this.updateLayout();
|
|
25169
|
-
};
|
|
25170
|
-
_proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
|
|
25171
|
-
if (margin === void 0) margin = 0;
|
|
25172
|
-
this.setAnchorsPreset(preset, false);
|
|
25173
|
-
this.setOffsetsPreset(preset, margin);
|
|
25174
|
-
};
|
|
25175
|
-
_proto.getGlobalTransform2D = function getGlobalTransform2D() {
|
|
25176
|
-
var local = this.getTransform2D();
|
|
25177
|
-
return this.parent ? new Matrix3().multiplyMatrices(this.parent.getGlobalTransform2D(), local) : local.clone();
|
|
25178
|
-
};
|
|
25179
|
-
_proto.hasPoint = function hasPoint(point) {
|
|
25180
|
-
return point.x >= 0 && point.y >= 0 && point.x <= this.size.x && point.y <= this.size.y;
|
|
25181
|
-
};
|
|
25182
|
-
_proto.getEffectiveMouseFilter = function getEffectiveMouseFilter() {
|
|
25183
|
-
return this.enabledInHierarchy && this.isMouseRecursiveEnabled() ? this.mouseFilter : MouseFilter.Ignore;
|
|
25184
|
-
};
|
|
25185
|
-
_proto.getFocusModeWithOverride = function getFocusModeWithOverride() {
|
|
25186
|
-
return this.enabledInHierarchy && this.isFocusRecursiveEnabled() ? this.focusMode : FocusMode.None;
|
|
25187
|
-
};
|
|
25188
|
-
_proto.getCursorShape = function getCursorShape(position) {
|
|
25189
|
-
return this.defaultCursorShape;
|
|
25190
|
-
};
|
|
25191
|
-
_proto.acceptEvent = function acceptEvent() {
|
|
25192
|
-
var _this_root;
|
|
25193
|
-
(_this_root = this.root) == null ? void 0 : _this_root.acceptControlEvent(this);
|
|
25194
|
-
};
|
|
25195
|
-
_proto.focus = function focus() {
|
|
25196
|
-
var _this_root;
|
|
25197
|
-
(_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
|
|
25198
|
-
};
|
|
25199
|
-
_proto.grabFocus = function grabFocus() {
|
|
25200
|
-
this.focus();
|
|
25201
|
-
};
|
|
25202
|
-
_proto.grabClickFocus = function grabClickFocus() {
|
|
25203
|
-
var _this_root;
|
|
25204
|
-
(_this_root = this.root) == null ? void 0 : _this_root.grabControlClickFocus(this);
|
|
25205
|
-
};
|
|
25206
|
-
_proto.releaseFocus = function releaseFocus() {
|
|
25207
|
-
var _this_root;
|
|
25208
|
-
(_this_root = this.root) == null ? void 0 : _this_root.releaseControlFocus(this);
|
|
25209
|
-
};
|
|
25210
|
-
_proto.warpMouse = function warpMouse(position) {
|
|
25211
|
-
var _this_root;
|
|
25212
|
-
var matrix = this.getGlobalTransform2D().elements;
|
|
25213
|
-
(_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]));
|
|
25214
|
-
};
|
|
25215
|
-
/** Converts a window-space position into this control's local coordinates. */ _proto.makePositionLocal = function makePositionLocal(position) {
|
|
25216
|
-
var transform = this.getGlobalTransform2D().clone();
|
|
25217
|
-
if (Math.abs(transform.determinant()) < 1e-12) {
|
|
25218
|
-
return new Vector2();
|
|
25219
|
-
}
|
|
25220
|
-
var elements = transform.invert().elements;
|
|
25221
|
-
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
25222
|
-
};
|
|
25223
|
-
/** Gets the current mouse position transformed into this control's coordinates. */ _proto.getLocalMousePosition = function getLocalMousePosition() {
|
|
25224
|
-
var root = this.root;
|
|
25225
|
-
return root ? this.makePositionLocal(root.getMousePosition()) : new Vector2();
|
|
25226
|
-
};
|
|
25227
|
-
_proto.update = function update(deltaTime) {};
|
|
25228
|
-
_proto.draw = function draw() {
|
|
25229
|
-
// OVERRIDE
|
|
25230
|
-
};
|
|
25231
|
-
_proto.onDestroy = function onDestroy() {};
|
|
25232
|
-
/** @internal */ _proto.drawInternal = function drawInternal() {
|
|
25233
|
-
if (!this.visibleInHierarchy || this.disposed) {
|
|
25234
|
-
return;
|
|
25235
|
-
}
|
|
25236
|
-
var graphics = this.engine.graphics;
|
|
25237
|
-
graphics.pushTransform(this.getTransform2D());
|
|
25238
|
-
this.draw();
|
|
25239
|
-
graphics.popTransform();
|
|
25240
|
-
};
|
|
25241
|
-
_proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
|
|
25242
|
-
this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
|
|
25243
|
-
};
|
|
25244
|
-
_proto.drawPolyline = function drawPolyline(points, color, thickness) {
|
|
25245
|
-
this.engine.graphics.drawLines(points, color, thickness);
|
|
25246
|
-
};
|
|
25247
|
-
_proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
|
|
25248
|
-
this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
|
|
25249
|
-
};
|
|
25250
|
-
_proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
|
|
25251
|
-
this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
|
|
25252
|
-
};
|
|
25253
|
-
_proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
|
|
25254
|
-
this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
|
|
25255
|
-
};
|
|
25256
|
-
_proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
|
|
25257
|
-
this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
|
|
25258
|
-
};
|
|
25259
|
-
_proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
|
|
25260
|
-
this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
|
|
25261
|
-
};
|
|
25262
|
-
_proto.fillRect = function fillRect(x, y, width, height, color) {
|
|
25263
|
-
this.engine.graphics.fillRectangle(x, y, width, height, color);
|
|
25264
|
-
};
|
|
25265
|
-
_proto.fillCircle = function fillCircle(cx, cy, radius, color) {
|
|
25266
|
-
this.engine.graphics.fillCircle(cx, cy, radius, color);
|
|
25267
|
-
};
|
|
25268
|
-
_proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
|
|
25269
|
-
this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
|
|
25270
|
-
};
|
|
25271
|
-
_proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
|
|
25272
|
-
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
25273
|
-
};
|
|
25274
|
-
_proto.onMouseEnter = function onMouseEnter(location) {};
|
|
25275
|
-
_proto.onMouseMove = function onMouseMove(location, event) {};
|
|
25276
|
-
_proto.onMouseLeave = function onMouseLeave() {};
|
|
25277
|
-
_proto.onMouseWheel = function onMouseWheel(location, delta, event) {};
|
|
25278
|
-
_proto.onMouseDown = function onMouseDown(location, button, event) {};
|
|
25279
|
-
_proto.onMouseUp = function onMouseUp(location, button, event) {};
|
|
25280
|
-
_proto.onTouchDown = function onTouchDown(location, pointerId, event) {};
|
|
25281
|
-
_proto.onTouchMove = function onTouchMove(location, pointerId, event) {};
|
|
25282
|
-
_proto.onTouchUp = function onTouchUp(location, pointerId, event) {};
|
|
25283
|
-
_proto.onKeyDown = function onKeyDown(event) {};
|
|
25284
|
-
_proto.onKeyUp = function onKeyUp(event) {};
|
|
25285
|
-
_proto.onGotFocus = function onGotFocus() {};
|
|
25286
|
-
_proto.onLostFocus = function onLostFocus() {};
|
|
25287
|
-
/** @internal */ _proto.invokeGetDragData = function invokeGetDragData(position) {
|
|
25288
|
-
return this.getDragData(position);
|
|
25289
|
-
};
|
|
25290
|
-
/** @internal */ _proto.invokeCanDropData = function invokeCanDropData(position, data) {
|
|
25291
|
-
return this.canDropData(position, data);
|
|
25292
|
-
};
|
|
25293
|
-
/** @internal */ _proto.invokeDropData = function invokeDropData(position, data) {
|
|
25294
|
-
this.dropData(position, data);
|
|
25295
|
-
};
|
|
25296
|
-
_proto.getDragData = function getDragData(position) {
|
|
25297
|
-
return null;
|
|
25298
|
-
};
|
|
25299
|
-
_proto.canDropData = function canDropData(position, data) {
|
|
25300
|
-
return false;
|
|
25301
|
-
};
|
|
25302
|
-
_proto.dropData = function dropData(position, data) {};
|
|
25303
|
-
_proto.dispose = function dispose() {
|
|
25304
|
-
if (this.disposed) {
|
|
25305
|
-
return;
|
|
25306
|
-
}
|
|
25307
|
-
this.disposed = true;
|
|
25308
|
-
this.onDestroy();
|
|
25309
|
-
this.parent = null;
|
|
25310
|
-
this.owner = null;
|
|
25311
|
-
};
|
|
25312
|
-
/** @internal */ _proto.updateLayout = function updateLayout() {
|
|
25313
|
-
var _this_parent;
|
|
25314
|
-
var _this_parent_size;
|
|
25315
|
-
var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
|
|
25316
|
-
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25317
|
-
var bottom = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25318
|
-
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25319
|
-
var top = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25320
|
-
this.applyBounds(left, bottom, right - left, top - bottom);
|
|
25321
|
-
};
|
|
25322
|
-
_proto.applyBounds = function applyBounds(x, y, width, height) {
|
|
25323
|
-
var locationChanged = this.position.x !== x || this.position.y !== y;
|
|
25324
|
-
var sizeChanged = this.size.x !== width || this.size.y !== height;
|
|
25325
|
-
if (!locationChanged && !sizeChanged) {
|
|
25326
|
-
return;
|
|
25327
|
-
}
|
|
25328
|
-
this.position.set(x, y);
|
|
25329
|
-
this.size.set(width, height);
|
|
25330
|
-
this.markTransformDirty();
|
|
25331
|
-
if (locationChanged) {
|
|
25332
|
-
this.eventEmitter.emit("locationChanged", this);
|
|
25333
|
-
}
|
|
25334
|
-
if (sizeChanged) {
|
|
25335
|
-
this.eventEmitter.emit("sizeChanged", this);
|
|
25336
|
-
if (_instanceof1(this, ContainerControl)) {
|
|
25337
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25338
|
-
var child = _step.value;
|
|
25339
|
-
child.updateLayout();
|
|
25340
|
-
}
|
|
25341
|
-
}
|
|
25342
|
-
}
|
|
25343
|
-
};
|
|
25344
|
-
_proto.markTransformDirty = function markTransformDirty() {
|
|
25345
|
-
var _this_root;
|
|
25346
|
-
this.transformDirty = true;
|
|
25347
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25348
|
-
};
|
|
25349
|
-
_proto.getParentRect = function getParentRect() {
|
|
25350
|
-
var _this_parent;
|
|
25351
|
-
var _this_parent_size_clone;
|
|
25352
|
-
return {
|
|
25353
|
-
position: new Vector2(),
|
|
25354
|
-
size: (_this_parent_size_clone = (_this_parent = this.parent) == null ? void 0 : _this_parent.size.clone()) != null ? _this_parent_size_clone : new Vector2()
|
|
25355
|
-
};
|
|
25356
|
-
};
|
|
25357
|
-
_proto.computeOffsets = function computeOffsets(rect, parentRect) {
|
|
25358
|
-
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);
|
|
25359
|
-
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);
|
|
25360
|
-
};
|
|
25361
|
-
_proto.computeAnchors = function computeAnchors(rect, parentRect) {
|
|
25362
|
-
if (parentRect.size.x !== 0) {
|
|
25363
|
-
this.anchorMin.x = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
|
|
25364
|
-
this.anchorMax.x = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
|
|
25365
|
-
}
|
|
25366
|
-
if (parentRect.size.y !== 0) {
|
|
25367
|
-
this.anchorMin.y = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
|
|
25368
|
-
this.anchorMax.y = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
|
|
25369
|
-
}
|
|
25370
|
-
};
|
|
25371
|
-
_proto.isMouseRecursiveEnabled = function isMouseRecursiveEnabled() {
|
|
25372
|
-
if (this.mouseBehaviorRecursive === MouseBehaviorRecursive.Inherited) {
|
|
25373
|
-
var _this_parent;
|
|
25374
|
-
var _this_parent_isMouseRecursiveEnabled;
|
|
25375
|
-
return (_this_parent_isMouseRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isMouseRecursiveEnabled()) != null ? _this_parent_isMouseRecursiveEnabled : true;
|
|
25376
|
-
}
|
|
25377
|
-
return this.mouseBehaviorRecursive === MouseBehaviorRecursive.Enabled;
|
|
25378
|
-
};
|
|
25379
|
-
_proto.isFocusRecursiveEnabled = function isFocusRecursiveEnabled() {
|
|
25380
|
-
if (this.focusBehaviorRecursive === FocusBehaviorRecursive.Inherited) {
|
|
25381
|
-
var _this_parent;
|
|
25382
|
-
var _this_parent_isFocusRecursiveEnabled;
|
|
25383
|
-
return (_this_parent_isFocusRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isFocusRecursiveEnabled()) != null ? _this_parent_isFocusRecursiveEnabled : true;
|
|
25384
|
-
}
|
|
25385
|
-
return this.focusBehaviorRecursive === FocusBehaviorRecursive.Enabled;
|
|
25386
|
-
};
|
|
25387
|
-
_create_class(Control, [
|
|
25388
|
-
{
|
|
25389
|
-
key: "parent",
|
|
25390
|
-
get: function get() {
|
|
25391
|
-
return this._parent;
|
|
25392
|
-
},
|
|
25393
|
-
set: function set(value) {
|
|
25394
|
-
var _this__parent;
|
|
25395
|
-
if (value === this._parent) {
|
|
25396
|
-
return;
|
|
25397
|
-
}
|
|
25398
|
-
var previousRoot = this.root;
|
|
25399
|
-
(_this__parent = this._parent) == null ? void 0 : _this__parent.removeChildInternal(this);
|
|
25400
|
-
this._parent = value;
|
|
25401
|
-
value == null ? void 0 : value.addChildInternal(this);
|
|
25402
|
-
this.updateLayout();
|
|
25403
|
-
var nextRoot = this.root;
|
|
25404
|
-
if (previousRoot && previousRoot !== nextRoot) {
|
|
25405
|
-
previousRoot.controlRemoved(this);
|
|
25406
|
-
}
|
|
25407
|
-
nextRoot == null ? void 0 : nextRoot.controlTreeChanged();
|
|
25408
|
-
this.eventEmitter.emit("parentChanged", this);
|
|
25409
|
-
}
|
|
25410
|
-
},
|
|
25411
|
-
{
|
|
25412
|
-
key: "item",
|
|
25413
|
-
get: /** Scene item exposed through the optional UIControl bridge. */ function get() {
|
|
25414
|
-
var _this_owner;
|
|
25415
|
-
var _this_owner_item;
|
|
25416
|
-
return (_this_owner_item = (_this_owner = this.owner) == null ? void 0 : _this_owner.item) != null ? _this_owner_item : null;
|
|
25417
|
-
}
|
|
25418
|
-
},
|
|
25419
|
-
{
|
|
25420
|
-
key: "indexInParent",
|
|
25421
|
-
get: function get() {
|
|
25422
|
-
var _this_parent;
|
|
25423
|
-
var _this_parent_getChildIndex;
|
|
25424
|
-
return (_this_parent_getChildIndex = (_this_parent = this.parent) == null ? void 0 : _this_parent.getChildIndex(this)) != null ? _this_parent_getChildIndex : -1;
|
|
25425
|
-
},
|
|
25426
|
-
set: function set(value) {
|
|
25427
|
-
var _this_parent;
|
|
25428
|
-
(_this_parent = this.parent) == null ? void 0 : _this_parent.changeChildIndex(this, value);
|
|
25429
|
-
}
|
|
25430
|
-
},
|
|
25431
|
-
{
|
|
25432
|
-
key: "visible",
|
|
25433
|
-
get: function get() {
|
|
25434
|
-
return this._visible;
|
|
25435
|
-
},
|
|
25436
|
-
set: function set(value) {
|
|
25437
|
-
if (this._visible !== value) {
|
|
25438
|
-
var _this_root;
|
|
25439
|
-
this._visible = value;
|
|
25440
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25441
|
-
}
|
|
25442
|
-
}
|
|
25443
|
-
},
|
|
25444
|
-
{
|
|
25445
|
-
key: "visibleInHierarchy",
|
|
25446
|
-
get: function get() {
|
|
25447
|
-
var _this_parent;
|
|
25448
|
-
var _this_parent_visibleInHierarchy;
|
|
25449
|
-
return this.visible && ((_this_parent_visibleInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.visibleInHierarchy) != null ? _this_parent_visibleInHierarchy : true);
|
|
25450
|
-
}
|
|
25451
|
-
},
|
|
25452
|
-
{
|
|
25453
|
-
key: "enabled",
|
|
25454
|
-
get: function get() {
|
|
25455
|
-
return this._enabled;
|
|
25456
|
-
},
|
|
25457
|
-
set: function set(value) {
|
|
25458
|
-
if (this._enabled !== value) {
|
|
25459
|
-
var _this_root;
|
|
25460
|
-
this._enabled = value;
|
|
25461
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25462
|
-
}
|
|
25463
|
-
}
|
|
25464
|
-
},
|
|
25465
|
-
{
|
|
25466
|
-
key: "enabledInHierarchy",
|
|
25467
|
-
get: function get() {
|
|
25468
|
-
var _this_parent;
|
|
25469
|
-
var _this_parent_enabledInHierarchy;
|
|
25470
|
-
return this.enabled && ((_this_parent_enabledInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.enabledInHierarchy) != null ? _this_parent_enabledInHierarchy : true);
|
|
25471
|
-
}
|
|
25472
|
-
},
|
|
25473
|
-
{
|
|
25474
|
-
key: "mouseFilter",
|
|
25475
|
-
get: function get() {
|
|
25476
|
-
return this._mouseFilter;
|
|
25477
|
-
},
|
|
25478
|
-
set: function set(value) {
|
|
25479
|
-
if (this._mouseFilter !== value) {
|
|
25480
|
-
var _this_root;
|
|
25481
|
-
this._mouseFilter = value;
|
|
25482
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25483
|
-
}
|
|
25484
|
-
}
|
|
25485
|
-
},
|
|
25486
|
-
{
|
|
25487
|
-
key: "mouseBehaviorRecursive",
|
|
25488
|
-
get: function get() {
|
|
25489
|
-
return this._mouseBehaviorRecursive;
|
|
25490
|
-
},
|
|
25491
|
-
set: function set(value) {
|
|
25492
|
-
if (this._mouseBehaviorRecursive !== value) {
|
|
25493
|
-
var _this_root;
|
|
25494
|
-
this._mouseBehaviorRecursive = value;
|
|
25495
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25496
|
-
}
|
|
25497
|
-
}
|
|
25498
|
-
},
|
|
25499
|
-
{
|
|
25500
|
-
key: "focusMode",
|
|
25501
|
-
get: function get() {
|
|
25502
|
-
return this._focusMode;
|
|
25503
|
-
},
|
|
25504
|
-
set: function set(value) {
|
|
25505
|
-
if (this._focusMode !== value) {
|
|
25506
|
-
var _this_root;
|
|
25507
|
-
this._focusMode = value;
|
|
25508
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25509
|
-
}
|
|
25510
|
-
}
|
|
25511
|
-
},
|
|
25512
|
-
{
|
|
25513
|
-
key: "focusBehaviorRecursive",
|
|
25514
|
-
get: function get() {
|
|
25515
|
-
return this._focusBehaviorRecursive;
|
|
25516
|
-
},
|
|
25517
|
-
set: function set(value) {
|
|
25518
|
-
if (this._focusBehaviorRecursive !== value) {
|
|
25519
|
-
var _this_root;
|
|
25520
|
-
this._focusBehaviorRecursive = value;
|
|
25521
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25522
|
-
}
|
|
25523
|
-
}
|
|
25524
|
-
},
|
|
25525
|
-
{
|
|
25526
|
-
key: "defaultCursorShape",
|
|
25527
|
-
get: function get() {
|
|
25528
|
-
return this._defaultCursorShape;
|
|
25529
|
-
},
|
|
25530
|
-
set: function set(value) {
|
|
25531
|
-
this._defaultCursorShape = value;
|
|
25532
|
-
}
|
|
25533
|
-
},
|
|
25534
|
-
{
|
|
25535
|
-
key: "location",
|
|
25536
|
-
get: function get() {
|
|
25537
|
-
return this.position;
|
|
25538
|
-
},
|
|
25539
|
-
set: function set(value) {
|
|
25540
|
-
this.setPosition(value.x, value.y);
|
|
25541
|
-
}
|
|
25542
|
-
},
|
|
25543
|
-
{
|
|
25544
|
-
key: "rotation",
|
|
25545
|
-
get: function get() {
|
|
25546
|
-
return this._rotation;
|
|
25547
|
-
}
|
|
25548
|
-
},
|
|
25549
|
-
{
|
|
25550
|
-
key: "x",
|
|
25551
|
-
get: function get() {
|
|
25552
|
-
return this.position.x;
|
|
25553
|
-
},
|
|
25554
|
-
set: function set(value) {
|
|
25555
|
-
this.setPosition(value, this.position.y);
|
|
25556
|
-
}
|
|
25557
|
-
},
|
|
25558
|
-
{
|
|
25559
|
-
key: "y",
|
|
25560
|
-
get: function get() {
|
|
25561
|
-
return this.position.y;
|
|
25562
|
-
},
|
|
25563
|
-
set: function set(value) {
|
|
25564
|
-
this.setPosition(this.position.x, value);
|
|
25565
|
-
}
|
|
25566
|
-
},
|
|
25567
|
-
{
|
|
25568
|
-
key: "width",
|
|
25569
|
-
get: function get() {
|
|
25570
|
-
return this.size.x;
|
|
25571
|
-
},
|
|
25572
|
-
set: function set(value) {
|
|
25573
|
-
this.setSize(value, this.size.y);
|
|
25574
|
-
}
|
|
25575
|
-
},
|
|
25576
|
-
{
|
|
25577
|
-
key: "height",
|
|
25578
|
-
get: function get() {
|
|
25579
|
-
return this.size.y;
|
|
25580
|
-
},
|
|
25581
|
-
set: function set(value) {
|
|
25582
|
-
this.setSize(this.size.x, value);
|
|
25583
|
-
}
|
|
25584
|
-
},
|
|
25585
|
-
{
|
|
25586
|
-
key: "root",
|
|
25587
|
-
get: function get() {
|
|
25588
|
-
var _this_parent;
|
|
25589
|
-
var _this_parent_root;
|
|
25590
|
-
return _instanceof1(this, RootControl) ? this : (_this_parent_root = (_this_parent = this.parent) == null ? void 0 : _this_parent.root) != null ? _this_parent_root : null;
|
|
25591
|
-
}
|
|
25592
|
-
},
|
|
25593
|
-
{
|
|
25594
|
-
key: "isDisposed",
|
|
25595
|
-
get: function get() {
|
|
25596
|
-
return this.disposed;
|
|
25597
|
-
}
|
|
25598
|
-
}
|
|
25599
|
-
]);
|
|
25600
|
-
return Control;
|
|
25601
|
-
}();
|
|
25602
|
-
/** A Control that owns child Controls. */ var ContainerControl = /*#__PURE__*/ function(Control) {
|
|
25603
|
-
_inherits(ContainerControl, Control);
|
|
25604
|
-
function ContainerControl() {
|
|
25605
|
-
var _this;
|
|
25606
|
-
_this = Control.apply(this, arguments) || this;
|
|
25607
|
-
_this.children = [];
|
|
25608
|
-
return _this;
|
|
25609
|
-
}
|
|
25610
|
-
var _proto = ContainerControl.prototype;
|
|
25611
|
-
_proto.addChild = function addChild(child) {
|
|
25612
|
-
child.parent = this;
|
|
25613
|
-
return child;
|
|
25614
|
-
};
|
|
25615
|
-
_proto.removeChild = function removeChild(child) {
|
|
25616
|
-
if (child.parent === this) {
|
|
25617
|
-
child.parent = null;
|
|
25618
|
-
}
|
|
25619
|
-
};
|
|
25620
|
-
_proto.getChildIndex = function getChildIndex(child) {
|
|
25621
|
-
return this.children.indexOf(child);
|
|
25622
|
-
};
|
|
25623
|
-
/** @internal */ _proto.changeChildIndex = function changeChildIndex(child, newIndex) {
|
|
25624
|
-
var _this_root;
|
|
25625
|
-
var oldIndex = this.children.indexOf(child);
|
|
25626
|
-
if (oldIndex === newIndex || oldIndex === -1) {
|
|
25627
|
-
return;
|
|
25628
|
-
}
|
|
25629
|
-
this.children.splice(oldIndex, 1);
|
|
25630
|
-
if (newIndex < 0 || newIndex >= this.children.length) {
|
|
25631
|
-
this.children.push(child);
|
|
25632
|
-
} else {
|
|
25633
|
-
this.children.splice(newIndex, 0, child);
|
|
25634
|
-
}
|
|
25635
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25636
|
-
};
|
|
25637
|
-
/** @internal */ _proto.addChildInternal = function addChildInternal(child) {
|
|
25638
|
-
if (!this.children.includes(child)) {
|
|
25639
|
-
this.children.push(child);
|
|
25640
|
-
}
|
|
25641
|
-
};
|
|
25642
|
-
/** @internal */ _proto.removeChildInternal = function removeChildInternal(child) {
|
|
25643
|
-
var index = this.children.indexOf(child);
|
|
25644
|
-
if (index !== -1) {
|
|
25645
|
-
this.children.splice(index, 1);
|
|
25646
|
-
}
|
|
25647
|
-
};
|
|
25648
|
-
_proto.drawSelf = function drawSelf() {
|
|
25649
|
-
Control.prototype.draw.call(this);
|
|
25650
|
-
};
|
|
25651
|
-
_proto.draw = function draw() {
|
|
25652
|
-
this.drawSelf();
|
|
25653
|
-
this.drawChildren();
|
|
25654
|
-
};
|
|
25655
|
-
_proto.drawChildren = function drawChildren() {
|
|
25656
|
-
var graphics = this.engine.graphics;
|
|
25657
|
-
if (this.clipContents) ;
|
|
25658
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25659
|
-
var child = _step.value;
|
|
25660
|
-
if (!child.visible || child.isDisposed) {
|
|
25661
|
-
continue;
|
|
25662
|
-
}
|
|
25663
|
-
graphics.pushTransform(child.getTransform2D());
|
|
25664
|
-
child.draw();
|
|
25665
|
-
graphics.popTransform();
|
|
25666
|
-
}
|
|
25667
|
-
};
|
|
25668
|
-
_proto.update = function update(deltaTime) {
|
|
25669
|
-
Control.prototype.update.call(this, deltaTime);
|
|
25670
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25671
|
-
var child = _step.value;
|
|
25672
|
-
if (child.enabled && !child.isDisposed) {
|
|
25673
|
-
child.update(deltaTime);
|
|
25674
|
-
}
|
|
25675
|
-
}
|
|
25676
|
-
};
|
|
25677
|
-
_proto.dispose = function dispose() {
|
|
25678
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25679
|
-
var child = _step.value;
|
|
25680
|
-
child.dispose();
|
|
25681
|
-
}
|
|
25682
|
-
Control.prototype.dispose.call(this);
|
|
25683
|
-
};
|
|
25684
|
-
return ContainerControl;
|
|
25685
|
-
}(Control);
|
|
25686
|
-
/** Base class for GUI tree roots and input dispatchers. */ var RootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25687
|
-
_inherits(RootControl, ContainerControl);
|
|
25688
|
-
function RootControl() {
|
|
25689
|
-
return ContainerControl.apply(this, arguments);
|
|
25690
|
-
}
|
|
25691
|
-
return RootControl;
|
|
25692
|
-
}(ContainerControl);
|
|
25693
|
-
|
|
25694
|
-
var _obj$3;
|
|
25695
|
-
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);
|
|
25696
|
-
function getButtonMask(button) {
|
|
25697
|
-
switch(button){
|
|
25698
|
-
case MouseButton.Left:
|
|
25699
|
-
return MouseButtonMask.Left;
|
|
25700
|
-
case MouseButton.Right:
|
|
25701
|
-
return MouseButtonMask.Right;
|
|
25702
|
-
case MouseButton.Middle:
|
|
25703
|
-
return MouseButtonMask.Middle;
|
|
25704
|
-
case MouseButton.Xbutton1:
|
|
25705
|
-
return MouseButtonMask.Xbutton1;
|
|
25706
|
-
case MouseButton.Xbutton2:
|
|
25707
|
-
return MouseButtonMask.Xbutton2;
|
|
25708
|
-
default:
|
|
25709
|
-
return MouseButtonMask.None;
|
|
25710
|
-
}
|
|
25711
|
-
}
|
|
25712
|
-
function isWheelButton(button) {
|
|
25713
|
-
return button >= MouseButton.WheelUp && button <= MouseButton.WheelRight;
|
|
25714
|
-
}
|
|
25715
|
-
function getWheelDelta(event) {
|
|
25716
|
-
return event.buttonIndex === MouseButton.WheelUp || event.buttonIndex === MouseButton.WheelLeft ? event.factor : -event.factor;
|
|
25717
|
-
}
|
|
25718
|
-
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25719
|
-
_inherits(CanvasRootControl, ContainerControl);
|
|
25720
|
-
function CanvasRootControl(engine, canvas) {
|
|
25721
|
-
var _this;
|
|
25722
|
-
_this = ContainerControl.call(this, engine) || this;
|
|
25723
|
-
_this.canvas = canvas;
|
|
25724
|
-
_this.mouseFilter = MouseFilter.Ignore;
|
|
25725
|
-
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25726
|
-
return _this;
|
|
25727
|
-
}
|
|
25728
|
-
_create_class(CanvasRootControl, [
|
|
25729
|
-
{
|
|
25730
|
-
key: "inputDisabled",
|
|
25731
|
-
get: function get() {
|
|
25732
|
-
var _this_canvas_item;
|
|
25733
|
-
return !this.canvas.receivesEvents || !this.canvas.enabled || !((_this_canvas_item = this.canvas.item) == null ? void 0 : _this_canvas_item.isActive);
|
|
25734
|
-
}
|
|
25735
|
-
}
|
|
25736
|
-
]);
|
|
25737
|
-
return CanvasRootControl;
|
|
25738
|
-
}(ContainerControl);
|
|
25739
|
-
/** Global ordered collection of UICanvas roots. */ var CanvasContainer = /*#__PURE__*/ function(ContainerControl) {
|
|
25740
|
-
_inherits(CanvasContainer, ContainerControl);
|
|
25741
|
-
function CanvasContainer(engine) {
|
|
25742
|
-
var _this;
|
|
25743
|
-
_this = ContainerControl.call(this, engine) || this;
|
|
25744
|
-
_this.mouseFilter = MouseFilter.Ignore;
|
|
25745
|
-
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25746
|
-
return _this;
|
|
25747
|
-
}
|
|
25748
|
-
var _proto = CanvasContainer.prototype;
|
|
25749
|
-
_proto.sortCanvases = function sortCanvases() {
|
|
25750
|
-
this.children.sort(function(left, right) {
|
|
25751
|
-
return left.canvas.order - right.canvas.order;
|
|
25752
|
-
});
|
|
25753
|
-
};
|
|
25754
|
-
_proto.addChildInternal = function addChildInternal(child) {
|
|
25755
|
-
ContainerControl.prototype.addChildInternal.call(this, child);
|
|
25756
|
-
this.sortCanvases();
|
|
25757
|
-
};
|
|
25758
|
-
_proto.draw = function draw() {
|
|
25759
|
-
this.sortCanvases();
|
|
25760
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25761
|
-
var child = _step.value;
|
|
25762
|
-
var root = child;
|
|
25763
|
-
if (root.canvas.isVisible) {
|
|
25764
|
-
root.draw();
|
|
25765
|
-
}
|
|
25766
|
-
}
|
|
25767
|
-
};
|
|
25768
|
-
return CanvasContainer;
|
|
25769
|
-
}(ContainerControl);
|
|
25770
|
-
/** Engine window GUI root. Routes events across all UICanvas roots. */ var WindowRootControl = /*#__PURE__*/ function(RootControl) {
|
|
25771
|
-
_inherits(WindowRootControl, RootControl);
|
|
25772
|
-
function WindowRootControl(engine) {
|
|
25773
|
-
var _this;
|
|
25774
|
-
_this = RootControl.call(this, engine) || this;
|
|
25775
|
-
_this.dragThreshold = 10;
|
|
25776
|
-
_this.inputHandled = false;
|
|
25777
|
-
_this.gui = {
|
|
25778
|
-
mouseFocus: null,
|
|
25779
|
-
mouseClickGrabber: null,
|
|
25780
|
-
mouseFocusMask: MouseButtonMask.None,
|
|
25781
|
-
mouseOver: null,
|
|
25782
|
-
mouseOverHierarchy: [],
|
|
25783
|
-
touchFocus: new Map(),
|
|
25784
|
-
keyFocus: null,
|
|
25785
|
-
dragAccum: new Vector2(),
|
|
25786
|
-
dragAttempted: false,
|
|
25787
|
-
dragging: false,
|
|
25788
|
-
dragData: null,
|
|
25789
|
-
dragMouseOver: null,
|
|
25790
|
-
dragSuccessful: false,
|
|
25791
|
-
lastMousePosition: new Vector2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY),
|
|
25792
|
-
sendingMouseEnterExit: false,
|
|
25793
|
-
mouseOverUpdatePending: false
|
|
25794
|
-
};
|
|
25795
|
-
_this.mouseFilter = MouseFilter.Ignore;
|
|
25796
|
-
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25797
|
-
_this.canvases = new CanvasContainer(engine);
|
|
25798
|
-
_this.canvases.parent = _assert_this_initialized(_this);
|
|
25799
|
-
return _this;
|
|
25800
|
-
}
|
|
25801
|
-
var _proto = WindowRootControl.prototype;
|
|
25802
|
-
_proto.pushInput = function pushInput(event) {
|
|
25803
|
-
this.inputHandled = false;
|
|
25804
|
-
this.cleanupInternalState();
|
|
25805
|
-
this.processGUIInput(event);
|
|
25806
|
-
this.postGrabClickFocus();
|
|
25807
|
-
};
|
|
25808
|
-
_proto.isInputHandled = function isInputHandled() {
|
|
25809
|
-
return this.inputHandled;
|
|
25810
|
-
};
|
|
25811
|
-
_proto.getMousePosition = function getMousePosition() {
|
|
25812
|
-
return this.gui.lastMousePosition.clone();
|
|
25813
|
-
};
|
|
25814
|
-
_proto.guiGetFocusOwner = function guiGetFocusOwner() {
|
|
25815
|
-
return this.isFocusTargetUsable(this.gui.keyFocus) ? this.gui.keyFocus : null;
|
|
25816
|
-
};
|
|
25817
|
-
_proto.guiReleaseFocus = function guiReleaseFocus() {
|
|
25818
|
-
this.releaseControlFocus();
|
|
25819
|
-
};
|
|
25820
|
-
_proto.guiIsDragging = function guiIsDragging() {
|
|
25821
|
-
return this.gui.dragging;
|
|
25822
|
-
};
|
|
25823
|
-
_proto.guiGetDragData = function guiGetDragData() {
|
|
25824
|
-
return this.gui.dragData;
|
|
25825
|
-
};
|
|
25826
|
-
_proto.guiIsDragSuccessful = function guiIsDragSuccessful() {
|
|
25827
|
-
return this.gui.dragSuccessful;
|
|
25828
|
-
};
|
|
25829
|
-
_proto.guiCancelDrag = function guiCancelDrag() {
|
|
25830
|
-
this.endDragging(false);
|
|
25831
|
-
};
|
|
25832
|
-
_proto.acceptControlEvent = function acceptControlEvent(control) {
|
|
25833
|
-
if (this.isControlUsable(control)) {
|
|
25834
|
-
this.inputHandled = true;
|
|
25835
|
-
}
|
|
25836
|
-
};
|
|
25837
|
-
_proto.grabControlFocus = function grabControlFocus(control) {
|
|
25838
|
-
if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
|
|
25839
|
-
return;
|
|
25840
|
-
}
|
|
25841
|
-
var previous = this.gui.keyFocus;
|
|
25842
|
-
this.gui.keyFocus = control;
|
|
25843
|
-
if (previous && !previous.isDisposed) {
|
|
25844
|
-
previous.onLostFocus();
|
|
25845
|
-
}
|
|
25846
|
-
control.onGotFocus();
|
|
25847
|
-
};
|
|
25848
|
-
_proto.grabControlClickFocus = function grabControlClickFocus(control) {
|
|
25849
|
-
var _this = this;
|
|
25850
|
-
if (this.isControlValid(control)) {
|
|
25851
|
-
this.gui.mouseClickGrabber = control;
|
|
25852
|
-
queueMicrotask(function() {
|
|
25853
|
-
return _this.postGrabClickFocus();
|
|
25854
|
-
});
|
|
25855
|
-
}
|
|
25856
|
-
};
|
|
25857
|
-
_proto.releaseControlFocus = function releaseControlFocus(control) {
|
|
25858
|
-
var previous = this.gui.keyFocus;
|
|
25859
|
-
if (!previous || control && previous !== control) {
|
|
25860
|
-
return;
|
|
25861
|
-
}
|
|
25862
|
-
this.gui.keyFocus = null;
|
|
25863
|
-
if (!previous.isDisposed) {
|
|
25864
|
-
previous.onLostFocus();
|
|
25865
|
-
}
|
|
25866
|
-
};
|
|
25867
|
-
_proto.warpControlMouse = function warpControlMouse(position) {
|
|
25868
|
-
this.gui.lastMousePosition.copyFrom(position);
|
|
25869
|
-
this.updateMouseOver(position);
|
|
25870
|
-
};
|
|
25871
|
-
_proto.controlStateChanged = function controlStateChanged(control) {
|
|
25872
|
-
if (!this.isControlUsable(control)) {
|
|
25873
|
-
this.dropControlState(control);
|
|
25874
|
-
}
|
|
25875
|
-
this.requestMouseOverUpdate();
|
|
25876
|
-
};
|
|
25877
|
-
_proto.controlRemoved = function controlRemoved(control) {
|
|
25878
|
-
this.dropControlState(control);
|
|
25879
|
-
this.cleanupInternalState();
|
|
25880
|
-
this.requestMouseOverUpdate();
|
|
25881
|
-
};
|
|
25882
|
-
_proto.controlTreeChanged = function controlTreeChanged() {
|
|
25883
|
-
this.requestMouseOverUpdate();
|
|
25884
|
-
};
|
|
25885
|
-
_proto.cancelPointerInput = function cancelPointerInput() {
|
|
25886
|
-
this.dropMouseFocus();
|
|
25887
|
-
this.dropMouseOver();
|
|
25888
|
-
this.gui.touchFocus.clear();
|
|
25889
|
-
this.endDragging(false);
|
|
25890
|
-
this.releaseControlFocus();
|
|
25891
|
-
};
|
|
25892
|
-
_proto.resize = function resize(width, height) {
|
|
25893
|
-
this.setSize(width, height);
|
|
25894
|
-
this.canvases.setSize(width, height);
|
|
25895
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvases.children), _step; !(_step = _iterator()).done;){
|
|
25896
|
-
var root = _step.value;
|
|
25897
|
-
root.setSize(width, height);
|
|
25898
|
-
}
|
|
25899
|
-
};
|
|
25900
|
-
_proto.render = function render() {
|
|
25901
|
-
if (this.canvases.children.length === 0) {
|
|
25902
|
-
return;
|
|
25903
|
-
}
|
|
25904
|
-
this.engine.graphics.begin();
|
|
25905
|
-
this.draw();
|
|
25906
|
-
this.engine.graphics.end();
|
|
25907
|
-
};
|
|
25908
|
-
_proto.update = function update(deltaTime) {
|
|
25909
|
-
if (this.gui.mouseOverUpdatePending) {
|
|
25910
|
-
this.gui.mouseOverUpdatePending = false;
|
|
25911
|
-
this.updateMouseOver(this.gui.lastMousePosition);
|
|
25912
|
-
}
|
|
25913
|
-
RootControl.prototype.update.call(this, deltaTime);
|
|
25914
|
-
};
|
|
25915
|
-
_proto.dispose = function dispose() {
|
|
25916
|
-
this.cancelPointerInput();
|
|
25917
|
-
RootControl.prototype.dispose.call(this);
|
|
25918
|
-
};
|
|
25919
|
-
_proto.processGUIInput = function processGUIInput(event) {
|
|
25920
|
-
if (_instanceof1(event, InputEventKey)) {
|
|
25921
|
-
var target = this.guiGetFocusOwner();
|
|
25922
|
-
if (target) {
|
|
25923
|
-
this.callControlInput(target, event);
|
|
25924
|
-
}
|
|
25925
|
-
} else if (_instanceof1(event, InputEventMouse)) {
|
|
25926
|
-
this.gui.lastMousePosition.copyFrom(event.globalPosition);
|
|
25927
|
-
this.updateMouseOver(event.globalPosition);
|
|
25928
|
-
if (_instanceof1(event, InputEventMouseButton)) {
|
|
25929
|
-
this.processMouseButton(event);
|
|
25930
|
-
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
25931
|
-
this.processMouseMotion(event);
|
|
25932
|
-
}
|
|
25933
|
-
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
25934
|
-
this.processScreenTouch(event);
|
|
25935
|
-
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
25936
|
-
this.processScreenDrag(event);
|
|
25937
|
-
}
|
|
25938
|
-
};
|
|
25939
|
-
_proto.processMouseButton = function processMouseButton(event) {
|
|
25940
|
-
if (isWheelButton(event.buttonIndex)) {
|
|
25941
|
-
var target = this.findInputControl(event.globalPosition);
|
|
25942
|
-
if (target) {
|
|
25943
|
-
this.callGUIInput(target, event);
|
|
25944
|
-
}
|
|
25945
|
-
return;
|
|
25946
|
-
}
|
|
25947
|
-
var mask = getButtonMask(event.buttonIndex);
|
|
25948
|
-
if (event.isPressed()) {
|
|
25949
|
-
var target1 = this.gui.mouseFocusMask !== 0 ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
25950
|
-
this.gui.mouseFocus = target1;
|
|
25951
|
-
if (!target1) {
|
|
25952
|
-
return;
|
|
25953
|
-
}
|
|
25954
|
-
this.gui.mouseFocusMask |= mask;
|
|
25955
|
-
if (event.buttonIndex === MouseButton.Left) {
|
|
25956
|
-
this.gui.dragAccum.setZero();
|
|
25957
|
-
this.gui.dragAttempted = false;
|
|
25958
|
-
this.findClickFocus(target1);
|
|
25959
|
-
}
|
|
25960
|
-
this.callGUIInput(target1, event);
|
|
25961
|
-
} else {
|
|
25962
|
-
if (event.buttonIndex === MouseButton.Left && this.gui.dragging) {
|
|
25963
|
-
this.finishDrop(event.globalPosition);
|
|
25964
|
-
}
|
|
25965
|
-
this.gui.mouseFocusMask &= ~mask;
|
|
25966
|
-
var target2 = this.gui.mouseFocus;
|
|
25967
|
-
if (this.gui.mouseFocusMask === 0) {
|
|
25968
|
-
this.gui.mouseFocus = null;
|
|
25969
|
-
}
|
|
25970
|
-
if (this.isControlUsable(target2)) {
|
|
25971
|
-
this.callGUIInput(target2, event);
|
|
25972
|
-
}
|
|
25973
|
-
}
|
|
25974
|
-
};
|
|
25975
|
-
_proto.processMouseMotion = function processMouseMotion(event) {
|
|
25976
|
-
if (!this.gui.dragging && !this.gui.dragAttempted && this.gui.mouseFocus && (this.gui.mouseFocusMask & MouseButtonMask.Left) !== 0) {
|
|
25977
|
-
this.gui.dragAccum.add(event.relative);
|
|
25978
|
-
if (this.gui.dragAccum.length() > this.dragThreshold) {
|
|
25979
|
-
var origin = event.globalPosition.clone().subtract(this.gui.dragAccum);
|
|
25980
|
-
this.beginDragging(this.gui.mouseFocus, origin);
|
|
25981
|
-
this.gui.dragAttempted = true;
|
|
25982
|
-
}
|
|
25983
|
-
}
|
|
25984
|
-
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
25985
|
-
if (target) {
|
|
25986
|
-
this.callGUIInput(target, event);
|
|
25987
|
-
}
|
|
25988
|
-
if (this.gui.dragging) {
|
|
25989
|
-
this.gui.dragMouseOver = this.findDropTarget(this.findInputControl(event.globalPosition), event.globalPosition);
|
|
25990
|
-
}
|
|
25991
|
-
this.updateCursor(target, event.globalPosition);
|
|
25992
|
-
};
|
|
25993
|
-
_proto.processScreenTouch = function processScreenTouch(event) {
|
|
25994
|
-
var target;
|
|
25995
|
-
if (event.isPressed()) {
|
|
25996
|
-
target = this.findInputControl(event.position);
|
|
25997
|
-
if (target) {
|
|
25998
|
-
this.gui.touchFocus.set(event.index, target);
|
|
25999
|
-
}
|
|
26000
|
-
} else {
|
|
26001
|
-
var _this_gui_touchFocus_get;
|
|
26002
|
-
target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : null;
|
|
26003
|
-
this.gui.touchFocus.delete(event.index);
|
|
26004
|
-
}
|
|
26005
|
-
if (this.isControlUsable(target)) {
|
|
26006
|
-
this.callGUIInput(target, event);
|
|
26007
|
-
}
|
|
26008
|
-
};
|
|
26009
|
-
_proto.processScreenDrag = function processScreenDrag(event) {
|
|
26010
|
-
var _this_gui_touchFocus_get;
|
|
26011
|
-
var target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : this.findInputControl(event.position);
|
|
26012
|
-
if (this.isControlUsable(target)) {
|
|
26013
|
-
this.callGUIInput(target, event);
|
|
26014
|
-
}
|
|
26015
|
-
};
|
|
26016
|
-
_proto.callGUIInput = function callGUIInput(target, event) {
|
|
26017
|
-
var current = target;
|
|
26018
|
-
var pointerEvent = _instanceof1(event, InputEventMouse) || _instanceof1(event, InputEventScreenTouch) || _instanceof1(event, InputEventScreenDrag);
|
|
26019
|
-
while(current && current !== this && this.isControlUsable(current)){
|
|
26020
|
-
var filter = current.getEffectiveMouseFilter();
|
|
26021
|
-
if (filter !== MouseFilter.Ignore) {
|
|
26022
|
-
this.callControlInput(current, event.xformedBy(this.getGlobalInverse(current)));
|
|
26023
|
-
}
|
|
26024
|
-
var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
|
|
26025
|
-
if (this.inputHandled || filter === MouseFilter.Stop && pointerEvent && !forcePassWheel) {
|
|
26026
|
-
this.inputHandled = true;
|
|
26027
|
-
return;
|
|
26028
|
-
}
|
|
26029
|
-
current = current.parent;
|
|
26030
|
-
}
|
|
26031
|
-
};
|
|
26032
|
-
_proto.callControlInput = function callControlInput(control, event) {
|
|
26033
|
-
if (_instanceof1(event, InputEventMouseButton)) {
|
|
26034
|
-
if (isWheelButton(event.buttonIndex)) {
|
|
26035
|
-
control.onMouseWheel(event.position, getWheelDelta(event), event);
|
|
26036
|
-
} else if (event.isPressed()) {
|
|
26037
|
-
control.onMouseDown(event.position, event.buttonIndex, event);
|
|
26038
|
-
} else {
|
|
26039
|
-
control.onMouseUp(event.position, event.buttonIndex, event);
|
|
26040
|
-
}
|
|
26041
|
-
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
26042
|
-
control.onMouseMove(event.position, event);
|
|
26043
|
-
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
26044
|
-
if (event.isPressed()) {
|
|
26045
|
-
control.onTouchDown(event.position, event.index, event);
|
|
26046
|
-
} else {
|
|
26047
|
-
control.onTouchUp(event.position, event.index, event);
|
|
26048
|
-
}
|
|
26049
|
-
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
26050
|
-
control.onTouchMove(event.position, event.index, event);
|
|
26051
|
-
} else if (_instanceof1(event, InputEventKey)) {
|
|
26052
|
-
if (event.isPressed()) {
|
|
26053
|
-
control.onKeyDown(event);
|
|
26054
|
-
} else if (event.isReleased()) {
|
|
26055
|
-
control.onKeyUp(event);
|
|
26056
|
-
}
|
|
26057
|
-
}
|
|
26058
|
-
};
|
|
26059
|
-
_proto.findInputControl = function findInputControl(position) {
|
|
26060
|
-
this.canvases.sortCanvases();
|
|
26061
|
-
for(var index = this.canvases.children.length - 1; index >= 0; index--){
|
|
26062
|
-
var root = this.canvases.children[index];
|
|
26063
|
-
if (!root.canvas.isVisible || root.inputDisabled) {
|
|
26064
|
-
continue;
|
|
26065
|
-
}
|
|
26066
|
-
var target = this.findControlAtPosition(root, position, true);
|
|
26067
|
-
if (target) {
|
|
26068
|
-
return target;
|
|
26069
|
-
}
|
|
26070
|
-
}
|
|
26071
|
-
return null;
|
|
26072
|
-
};
|
|
26073
|
-
_proto.findControlAtPosition = function findControlAtPosition(container, position, skipSelf) {
|
|
26074
|
-
if (skipSelf === void 0) skipSelf = false;
|
|
26075
|
-
if (!container.visibleInHierarchy || container.isDisposed) {
|
|
26076
|
-
return null;
|
|
26077
|
-
}
|
|
26078
|
-
var localPosition = this.toLocal(container, position);
|
|
26079
|
-
if (container.clipContents && !container.hasPoint(localPosition)) {
|
|
26080
|
-
return null;
|
|
26081
|
-
}
|
|
26082
|
-
for(var index = container.children.length - 1; index >= 0; index--){
|
|
26083
|
-
var child = container.children[index];
|
|
26084
|
-
if (!child.visibleInHierarchy || child.isDisposed) {
|
|
26085
|
-
continue;
|
|
26086
|
-
}
|
|
26087
|
-
if (_instanceof1(child, ContainerControl)) {
|
|
26088
|
-
var found = this.findControlAtPosition(child, position);
|
|
26089
|
-
if (found) {
|
|
26090
|
-
return found;
|
|
26091
|
-
}
|
|
26092
|
-
} else if (child.getEffectiveMouseFilter() !== MouseFilter.Ignore && child.hasPoint(this.toLocal(child, position))) {
|
|
26093
|
-
return child;
|
|
26094
|
-
}
|
|
26095
|
-
}
|
|
26096
|
-
if (!skipSelf && container.getEffectiveMouseFilter() !== MouseFilter.Ignore && container.hasPoint(localPosition)) {
|
|
26097
|
-
return container;
|
|
26098
|
-
}
|
|
26099
|
-
return null;
|
|
26100
|
-
};
|
|
26101
|
-
_proto.updateMouseOver = function updateMouseOver(position) {
|
|
26102
|
-
if (this.gui.sendingMouseEnterExit) {
|
|
26103
|
-
this.gui.mouseOverUpdatePending = true;
|
|
26104
|
-
return;
|
|
26105
|
-
}
|
|
26106
|
-
this.gui.mouseOverUpdatePending = false;
|
|
26107
|
-
var target = this.findInputControl(position);
|
|
26108
|
-
var next = this.buildHoverHierarchy(target);
|
|
26109
|
-
var previous = this.gui.mouseOverHierarchy;
|
|
26110
|
-
var common = 0;
|
|
26111
|
-
while(common < previous.length && common < next.length && previous[common] === next[common]){
|
|
26112
|
-
common++;
|
|
26113
|
-
}
|
|
26114
|
-
this.gui.sendingMouseEnterExit = true;
|
|
26115
|
-
for(var index = previous.length - 1; index >= common; index--){
|
|
26116
|
-
if (!previous[index].isDisposed) {
|
|
26117
|
-
previous[index].onMouseLeave();
|
|
26118
|
-
}
|
|
26119
|
-
}
|
|
26120
|
-
for(var index1 = common; index1 < next.length; index1++){
|
|
26121
|
-
next[index1].onMouseEnter(this.toLocal(next[index1], position));
|
|
26122
|
-
}
|
|
26123
|
-
this.gui.sendingMouseEnterExit = false;
|
|
26124
|
-
this.gui.mouseOver = target;
|
|
26125
|
-
this.gui.mouseOverHierarchy = next;
|
|
26126
|
-
};
|
|
26127
|
-
_proto.buildHoverHierarchy = function buildHoverHierarchy(target) {
|
|
26128
|
-
var hierarchy = [];
|
|
26129
|
-
var current = target;
|
|
26130
|
-
while(current && current !== this){
|
|
26131
|
-
if (current.getEffectiveMouseFilter() !== MouseFilter.Ignore) {
|
|
26132
|
-
hierarchy.push(current);
|
|
26133
|
-
}
|
|
26134
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26135
|
-
break;
|
|
26136
|
-
}
|
|
26137
|
-
current = current.parent;
|
|
26138
|
-
}
|
|
26139
|
-
hierarchy.reverse();
|
|
26140
|
-
return hierarchy;
|
|
26141
|
-
};
|
|
26142
|
-
_proto.findClickFocus = function findClickFocus(target) {
|
|
26143
|
-
var current = target;
|
|
26144
|
-
while(current && current !== this){
|
|
26145
|
-
var mode = current.getFocusModeWithOverride();
|
|
26146
|
-
if (mode === FocusMode.Click || mode === FocusMode.All) {
|
|
26147
|
-
this.grabControlFocus(current);
|
|
26148
|
-
return;
|
|
26149
|
-
}
|
|
26150
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26151
|
-
return;
|
|
26152
|
-
}
|
|
26153
|
-
current = current.parent;
|
|
26154
|
-
}
|
|
26155
|
-
};
|
|
26156
|
-
_proto.beginDragging = function beginDragging(source, position) {
|
|
26157
|
-
var current = source;
|
|
26158
|
-
while(current && current !== this){
|
|
26159
|
-
var data = current.invokeGetDragData(this.toLocal(current, position));
|
|
26160
|
-
if (data !== null && data !== undefined) {
|
|
26161
|
-
this.gui.dragging = true;
|
|
26162
|
-
this.gui.dragData = data;
|
|
26163
|
-
this.gui.mouseFocus = null;
|
|
26164
|
-
this.gui.mouseFocusMask = MouseButtonMask.None;
|
|
26165
|
-
return;
|
|
26166
|
-
}
|
|
26167
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26168
|
-
return;
|
|
26169
|
-
}
|
|
26170
|
-
current = current.parent;
|
|
26171
|
-
}
|
|
26172
|
-
};
|
|
26173
|
-
_proto.finishDrop = function finishDrop(position) {
|
|
26174
|
-
var target = this.findDropTarget(this.findInputControl(position), position);
|
|
26175
|
-
if (target) {
|
|
26176
|
-
target.invokeDropData(this.toLocal(target, position), this.gui.dragData);
|
|
26177
|
-
}
|
|
26178
|
-
this.endDragging(!!target);
|
|
26179
|
-
};
|
|
26180
|
-
_proto.findDropTarget = function findDropTarget(target, position) {
|
|
26181
|
-
var current = target;
|
|
26182
|
-
while(current && current !== this){
|
|
26183
|
-
if (current.invokeCanDropData(this.toLocal(current, position), this.gui.dragData)) {
|
|
26184
|
-
return current;
|
|
26185
|
-
}
|
|
26186
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26187
|
-
return null;
|
|
26188
|
-
}
|
|
26189
|
-
current = current.parent;
|
|
26190
|
-
}
|
|
26191
|
-
return null;
|
|
26192
|
-
};
|
|
26193
|
-
_proto.endDragging = function endDragging(successful) {
|
|
26194
|
-
this.gui.dragSuccessful = successful;
|
|
26195
|
-
this.gui.dragging = false;
|
|
26196
|
-
this.gui.dragData = null;
|
|
26197
|
-
this.gui.dragMouseOver = null;
|
|
26198
|
-
};
|
|
26199
|
-
_proto.updateCursor = function updateCursor(target, position) {
|
|
26200
|
-
var current = target;
|
|
26201
|
-
var shape = CursorShape.Arrow;
|
|
26202
|
-
while(current && current !== this){
|
|
26203
|
-
var candidate = current.getCursorShape(this.toLocal(current, position));
|
|
26204
|
-
if (candidate !== CursorShape.Arrow) {
|
|
26205
|
-
shape = candidate;
|
|
26206
|
-
break;
|
|
26207
|
-
}
|
|
26208
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26209
|
-
break;
|
|
26210
|
-
}
|
|
26211
|
-
current = current.parent;
|
|
26212
|
-
}
|
|
26213
|
-
this.engine.canvas.style.cursor = cursorNames[shape];
|
|
26214
|
-
};
|
|
26215
|
-
_proto.postGrabClickFocus = function postGrabClickFocus() {
|
|
26216
|
-
var target = this.gui.mouseClickGrabber;
|
|
26217
|
-
this.gui.mouseClickGrabber = null;
|
|
26218
|
-
if (this.isControlUsable(target)) {
|
|
26219
|
-
this.gui.mouseFocus = target;
|
|
26220
|
-
}
|
|
26221
|
-
};
|
|
26222
|
-
_proto.cleanupInternalState = function cleanupInternalState() {
|
|
26223
|
-
if (!this.isControlUsable(this.gui.mouseFocus)) {
|
|
26224
|
-
this.dropMouseFocus();
|
|
26225
|
-
}
|
|
26226
|
-
if (this.gui.keyFocus && !this.isFocusTargetUsable(this.gui.keyFocus)) {
|
|
26227
|
-
this.releaseControlFocus(this.gui.keyFocus);
|
|
26228
|
-
}
|
|
26229
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26230
|
-
var _step_value = _step.value, index = _step_value[0], control = _step_value[1];
|
|
26231
|
-
if (!this.isControlUsable(control)) {
|
|
26232
|
-
this.gui.touchFocus.delete(index);
|
|
26233
|
-
}
|
|
26234
|
-
}
|
|
26235
|
-
};
|
|
26236
|
-
_proto.dropMouseFocus = function dropMouseFocus() {
|
|
26237
|
-
this.gui.mouseFocus = null;
|
|
26238
|
-
this.gui.mouseFocusMask = MouseButtonMask.None;
|
|
26239
|
-
};
|
|
26240
|
-
_proto.dropMouseOver = function dropMouseOver() {
|
|
26241
|
-
for(var index = this.gui.mouseOverHierarchy.length - 1; index >= 0; index--){
|
|
26242
|
-
var control = this.gui.mouseOverHierarchy[index];
|
|
26243
|
-
if (!control.isDisposed) {
|
|
26244
|
-
control.onMouseLeave();
|
|
26245
|
-
}
|
|
26246
|
-
}
|
|
26247
|
-
this.gui.mouseOver = null;
|
|
26248
|
-
this.gui.mouseOverHierarchy = [];
|
|
26249
|
-
};
|
|
26250
|
-
_proto.dropControlState = function dropControlState(control) {
|
|
26251
|
-
if (this.controlBelongsToSubtree(this.gui.mouseFocus, control)) {
|
|
26252
|
-
this.dropMouseFocus();
|
|
26253
|
-
}
|
|
26254
|
-
if (this.controlBelongsToSubtree(this.gui.mouseClickGrabber, control)) {
|
|
26255
|
-
this.gui.mouseClickGrabber = null;
|
|
26256
|
-
}
|
|
26257
|
-
if (this.controlBelongsToSubtree(this.gui.keyFocus, control)) {
|
|
26258
|
-
var _this_gui_keyFocus;
|
|
26259
|
-
this.releaseControlFocus((_this_gui_keyFocus = this.gui.keyFocus) != null ? _this_gui_keyFocus : undefined);
|
|
26260
|
-
}
|
|
26261
|
-
if (this.controlBelongsToSubtree(this.gui.mouseOver, control)) {
|
|
26262
|
-
this.dropMouseOver();
|
|
26263
|
-
}
|
|
26264
|
-
if (this.controlBelongsToSubtree(this.gui.dragMouseOver, control)) {
|
|
26265
|
-
this.gui.dragMouseOver = null;
|
|
26266
|
-
}
|
|
26267
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26268
|
-
var _step_value = _step.value, index = _step_value[0], target = _step_value[1];
|
|
26269
|
-
if (this.controlBelongsToSubtree(target, control)) {
|
|
26270
|
-
this.gui.touchFocus.delete(index);
|
|
26271
|
-
}
|
|
26272
|
-
}
|
|
26273
|
-
};
|
|
26274
|
-
_proto.requestMouseOverUpdate = function requestMouseOverUpdate() {
|
|
26275
|
-
if (Number.isFinite(this.gui.lastMousePosition.x)) {
|
|
26276
|
-
this.updateMouseOver(this.gui.lastMousePosition);
|
|
26277
|
-
}
|
|
26278
|
-
};
|
|
26279
|
-
_proto.getGlobalInverse = function getGlobalInverse(control) {
|
|
26280
|
-
var transform = control.getGlobalTransform2D().clone();
|
|
26281
|
-
return Math.abs(transform.determinant()) < 1e-12 ? new Matrix3() : transform.invert();
|
|
26282
|
-
};
|
|
26283
|
-
_proto.toLocal = function toLocal(control, position) {
|
|
26284
|
-
var elements = this.getGlobalInverse(control).elements;
|
|
26285
|
-
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
26286
|
-
};
|
|
26287
|
-
_proto.controlBelongsToSubtree = function controlBelongsToSubtree(control, subtree) {
|
|
26288
|
-
var current = control;
|
|
26289
|
-
while(current){
|
|
26290
|
-
if (current === subtree) {
|
|
26291
|
-
return true;
|
|
26292
|
-
}
|
|
26293
|
-
current = current.parent;
|
|
26294
|
-
}
|
|
26295
|
-
return false;
|
|
26296
|
-
};
|
|
26297
|
-
_proto.isControlValid = function isControlValid(control) {
|
|
26298
|
-
return !!control && !control.isDisposed && control.root === this;
|
|
26299
|
-
};
|
|
26300
|
-
_proto.isControlUsable = function isControlUsable(control) {
|
|
26301
|
-
if (!this.isControlValid(control) || !control.visibleInHierarchy || !control.enabledInHierarchy) {
|
|
26302
|
-
return false;
|
|
26303
|
-
}
|
|
26304
|
-
var root = this.findCanvasRoot(control);
|
|
26305
|
-
return !root || !root.inputDisabled;
|
|
26306
|
-
};
|
|
26307
|
-
_proto.findCanvasRoot = function findCanvasRoot(control) {
|
|
26308
|
-
var current = control;
|
|
26309
|
-
while(current && current !== this){
|
|
26310
|
-
if (_instanceof1(current, CanvasRootControl)) {
|
|
26311
|
-
return current;
|
|
26312
|
-
}
|
|
26313
|
-
current = current.parent;
|
|
26314
|
-
}
|
|
26315
|
-
return null;
|
|
26316
|
-
};
|
|
26317
|
-
_proto.isFocusTargetUsable = function isFocusTargetUsable(control) {
|
|
26318
|
-
return this.isControlUsable(control) && control.getFocusModeWithOverride() !== FocusMode.None;
|
|
26319
|
-
};
|
|
26320
|
-
return WindowRootControl;
|
|
26321
|
-
}(RootControl);
|
|
26322
|
-
|
|
26323
|
-
var CanvasRenderMode;
|
|
26324
|
-
(function(CanvasRenderMode) {
|
|
26325
|
-
CanvasRenderMode[CanvasRenderMode["ScreenSpace"] = 0] = "ScreenSpace";
|
|
26326
|
-
CanvasRenderMode[CanvasRenderMode["CameraSpace"] = 1] = "CameraSpace";
|
|
26327
|
-
CanvasRenderMode[CanvasRenderMode["WorldSpace"] = 2] = "WorldSpace";
|
|
26328
|
-
CanvasRenderMode[CanvasRenderMode["WorldSpaceFaceCamera"] = 3] = "WorldSpaceFaceCamera";
|
|
26329
|
-
})(CanvasRenderMode || (CanvasRenderMode = {}));
|
|
26330
|
-
/** Canvas-layer boundary attached to a VFXItem. Input state remains owned by the window root. */ var UICanvas = /*#__PURE__*/ function(Component) {
|
|
26331
|
-
_inherits(UICanvas, Component);
|
|
26332
|
-
function UICanvas(engine) {
|
|
26333
|
-
var _this;
|
|
26334
|
-
_this = Component.call(this, engine) || this;
|
|
26335
|
-
_this.renderMode = 0;
|
|
26336
|
-
_this.receivesEvents = true;
|
|
26337
|
-
_this._order = 0;
|
|
26338
|
-
_this.registered = false;
|
|
26339
|
-
_this.rootControl = new CanvasRootControl(engine, _assert_this_initialized(_this));
|
|
26340
|
-
return _this;
|
|
26341
|
-
}
|
|
26342
|
-
var _proto = UICanvas.prototype;
|
|
26343
|
-
_proto.onEnable = function onEnable() {
|
|
26344
|
-
this.register();
|
|
26345
|
-
};
|
|
26346
|
-
_proto.onDisable = function onDisable() {
|
|
26347
|
-
this.unregister();
|
|
26348
|
-
};
|
|
26349
|
-
_proto.onDestroy = function onDestroy() {
|
|
26350
|
-
this.destroyCanvas();
|
|
26351
|
-
};
|
|
26352
|
-
_proto.dispose = function dispose() {
|
|
26353
|
-
this.destroyCanvas();
|
|
26354
|
-
Component.prototype.dispose.call(this);
|
|
26355
|
-
};
|
|
26356
|
-
_proto.register = function register() {
|
|
26357
|
-
if (!this.registered) {
|
|
26358
|
-
this.rootControl.parent = this.engine.windowRoot.canvases;
|
|
26359
|
-
this.registered = true;
|
|
26360
|
-
}
|
|
26361
|
-
};
|
|
26362
|
-
_proto.unregister = function unregister() {
|
|
26363
|
-
if (this.registered) {
|
|
26364
|
-
this.rootControl.parent = null;
|
|
26365
|
-
this.registered = false;
|
|
26366
|
-
}
|
|
26367
|
-
};
|
|
26368
|
-
_proto.destroyCanvas = function destroyCanvas() {
|
|
26369
|
-
this.unregister();
|
|
26370
|
-
if (!this.rootControl.isDisposed) {
|
|
26371
|
-
this.rootControl.dispose();
|
|
26372
|
-
}
|
|
26373
|
-
};
|
|
26374
|
-
_create_class(UICanvas, [
|
|
26375
|
-
{
|
|
26376
|
-
key: "order",
|
|
26377
|
-
get: function get() {
|
|
26378
|
-
return this._order;
|
|
26379
|
-
},
|
|
26380
|
-
set: function set(value) {
|
|
26381
|
-
if (this._order !== value) {
|
|
26382
|
-
this._order = value;
|
|
26383
|
-
this.engine.windowRoot.canvases.sortCanvases();
|
|
26384
|
-
}
|
|
26385
|
-
}
|
|
26386
|
-
},
|
|
26387
|
-
{
|
|
26388
|
-
key: "isVisible",
|
|
26389
|
-
get: function get() {
|
|
26390
|
-
var _this_item;
|
|
26391
|
-
return this.renderMode === 0 && this.enabled && !!((_this_item = this.item) == null ? void 0 : _this_item.isActive);
|
|
26392
|
-
}
|
|
26393
|
-
}
|
|
26394
|
-
]);
|
|
26395
|
-
return UICanvas;
|
|
26396
|
-
}(Component);
|
|
26397
|
-
|
|
26398
|
-
/**
|
|
26399
|
-
* Scene-tree bridge for a GUI Control. The VFXItem tree owns lifecycle and
|
|
26400
|
-
* serialization while the Control tree owns layout, drawing and input.
|
|
26401
|
-
*/ var UIControl = /*#__PURE__*/ function(Component) {
|
|
26402
|
-
_inherits(UIControl, Component);
|
|
26403
|
-
function UIControl(engine) {
|
|
26404
|
-
var _this;
|
|
26405
|
-
_this = Component.call(this, engine) || this;
|
|
26406
|
-
_this.controlNode = null;
|
|
26407
|
-
_this.linkedItemTransform = null;
|
|
26408
|
-
_this.linkedControl = null;
|
|
26409
|
-
_this.syncingLocation = false;
|
|
26410
|
-
_this.itemTransformChanged = function() {
|
|
26411
|
-
return _this.syncItemLocationToControl();
|
|
26412
|
-
};
|
|
26413
|
-
_this.controlLocationChanged = function() {
|
|
26414
|
-
return _this.syncControlLocationToItem();
|
|
26415
|
-
};
|
|
26416
|
-
return _this;
|
|
26417
|
-
}
|
|
26418
|
-
var _proto = UIControl.prototype;
|
|
26419
|
-
_proto.onAwake = function onAwake() {
|
|
26420
|
-
this.syncControl();
|
|
26421
|
-
};
|
|
26422
|
-
_proto.onEnable = function onEnable() {
|
|
26423
|
-
if (this.controlNode) {
|
|
26424
|
-
this.controlNode.visible = this.item.isActive;
|
|
26425
|
-
this.controlNode.enabled = true;
|
|
26426
|
-
}
|
|
26427
|
-
};
|
|
26428
|
-
_proto.onDisable = function onDisable() {
|
|
26429
|
-
if (this.controlNode) {
|
|
26430
|
-
this.controlNode.visible = this.item.isActive;
|
|
26431
|
-
this.controlNode.enabled = false;
|
|
26432
|
-
}
|
|
26433
|
-
};
|
|
26434
|
-
_proto.onParentChanged = function onParentChanged() {
|
|
26435
|
-
this.syncControl();
|
|
26436
|
-
};
|
|
26437
|
-
_proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
26438
|
-
this.syncControlOrder();
|
|
26439
|
-
};
|
|
26440
|
-
_proto.onDestroy = function onDestroy() {
|
|
26441
|
-
this.disposeControl();
|
|
26442
|
-
};
|
|
26443
|
-
_proto.dispose = function dispose() {
|
|
26444
|
-
this.disposeControl();
|
|
26445
|
-
Component.prototype.dispose.call(this);
|
|
26446
|
-
};
|
|
26447
|
-
/** Unlinks the GUI object without disposing or modifying it. */ _proto.unlinkControl = function unlinkControl() {
|
|
26448
|
-
if (this.controlNode) {
|
|
26449
|
-
this.unbindLocationSync();
|
|
26450
|
-
this.controlNode = null;
|
|
26451
|
-
}
|
|
26452
|
-
};
|
|
26453
|
-
_proto.disposeControl = function disposeControl() {
|
|
26454
|
-
var control = this.controlNode;
|
|
26455
|
-
if (control) {
|
|
26456
|
-
this.unbindLocationSync();
|
|
26457
|
-
this.controlNode = null;
|
|
26458
|
-
control.dispose();
|
|
26459
|
-
}
|
|
26460
|
-
};
|
|
26461
|
-
_proto.syncControl = function syncControl() {
|
|
26462
|
-
var control = this.controlNode;
|
|
26463
|
-
if (!control || !this.item) {
|
|
26464
|
-
return;
|
|
26465
|
-
}
|
|
26466
|
-
this.syncingLocation = true;
|
|
26467
|
-
try {
|
|
26468
|
-
control.visible = this.item.isActive;
|
|
26469
|
-
control.enabled = this.enabled;
|
|
26470
|
-
control.parent = this.resolveParent();
|
|
26471
|
-
this.syncControlOrder();
|
|
26472
|
-
this.copyItemLocationToControl();
|
|
26473
|
-
} finally{
|
|
26474
|
-
this.syncingLocation = false;
|
|
26475
|
-
}
|
|
26476
|
-
this.bindLocationSync();
|
|
26477
|
-
};
|
|
26478
|
-
_proto.syncControlOrder = function syncControlOrder() {
|
|
26479
|
-
if (this.controlNode && this.item) {
|
|
26480
|
-
this.controlNode.indexInParent = this.item.orderInParent;
|
|
26481
|
-
}
|
|
26482
|
-
};
|
|
26483
|
-
_proto.resolveParent = function resolveParent() {
|
|
26484
|
-
var parentItem = this.item.parent;
|
|
26485
|
-
if (!parentItem) {
|
|
26486
|
-
var _UIControl_fallbackParentGetDelegate;
|
|
26487
|
-
return (_UIControl_fallbackParentGetDelegate = UIControl.fallbackParentGetDelegate == null ? void 0 : UIControl.fallbackParentGetDelegate.call(UIControl, this)) != null ? _UIControl_fallbackParentGetDelegate : null;
|
|
26488
|
-
}
|
|
26489
|
-
var uiControl = parentItem.getComponent(UIControl);
|
|
26490
|
-
if ((uiControl == null ? void 0 : uiControl.control) && "children" in uiControl.control) {
|
|
26491
|
-
return uiControl.control;
|
|
26492
|
-
}
|
|
26493
|
-
var canvas = parentItem.getComponent(UICanvas);
|
|
26494
|
-
var _canvas_rootControl, _ref;
|
|
26495
|
-
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;
|
|
26496
|
-
};
|
|
26497
|
-
_proto.bindLocationSync = function bindLocationSync() {
|
|
26498
|
-
var itemTransform = this.item.transform;
|
|
26499
|
-
var control = this.controlNode;
|
|
26500
|
-
if (this.linkedItemTransform === itemTransform && this.linkedControl === control) {
|
|
26501
|
-
return;
|
|
26502
|
-
}
|
|
26503
|
-
this.unbindLocationSync();
|
|
26504
|
-
if (control) {
|
|
26505
|
-
this.linkedItemTransform = itemTransform;
|
|
26506
|
-
this.linkedControl = control;
|
|
26507
|
-
itemTransform.on("changed", this.itemTransformChanged);
|
|
26508
|
-
control.on("locationChanged", this.controlLocationChanged);
|
|
26509
|
-
}
|
|
26510
|
-
};
|
|
26511
|
-
_proto.unbindLocationSync = function unbindLocationSync() {
|
|
26512
|
-
var _this_linkedItemTransform, _this_linkedControl;
|
|
26513
|
-
(_this_linkedItemTransform = this.linkedItemTransform) == null ? void 0 : _this_linkedItemTransform.off("changed", this.itemTransformChanged);
|
|
26514
|
-
(_this_linkedControl = this.linkedControl) == null ? void 0 : _this_linkedControl.off("locationChanged", this.controlLocationChanged);
|
|
26515
|
-
this.linkedItemTransform = null;
|
|
26516
|
-
this.linkedControl = null;
|
|
26517
|
-
};
|
|
26518
|
-
_proto.syncItemLocationToControl = function syncItemLocationToControl() {
|
|
26519
|
-
if (!this.syncingLocation && this.controlNode) {
|
|
26520
|
-
this.syncingLocation = true;
|
|
26521
|
-
try {
|
|
26522
|
-
this.copyItemLocationToControl();
|
|
26523
|
-
} finally{
|
|
26524
|
-
this.syncingLocation = false;
|
|
26525
|
-
}
|
|
26526
|
-
}
|
|
26527
|
-
};
|
|
26528
|
-
_proto.syncControlLocationToItem = function syncControlLocationToItem() {
|
|
26529
|
-
var control = this.controlNode;
|
|
26530
|
-
if (!this.syncingLocation && control) {
|
|
26531
|
-
var source = control.location;
|
|
26532
|
-
var target = this.item.transform.position;
|
|
26533
|
-
if (source.x !== target.x || source.y !== target.y) {
|
|
26534
|
-
this.syncingLocation = true;
|
|
26535
|
-
try {
|
|
26536
|
-
this.item.transform.setPosition(source.x, source.y, target.z);
|
|
26537
|
-
} finally{
|
|
26538
|
-
this.syncingLocation = false;
|
|
26539
|
-
}
|
|
26540
|
-
}
|
|
26541
|
-
}
|
|
26542
|
-
};
|
|
26543
|
-
_proto.copyItemLocationToControl = function copyItemLocationToControl() {
|
|
26544
|
-
var control = this.controlNode;
|
|
26545
|
-
if (control) {
|
|
26546
|
-
var source = this.item.transform.position;
|
|
26547
|
-
var target = control.location;
|
|
26548
|
-
if (source.x !== target.x || source.y !== target.y) {
|
|
26549
|
-
control.setPosition(source.x, source.y);
|
|
26550
|
-
}
|
|
26551
|
-
}
|
|
26552
|
-
};
|
|
26553
|
-
_create_class(UIControl, [
|
|
26554
|
-
{
|
|
26555
|
-
key: "control",
|
|
26556
|
-
get: function get() {
|
|
26557
|
-
return this.controlNode;
|
|
26558
|
-
},
|
|
26559
|
-
set: function set(value) {
|
|
26560
|
-
if (value === this.controlNode) {
|
|
26561
|
-
return;
|
|
26562
|
-
}
|
|
26563
|
-
this.disposeControl();
|
|
26564
|
-
if (value) {
|
|
26565
|
-
if (value.owner && value.owner !== this && value.owner.control === value) {
|
|
26566
|
-
throw new Error("A Control can only be owned by one UIControl.");
|
|
26567
|
-
}
|
|
26568
|
-
this.controlNode = value;
|
|
26569
|
-
value.owner = this;
|
|
26570
|
-
this.syncControl();
|
|
26571
|
-
}
|
|
26572
|
-
}
|
|
26573
|
-
},
|
|
26574
|
-
{
|
|
26575
|
-
key: "hasControl",
|
|
26576
|
-
get: function get() {
|
|
26577
|
-
return this.controlNode !== null;
|
|
26578
|
-
}
|
|
26579
|
-
}
|
|
26580
|
-
]);
|
|
26581
|
-
return UIControl;
|
|
26582
|
-
}(Component);
|
|
26583
|
-
|
|
26584
24748
|
var CameraController = /*#__PURE__*/ function(Component) {
|
|
26585
24749
|
_inherits(CameraController, Component);
|
|
26586
24750
|
function CameraController(engine, props) {
|
|
@@ -26615,6 +24779,42 @@ CameraController = __decorate([
|
|
|
26615
24779
|
effectsClass(DataType.CameraController)
|
|
26616
24780
|
], CameraController);
|
|
26617
24781
|
|
|
24782
|
+
function _get_prototype_of(o) {
|
|
24783
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
24784
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
24785
|
+
};
|
|
24786
|
+
return _get_prototype_of(o);
|
|
24787
|
+
}
|
|
24788
|
+
|
|
24789
|
+
function _is_native_function(fn) {
|
|
24790
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
24791
|
+
}
|
|
24792
|
+
|
|
24793
|
+
function _wrap_native_super(Class) {
|
|
24794
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
24795
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
24796
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
24797
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
24798
|
+
if (typeof _cache !== "undefined") {
|
|
24799
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
24800
|
+
_cache.set(Class, Wrapper);
|
|
24801
|
+
}
|
|
24802
|
+
function Wrapper() {
|
|
24803
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
24804
|
+
}
|
|
24805
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
24806
|
+
constructor: {
|
|
24807
|
+
value: Wrapper,
|
|
24808
|
+
enumerable: false,
|
|
24809
|
+
writable: true,
|
|
24810
|
+
configurable: true
|
|
24811
|
+
}
|
|
24812
|
+
});
|
|
24813
|
+
return _set_prototype_of(Wrapper, Class);
|
|
24814
|
+
};
|
|
24815
|
+
return _wrap_native_super(Class);
|
|
24816
|
+
}
|
|
24817
|
+
|
|
26618
24818
|
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
26619
24819
|
_inherits(CameraVFXItemLoader, Plugin);
|
|
26620
24820
|
function CameraVFXItemLoader() {
|
|
@@ -26623,6 +24823,255 @@ var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
|
26623
24823
|
return CameraVFXItemLoader;
|
|
26624
24824
|
}(_wrap_native_super(Plugin));
|
|
26625
24825
|
|
|
24826
|
+
var MouseButton;
|
|
24827
|
+
(function(MouseButton) {
|
|
24828
|
+
MouseButton[MouseButton["None"] = 0] = "None";
|
|
24829
|
+
MouseButton[MouseButton["Left"] = 1] = "Left";
|
|
24830
|
+
MouseButton[MouseButton["Right"] = 2] = "Right";
|
|
24831
|
+
MouseButton[MouseButton["Middle"] = 3] = "Middle";
|
|
24832
|
+
MouseButton[MouseButton["WheelUp"] = 4] = "WheelUp";
|
|
24833
|
+
MouseButton[MouseButton["WheelDown"] = 5] = "WheelDown";
|
|
24834
|
+
MouseButton[MouseButton["WheelLeft"] = 6] = "WheelLeft";
|
|
24835
|
+
MouseButton[MouseButton["WheelRight"] = 7] = "WheelRight";
|
|
24836
|
+
MouseButton[MouseButton["Xbutton1"] = 8] = "Xbutton1";
|
|
24837
|
+
MouseButton[MouseButton["Xbutton2"] = 9] = "Xbutton2";
|
|
24838
|
+
})(MouseButton || (MouseButton = {}));
|
|
24839
|
+
var MouseButtonMask;
|
|
24840
|
+
(function(MouseButtonMask) {
|
|
24841
|
+
MouseButtonMask[MouseButtonMask["None"] = 0] = "None";
|
|
24842
|
+
MouseButtonMask[MouseButtonMask["Left"] = 1] = "Left";
|
|
24843
|
+
MouseButtonMask[MouseButtonMask["Right"] = 2] = "Right";
|
|
24844
|
+
MouseButtonMask[MouseButtonMask["Middle"] = 4] = "Middle";
|
|
24845
|
+
MouseButtonMask[MouseButtonMask["Xbutton1"] = 128] = "Xbutton1";
|
|
24846
|
+
MouseButtonMask[MouseButtonMask["Xbutton2"] = 256] = "Xbutton2";
|
|
24847
|
+
})(MouseButtonMask || (MouseButtonMask = {}));
|
|
24848
|
+
var KeyLocation;
|
|
24849
|
+
(function(KeyLocation) {
|
|
24850
|
+
KeyLocation[KeyLocation["Unspecified"] = 0] = "Unspecified";
|
|
24851
|
+
KeyLocation[KeyLocation["Left"] = 1] = "Left";
|
|
24852
|
+
KeyLocation[KeyLocation["Right"] = 2] = "Right";
|
|
24853
|
+
})(KeyLocation || (KeyLocation = {}));
|
|
24854
|
+
|
|
24855
|
+
function transformPoint(transform, value) {
|
|
24856
|
+
var elements = transform.elements;
|
|
24857
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y + elements[6], elements[1] * value.x + elements[4] * value.y + elements[7]);
|
|
24858
|
+
}
|
|
24859
|
+
function transformVector(transform, value) {
|
|
24860
|
+
var elements = transform.elements;
|
|
24861
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y, elements[1] * value.x + elements[4] * value.y);
|
|
24862
|
+
}
|
|
24863
|
+
var InputEvent = /*#__PURE__*/ function() {
|
|
24864
|
+
function InputEvent() {
|
|
24865
|
+
this.device = 0;
|
|
24866
|
+
this.pressed = false;
|
|
24867
|
+
this.canceled = false;
|
|
24868
|
+
this._accepted = false;
|
|
24869
|
+
}
|
|
24870
|
+
var _proto = InputEvent.prototype;
|
|
24871
|
+
_proto.accept = function accept() {
|
|
24872
|
+
this._accepted = true;
|
|
24873
|
+
};
|
|
24874
|
+
_proto.clearAccepted = function clearAccepted() {
|
|
24875
|
+
this._accepted = false;
|
|
24876
|
+
};
|
|
24877
|
+
_proto.isAccepted = function isAccepted() {
|
|
24878
|
+
return this._accepted;
|
|
24879
|
+
};
|
|
24880
|
+
_proto.isPressed = function isPressed() {
|
|
24881
|
+
return this.pressed && !this.canceled;
|
|
24882
|
+
};
|
|
24883
|
+
_proto.isReleased = function isReleased() {
|
|
24884
|
+
return !this.pressed && !this.canceled;
|
|
24885
|
+
};
|
|
24886
|
+
_proto.isCanceled = function isCanceled() {
|
|
24887
|
+
return this.canceled;
|
|
24888
|
+
};
|
|
24889
|
+
_proto.isEcho = function isEcho() {
|
|
24890
|
+
return false;
|
|
24891
|
+
};
|
|
24892
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24893
|
+
return this;
|
|
24894
|
+
};
|
|
24895
|
+
return InputEvent;
|
|
24896
|
+
}();
|
|
24897
|
+
InputEvent.deviceIdEmulation = -1;
|
|
24898
|
+
InputEvent.deviceIdInternal = -2;
|
|
24899
|
+
InputEvent.deviceIdKeyboard = 16;
|
|
24900
|
+
InputEvent.deviceIdMouse = 32;
|
|
24901
|
+
var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
24902
|
+
_inherits(InputEventWithModifiers, InputEvent);
|
|
24903
|
+
function InputEventWithModifiers() {
|
|
24904
|
+
var _this;
|
|
24905
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24906
|
+
_this.commandOrControlAutoremap = false;
|
|
24907
|
+
_this.shiftPressed = false;
|
|
24908
|
+
_this.altPressed = false;
|
|
24909
|
+
_this.metaPressed = false;
|
|
24910
|
+
_this.ctrlPressed = false;
|
|
24911
|
+
return _this;
|
|
24912
|
+
}
|
|
24913
|
+
var _proto = InputEventWithModifiers.prototype;
|
|
24914
|
+
_proto.copyModifiersTo = function copyModifiersTo(event) {
|
|
24915
|
+
event.device = this.device;
|
|
24916
|
+
event.pressed = this.pressed;
|
|
24917
|
+
event.canceled = this.canceled;
|
|
24918
|
+
event.commandOrControlAutoremap = this.commandOrControlAutoremap;
|
|
24919
|
+
event.shiftPressed = this.shiftPressed;
|
|
24920
|
+
event.altPressed = this.altPressed;
|
|
24921
|
+
event.metaPressed = this.metaPressed;
|
|
24922
|
+
event.ctrlPressed = this.ctrlPressed;
|
|
24923
|
+
};
|
|
24924
|
+
return InputEventWithModifiers;
|
|
24925
|
+
}(_wrap_native_super(InputEvent));
|
|
24926
|
+
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24927
|
+
_inherits(InputEventKey, InputEventWithModifiers);
|
|
24928
|
+
function InputEventKey() {
|
|
24929
|
+
var _this;
|
|
24930
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24931
|
+
_this.keycode = "";
|
|
24932
|
+
_this.physicalKeycode = "";
|
|
24933
|
+
_this.keyLabel = "";
|
|
24934
|
+
_this.unicode = 0;
|
|
24935
|
+
_this.location = KeyLocation.Unspecified;
|
|
24936
|
+
_this.echo = false;
|
|
24937
|
+
return _this;
|
|
24938
|
+
}
|
|
24939
|
+
var _proto = InputEventKey.prototype;
|
|
24940
|
+
_proto.isEcho = function isEcho() {
|
|
24941
|
+
return this.echo;
|
|
24942
|
+
};
|
|
24943
|
+
return InputEventKey;
|
|
24944
|
+
}(InputEventWithModifiers);
|
|
24945
|
+
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24946
|
+
_inherits(InputEventMouse, InputEventWithModifiers);
|
|
24947
|
+
function InputEventMouse() {
|
|
24948
|
+
var _this;
|
|
24949
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24950
|
+
_this.buttonMask = MouseButtonMask.None;
|
|
24951
|
+
_this.position = new Vector2();
|
|
24952
|
+
_this.globalPosition = new Vector2();
|
|
24953
|
+
return _this;
|
|
24954
|
+
}
|
|
24955
|
+
var _proto = InputEventMouse.prototype;
|
|
24956
|
+
_proto.copyMouseTo = function copyMouseTo(event) {
|
|
24957
|
+
this.copyModifiersTo(event);
|
|
24958
|
+
event.buttonMask = this.buttonMask;
|
|
24959
|
+
event.position.copyFrom(this.position);
|
|
24960
|
+
event.globalPosition.copyFrom(this.globalPosition);
|
|
24961
|
+
};
|
|
24962
|
+
return InputEventMouse;
|
|
24963
|
+
}(InputEventWithModifiers);
|
|
24964
|
+
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
24965
|
+
_inherits(InputEventMouseButton, InputEventMouse);
|
|
24966
|
+
function InputEventMouseButton() {
|
|
24967
|
+
var _this;
|
|
24968
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24969
|
+
_this.factor = 1;
|
|
24970
|
+
_this.buttonIndex = MouseButton.None;
|
|
24971
|
+
_this.doubleClick = false;
|
|
24972
|
+
return _this;
|
|
24973
|
+
}
|
|
24974
|
+
var _proto = InputEventMouseButton.prototype;
|
|
24975
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24976
|
+
var event = new InputEventMouseButton();
|
|
24977
|
+
this.copyMouseTo(event);
|
|
24978
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24979
|
+
event.factor = this.factor;
|
|
24980
|
+
event.buttonIndex = this.buttonIndex;
|
|
24981
|
+
event.doubleClick = this.doubleClick;
|
|
24982
|
+
return event;
|
|
24983
|
+
};
|
|
24984
|
+
return InputEventMouseButton;
|
|
24985
|
+
}(InputEventMouse);
|
|
24986
|
+
var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
|
|
24987
|
+
_inherits(InputEventMouseMotion, InputEventMouse);
|
|
24988
|
+
function InputEventMouseMotion() {
|
|
24989
|
+
var _this;
|
|
24990
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24991
|
+
_this.tilt = new Vector2();
|
|
24992
|
+
_this.pressure = 0;
|
|
24993
|
+
_this.relative = new Vector2();
|
|
24994
|
+
_this.screenRelative = new Vector2();
|
|
24995
|
+
_this.velocity = new Vector2();
|
|
24996
|
+
_this.screenVelocity = new Vector2();
|
|
24997
|
+
_this.penInverted = false;
|
|
24998
|
+
return _this;
|
|
24999
|
+
}
|
|
25000
|
+
var _proto = InputEventMouseMotion.prototype;
|
|
25001
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
25002
|
+
var event = new InputEventMouseMotion();
|
|
25003
|
+
this.copyMouseTo(event);
|
|
25004
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
25005
|
+
event.tilt.copyFrom(this.tilt);
|
|
25006
|
+
event.pressure = this.pressure;
|
|
25007
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
25008
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
25009
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
25010
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
25011
|
+
event.penInverted = this.penInverted;
|
|
25012
|
+
return event;
|
|
25013
|
+
};
|
|
25014
|
+
return InputEventMouseMotion;
|
|
25015
|
+
}(InputEventMouse);
|
|
25016
|
+
var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
|
|
25017
|
+
_inherits(InputEventScreenTouch, InputEvent);
|
|
25018
|
+
function InputEventScreenTouch() {
|
|
25019
|
+
var _this;
|
|
25020
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
25021
|
+
_this.index = 0;
|
|
25022
|
+
_this.position = new Vector2();
|
|
25023
|
+
_this.doubleTap = false;
|
|
25024
|
+
return _this;
|
|
25025
|
+
}
|
|
25026
|
+
var _proto = InputEventScreenTouch.prototype;
|
|
25027
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
25028
|
+
var event = new InputEventScreenTouch();
|
|
25029
|
+
event.device = this.device;
|
|
25030
|
+
event.pressed = this.pressed;
|
|
25031
|
+
event.canceled = this.canceled;
|
|
25032
|
+
event.index = this.index;
|
|
25033
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
25034
|
+
event.doubleTap = this.doubleTap;
|
|
25035
|
+
return event;
|
|
25036
|
+
};
|
|
25037
|
+
return InputEventScreenTouch;
|
|
25038
|
+
}(_wrap_native_super(InputEvent));
|
|
25039
|
+
var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
25040
|
+
_inherits(InputEventScreenDrag, InputEvent);
|
|
25041
|
+
function InputEventScreenDrag() {
|
|
25042
|
+
var _this;
|
|
25043
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
25044
|
+
_this.index = 0;
|
|
25045
|
+
_this.position = new Vector2();
|
|
25046
|
+
_this.relative = new Vector2();
|
|
25047
|
+
_this.screenRelative = new Vector2();
|
|
25048
|
+
_this.velocity = new Vector2();
|
|
25049
|
+
_this.screenVelocity = new Vector2();
|
|
25050
|
+
_this.pressure = 0;
|
|
25051
|
+
_this.tilt = new Vector2();
|
|
25052
|
+
_this.penInverted = false;
|
|
25053
|
+
return _this;
|
|
25054
|
+
}
|
|
25055
|
+
var _proto = InputEventScreenDrag.prototype;
|
|
25056
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
25057
|
+
var event = new InputEventScreenDrag();
|
|
25058
|
+
event.device = this.device;
|
|
25059
|
+
event.pressed = this.pressed;
|
|
25060
|
+
event.canceled = this.canceled;
|
|
25061
|
+
event.index = this.index;
|
|
25062
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
25063
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
25064
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
25065
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
25066
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
25067
|
+
event.pressure = this.pressure;
|
|
25068
|
+
event.tilt.copyFrom(this.tilt);
|
|
25069
|
+
event.penInverted = this.penInverted;
|
|
25070
|
+
return event;
|
|
25071
|
+
};
|
|
25072
|
+
return InputEventScreenDrag;
|
|
25073
|
+
}(_wrap_native_super(InputEvent));
|
|
25074
|
+
|
|
26626
25075
|
var EVENT_TYPE_CLICK = "click";
|
|
26627
25076
|
var EVENT_TYPE_TOUCH_START = "touchstart";
|
|
26628
25077
|
var EVENT_TYPE_TOUCH_MOVE = "touchmove";
|
|
@@ -26633,49 +25082,52 @@ var PointerEventType;
|
|
|
26633
25082
|
PointerEventType[PointerEventType["PointerUp"] = 1] = "PointerUp";
|
|
26634
25083
|
PointerEventType[PointerEventType["PointerMove"] = 2] = "PointerMove";
|
|
26635
25084
|
})(PointerEventType || (PointerEventType = {}));
|
|
26636
|
-
var EventSystem = /*#__PURE__*/ function() {
|
|
25085
|
+
var EventSystem = /*#__PURE__*/ function(EventEmitter) {
|
|
25086
|
+
_inherits(EventSystem, EventEmitter);
|
|
26637
25087
|
function EventSystem(engine, allowPropagation) {
|
|
26638
|
-
var _this = this;
|
|
26639
25088
|
if (allowPropagation === void 0) allowPropagation = false;
|
|
26640
|
-
|
|
26641
|
-
|
|
26642
|
-
|
|
26643
|
-
|
|
26644
|
-
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
25089
|
+
var _this;
|
|
25090
|
+
_this = EventEmitter.call(this) || this;
|
|
25091
|
+
_this.engine = engine;
|
|
25092
|
+
_this.allowPropagation = allowPropagation;
|
|
25093
|
+
_this.skipPointerMovePicking = true;
|
|
25094
|
+
_this.emulateMouseFromTouch = true;
|
|
25095
|
+
_this.emulateTouchFromMouse = false;
|
|
25096
|
+
_this._enabled = true;
|
|
25097
|
+
_this.handlers = {};
|
|
25098
|
+
_this.nativeHandlers = [];
|
|
25099
|
+
_this.target = null;
|
|
25100
|
+
_this.mouseState = null;
|
|
25101
|
+
_this.mouseButtonMask = MouseButtonMask.None;
|
|
25102
|
+
_this.touchStates = new Map();
|
|
25103
|
+
_this.mouseFromTouchIndex = null;
|
|
25104
|
+
_this.touchFromMousePressed = false;
|
|
25105
|
+
_this.addedTabIndex = false;
|
|
25106
|
+
_this.addedOutlineStyle = false;
|
|
25107
|
+
_this.onNativeWheel = function(event) {
|
|
26656
25108
|
if (!_this.enabled || !_this.target) {
|
|
26657
25109
|
return;
|
|
26658
25110
|
}
|
|
26659
25111
|
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26660
25112
|
var handled = false;
|
|
26661
25113
|
if (event.deltaY !== 0) {
|
|
26662
|
-
handled = _this.pushWheelButton(event.deltaY < 0 ? MouseButton.WheelUp : MouseButton.WheelDown,
|
|
25114
|
+
handled = _this.pushWheelButton(event.deltaY < 0 ? MouseButton.WheelUp : MouseButton.WheelDown, normalizeWheelFactor(event.deltaY, event.deltaMode), position, event) || handled;
|
|
26663
25115
|
}
|
|
26664
25116
|
if (event.deltaX !== 0) {
|
|
26665
|
-
handled = _this.pushWheelButton(event.deltaX < 0 ? MouseButton.WheelLeft : MouseButton.WheelRight,
|
|
25117
|
+
handled = _this.pushWheelButton(event.deltaX < 0 ? MouseButton.WheelLeft : MouseButton.WheelRight, normalizeWheelFactor(event.deltaX, event.deltaMode), position, event) || handled;
|
|
26666
25118
|
}
|
|
26667
25119
|
_this.consumeNativeEvent(event, handled);
|
|
26668
25120
|
};
|
|
26669
|
-
|
|
25121
|
+
_this.onNativeKeyDown = function(event) {
|
|
26670
25122
|
_this.handleNativeKey(event, true);
|
|
26671
25123
|
};
|
|
26672
|
-
|
|
25124
|
+
_this.onNativeKeyUp = function(event) {
|
|
26673
25125
|
_this.handleNativeKey(event, false);
|
|
26674
25126
|
};
|
|
26675
|
-
|
|
25127
|
+
_this.onNativeMouseDown = function(event) {
|
|
26676
25128
|
_this.handleNativeMouseDown(event);
|
|
26677
25129
|
};
|
|
26678
|
-
|
|
25130
|
+
_this.onNativeMouseMove = function(event) {
|
|
26679
25131
|
var _state;
|
|
26680
25132
|
if (!_this.enabled || !_this.target) {
|
|
26681
25133
|
return;
|
|
@@ -26687,18 +25139,22 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26687
25139
|
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26688
25140
|
var velocity = _this.getVelocity(state, position);
|
|
26689
25141
|
var handled = _this.pushNativeMouseMotion(event, position, relative, velocity);
|
|
26690
|
-
(_state = state).
|
|
26691
|
-
if (!handled && (!state.pressed || !state.
|
|
25142
|
+
(_state = state).inputHandled || (_state.inputHandled = handled);
|
|
25143
|
+
if (!handled && (!state.pressed || !state.inputHandled)) {
|
|
26692
25144
|
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26693
25145
|
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
26694
25146
|
}
|
|
26695
25147
|
_this.updatePointerState(state, position);
|
|
26696
25148
|
_this.consumeNativeEvent(event, handled);
|
|
26697
25149
|
};
|
|
26698
|
-
|
|
25150
|
+
_this.onNativeMouseUp = function(event) {
|
|
26699
25151
|
if (!_this.enabled || !_this.target) {
|
|
26700
25152
|
return;
|
|
26701
25153
|
}
|
|
25154
|
+
// Keep the canonical mask in sync even when mouseState already ended on a
|
|
25155
|
+
// previous button release. The target and Window listeners may see the
|
|
25156
|
+
// same mouseup, but clearing a bit twice is intentionally idempotent.
|
|
25157
|
+
_this.setMouseButtonPressed(event.button, false);
|
|
26702
25158
|
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26703
25159
|
var existingState = _this.mouseState;
|
|
26704
25160
|
if (!(existingState == null ? void 0 : existingState.pressed)) {
|
|
@@ -26707,16 +25163,16 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26707
25163
|
var state = existingState;
|
|
26708
25164
|
var handled = _this.pushNativeMouseButton(event, position, false);
|
|
26709
25165
|
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26710
|
-
if (!state.
|
|
25166
|
+
if (!state.inputHandled && !handled && _this.isClick(state, position)) {
|
|
26711
25167
|
_this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26712
25168
|
}
|
|
26713
|
-
if (!handled && !state.
|
|
25169
|
+
if (!handled && !state.inputHandled) {
|
|
26714
25170
|
_this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26715
25171
|
}
|
|
26716
25172
|
_this.mouseState = null;
|
|
26717
|
-
_this.consumeNativeEvent(event, handled || state.
|
|
25173
|
+
_this.consumeNativeEvent(event, handled || state.inputHandled || !_this.allowPropagation);
|
|
26718
25174
|
};
|
|
26719
|
-
|
|
25175
|
+
_this.onNativeTouchStart = function(event) {
|
|
26720
25176
|
if (!_this.enabled) {
|
|
26721
25177
|
return;
|
|
26722
25178
|
}
|
|
@@ -26728,7 +25184,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26728
25184
|
_this.touchStates.set(touch.identifier, state);
|
|
26729
25185
|
state.pressed = true;
|
|
26730
25186
|
var handled = _this.pushNativeScreenTouch(touch.identifier, position, true, false, false);
|
|
26731
|
-
state.
|
|
25187
|
+
state.inputHandled = handled;
|
|
26732
25188
|
if (!handled) {
|
|
26733
25189
|
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26734
25190
|
_this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
@@ -26737,7 +25193,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26737
25193
|
}
|
|
26738
25194
|
_this.preventTouchDefaults(event);
|
|
26739
25195
|
};
|
|
26740
|
-
|
|
25196
|
+
_this.onNativeTouchMove = function(event) {
|
|
26741
25197
|
if (!_this.enabled) {
|
|
26742
25198
|
return;
|
|
26743
25199
|
}
|
|
@@ -26751,8 +25207,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26751
25207
|
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26752
25208
|
var velocity = _this.getVelocity(state, position);
|
|
26753
25209
|
var handled = _this.pushNativeScreenDrag(touch.identifier, position, relative, velocity);
|
|
26754
|
-
(_state = state).
|
|
26755
|
-
if (!handled && !state.
|
|
25210
|
+
(_state = state).inputHandled || (_state.inputHandled = handled);
|
|
25211
|
+
if (!handled && !state.inputHandled) {
|
|
26756
25212
|
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26757
25213
|
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
26758
25214
|
}
|
|
@@ -26761,24 +25217,26 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26761
25217
|
}
|
|
26762
25218
|
_this.preventTouchDefaults(event);
|
|
26763
25219
|
};
|
|
26764
|
-
|
|
25220
|
+
_this.onNativeTouchEnd = function(event) {
|
|
26765
25221
|
_this.handleNativeTouchEnd(event, false);
|
|
26766
25222
|
};
|
|
26767
|
-
|
|
25223
|
+
_this.onNativeTouchCancel = function(event) {
|
|
26768
25224
|
_this.handleNativeTouchEnd(event, true);
|
|
26769
25225
|
};
|
|
26770
|
-
|
|
26771
|
-
|
|
26772
|
-
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
_this.touchFromMousePressed = false;
|
|
26776
|
-
_this.engine.windowRoot.cancelPointerInput();
|
|
26777
|
-
}
|
|
25226
|
+
_this.onCanvasFocus = function() {
|
|
25227
|
+
_this.emit("canvasFocus");
|
|
25228
|
+
};
|
|
25229
|
+
_this.onCanvasBlur = function() {
|
|
25230
|
+
_this.emit("canvasBlur");
|
|
26778
25231
|
};
|
|
25232
|
+
return _this;
|
|
26779
25233
|
}
|
|
26780
25234
|
var _proto = EventSystem.prototype;
|
|
26781
|
-
|
|
25235
|
+
/**
|
|
25236
|
+
* Rebinds native input listeners to a canvas.
|
|
25237
|
+
*
|
|
25238
|
+
* Rebind or unbind only while there are no active key, mouse, touch, or drag sessions.
|
|
25239
|
+
*/ _proto.bindListeners = function bindListeners(target) {
|
|
26782
25240
|
this.unbindListeners();
|
|
26783
25241
|
this.target = target;
|
|
26784
25242
|
if (!target || typeof window === "undefined") {
|
|
@@ -26815,7 +25273,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26815
25273
|
});
|
|
26816
25274
|
this.addNativeHandler(target, "keydown", this.onNativeKeyDown);
|
|
26817
25275
|
this.addNativeHandler(target, "keyup", this.onNativeKeyUp);
|
|
26818
|
-
this.addNativeHandler(
|
|
25276
|
+
this.addNativeHandler(target, "focus", this.onCanvasFocus);
|
|
25277
|
+
this.addNativeHandler(target, "blur", this.onCanvasBlur);
|
|
26819
25278
|
};
|
|
26820
25279
|
_proto.dispatchEvent = function dispatchEvent(type, event) {
|
|
26821
25280
|
var handlers = this.handlers[type];
|
|
@@ -26849,11 +25308,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26849
25308
|
}
|
|
26850
25309
|
};
|
|
26851
25310
|
_proto.dispose = function dispose() {
|
|
26852
|
-
this.
|
|
26853
|
-
this.mouseState = null;
|
|
26854
|
-
this.touchStates.clear();
|
|
26855
|
-
this.mouseFromTouchIndex = null;
|
|
26856
|
-
this.touchFromMousePressed = false;
|
|
25311
|
+
this.resetInputState();
|
|
26857
25312
|
this.handlers = {};
|
|
26858
25313
|
this.unbindListeners();
|
|
26859
25314
|
this.target = null;
|
|
@@ -26862,13 +25317,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26862
25317
|
if (!this.enabled || !this.target) {
|
|
26863
25318
|
return;
|
|
26864
25319
|
}
|
|
26865
|
-
this.
|
|
25320
|
+
this.setMouseButtonPressed(event.button, true);
|
|
26866
25321
|
var position = this.getCanvasPosition(event.clientX, event.clientY);
|
|
25322
|
+
this.focusTarget();
|
|
26867
25323
|
var state = this.createPointerState(position);
|
|
26868
25324
|
this.mouseState = state;
|
|
26869
25325
|
state.pressed = true;
|
|
26870
25326
|
var handled = this.pushNativeMouseButton(event, position, true);
|
|
26871
|
-
state.
|
|
25327
|
+
state.inputHandled = handled;
|
|
26872
25328
|
if (!handled) {
|
|
26873
25329
|
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26874
25330
|
this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
@@ -26892,8 +25348,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26892
25348
|
input.altPressed = event.altKey;
|
|
26893
25349
|
input.metaPressed = event.metaKey;
|
|
26894
25350
|
input.ctrlPressed = event.ctrlKey;
|
|
26895
|
-
this.
|
|
26896
|
-
this.consumeNativeEvent(event, this.engine.windowRoot.isInputHandled());
|
|
25351
|
+
this.consumeNativeEvent(event, this.pushInput(input));
|
|
26897
25352
|
};
|
|
26898
25353
|
_proto.handleNativeTouchEnd = function handleNativeTouchEnd(event, canceled) {
|
|
26899
25354
|
if (!this.enabled) {
|
|
@@ -26908,14 +25363,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26908
25363
|
}
|
|
26909
25364
|
var handled = this.pushNativeScreenTouch(touch.identifier, position, false, canceled, false);
|
|
26910
25365
|
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26911
|
-
if (!canceled && !state.
|
|
25366
|
+
if (!canceled && !state.inputHandled && !handled && this.isClick(state, position)) {
|
|
26912
25367
|
this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26913
25368
|
}
|
|
26914
|
-
if (!handled && !canceled && !state.
|
|
25369
|
+
if (!handled && !canceled && !state.inputHandled) {
|
|
26915
25370
|
this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26916
25371
|
}
|
|
26917
25372
|
this.touchStates.delete(touch.identifier);
|
|
26918
|
-
this.consumeNativeEvent(event, handled || state.
|
|
25373
|
+
this.consumeNativeEvent(event, handled || state.inputHandled || !this.allowPropagation);
|
|
26919
25374
|
}
|
|
26920
25375
|
this.preventTouchDefaults(event);
|
|
26921
25376
|
};
|
|
@@ -26935,7 +25390,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26935
25390
|
};
|
|
26936
25391
|
_proto.pushNativeMouseMotion = function pushNativeMouseMotion(event, position, relative, velocity) {
|
|
26937
25392
|
var handled = false;
|
|
26938
|
-
if (this.touchFromMousePressed && (
|
|
25393
|
+
if (this.touchFromMousePressed && (this.mouseButtonMask & MouseButtonMask.Left) !== 0) {
|
|
26939
25394
|
handled = this.pushScreenDrag(0, position, relative, velocity, InputEvent.deviceIdEmulation);
|
|
26940
25395
|
}
|
|
26941
25396
|
return this.pushMouseMotion(event, position, relative, velocity) || handled;
|
|
@@ -26972,8 +25427,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26972
25427
|
input.pressed = pressed;
|
|
26973
25428
|
input.canceled = canceled;
|
|
26974
25429
|
input.doubleClick = doubleClick;
|
|
26975
|
-
this.
|
|
26976
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25430
|
+
return this.pushInput(input);
|
|
26977
25431
|
};
|
|
26978
25432
|
_proto.pushEmulatedMouseMotion = function pushEmulatedMouseMotion(position, relative, velocity) {
|
|
26979
25433
|
var input = new InputEventMouseMotion();
|
|
@@ -26986,42 +25440,42 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26986
25440
|
input.screenRelative.copyFrom(relative);
|
|
26987
25441
|
input.velocity.copyFrom(velocity);
|
|
26988
25442
|
input.screenVelocity.copyFrom(velocity);
|
|
26989
|
-
this.
|
|
26990
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25443
|
+
return this.pushInput(input);
|
|
26991
25444
|
};
|
|
26992
25445
|
_proto.pushMouseButton = function pushMouseButton(event, position, pressed) {
|
|
26993
25446
|
var input = new InputEventMouseButton();
|
|
26994
25447
|
this.copyMouseFields(input, event, position);
|
|
26995
25448
|
input.device = InputEvent.deviceIdMouse;
|
|
26996
25449
|
input.buttonIndex = getMouseButton(event.button);
|
|
26997
|
-
input.buttonMask =
|
|
25450
|
+
input.buttonMask = this.mouseButtonMask;
|
|
25451
|
+
input.pressed = pressed;
|
|
25452
|
+
input.doubleClick = event.detail > 1;
|
|
25453
|
+
return this.pushInput(input);
|
|
25454
|
+
};
|
|
25455
|
+
_proto.setMouseButtonPressed = function setMouseButtonPressed(button, pressed) {
|
|
25456
|
+
var buttonBit = getMouseButtonBit(getMouseButton(button));
|
|
26998
25457
|
if (pressed) {
|
|
26999
|
-
|
|
25458
|
+
this.mouseButtonMask |= buttonBit;
|
|
27000
25459
|
} else {
|
|
27001
|
-
|
|
25460
|
+
this.mouseButtonMask &= ~buttonBit;
|
|
27002
25461
|
}
|
|
27003
|
-
input.pressed = pressed;
|
|
27004
|
-
input.doubleClick = event.detail > 1;
|
|
27005
|
-
this.engine.windowRoot.pushInput(input);
|
|
27006
|
-
return this.engine.windowRoot.isInputHandled();
|
|
27007
25462
|
};
|
|
27008
25463
|
_proto.pushWheelButton = function pushWheelButton(button, factor, position, event) {
|
|
27009
25464
|
var input = new InputEventMouseButton();
|
|
27010
25465
|
this.copyMouseFields(input, event, position);
|
|
27011
25466
|
input.device = InputEvent.deviceIdMouse;
|
|
27012
25467
|
input.buttonIndex = button;
|
|
27013
|
-
input.buttonMask =
|
|
25468
|
+
input.buttonMask = this.mouseButtonMask;
|
|
27014
25469
|
input.factor = factor;
|
|
27015
25470
|
input.pressed = true;
|
|
27016
|
-
this.
|
|
27017
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25471
|
+
return this.pushInput(input);
|
|
27018
25472
|
};
|
|
27019
25473
|
_proto.pushMouseMotion = function pushMouseMotion(event, position, relative, velocity) {
|
|
27020
25474
|
var input = new InputEventMouseMotion();
|
|
27021
25475
|
this.copyMouseFields(input, event, position);
|
|
27022
25476
|
input.device = InputEvent.deviceIdMouse;
|
|
27023
|
-
input.buttonMask =
|
|
27024
|
-
input.pressed =
|
|
25477
|
+
input.buttonMask = this.mouseButtonMask;
|
|
25478
|
+
input.pressed = this.mouseButtonMask !== MouseButtonMask.None;
|
|
27025
25479
|
input.relative.copyFrom(relative);
|
|
27026
25480
|
input.screenRelative.copyFrom(relative);
|
|
27027
25481
|
input.velocity.copyFrom(velocity);
|
|
@@ -27030,8 +25484,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27030
25484
|
input.pressure = event.pressure;
|
|
27031
25485
|
input.tilt.set(event.tiltX, event.tiltY);
|
|
27032
25486
|
}
|
|
27033
|
-
this.
|
|
27034
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25487
|
+
return this.pushInput(input);
|
|
27035
25488
|
};
|
|
27036
25489
|
_proto.pushScreenTouch = function pushScreenTouch(index, position, pressed, canceled, doubleTap, device) {
|
|
27037
25490
|
var input = new InputEventScreenTouch();
|
|
@@ -27041,8 +25494,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27041
25494
|
input.pressed = pressed;
|
|
27042
25495
|
input.canceled = canceled;
|
|
27043
25496
|
input.doubleTap = doubleTap;
|
|
27044
|
-
this.
|
|
27045
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25497
|
+
return this.pushInput(input);
|
|
27046
25498
|
};
|
|
27047
25499
|
_proto.pushScreenDrag = function pushScreenDrag(index, position, relative, velocity, device) {
|
|
27048
25500
|
var input = new InputEventScreenDrag();
|
|
@@ -27054,8 +25506,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27054
25506
|
input.velocity.copyFrom(velocity);
|
|
27055
25507
|
input.screenVelocity.copyFrom(velocity);
|
|
27056
25508
|
input.pressed = true;
|
|
27057
|
-
this.
|
|
27058
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25509
|
+
return this.pushInput(input);
|
|
27059
25510
|
};
|
|
27060
25511
|
_proto.copyMouseFields = function copyMouseFields(input, event, position) {
|
|
27061
25512
|
input.position.copyFrom(position);
|
|
@@ -27130,7 +25581,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27130
25581
|
start: position.clone(),
|
|
27131
25582
|
last: position.clone(),
|
|
27132
25583
|
lastTime: performance.now(),
|
|
27133
|
-
|
|
25584
|
+
inputHandled: false,
|
|
27134
25585
|
pressed: false
|
|
27135
25586
|
};
|
|
27136
25587
|
return state;
|
|
@@ -27155,12 +25606,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27155
25606
|
var _target_width, _target_height;
|
|
27156
25607
|
return {
|
|
27157
25608
|
x: position.x / cssWidth * 2 - 1,
|
|
27158
|
-
|
|
25609
|
+
// Legacy composition picking uses bottom-left, Y-up NDC even though
|
|
25610
|
+
// standardized input follows the DOM convention of top-left, Y-down pixels.
|
|
25611
|
+
y: 1 - position.y / cssHeight * 2,
|
|
27159
25612
|
vx: velocity.x / cssWidth * 2,
|
|
27160
|
-
vy: velocity.y / cssHeight * 2,
|
|
25613
|
+
vy: -velocity.y / cssHeight * 2,
|
|
27161
25614
|
ts: performance.now(),
|
|
27162
25615
|
dx: (position.x - state.start.x) / cssWidth * 2,
|
|
27163
|
-
dy: (position.y - state.start.y) / cssHeight * 2,
|
|
25616
|
+
dy: -(position.y - state.start.y) / cssHeight * 2,
|
|
27164
25617
|
width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
|
|
27165
25618
|
height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
|
|
27166
25619
|
origin: origin
|
|
@@ -27172,7 +25625,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27172
25625
|
if (!rect) {
|
|
27173
25626
|
return new Vector2();
|
|
27174
25627
|
}
|
|
27175
|
-
return new Vector2(clientX - rect.left,
|
|
25628
|
+
return new Vector2(clientX - rect.left, clientY - rect.top);
|
|
27176
25629
|
};
|
|
27177
25630
|
_proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
|
|
27178
25631
|
if (handled && !this.allowPropagation) {
|
|
@@ -27182,15 +25635,26 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27182
25635
|
event.stopPropagation();
|
|
27183
25636
|
}
|
|
27184
25637
|
};
|
|
25638
|
+
_proto.pushInput = function pushInput(input) {
|
|
25639
|
+
input.clearAccepted();
|
|
25640
|
+
this.emit("input", input);
|
|
25641
|
+
return input.isAccepted();
|
|
25642
|
+
};
|
|
27185
25643
|
_proto.preventTouchDefaults = function preventTouchDefaults(event) {
|
|
27186
25644
|
if (event.cancelable) {
|
|
27187
25645
|
event.preventDefault();
|
|
27188
25646
|
}
|
|
27189
25647
|
};
|
|
27190
25648
|
_proto.focusTarget = function focusTarget() {
|
|
27191
|
-
|
|
27192
|
-
|
|
27193
|
-
|
|
25649
|
+
var _this_target;
|
|
25650
|
+
(_this_target = this.target) == null ? void 0 : _this_target.focus();
|
|
25651
|
+
};
|
|
25652
|
+
_proto.resetInputState = function resetInputState() {
|
|
25653
|
+
this.mouseState = null;
|
|
25654
|
+
this.mouseButtonMask = MouseButtonMask.None;
|
|
25655
|
+
this.touchStates.clear();
|
|
25656
|
+
this.mouseFromTouchIndex = null;
|
|
25657
|
+
this.touchFromMousePressed = false;
|
|
27194
25658
|
};
|
|
27195
25659
|
_proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
|
|
27196
25660
|
target.addEventListener(name, handler, options);
|
|
@@ -27222,23 +25686,20 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27222
25686
|
get: function get() {
|
|
27223
25687
|
return this._enabled;
|
|
27224
25688
|
},
|
|
27225
|
-
set:
|
|
25689
|
+
set: /**
|
|
25690
|
+
* Enables native input processing.
|
|
25691
|
+
*
|
|
25692
|
+
* Change this only while there are no active key, mouse, touch, or drag sessions.
|
|
25693
|
+
*/ function set(value) {
|
|
27226
25694
|
if (this._enabled === value) {
|
|
27227
25695
|
return;
|
|
27228
25696
|
}
|
|
27229
25697
|
this._enabled = value;
|
|
27230
|
-
if (!value) {
|
|
27231
|
-
this.mouseState = null;
|
|
27232
|
-
this.touchStates.clear();
|
|
27233
|
-
this.mouseFromTouchIndex = null;
|
|
27234
|
-
this.touchFromMousePressed = false;
|
|
27235
|
-
this.engine.windowRoot.cancelPointerInput();
|
|
27236
|
-
}
|
|
27237
25698
|
}
|
|
27238
25699
|
}
|
|
27239
25700
|
]);
|
|
27240
25701
|
return EventSystem;
|
|
27241
|
-
}();
|
|
25702
|
+
}(EventEmitter);
|
|
27242
25703
|
function getKeyLocation(location) {
|
|
27243
25704
|
if (location === 1) {
|
|
27244
25705
|
return KeyLocation.Left;
|
|
@@ -27269,25 +25730,6 @@ function getMouseButton(button) {
|
|
|
27269
25730
|
return MouseButton.None;
|
|
27270
25731
|
}
|
|
27271
25732
|
}
|
|
27272
|
-
function getMouseButtonMask(buttons) {
|
|
27273
|
-
var mask = MouseButtonMask.None;
|
|
27274
|
-
if ((buttons & 1) !== 0) {
|
|
27275
|
-
mask |= MouseButtonMask.Left;
|
|
27276
|
-
}
|
|
27277
|
-
if ((buttons & 2) !== 0) {
|
|
27278
|
-
mask |= MouseButtonMask.Right;
|
|
27279
|
-
}
|
|
27280
|
-
if ((buttons & 4) !== 0) {
|
|
27281
|
-
mask |= MouseButtonMask.Middle;
|
|
27282
|
-
}
|
|
27283
|
-
if ((buttons & 8) !== 0) {
|
|
27284
|
-
mask |= MouseButtonMask.Xbutton1;
|
|
27285
|
-
}
|
|
27286
|
-
if ((buttons & 16) !== 0) {
|
|
27287
|
-
mask |= MouseButtonMask.Xbutton2;
|
|
27288
|
-
}
|
|
27289
|
-
return mask;
|
|
27290
|
-
}
|
|
27291
25733
|
function getMouseButtonBit(button) {
|
|
27292
25734
|
switch(button){
|
|
27293
25735
|
case MouseButton.Left:
|
|
@@ -27304,6 +25746,16 @@ function getMouseButtonBit(button) {
|
|
|
27304
25746
|
return MouseButtonMask.None;
|
|
27305
25747
|
}
|
|
27306
25748
|
}
|
|
25749
|
+
function normalizeWheelFactor(delta, mode) {
|
|
25750
|
+
var magnitude = Math.abs(delta);
|
|
25751
|
+
if (mode === 1) {
|
|
25752
|
+
return magnitude / 3;
|
|
25753
|
+
}
|
|
25754
|
+
if (mode === 2) {
|
|
25755
|
+
return magnitude;
|
|
25756
|
+
}
|
|
25757
|
+
return magnitude / 100;
|
|
25758
|
+
}
|
|
27307
25759
|
|
|
27308
25760
|
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
27309
25761
|
_inherits(InteractLoader, Plugin);
|
|
@@ -29323,6 +27775,11 @@ SpritePropertyTrack = __decorate([
|
|
|
29323
27775
|
effectsClass("SpritePropertyTrack")
|
|
29324
27776
|
], SpritePropertyTrack);
|
|
29325
27777
|
|
|
27778
|
+
function _assert_this_initialized(self) {
|
|
27779
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
27780
|
+
return self;
|
|
27781
|
+
}
|
|
27782
|
+
|
|
29326
27783
|
var Cone = /*#__PURE__*/ function() {
|
|
29327
27784
|
function Cone(props) {
|
|
29328
27785
|
var _this = this;
|
|
@@ -39327,7 +37784,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
39327
37784
|
return ret;
|
|
39328
37785
|
}
|
|
39329
37786
|
|
|
39330
|
-
var version$1 = "2.10.0-alpha.
|
|
37787
|
+
var version$1 = "2.10.0-alpha.5";
|
|
39331
37788
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
39332
37789
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
39333
37790
|
var reverseParticle = false;
|
|
@@ -41323,9 +39780,11 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
41323
39780
|
// Instantiate composition rootItem
|
|
41324
39781
|
_this.sceneRoot = new VFXItem(_this.engine);
|
|
41325
39782
|
_this.sceneRoot.setParent(_this.root);
|
|
41326
|
-
_this.uiCanvas = _this.sceneRoot.addComponent(UICanvas);
|
|
41327
39783
|
if (sourceContent) {
|
|
41328
39784
|
_this.sceneRoot.setInstanceId(sourceContent.id);
|
|
39785
|
+
}
|
|
39786
|
+
PluginSystem.notifyCompositionCreating(_assert_this_initialized(_this), scene);
|
|
39787
|
+
if (sourceContent) {
|
|
41329
39788
|
_this.sceneRoot.instantiatePreComposition(sourceContent, false);
|
|
41330
39789
|
}
|
|
41331
39790
|
// 在 instantiatePreComposition 后设置 rootItem 的 name,避免 name 被覆盖
|
|
@@ -41894,9 +40353,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
41894
40353
|
},
|
|
41895
40354
|
set: function set(value) {
|
|
41896
40355
|
this._renderOrder = value;
|
|
41897
|
-
if (this.uiCanvas) {
|
|
41898
|
-
this.uiCanvas.order = value;
|
|
41899
|
-
}
|
|
41900
40356
|
}
|
|
41901
40357
|
},
|
|
41902
40358
|
{
|
|
@@ -41909,9 +40365,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
41909
40365
|
},
|
|
41910
40366
|
set: function set(value) {
|
|
41911
40367
|
this._interactive = !!value;
|
|
41912
|
-
if (this.uiCanvas) {
|
|
41913
|
-
this.uiCanvas.receivesEvents = this._interactive;
|
|
41914
|
-
}
|
|
41915
40368
|
}
|
|
41916
40369
|
},
|
|
41917
40370
|
{
|
|
@@ -43739,7 +42192,6 @@ var DEFAULT_FPS = 60;
|
|
|
43739
42192
|
_this.objectInstance = {};
|
|
43740
42193
|
_this.root = new VFXItem(_assert_this_initialized(_this));
|
|
43741
42194
|
_this.root.name = "root";
|
|
43742
|
-
_this.windowRoot = new WindowRootControl(_assert_this_initialized(_this));
|
|
43743
42195
|
_this.whiteTexture = generateWhiteTexture(_assert_this_initialized(_this));
|
|
43744
42196
|
_this.transparentTexture = generateEmptyTexture(_assert_this_initialized(_this));
|
|
43745
42197
|
if (!(options == null ? void 0 : options.manualRender)) {
|
|
@@ -43892,7 +42344,7 @@ var DEFAULT_FPS = 60;
|
|
|
43892
42344
|
(_this_ticker1 = this.ticker) == null ? void 0 : _this_ticker1.pause();
|
|
43893
42345
|
return;
|
|
43894
42346
|
}
|
|
43895
|
-
this.
|
|
42347
|
+
this.emit("update", dt);
|
|
43896
42348
|
// Tick compositions onPreRender
|
|
43897
42349
|
//-------------------------------------------------------------------------
|
|
43898
42350
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -43907,7 +42359,7 @@ var DEFAULT_FPS = 60;
|
|
|
43907
42359
|
var composition2 = _step2.value;
|
|
43908
42360
|
composition2.renderContent();
|
|
43909
42361
|
}
|
|
43910
|
-
this.
|
|
42362
|
+
this.emit("postrender");
|
|
43911
42363
|
this.renderTargetPool.flush();
|
|
43912
42364
|
};
|
|
43913
42365
|
/**
|
|
@@ -43949,7 +42401,6 @@ var DEFAULT_FPS = 60;
|
|
|
43949
42401
|
this.canvas.style.height = containerHeight + "px";
|
|
43950
42402
|
logger.info("Resize engine " + this.name + " [" + canvasWidth + "," + canvasHeight + "," + containerWidth + "," + containerHeight + "].");
|
|
43951
42403
|
this.setSize(canvasWidth, canvasHeight);
|
|
43952
|
-
this.windowRoot.resize(canvasWidth, canvasHeight);
|
|
43953
42404
|
}
|
|
43954
42405
|
};
|
|
43955
42406
|
_proto.setSize = function setSize(width, height) {
|
|
@@ -44155,6 +42606,12 @@ var DEFAULT_FPS = 60;
|
|
|
44155
42606
|
_proto.setStencilTest = function setStencilTest(enable) {
|
|
44156
42607
|
// OVERRIDE
|
|
44157
42608
|
};
|
|
42609
|
+
_proto.setScissorTest = function setScissorTest(enable) {
|
|
42610
|
+
// OVERRIDE
|
|
42611
|
+
};
|
|
42612
|
+
_proto.setScissor = function setScissor(x, y, width, height) {
|
|
42613
|
+
// OVERRIDE
|
|
42614
|
+
};
|
|
44158
42615
|
_proto.setCulling = function setCulling(enable) {
|
|
44159
42616
|
// OVERRIDE
|
|
44160
42617
|
};
|
|
@@ -44232,7 +42689,6 @@ var DEFAULT_FPS = 60;
|
|
|
44232
42689
|
composition.dispose();
|
|
44233
42690
|
}
|
|
44234
42691
|
this.root.dispose();
|
|
44235
|
-
this.windowRoot.dispose();
|
|
44236
42692
|
(_this_assetService = this.assetService) == null ? void 0 : _this_assetService.dispose();
|
|
44237
42693
|
(_this__graphics = this._graphics) == null ? void 0 : _this__graphics.dispose();
|
|
44238
42694
|
this.renderPasses.forEach(function(pass) {
|
|
@@ -44557,8 +43013,8 @@ registerPlugin("text", TextLoader);
|
|
|
44557
43013
|
registerPlugin("sprite", SpriteLoader);
|
|
44558
43014
|
registerPlugin("particle", ParticleLoader);
|
|
44559
43015
|
registerPlugin("interact", InteractLoader);
|
|
44560
|
-
var version = "2.10.0-alpha.
|
|
43016
|
+
var version = "2.10.0-alpha.5";
|
|
44561
43017
|
logger.info("Core version: " + version + ".");
|
|
44562
43018
|
|
|
44563
|
-
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,
|
|
43019
|
+
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, Circle$1 as Circle, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, 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, 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, MouseButton, MouseButtonMask, 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, 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, UpdateModes, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, VertexBuffer, WeightedMode, 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 };
|
|
44564
43020
|
//# sourceMappingURL=index.mjs.map
|