@galacean/effects-threejs 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/index.js +753 -2305
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +754 -2298
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.10.0-alpha.
|
|
6
|
+
* Version: v2.10.0-alpha.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -2934,6 +2934,11 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
2934
2934
|
PluginSystem.getPlugins = function getPlugins() {
|
|
2935
2935
|
return plugins;
|
|
2936
2936
|
};
|
|
2937
|
+
PluginSystem.notifyCompositionCreating = function notifyCompositionCreating(composition, scene) {
|
|
2938
|
+
plugins.forEach(function(plugin) {
|
|
2939
|
+
return plugin.onCompositionCreating(composition, scene);
|
|
2940
|
+
});
|
|
2941
|
+
};
|
|
2937
2942
|
PluginSystem.notifyCompositionCreated = function notifyCompositionCreated(composition, scene) {
|
|
2938
2943
|
plugins.forEach(function(plugin) {
|
|
2939
2944
|
return plugin.onCompositionCreated(composition, scene);
|
|
@@ -3026,6 +3031,12 @@ function getPluginUsageInfo(name) {
|
|
|
3026
3031
|
* @param engine - 引擎实例
|
|
3027
3032
|
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
3028
3033
|
/**
|
|
3034
|
+
* 合成内容开始创建前触发。
|
|
3035
|
+
* 此时 root、pluginRoot 和 sceneRoot 已创建,但场景内容尚未实例化。
|
|
3036
|
+
* @param composition - 正在创建的合成对象
|
|
3037
|
+
* @param scene - 场景对象
|
|
3038
|
+
*/ _proto.onCompositionCreating = function onCompositionCreating(composition, scene) {};
|
|
3039
|
+
/**
|
|
3029
3040
|
* 合成创建完成后触发。
|
|
3030
3041
|
* @param composition - 合成对象
|
|
3031
3042
|
* @param scene - 场景对象
|
|
@@ -15634,35 +15645,35 @@ function vecMulCombine(out, a, b) {
|
|
|
15634
15645
|
}
|
|
15635
15646
|
return out;
|
|
15636
15647
|
}
|
|
15637
|
-
var _obj$
|
|
15638
|
-
var particleOriginTranslateMap$1 = (_obj$
|
|
15648
|
+
var _obj$6;
|
|
15649
|
+
var particleOriginTranslateMap$1 = (_obj$6 = {}, _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
15639
15650
|
0,
|
|
15640
15651
|
0
|
|
15641
|
-
], _obj$
|
|
15652
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
15642
15653
|
0,
|
|
15643
15654
|
-0.5
|
|
15644
|
-
], _obj$
|
|
15655
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
15645
15656
|
0,
|
|
15646
15657
|
0.5
|
|
15647
|
-
], _obj$
|
|
15658
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
15648
15659
|
-0.5,
|
|
15649
15660
|
0.5
|
|
15650
|
-
], _obj$
|
|
15661
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
15651
15662
|
-0.5,
|
|
15652
15663
|
0
|
|
15653
|
-
], _obj$
|
|
15664
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
15654
15665
|
-0.5,
|
|
15655
15666
|
-0.5
|
|
15656
|
-
], _obj$
|
|
15667
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
15657
15668
|
0.5,
|
|
15658
15669
|
0
|
|
15659
|
-
], _obj$
|
|
15670
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
15660
15671
|
0.5,
|
|
15661
15672
|
-0.5
|
|
15662
|
-
], _obj$
|
|
15673
|
+
], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
15663
15674
|
0.5,
|
|
15664
15675
|
0.5
|
|
15665
|
-
], _obj$
|
|
15676
|
+
], _obj$6);
|
|
15666
15677
|
function nearestPowerOfTwo(value) {
|
|
15667
15678
|
return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
|
|
15668
15679
|
}
|
|
@@ -17400,27 +17411,27 @@ function oldBezierKeyFramesToNew(props) {
|
|
|
17400
17411
|
* 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
|
|
17401
17412
|
* props 为 [[time, value], ...],value 为已解析的对象引用实例。
|
|
17402
17413
|
*/ var REFERENCE_CURVE = 28;
|
|
17403
|
-
var _obj$
|
|
17404
|
-
var map$1 = (_obj$
|
|
17414
|
+
var _obj$5;
|
|
17415
|
+
var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
|
|
17405
17416
|
if (_instanceof1(props[0], Array)) {
|
|
17406
17417
|
return new RandomVectorValue(props);
|
|
17407
17418
|
}
|
|
17408
17419
|
return new RandomValue(props);
|
|
17409
|
-
}, _obj$
|
|
17420
|
+
}, _obj$5[ValueType.CONSTANT] = function(props) {
|
|
17410
17421
|
return new StaticValue(props);
|
|
17411
|
-
}, _obj$
|
|
17422
|
+
}, _obj$5[ValueType.CONSTANT_VEC2] = function(props) {
|
|
17412
17423
|
return new StaticValue(props);
|
|
17413
|
-
}, _obj$
|
|
17424
|
+
}, _obj$5[ValueType.CONSTANT_VEC3] = function(props) {
|
|
17414
17425
|
return new StaticValue(props);
|
|
17415
|
-
}, _obj$
|
|
17426
|
+
}, _obj$5[ValueType.CONSTANT_VEC4] = function(props) {
|
|
17416
17427
|
return new StaticValue(props);
|
|
17417
|
-
}, _obj$
|
|
17428
|
+
}, _obj$5[ValueType.RGBA_COLOR] = function(props) {
|
|
17418
17429
|
return new StaticValue(props);
|
|
17419
|
-
}, _obj$
|
|
17430
|
+
}, _obj$5[ValueType.COLORS] = function(props) {
|
|
17420
17431
|
return new RandomSetValue(props.map(function(c) {
|
|
17421
17432
|
return colorToArr$1(c, false);
|
|
17422
17433
|
}));
|
|
17423
|
-
}, _obj$
|
|
17434
|
+
}, _obj$5[ValueType.LINE] = function(props) {
|
|
17424
17435
|
if (props.length === 2 && props[0][0] === 0 && props[1][0] === 1) {
|
|
17425
17436
|
return new LinearValue([
|
|
17426
17437
|
props[0][1],
|
|
@@ -17428,38 +17439,38 @@ var map$1 = (_obj$6 = {}, _obj$6[ValueType.RANDOM] = function(props) {
|
|
|
17428
17439
|
]);
|
|
17429
17440
|
}
|
|
17430
17441
|
return new LineSegments(props);
|
|
17431
|
-
}, _obj$
|
|
17442
|
+
}, _obj$5[ValueType.GRADIENT_COLOR] = function(props) {
|
|
17432
17443
|
return new GradientValue(props);
|
|
17433
|
-
}, _obj$
|
|
17444
|
+
}, _obj$5[ValueType.LINEAR_PATH] = function(pros) {
|
|
17434
17445
|
return new PathSegments(pros);
|
|
17435
|
-
}, _obj$
|
|
17446
|
+
}, _obj$5[ValueType.BEZIER_CURVE] = function(props) {
|
|
17436
17447
|
if (props.length === 1) {
|
|
17437
17448
|
return new StaticValue(props[0][1][1]);
|
|
17438
17449
|
}
|
|
17439
17450
|
return new BezierCurve(props);
|
|
17440
|
-
}, _obj$
|
|
17451
|
+
}, _obj$5[ValueType.BEZIER_CURVE_PATH] = function(props) {
|
|
17441
17452
|
if (props[0].length === 1) {
|
|
17442
17453
|
return new StaticValue(_construct(Vector3, [].concat(props[1][0])));
|
|
17443
17454
|
}
|
|
17444
17455
|
return new BezierCurvePath(props);
|
|
17445
|
-
}, _obj$
|
|
17456
|
+
}, _obj$5[ValueType.BEZIER_CURVE_QUAT] = function(props) {
|
|
17446
17457
|
if (props[0].length === 1) {
|
|
17447
17458
|
return new StaticValue(_construct(Quaternion, [].concat(props[1][0])));
|
|
17448
17459
|
}
|
|
17449
17460
|
return new BezierCurveQuat(props);
|
|
17450
|
-
}, _obj$
|
|
17461
|
+
}, _obj$5[ValueType.COLOR_CURVE] = function(props) {
|
|
17451
17462
|
return new ColorCurve(props);
|
|
17452
|
-
}, _obj$
|
|
17463
|
+
}, _obj$5[ValueType.VECTOR4_CURVE] = function(props) {
|
|
17453
17464
|
return new Vector4Curve(props);
|
|
17454
|
-
}, _obj$
|
|
17465
|
+
}, _obj$5[ValueType.VECTOR2_CURVE] = function(props) {
|
|
17455
17466
|
return new Vector2Curve(props);
|
|
17456
17467
|
}, // TODO: add spec
|
|
17457
|
-
_obj$
|
|
17468
|
+
_obj$5[VECTOR3_CURVE] = function(props) {
|
|
17458
17469
|
return new Vector3Curve(props);
|
|
17459
17470
|
}, // 对象引用阶梯曲线(不插值):props.data 为 [time, value][],value 已解析为 EffectsObject
|
|
17460
|
-
_obj$
|
|
17471
|
+
_obj$5[REFERENCE_CURVE] = function(props) {
|
|
17461
17472
|
return new ReferenceCurve(props);
|
|
17462
|
-
}, _obj$
|
|
17473
|
+
}, _obj$5);
|
|
17463
17474
|
function createValueGetter(args) {
|
|
17464
17475
|
if (!args || !isNaN(+args)) {
|
|
17465
17476
|
return new StaticValue(args || 0);
|
|
@@ -21400,8 +21411,8 @@ var vertexBufferSemanticMap = {
|
|
|
21400
21411
|
TANGENT_BS2: "aTargetTangent2",
|
|
21401
21412
|
TANGENT_BS3: "aTargetTangent3"
|
|
21402
21413
|
};
|
|
21403
|
-
var _obj$
|
|
21404
|
-
var BYTES_TYPE_MAP = (_obj$
|
|
21414
|
+
var _obj$4;
|
|
21415
|
+
var BYTES_TYPE_MAP = (_obj$4 = {}, _obj$4[BufferDataType.Float] = 4, _obj$4[BufferDataType.Int] = 4, _obj$4[BufferDataType.UnsignedInt] = 4, _obj$4[BufferDataType.Short] = 2, _obj$4[BufferDataType.UnsignedShort] = 2, _obj$4[BufferDataType.Byte] = 1, _obj$4[BufferDataType.UnsignedByte] = 1, _obj$4);
|
|
21405
21416
|
function generateEmptyTypedArray(type) {
|
|
21406
21417
|
return createTypedArray(type, 0);
|
|
21407
21418
|
}
|
|
@@ -22918,7 +22929,7 @@ var canvasPool = new CanvasPool();
|
|
|
22918
22929
|
* `ATLAS_SIZE × ATLAS_SIZE` 的离屏 canvas atlas,字符按需逐个绘制并打包,
|
|
22919
22930
|
* `Graphics.drawText` 通过逐字 quad 引用 atlas 子矩形渲染。
|
|
22920
22931
|
*
|
|
22921
|
-
* - 同一段文本不同颜色不会重复 upload(颜色由顶点 `vColor`
|
|
22932
|
+
* - 同一段文本不同颜色不会重复 upload(颜色由顶点 `vColor` 与字形 RGBA 相乘)
|
|
22922
22933
|
* - 同一字体/字号下重复字符只渲染一次,显著减少 canvas → texture 上传次数
|
|
22923
22934
|
*
|
|
22924
22935
|
* 入参全部展开(避免调用方每帧创建临时 style 对象触发 GC)
|
|
@@ -22932,7 +22943,7 @@ var canvasPool = new CanvasPool();
|
|
|
22932
22943
|
/**
|
|
22933
22944
|
* 取(必要时新建)对应字体的字符 atlas
|
|
22934
22945
|
*/ _proto.getAtlas = function getAtlas(fontSize, fontFamily, fontWeight, fontStyle) {
|
|
22935
|
-
//
|
|
22946
|
+
// 字形 atlas 跟随 Engine.pixelRatio。
|
|
22936
22947
|
var resolution = this.engine.pixelRatio;
|
|
22937
22948
|
if (resolution !== this.resolution) {
|
|
22938
22949
|
this.clear();
|
|
@@ -22953,14 +22964,11 @@ var canvasPool = new CanvasPool();
|
|
|
22953
22964
|
var probeCtx = probeCanvasAndContext.context;
|
|
22954
22965
|
var ascentPx = fontSize * 0.8 * resolution;
|
|
22955
22966
|
var descentPx = fontSize * 0.2 * resolution;
|
|
22956
|
-
|
|
22957
|
-
|
|
22958
|
-
|
|
22959
|
-
|
|
22960
|
-
|
|
22961
|
-
} finally{
|
|
22962
|
-
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22963
|
-
}
|
|
22967
|
+
probeCtx.font = scaledFontString;
|
|
22968
|
+
var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
|
|
22969
|
+
ascentPx = m.actualBoundingBoxAscent || ascentPx;
|
|
22970
|
+
descentPx = m.actualBoundingBoxDescent || descentPx;
|
|
22971
|
+
canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
|
|
22964
22972
|
var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle, resolution);
|
|
22965
22973
|
this.atlases.set(fontKey, atlas);
|
|
22966
22974
|
return atlas;
|
|
@@ -22996,6 +23004,10 @@ var FULL_REGION = {
|
|
|
22996
23004
|
u1: 1,
|
|
22997
23005
|
v1: 1
|
|
22998
23006
|
};
|
|
23007
|
+
var NINE_PATCH_DRAW_SOURCE_SIZE = "aDrawSourceSize";
|
|
23008
|
+
var NINE_PATCH_SOURCE_RECT = "aSourceRect";
|
|
23009
|
+
var NINE_PATCH_MARGINS = "aMargins";
|
|
23010
|
+
var NINE_PATCH_OPTIONS = "aOptions";
|
|
22999
23011
|
var Graphics = /*#__PURE__*/ function() {
|
|
23000
23012
|
function Graphics(engine) {
|
|
23001
23013
|
this.engine = engine;
|
|
@@ -23009,6 +23021,10 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23009
23021
|
this.colors = [];
|
|
23010
23022
|
this.uvs = [];
|
|
23011
23023
|
this.indices = [];
|
|
23024
|
+
this.ninePatchDrawSourceSizes = [];
|
|
23025
|
+
this.ninePatchSourceRects = [];
|
|
23026
|
+
this.ninePatchMargins = [];
|
|
23027
|
+
this.ninePatchOptions = [];
|
|
23012
23028
|
this.lineStyle = {
|
|
23013
23029
|
width: 1,
|
|
23014
23030
|
alignment: 0.5,
|
|
@@ -23020,6 +23036,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23020
23036
|
this.currentBatchTexture = null;
|
|
23021
23037
|
this.transformStack = [];
|
|
23022
23038
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23039
|
+
this.clipStack = [];
|
|
23040
|
+
this.logicalWidth = 1;
|
|
23041
|
+
this.logicalHeight = 1;
|
|
23023
23042
|
var _obj;
|
|
23024
23043
|
this.geometry = Geometry.create(this.engine, {
|
|
23025
23044
|
attributes: (_obj = {}, _obj[VertexBuffer.PositionKind] = {
|
|
@@ -23085,6 +23104,51 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23085
23104
|
drawCount: 6,
|
|
23086
23105
|
bufferUsage: glContext.DYNAMIC_DRAW
|
|
23087
23106
|
});
|
|
23107
|
+
var _obj1;
|
|
23108
|
+
this.ninePatchGeometry = Geometry.create(this.engine, {
|
|
23109
|
+
attributes: (_obj1 = {}, _obj1[VertexBuffer.PositionKind] = {
|
|
23110
|
+
type: glContext.FLOAT,
|
|
23111
|
+
size: 2,
|
|
23112
|
+
data: new Float32Array(8)
|
|
23113
|
+
}, _obj1[VertexBuffer.ColorKind] = {
|
|
23114
|
+
type: glContext.FLOAT,
|
|
23115
|
+
size: 4,
|
|
23116
|
+
data: new Float32Array(16)
|
|
23117
|
+
}, _obj1[VertexBuffer.UVKind] = {
|
|
23118
|
+
type: glContext.FLOAT,
|
|
23119
|
+
size: 2,
|
|
23120
|
+
data: new Float32Array(8)
|
|
23121
|
+
}, _obj1[NINE_PATCH_DRAW_SOURCE_SIZE] = {
|
|
23122
|
+
type: glContext.FLOAT,
|
|
23123
|
+
size: 4,
|
|
23124
|
+
data: new Float32Array(16)
|
|
23125
|
+
}, _obj1[NINE_PATCH_SOURCE_RECT] = {
|
|
23126
|
+
type: glContext.FLOAT,
|
|
23127
|
+
size: 4,
|
|
23128
|
+
data: new Float32Array(16)
|
|
23129
|
+
}, _obj1[NINE_PATCH_MARGINS] = {
|
|
23130
|
+
type: glContext.FLOAT,
|
|
23131
|
+
size: 4,
|
|
23132
|
+
data: new Float32Array(16)
|
|
23133
|
+
}, _obj1[NINE_PATCH_OPTIONS] = {
|
|
23134
|
+
type: glContext.FLOAT,
|
|
23135
|
+
size: 4,
|
|
23136
|
+
data: new Float32Array(16)
|
|
23137
|
+
}, _obj1),
|
|
23138
|
+
indices: {
|
|
23139
|
+
data: new Uint16Array([
|
|
23140
|
+
0,
|
|
23141
|
+
1,
|
|
23142
|
+
2,
|
|
23143
|
+
2,
|
|
23144
|
+
1,
|
|
23145
|
+
3
|
|
23146
|
+
])
|
|
23147
|
+
},
|
|
23148
|
+
mode: glContext.TRIANGLES,
|
|
23149
|
+
drawCount: 6,
|
|
23150
|
+
bufferUsage: glContext.DYNAMIC_DRAW
|
|
23151
|
+
});
|
|
23088
23152
|
this.coloredMaterial = Material.create(this.engine, {
|
|
23089
23153
|
shader: {
|
|
23090
23154
|
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 }",
|
|
@@ -23103,12 +23167,21 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23103
23167
|
this.texturedMaterial.depthTest = false;
|
|
23104
23168
|
this.texturedMaterial.depthMask = false;
|
|
23105
23169
|
this.texturedMaterial.blending = true;
|
|
23106
|
-
|
|
23170
|
+
this.ninePatchMaterial = Material.create(this.engine, {
|
|
23171
|
+
shader: {
|
|
23172
|
+
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 }",
|
|
23173
|
+
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 }"
|
|
23174
|
+
}
|
|
23175
|
+
});
|
|
23176
|
+
this.ninePatchMaterial.depthTest = false;
|
|
23177
|
+
this.ninePatchMaterial.depthMask = false;
|
|
23178
|
+
this.ninePatchMaterial.blending = true;
|
|
23179
|
+
// 文本 atlas 在上传时预乘 alpha,因此纹理 RGB 只需乘顶点色和顶点 alpha。
|
|
23107
23180
|
// 单独使用 material,避免改变 drawTexture 对普通非预乘纹理的处理。
|
|
23108
23181
|
this.textMaterial = Material.create(this.engine, {
|
|
23109
23182
|
shader: {
|
|
23110
23183
|
vertex: "precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n varying vec4 vColor;\n varying vec2 vUV;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",
|
|
23111
|
-
fragment: "precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n
|
|
23184
|
+
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 }"
|
|
23112
23185
|
}
|
|
23113
23186
|
});
|
|
23114
23187
|
this.textMaterial.depthTest = false;
|
|
@@ -23124,25 +23197,36 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23124
23197
|
this.vertices.length = 0;
|
|
23125
23198
|
this.colors.length = 0;
|
|
23126
23199
|
this.uvs.length = 0;
|
|
23200
|
+
this.ninePatchDrawSourceSizes.length = 0;
|
|
23201
|
+
this.ninePatchSourceRects.length = 0;
|
|
23202
|
+
this.ninePatchMargins.length = 0;
|
|
23203
|
+
this.ninePatchOptions.length = 0;
|
|
23127
23204
|
this.transformStack = [];
|
|
23128
23205
|
this.currentTransform = Matrix3.fromIdentity();
|
|
23206
|
+
this.clipStack = [];
|
|
23129
23207
|
this.currentBatchType = "colored";
|
|
23130
23208
|
this.currentBatchTexture = null;
|
|
23131
|
-
|
|
23132
|
-
|
|
23209
|
+
this.engine.setScissorTest(false);
|
|
23210
|
+
// 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
|
|
23211
|
+
var bounds = this.engine.canvas.getBoundingClientRect();
|
|
23212
|
+
var width = bounds.width || this.engine.canvas.width / this.engine.pixelRatio || 1;
|
|
23213
|
+
var height = bounds.height || this.engine.canvas.height / this.engine.pixelRatio || 1;
|
|
23214
|
+
this.logicalWidth = width;
|
|
23215
|
+
this.logicalHeight = height;
|
|
23133
23216
|
// 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
|
|
23134
|
-
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, -1, 0, -1,
|
|
23217
|
+
var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
|
|
23135
23218
|
);
|
|
23136
23219
|
this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23137
23220
|
this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23138
23221
|
this.textMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23222
|
+
this.ninePatchMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
|
|
23139
23223
|
};
|
|
23140
23224
|
/**
|
|
23141
23225
|
* 将当前变换压入栈,并设置新的变换
|
|
23142
23226
|
* @param transform - 新的变换矩阵(会与当前变换相乘)
|
|
23143
23227
|
*/ _proto.pushTransform = function pushTransform(transform) {
|
|
23144
23228
|
this.transformStack.push(this.currentTransform.clone());
|
|
23145
|
-
this.currentTransform = this.currentTransform.
|
|
23229
|
+
this.currentTransform = this.currentTransform.multiply(transform);
|
|
23146
23230
|
};
|
|
23147
23231
|
/**
|
|
23148
23232
|
* 恢复上一个变换
|
|
@@ -23154,10 +23238,81 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23154
23238
|
}
|
|
23155
23239
|
this.currentTransform = transform;
|
|
23156
23240
|
};
|
|
23241
|
+
/** Pushes a local rectangular child clip using a screen-space AABB scissor. */ _proto.pushClipRect = function pushClipRect(x, y, width, height) {
|
|
23242
|
+
var elements = this.currentTransform.elements;
|
|
23243
|
+
var corners = [
|
|
23244
|
+
[
|
|
23245
|
+
x,
|
|
23246
|
+
y
|
|
23247
|
+
],
|
|
23248
|
+
[
|
|
23249
|
+
x + width,
|
|
23250
|
+
y
|
|
23251
|
+
],
|
|
23252
|
+
[
|
|
23253
|
+
x,
|
|
23254
|
+
y + height
|
|
23255
|
+
],
|
|
23256
|
+
[
|
|
23257
|
+
x + width,
|
|
23258
|
+
y + height
|
|
23259
|
+
]
|
|
23260
|
+
];
|
|
23261
|
+
var left = Infinity;
|
|
23262
|
+
var top = Infinity;
|
|
23263
|
+
var right = -Infinity;
|
|
23264
|
+
var bottom = -Infinity;
|
|
23265
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(corners), _step; !(_step = _iterator()).done;){
|
|
23266
|
+
var corner = _step.value;
|
|
23267
|
+
var transformedX = elements[0] * corner[0] + elements[3] * corner[1] + elements[6];
|
|
23268
|
+
var transformedY = elements[1] * corner[0] + elements[4] * corner[1] + elements[7];
|
|
23269
|
+
left = Math.min(left, transformedX);
|
|
23270
|
+
top = Math.min(top, transformedY);
|
|
23271
|
+
right = Math.max(right, transformedX);
|
|
23272
|
+
bottom = Math.max(bottom, transformedY);
|
|
23273
|
+
}
|
|
23274
|
+
var parent = this.clipStack[this.clipStack.length - 1];
|
|
23275
|
+
if (parent) {
|
|
23276
|
+
left = Math.max(left, parent.x);
|
|
23277
|
+
top = Math.max(top, parent.y);
|
|
23278
|
+
right = Math.min(right, parent.x + parent.width);
|
|
23279
|
+
bottom = Math.min(bottom, parent.y + parent.height);
|
|
23280
|
+
}
|
|
23281
|
+
var clip = {
|
|
23282
|
+
x: left,
|
|
23283
|
+
y: top,
|
|
23284
|
+
width: Math.max(0, right - left),
|
|
23285
|
+
height: Math.max(0, bottom - top)
|
|
23286
|
+
};
|
|
23287
|
+
var previous = parent;
|
|
23288
|
+
this.clipStack.push(clip);
|
|
23289
|
+
if (!this.clipRectsEqual(previous, clip)) {
|
|
23290
|
+
this.flushBatch();
|
|
23291
|
+
this.applyClipRect(clip);
|
|
23292
|
+
}
|
|
23293
|
+
};
|
|
23294
|
+
/** Restores the parent rectangular clip. */ _proto.popClipRect = function popClipRect() {
|
|
23295
|
+
var previous = this.clipStack.pop();
|
|
23296
|
+
if (!previous) {
|
|
23297
|
+
console.warn("Graphics: clip stack is empty.");
|
|
23298
|
+
return;
|
|
23299
|
+
}
|
|
23300
|
+
var clip = this.clipStack[this.clipStack.length - 1];
|
|
23301
|
+
if (!this.clipRectsEqual(previous, clip)) {
|
|
23302
|
+
this.flushBatch();
|
|
23303
|
+
if (clip) {
|
|
23304
|
+
this.applyClipRect(clip);
|
|
23305
|
+
} else {
|
|
23306
|
+
this.engine.setScissorTest(false);
|
|
23307
|
+
}
|
|
23308
|
+
}
|
|
23309
|
+
};
|
|
23157
23310
|
/**
|
|
23158
23311
|
* 刷新并渲染所有累积的绘制命令
|
|
23159
23312
|
*/ _proto.end = function end() {
|
|
23160
23313
|
this.flushBatch();
|
|
23314
|
+
this.clipStack = [];
|
|
23315
|
+
this.engine.setScissorTest(false);
|
|
23161
23316
|
};
|
|
23162
23317
|
/**
|
|
23163
23318
|
* 切换到指定批次类型/纹理。若与当前批次不一致,先 flush 已累积顶点
|
|
@@ -23170,6 +23325,24 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23170
23325
|
this.currentBatchType = type;
|
|
23171
23326
|
this.currentBatchTexture = texture;
|
|
23172
23327
|
};
|
|
23328
|
+
_proto.applyClipRect = function applyClipRect(clip) {
|
|
23329
|
+
var framebufferWidth = this.engine.canvas.width;
|
|
23330
|
+
var framebufferHeight = this.engine.canvas.height;
|
|
23331
|
+
var scaleX = framebufferWidth / this.logicalWidth;
|
|
23332
|
+
var scaleY = framebufferHeight / this.logicalHeight;
|
|
23333
|
+
var left = Math.max(0, Math.min(framebufferWidth, Math.floor(clip.x * scaleX)));
|
|
23334
|
+
var top = Math.max(0, Math.min(framebufferHeight, Math.floor(clip.y * scaleY)));
|
|
23335
|
+
var right = Math.max(left, Math.min(framebufferWidth, Math.ceil((clip.x + clip.width) * scaleX)));
|
|
23336
|
+
var bottom = Math.max(top, Math.min(framebufferHeight, Math.ceil((clip.y + clip.height) * scaleY)));
|
|
23337
|
+
this.engine.setScissorTest(true);
|
|
23338
|
+
this.engine.setScissor(left, framebufferHeight - bottom, right - left, bottom - top);
|
|
23339
|
+
};
|
|
23340
|
+
_proto.clipRectsEqual = function clipRectsEqual(left, right) {
|
|
23341
|
+
if (!left || !right) {
|
|
23342
|
+
return left === right;
|
|
23343
|
+
}
|
|
23344
|
+
return left.x === right.x && left.y === right.y && left.width === right.width && left.height === right.height;
|
|
23345
|
+
};
|
|
23173
23346
|
/**
|
|
23174
23347
|
* 提交当前累积的顶点到 renderer,清空缓冲(批次内部 flush 不重置 batchType)
|
|
23175
23348
|
*/ _proto.flushBatch = function flushBatch() {
|
|
@@ -23183,37 +23356,48 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23183
23356
|
var colorsArray = new Float32Array(this.colors);
|
|
23184
23357
|
var uvsArray = new Float32Array(this.uvs);
|
|
23185
23358
|
var indicesArray = new Uint16Array(this.indices);
|
|
23186
|
-
this.
|
|
23187
|
-
this.updateAttributeData(VertexBuffer.
|
|
23188
|
-
this.updateAttributeData(VertexBuffer.
|
|
23189
|
-
this.geometry.
|
|
23190
|
-
|
|
23359
|
+
var geometry = this.currentBatchType === "ninePatch" ? this.ninePatchGeometry : this.geometry;
|
|
23360
|
+
this.updateAttributeData(geometry, VertexBuffer.PositionKind, verticesArray, 2);
|
|
23361
|
+
this.updateAttributeData(geometry, VertexBuffer.ColorKind, colorsArray, 4);
|
|
23362
|
+
this.updateAttributeData(geometry, VertexBuffer.UVKind, uvsArray, 2);
|
|
23363
|
+
if (this.currentBatchType === "ninePatch") {
|
|
23364
|
+
this.updateAttributeData(geometry, NINE_PATCH_DRAW_SOURCE_SIZE, new Float32Array(this.ninePatchDrawSourceSizes), 4);
|
|
23365
|
+
this.updateAttributeData(geometry, NINE_PATCH_SOURCE_RECT, new Float32Array(this.ninePatchSourceRects), 4);
|
|
23366
|
+
this.updateAttributeData(geometry, NINE_PATCH_MARGINS, new Float32Array(this.ninePatchMargins), 4);
|
|
23367
|
+
this.updateAttributeData(geometry, NINE_PATCH_OPTIONS, new Float32Array(this.ninePatchOptions), 4);
|
|
23368
|
+
}
|
|
23369
|
+
geometry.setIndexData(indicesArray);
|
|
23370
|
+
geometry.setDrawCount(this.currentIndexCount);
|
|
23191
23371
|
var material;
|
|
23192
|
-
if (this.currentBatchType === "textured" || this.currentBatchType === "text") {
|
|
23193
|
-
material = this.currentBatchType === "text" ? this.textMaterial : this.texturedMaterial;
|
|
23372
|
+
if (this.currentBatchType === "textured" || this.currentBatchType === "text" || this.currentBatchType === "ninePatch") {
|
|
23373
|
+
material = this.currentBatchType === "text" ? this.textMaterial : this.currentBatchType === "ninePatch" ? this.ninePatchMaterial : this.texturedMaterial;
|
|
23194
23374
|
var _this_currentBatchTexture;
|
|
23195
23375
|
var tex = (_this_currentBatchTexture = this.currentBatchTexture) != null ? _this_currentBatchTexture : this.engine.whiteTexture;
|
|
23196
23376
|
material.setTexture("uMainTexture", tex);
|
|
23197
23377
|
} else {
|
|
23198
23378
|
material = this.coloredMaterial;
|
|
23199
23379
|
}
|
|
23200
|
-
this.engine.renderer.drawGeometry(
|
|
23380
|
+
this.engine.renderer.drawGeometry(geometry, Matrix4.IDENTITY, material);
|
|
23201
23381
|
this.indices.length = 0;
|
|
23202
23382
|
this.vertices.length = 0;
|
|
23203
23383
|
this.colors.length = 0;
|
|
23204
23384
|
this.uvs.length = 0;
|
|
23205
|
-
|
|
23206
|
-
|
|
23207
|
-
|
|
23208
|
-
|
|
23385
|
+
this.ninePatchDrawSourceSizes.length = 0;
|
|
23386
|
+
this.ninePatchSourceRects.length = 0;
|
|
23387
|
+
this.ninePatchMargins.length = 0;
|
|
23388
|
+
this.ninePatchOptions.length = 0;
|
|
23389
|
+
};
|
|
23390
|
+
_proto.updateAttributeData = function updateAttributeData(geometry, name, data, size) {
|
|
23391
|
+
var _geometry_getVertexBuffer;
|
|
23392
|
+
var dataBuffer = (_geometry_getVertexBuffer = geometry.getVertexBuffer(name)) == null ? void 0 : _geometry_getVertexBuffer.getBuffer();
|
|
23209
23393
|
if (dataBuffer && data.byteLength > dataBuffer.capacity) {
|
|
23210
|
-
|
|
23394
|
+
geometry.setVerticesBuffer(new VertexBuffer(this.engine, data, name, {
|
|
23211
23395
|
updatable: true,
|
|
23212
23396
|
size: size
|
|
23213
23397
|
}));
|
|
23214
23398
|
return;
|
|
23215
23399
|
}
|
|
23216
|
-
|
|
23400
|
+
geometry.setAttributeData(name, data);
|
|
23217
23401
|
};
|
|
23218
23402
|
/**
|
|
23219
23403
|
* 线段顶点按顺序连接 (p0-p1, p1-p2, p2-p3, ...)
|
|
@@ -23296,8 +23480,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23296
23480
|
};
|
|
23297
23481
|
/**
|
|
23298
23482
|
* 绘制矩形边框
|
|
23299
|
-
* @param x -
|
|
23300
|
-
* @param y -
|
|
23483
|
+
* @param x - 矩形左上角 X 坐标
|
|
23484
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23301
23485
|
* @param width - 矩形宽度
|
|
23302
23486
|
* @param height - 矩形高度
|
|
23303
23487
|
* @param color - 边框颜色,默认白色,范围 0-1
|
|
@@ -23340,8 +23524,8 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23340
23524
|
};
|
|
23341
23525
|
/**
|
|
23342
23526
|
* 绘制填充矩形
|
|
23343
|
-
* @param x -
|
|
23344
|
-
* @param y -
|
|
23527
|
+
* @param x - 矩形左上角 X 坐标
|
|
23528
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23345
23529
|
* @param width - 矩形宽度
|
|
23346
23530
|
* @param height - 矩形高度
|
|
23347
23531
|
* @param color - 填充颜色,默认白色,范围 0-1
|
|
@@ -23367,9 +23551,9 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23367
23551
|
this.buildShape(this.circleShape, color);
|
|
23368
23552
|
};
|
|
23369
23553
|
/**
|
|
23370
|
-
* 绘制纹理矩形(本地坐标,Y
|
|
23371
|
-
* @param x -
|
|
23372
|
-
* @param y -
|
|
23554
|
+
* 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
|
|
23555
|
+
* @param x - 矩形左上角 X 坐标
|
|
23556
|
+
* @param y - 矩形左上角 Y 坐标
|
|
23373
23557
|
* @param width - 矩形宽度
|
|
23374
23558
|
* @param height - 矩形高度
|
|
23375
23559
|
* @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
|
|
@@ -23382,14 +23566,41 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23382
23566
|
this.pushQuad(x, y, width, height, color, region);
|
|
23383
23567
|
};
|
|
23384
23568
|
/**
|
|
23385
|
-
*
|
|
23569
|
+
* Draws a nine-patch as one quad. Stretching and repetition are resolved in the fragment shader,
|
|
23570
|
+
* so Tile and TileFit do not expand into CPU-side geometry.
|
|
23571
|
+
*/ _proto.drawNinePatch = function drawNinePatch(x, y, width, height, texture, options, color) {
|
|
23572
|
+
if (color === void 0) color = Color.WHITE;
|
|
23573
|
+
if (width <= 0 || height <= 0 || options.sourceWidth <= 0 || options.sourceHeight <= 0) {
|
|
23574
|
+
return;
|
|
23575
|
+
}
|
|
23576
|
+
this.ensureBatch("ninePatch", texture);
|
|
23577
|
+
var sourceU = options.sourceX / texture.width;
|
|
23578
|
+
var sourceV = 1 - options.sourceY / texture.height;
|
|
23579
|
+
var sourceUSize = options.sourceWidth / texture.width;
|
|
23580
|
+
var sourceVSize = options.sourceHeight / texture.height;
|
|
23581
|
+
var _options_horizontalMode;
|
|
23582
|
+
var horizontalMode = (_options_horizontalMode = options.horizontalMode) != null ? _options_horizontalMode : 0;
|
|
23583
|
+
var _options_verticalMode;
|
|
23584
|
+
var verticalMode = (_options_verticalMode = options.verticalMode) != null ? _options_verticalMode : 0;
|
|
23585
|
+
var _options_drawCenter;
|
|
23586
|
+
var drawCenter = Number((_options_drawCenter = options.drawCenter) != null ? _options_drawCenter : true);
|
|
23587
|
+
this.pushQuad(x, y, width, height, color, FULL_REGION);
|
|
23588
|
+
for(var i = 0; i < 4; i++){
|
|
23589
|
+
this.ninePatchDrawSourceSizes.push(width, height, options.sourceWidth, options.sourceHeight);
|
|
23590
|
+
this.ninePatchSourceRects.push(sourceU, sourceV, sourceUSize, sourceVSize);
|
|
23591
|
+
this.ninePatchMargins.push(options.marginLeft, options.marginTop, options.marginRight, options.marginBottom);
|
|
23592
|
+
this.ninePatchOptions.push(horizontalMode, verticalMode, drawCenter, 0);
|
|
23593
|
+
}
|
|
23594
|
+
};
|
|
23595
|
+
/**
|
|
23596
|
+
* 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
|
|
23386
23597
|
*
|
|
23387
23598
|
* 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
|
|
23388
|
-
* `color`
|
|
23599
|
+
* `color` 与 atlas 字形 RGBA 相乘,任意颜色都不会污染 atlas。
|
|
23389
23600
|
*
|
|
23390
23601
|
* 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
|
|
23391
|
-
* @param x -
|
|
23392
|
-
* @param y -
|
|
23602
|
+
* @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
|
|
23603
|
+
* @param y - 文本 cell 顶部 Y 坐标
|
|
23393
23604
|
* @param text - 要绘制的文本内容,空串直接 return
|
|
23394
23605
|
* @param fontSize - 字号(逻辑像素)
|
|
23395
23606
|
* @param color - 乘色,默认白色,范围 0-1
|
|
@@ -23408,10 +23619,11 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23408
23619
|
this.ensureBatch("text", atlas.texture);
|
|
23409
23620
|
var lineHeight = atlas.lineHeight;
|
|
23410
23621
|
var cursorX = x;
|
|
23622
|
+
var characters = Array.from(text);
|
|
23411
23623
|
// ensureChar 可能往 atlas canvas 写新字并打 dirty 标;实际 upload 推迟到
|
|
23412
23624
|
// flushBatch 统一处理,这样一帧多次 drawText 共写同一 atlas 只 upload 一次
|
|
23413
|
-
for(var i = 0; i <
|
|
23414
|
-
var info = atlas.ensureChar(
|
|
23625
|
+
for(var i = 0; i < characters.length; i++){
|
|
23626
|
+
var info = atlas.ensureChar(characters[i]);
|
|
23415
23627
|
if (!info) {
|
|
23416
23628
|
continue;
|
|
23417
23629
|
}
|
|
@@ -23433,11 +23645,35 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23433
23645
|
cursorX += info.advance;
|
|
23434
23646
|
}
|
|
23435
23647
|
};
|
|
23648
|
+
/** Measures text with the same glyph metrics used by {@link drawText}. */ _proto.measureText = function measureText(text, fontSize, fontFamily, fontWeight, fontStyle) {
|
|
23649
|
+
if (fontFamily === void 0) fontFamily = "sans-serif";
|
|
23650
|
+
if (fontWeight === void 0) fontWeight = "normal";
|
|
23651
|
+
if (fontStyle === void 0) fontStyle = "normal";
|
|
23652
|
+
var atlas = this.textCache.getAtlas(fontSize, fontFamily, fontWeight, fontStyle);
|
|
23653
|
+
var characters = Array.from(text);
|
|
23654
|
+
var advances = [];
|
|
23655
|
+
var width = 0;
|
|
23656
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(characters), _step; !(_step = _iterator()).done;){
|
|
23657
|
+
var character = _step.value;
|
|
23658
|
+
var _atlas_ensureChar;
|
|
23659
|
+
var _atlas_ensureChar_advance;
|
|
23660
|
+
var advance = (_atlas_ensureChar_advance = (_atlas_ensureChar = atlas.ensureChar(character)) == null ? void 0 : _atlas_ensureChar.advance) != null ? _atlas_ensureChar_advance : 0;
|
|
23661
|
+
advances.push(advance);
|
|
23662
|
+
width += advance;
|
|
23663
|
+
}
|
|
23664
|
+
return {
|
|
23665
|
+
width: width,
|
|
23666
|
+
lineHeight: atlas.lineHeight,
|
|
23667
|
+
advances: advances
|
|
23668
|
+
};
|
|
23669
|
+
};
|
|
23436
23670
|
_proto.dispose = function dispose() {
|
|
23437
23671
|
this.geometry.dispose();
|
|
23672
|
+
this.ninePatchGeometry.dispose();
|
|
23438
23673
|
this.coloredMaterial.dispose();
|
|
23439
23674
|
this.texturedMaterial.dispose();
|
|
23440
23675
|
this.textMaterial.dispose();
|
|
23676
|
+
this.ninePatchMaterial.dispose();
|
|
23441
23677
|
this.textCache.dispose();
|
|
23442
23678
|
};
|
|
23443
23679
|
_proto.buildShape = function buildShape(shape, color) {
|
|
@@ -23445,7 +23681,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23445
23681
|
var indexOffset = this.indices.length;
|
|
23446
23682
|
var vertexOffset = this.vertices.length / 2;
|
|
23447
23683
|
buildPoints.length = 0;
|
|
23448
|
-
shape.build(buildPoints);
|
|
23684
|
+
shape.build(buildPoints, this.getScreenScale());
|
|
23449
23685
|
shape.triangulate(buildPoints, this.vertices, vertexOffset, this.indices, indexOffset);
|
|
23450
23686
|
this.applyTransformAndColor(vertexOffset, this.vertices.length / 2 - vertexOffset, color);
|
|
23451
23687
|
};
|
|
@@ -23455,11 +23691,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23455
23691
|
this.indices.length;
|
|
23456
23692
|
var vertexOffset = this.vertices.length / 2;
|
|
23457
23693
|
buildPoints.length = 0;
|
|
23458
|
-
shape.build(buildPoints);
|
|
23694
|
+
shape.build(buildPoints, this.getScreenScale());
|
|
23459
23695
|
this.lineStyle.width = thickness;
|
|
23460
23696
|
buildLine(buildPoints, this.lineStyle, false, closed, this.vertices, 2, vertexOffset, this.indices);
|
|
23461
23697
|
this.applyTransformAndColor(vertexOffset, this.vertices.length / 2 - vertexOffset, color);
|
|
23462
23698
|
};
|
|
23699
|
+
_proto.getScreenScale = function getScreenScale() {
|
|
23700
|
+
var transform = this.currentTransform.elements;
|
|
23701
|
+
var transformScaleX = Math.hypot(transform[0], transform[1]);
|
|
23702
|
+
var transformScaleY = Math.hypot(transform[3], transform[4]);
|
|
23703
|
+
var framebufferScaleX = this.engine.canvas.width / this.logicalWidth;
|
|
23704
|
+
var framebufferScaleY = this.engine.canvas.height / this.logicalHeight;
|
|
23705
|
+
return Math.max(transformScaleX * framebufferScaleX, transformScaleY * framebufferScaleY, 1);
|
|
23706
|
+
};
|
|
23463
23707
|
_proto.setTriangleShape = function setTriangleShape(x1, y1, x2, y2, x3, y3) {
|
|
23464
23708
|
this.triangleShape.x = x1;
|
|
23465
23709
|
this.triangleShape.y = y1;
|
|
@@ -23504,7 +23748,7 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23504
23748
|
* 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
|
|
23505
23749
|
*/ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
|
|
23506
23750
|
var vertexOffset = this.vertices.length / 2;
|
|
23507
|
-
// 4
|
|
23751
|
+
// 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
|
|
23508
23752
|
var corners = [
|
|
23509
23753
|
[
|
|
23510
23754
|
x,
|
|
@@ -23530,19 +23774,19 @@ var Graphics = /*#__PURE__*/ function() {
|
|
|
23530
23774
|
var cornerUVs = [
|
|
23531
23775
|
[
|
|
23532
23776
|
u0,
|
|
23533
|
-
|
|
23777
|
+
v1
|
|
23534
23778
|
],
|
|
23535
23779
|
[
|
|
23536
23780
|
u1,
|
|
23537
|
-
|
|
23781
|
+
v1
|
|
23538
23782
|
],
|
|
23539
23783
|
[
|
|
23540
23784
|
u0,
|
|
23541
|
-
|
|
23785
|
+
v0
|
|
23542
23786
|
],
|
|
23543
23787
|
[
|
|
23544
23788
|
u1,
|
|
23545
|
-
|
|
23789
|
+
v0
|
|
23546
23790
|
]
|
|
23547
23791
|
];
|
|
23548
23792
|
for(var i = 0; i < 4; i++){
|
|
@@ -24508,2086 +24752,6 @@ FrameComponent = __decorate([
|
|
|
24508
24752
|
// 第四列 (位移) 乘 1,无需修改
|
|
24509
24753
|
}
|
|
24510
24754
|
|
|
24511
|
-
function _assert_this_initialized(self) {
|
|
24512
|
-
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
24513
|
-
return self;
|
|
24514
|
-
}
|
|
24515
|
-
|
|
24516
|
-
var MouseFilter;
|
|
24517
|
-
(function(MouseFilter) {
|
|
24518
|
-
MouseFilter[MouseFilter["Stop"] = 0] = "Stop";
|
|
24519
|
-
MouseFilter[MouseFilter["Pass"] = 1] = "Pass";
|
|
24520
|
-
MouseFilter[MouseFilter["Ignore"] = 2] = "Ignore";
|
|
24521
|
-
})(MouseFilter || (MouseFilter = {}));
|
|
24522
|
-
var MouseBehaviorRecursive;
|
|
24523
|
-
(function(MouseBehaviorRecursive) {
|
|
24524
|
-
MouseBehaviorRecursive[MouseBehaviorRecursive["Inherited"] = 0] = "Inherited";
|
|
24525
|
-
MouseBehaviorRecursive[MouseBehaviorRecursive["Disabled"] = 1] = "Disabled";
|
|
24526
|
-
MouseBehaviorRecursive[MouseBehaviorRecursive["Enabled"] = 2] = "Enabled";
|
|
24527
|
-
})(MouseBehaviorRecursive || (MouseBehaviorRecursive = {}));
|
|
24528
|
-
var MouseButton;
|
|
24529
|
-
(function(MouseButton) {
|
|
24530
|
-
MouseButton[MouseButton["None"] = 0] = "None";
|
|
24531
|
-
MouseButton[MouseButton["Left"] = 1] = "Left";
|
|
24532
|
-
MouseButton[MouseButton["Right"] = 2] = "Right";
|
|
24533
|
-
MouseButton[MouseButton["Middle"] = 3] = "Middle";
|
|
24534
|
-
MouseButton[MouseButton["WheelUp"] = 4] = "WheelUp";
|
|
24535
|
-
MouseButton[MouseButton["WheelDown"] = 5] = "WheelDown";
|
|
24536
|
-
MouseButton[MouseButton["WheelLeft"] = 6] = "WheelLeft";
|
|
24537
|
-
MouseButton[MouseButton["WheelRight"] = 7] = "WheelRight";
|
|
24538
|
-
MouseButton[MouseButton["Xbutton1"] = 8] = "Xbutton1";
|
|
24539
|
-
MouseButton[MouseButton["Xbutton2"] = 9] = "Xbutton2";
|
|
24540
|
-
})(MouseButton || (MouseButton = {}));
|
|
24541
|
-
var MouseButtonMask;
|
|
24542
|
-
(function(MouseButtonMask) {
|
|
24543
|
-
MouseButtonMask[MouseButtonMask["None"] = 0] = "None";
|
|
24544
|
-
MouseButtonMask[MouseButtonMask["Left"] = 1] = "Left";
|
|
24545
|
-
MouseButtonMask[MouseButtonMask["Right"] = 2] = "Right";
|
|
24546
|
-
MouseButtonMask[MouseButtonMask["Middle"] = 4] = "Middle";
|
|
24547
|
-
MouseButtonMask[MouseButtonMask["Xbutton1"] = 128] = "Xbutton1";
|
|
24548
|
-
MouseButtonMask[MouseButtonMask["Xbutton2"] = 256] = "Xbutton2";
|
|
24549
|
-
})(MouseButtonMask || (MouseButtonMask = {}));
|
|
24550
|
-
var FocusMode;
|
|
24551
|
-
(function(FocusMode) {
|
|
24552
|
-
FocusMode[FocusMode["None"] = 0] = "None";
|
|
24553
|
-
FocusMode[FocusMode["Click"] = 1] = "Click";
|
|
24554
|
-
FocusMode[FocusMode["All"] = 2] = "All";
|
|
24555
|
-
FocusMode[FocusMode["Accessibility"] = 3] = "Accessibility";
|
|
24556
|
-
})(FocusMode || (FocusMode = {}));
|
|
24557
|
-
var FocusBehaviorRecursive;
|
|
24558
|
-
(function(FocusBehaviorRecursive) {
|
|
24559
|
-
FocusBehaviorRecursive[FocusBehaviorRecursive["Inherited"] = 0] = "Inherited";
|
|
24560
|
-
FocusBehaviorRecursive[FocusBehaviorRecursive["Disabled"] = 1] = "Disabled";
|
|
24561
|
-
FocusBehaviorRecursive[FocusBehaviorRecursive["Enabled"] = 2] = "Enabled";
|
|
24562
|
-
})(FocusBehaviorRecursive || (FocusBehaviorRecursive = {}));
|
|
24563
|
-
var KeyLocation;
|
|
24564
|
-
(function(KeyLocation) {
|
|
24565
|
-
KeyLocation[KeyLocation["Unspecified"] = 0] = "Unspecified";
|
|
24566
|
-
KeyLocation[KeyLocation["Left"] = 1] = "Left";
|
|
24567
|
-
KeyLocation[KeyLocation["Right"] = 2] = "Right";
|
|
24568
|
-
})(KeyLocation || (KeyLocation = {}));
|
|
24569
|
-
var CursorShape;
|
|
24570
|
-
(function(CursorShape) {
|
|
24571
|
-
CursorShape[CursorShape["Arrow"] = 0] = "Arrow";
|
|
24572
|
-
CursorShape[CursorShape["Ibeam"] = 1] = "Ibeam";
|
|
24573
|
-
CursorShape[CursorShape["PointingHand"] = 2] = "PointingHand";
|
|
24574
|
-
CursorShape[CursorShape["Cross"] = 3] = "Cross";
|
|
24575
|
-
CursorShape[CursorShape["Wait"] = 4] = "Wait";
|
|
24576
|
-
CursorShape[CursorShape["Busy"] = 5] = "Busy";
|
|
24577
|
-
CursorShape[CursorShape["Drag"] = 6] = "Drag";
|
|
24578
|
-
CursorShape[CursorShape["CanDrop"] = 7] = "CanDrop";
|
|
24579
|
-
CursorShape[CursorShape["Forbidden"] = 8] = "Forbidden";
|
|
24580
|
-
CursorShape[CursorShape["Vsize"] = 9] = "Vsize";
|
|
24581
|
-
CursorShape[CursorShape["Hsize"] = 10] = "Hsize";
|
|
24582
|
-
CursorShape[CursorShape["Bdiagsize"] = 11] = "Bdiagsize";
|
|
24583
|
-
CursorShape[CursorShape["Fdiagsize"] = 12] = "Fdiagsize";
|
|
24584
|
-
CursorShape[CursorShape["Move"] = 13] = "Move";
|
|
24585
|
-
CursorShape[CursorShape["Vsplit"] = 14] = "Vsplit";
|
|
24586
|
-
CursorShape[CursorShape["Hsplit"] = 15] = "Hsplit";
|
|
24587
|
-
CursorShape[CursorShape["Help"] = 16] = "Help";
|
|
24588
|
-
})(CursorShape || (CursorShape = {}));
|
|
24589
|
-
|
|
24590
|
-
function _get_prototype_of(o) {
|
|
24591
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
24592
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
24593
|
-
};
|
|
24594
|
-
return _get_prototype_of(o);
|
|
24595
|
-
}
|
|
24596
|
-
|
|
24597
|
-
function _is_native_function(fn) {
|
|
24598
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
24599
|
-
}
|
|
24600
|
-
|
|
24601
|
-
function _wrap_native_super(Class) {
|
|
24602
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
24603
|
-
_wrap_native_super = function _wrap_native_super(Class) {
|
|
24604
|
-
if (Class === null || !_is_native_function(Class)) return Class;
|
|
24605
|
-
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
24606
|
-
if (typeof _cache !== "undefined") {
|
|
24607
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
24608
|
-
_cache.set(Class, Wrapper);
|
|
24609
|
-
}
|
|
24610
|
-
function Wrapper() {
|
|
24611
|
-
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
24612
|
-
}
|
|
24613
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
24614
|
-
constructor: {
|
|
24615
|
-
value: Wrapper,
|
|
24616
|
-
enumerable: false,
|
|
24617
|
-
writable: true,
|
|
24618
|
-
configurable: true
|
|
24619
|
-
}
|
|
24620
|
-
});
|
|
24621
|
-
return _set_prototype_of(Wrapper, Class);
|
|
24622
|
-
};
|
|
24623
|
-
return _wrap_native_super(Class);
|
|
24624
|
-
}
|
|
24625
|
-
|
|
24626
|
-
function transformPoint(transform, value) {
|
|
24627
|
-
var elements = transform.elements;
|
|
24628
|
-
return new Vector2(elements[0] * value.x + elements[3] * value.y + elements[6], elements[1] * value.x + elements[4] * value.y + elements[7]);
|
|
24629
|
-
}
|
|
24630
|
-
function transformVector(transform, value) {
|
|
24631
|
-
var elements = transform.elements;
|
|
24632
|
-
return new Vector2(elements[0] * value.x + elements[3] * value.y, elements[1] * value.x + elements[4] * value.y);
|
|
24633
|
-
}
|
|
24634
|
-
var InputEvent = /*#__PURE__*/ function() {
|
|
24635
|
-
function InputEvent() {
|
|
24636
|
-
this.device = 0;
|
|
24637
|
-
this.pressed = false;
|
|
24638
|
-
this.canceled = false;
|
|
24639
|
-
}
|
|
24640
|
-
var _proto = InputEvent.prototype;
|
|
24641
|
-
_proto.isPressed = function isPressed() {
|
|
24642
|
-
return this.pressed && !this.canceled;
|
|
24643
|
-
};
|
|
24644
|
-
_proto.isReleased = function isReleased() {
|
|
24645
|
-
return !this.pressed && !this.canceled;
|
|
24646
|
-
};
|
|
24647
|
-
_proto.isCanceled = function isCanceled() {
|
|
24648
|
-
return this.canceled;
|
|
24649
|
-
};
|
|
24650
|
-
_proto.isEcho = function isEcho() {
|
|
24651
|
-
return false;
|
|
24652
|
-
};
|
|
24653
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24654
|
-
var event = new InputEvent();
|
|
24655
|
-
event.device = this.device;
|
|
24656
|
-
event.pressed = this.pressed;
|
|
24657
|
-
event.canceled = this.canceled;
|
|
24658
|
-
return event;
|
|
24659
|
-
};
|
|
24660
|
-
return InputEvent;
|
|
24661
|
-
}();
|
|
24662
|
-
InputEvent.deviceIdEmulation = -1;
|
|
24663
|
-
InputEvent.deviceIdInternal = -2;
|
|
24664
|
-
InputEvent.deviceIdKeyboard = 16;
|
|
24665
|
-
InputEvent.deviceIdMouse = 32;
|
|
24666
|
-
var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
24667
|
-
_inherits(InputEventWithModifiers, InputEvent);
|
|
24668
|
-
function InputEventWithModifiers() {
|
|
24669
|
-
var _this;
|
|
24670
|
-
_this = InputEvent.apply(this, arguments) || this;
|
|
24671
|
-
_this.commandOrControlAutoremap = false;
|
|
24672
|
-
_this.shiftPressed = false;
|
|
24673
|
-
_this.altPressed = false;
|
|
24674
|
-
_this.metaPressed = false;
|
|
24675
|
-
_this.ctrlPressed = false;
|
|
24676
|
-
return _this;
|
|
24677
|
-
}
|
|
24678
|
-
var _proto = InputEventWithModifiers.prototype;
|
|
24679
|
-
_proto.copyModifiersTo = function copyModifiersTo(event) {
|
|
24680
|
-
event.device = this.device;
|
|
24681
|
-
event.pressed = this.pressed;
|
|
24682
|
-
event.canceled = this.canceled;
|
|
24683
|
-
event.commandOrControlAutoremap = this.commandOrControlAutoremap;
|
|
24684
|
-
event.shiftPressed = this.shiftPressed;
|
|
24685
|
-
event.altPressed = this.altPressed;
|
|
24686
|
-
event.metaPressed = this.metaPressed;
|
|
24687
|
-
event.ctrlPressed = this.ctrlPressed;
|
|
24688
|
-
};
|
|
24689
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24690
|
-
var event = new InputEventWithModifiers();
|
|
24691
|
-
this.copyModifiersTo(event);
|
|
24692
|
-
return event;
|
|
24693
|
-
};
|
|
24694
|
-
return InputEventWithModifiers;
|
|
24695
|
-
}(_wrap_native_super(InputEvent));
|
|
24696
|
-
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24697
|
-
_inherits(InputEventKey, InputEventWithModifiers);
|
|
24698
|
-
function InputEventKey() {
|
|
24699
|
-
var _this;
|
|
24700
|
-
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24701
|
-
_this.keycode = "";
|
|
24702
|
-
_this.physicalKeycode = "";
|
|
24703
|
-
_this.keyLabel = "";
|
|
24704
|
-
_this.unicode = 0;
|
|
24705
|
-
_this.location = KeyLocation.Unspecified;
|
|
24706
|
-
_this.echo = false;
|
|
24707
|
-
return _this;
|
|
24708
|
-
}
|
|
24709
|
-
var _proto = InputEventKey.prototype;
|
|
24710
|
-
_proto.isEcho = function isEcho() {
|
|
24711
|
-
return this.echo;
|
|
24712
|
-
};
|
|
24713
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24714
|
-
var event = new InputEventKey();
|
|
24715
|
-
this.copyModifiersTo(event);
|
|
24716
|
-
event.keycode = this.keycode;
|
|
24717
|
-
event.physicalKeycode = this.physicalKeycode;
|
|
24718
|
-
event.keyLabel = this.keyLabel;
|
|
24719
|
-
event.unicode = this.unicode;
|
|
24720
|
-
event.location = this.location;
|
|
24721
|
-
event.echo = this.echo;
|
|
24722
|
-
return event;
|
|
24723
|
-
};
|
|
24724
|
-
return InputEventKey;
|
|
24725
|
-
}(InputEventWithModifiers);
|
|
24726
|
-
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24727
|
-
_inherits(InputEventMouse, InputEventWithModifiers);
|
|
24728
|
-
function InputEventMouse() {
|
|
24729
|
-
var _this;
|
|
24730
|
-
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24731
|
-
_this.buttonMask = MouseButtonMask.None;
|
|
24732
|
-
_this.position = new Vector2();
|
|
24733
|
-
_this.globalPosition = new Vector2();
|
|
24734
|
-
return _this;
|
|
24735
|
-
}
|
|
24736
|
-
var _proto = InputEventMouse.prototype;
|
|
24737
|
-
_proto.copyMouseTo = function copyMouseTo(event) {
|
|
24738
|
-
this.copyModifiersTo(event);
|
|
24739
|
-
event.buttonMask = this.buttonMask;
|
|
24740
|
-
event.position.copyFrom(this.position);
|
|
24741
|
-
event.globalPosition.copyFrom(this.globalPosition);
|
|
24742
|
-
};
|
|
24743
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24744
|
-
var event = new InputEventMouse();
|
|
24745
|
-
this.copyMouseTo(event);
|
|
24746
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24747
|
-
return event;
|
|
24748
|
-
};
|
|
24749
|
-
return InputEventMouse;
|
|
24750
|
-
}(InputEventWithModifiers);
|
|
24751
|
-
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
24752
|
-
_inherits(InputEventMouseButton, InputEventMouse);
|
|
24753
|
-
function InputEventMouseButton() {
|
|
24754
|
-
var _this;
|
|
24755
|
-
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24756
|
-
_this.factor = 1;
|
|
24757
|
-
_this.buttonIndex = MouseButton.None;
|
|
24758
|
-
_this.doubleClick = false;
|
|
24759
|
-
return _this;
|
|
24760
|
-
}
|
|
24761
|
-
var _proto = InputEventMouseButton.prototype;
|
|
24762
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24763
|
-
var event = new InputEventMouseButton();
|
|
24764
|
-
this.copyMouseTo(event);
|
|
24765
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24766
|
-
event.factor = this.factor;
|
|
24767
|
-
event.buttonIndex = this.buttonIndex;
|
|
24768
|
-
event.doubleClick = this.doubleClick;
|
|
24769
|
-
return event;
|
|
24770
|
-
};
|
|
24771
|
-
return InputEventMouseButton;
|
|
24772
|
-
}(InputEventMouse);
|
|
24773
|
-
var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
|
|
24774
|
-
_inherits(InputEventMouseMotion, InputEventMouse);
|
|
24775
|
-
function InputEventMouseMotion() {
|
|
24776
|
-
var _this;
|
|
24777
|
-
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24778
|
-
_this.tilt = new Vector2();
|
|
24779
|
-
_this.pressure = 0;
|
|
24780
|
-
_this.relative = new Vector2();
|
|
24781
|
-
_this.screenRelative = new Vector2();
|
|
24782
|
-
_this.velocity = new Vector2();
|
|
24783
|
-
_this.screenVelocity = new Vector2();
|
|
24784
|
-
_this.penInverted = false;
|
|
24785
|
-
return _this;
|
|
24786
|
-
}
|
|
24787
|
-
var _proto = InputEventMouseMotion.prototype;
|
|
24788
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24789
|
-
var event = new InputEventMouseMotion();
|
|
24790
|
-
this.copyMouseTo(event);
|
|
24791
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24792
|
-
event.tilt.copyFrom(this.tilt);
|
|
24793
|
-
event.pressure = this.pressure;
|
|
24794
|
-
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24795
|
-
event.screenRelative.copyFrom(this.screenRelative);
|
|
24796
|
-
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24797
|
-
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24798
|
-
event.penInverted = this.penInverted;
|
|
24799
|
-
return event;
|
|
24800
|
-
};
|
|
24801
|
-
return InputEventMouseMotion;
|
|
24802
|
-
}(InputEventMouse);
|
|
24803
|
-
var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
|
|
24804
|
-
_inherits(InputEventScreenTouch, InputEvent);
|
|
24805
|
-
function InputEventScreenTouch() {
|
|
24806
|
-
var _this;
|
|
24807
|
-
_this = InputEvent.apply(this, arguments) || this;
|
|
24808
|
-
_this.index = 0;
|
|
24809
|
-
_this.position = new Vector2();
|
|
24810
|
-
_this.doubleTap = false;
|
|
24811
|
-
return _this;
|
|
24812
|
-
}
|
|
24813
|
-
var _proto = InputEventScreenTouch.prototype;
|
|
24814
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24815
|
-
var event = new InputEventScreenTouch();
|
|
24816
|
-
event.device = this.device;
|
|
24817
|
-
event.pressed = this.pressed;
|
|
24818
|
-
event.canceled = this.canceled;
|
|
24819
|
-
event.index = this.index;
|
|
24820
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24821
|
-
event.doubleTap = this.doubleTap;
|
|
24822
|
-
return event;
|
|
24823
|
-
};
|
|
24824
|
-
return InputEventScreenTouch;
|
|
24825
|
-
}(_wrap_native_super(InputEvent));
|
|
24826
|
-
var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
24827
|
-
_inherits(InputEventScreenDrag, InputEvent);
|
|
24828
|
-
function InputEventScreenDrag() {
|
|
24829
|
-
var _this;
|
|
24830
|
-
_this = InputEvent.apply(this, arguments) || this;
|
|
24831
|
-
_this.index = 0;
|
|
24832
|
-
_this.position = new Vector2();
|
|
24833
|
-
_this.relative = new Vector2();
|
|
24834
|
-
_this.screenRelative = new Vector2();
|
|
24835
|
-
_this.velocity = new Vector2();
|
|
24836
|
-
_this.screenVelocity = new Vector2();
|
|
24837
|
-
_this.pressure = 0;
|
|
24838
|
-
_this.tilt = new Vector2();
|
|
24839
|
-
_this.penInverted = false;
|
|
24840
|
-
return _this;
|
|
24841
|
-
}
|
|
24842
|
-
var _proto = InputEventScreenDrag.prototype;
|
|
24843
|
-
_proto.xformedBy = function xformedBy(transform) {
|
|
24844
|
-
var event = new InputEventScreenDrag();
|
|
24845
|
-
event.device = this.device;
|
|
24846
|
-
event.pressed = this.pressed;
|
|
24847
|
-
event.canceled = this.canceled;
|
|
24848
|
-
event.index = this.index;
|
|
24849
|
-
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24850
|
-
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
24851
|
-
event.screenRelative.copyFrom(this.screenRelative);
|
|
24852
|
-
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
24853
|
-
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
24854
|
-
event.pressure = this.pressure;
|
|
24855
|
-
event.tilt.copyFrom(this.tilt);
|
|
24856
|
-
event.penInverted = this.penInverted;
|
|
24857
|
-
return event;
|
|
24858
|
-
};
|
|
24859
|
-
return InputEventScreenDrag;
|
|
24860
|
-
}(_wrap_native_super(InputEvent));
|
|
24861
|
-
|
|
24862
|
-
var ANCHOR_PRESET_TABLE = {
|
|
24863
|
-
topLeft: [
|
|
24864
|
-
0,
|
|
24865
|
-
1,
|
|
24866
|
-
0,
|
|
24867
|
-
1
|
|
24868
|
-
],
|
|
24869
|
-
topRight: [
|
|
24870
|
-
1,
|
|
24871
|
-
1,
|
|
24872
|
-
1,
|
|
24873
|
-
1
|
|
24874
|
-
],
|
|
24875
|
-
bottomLeft: [
|
|
24876
|
-
0,
|
|
24877
|
-
0,
|
|
24878
|
-
0,
|
|
24879
|
-
0
|
|
24880
|
-
],
|
|
24881
|
-
bottomRight: [
|
|
24882
|
-
1,
|
|
24883
|
-
0,
|
|
24884
|
-
1,
|
|
24885
|
-
0
|
|
24886
|
-
],
|
|
24887
|
-
centerLeft: [
|
|
24888
|
-
0,
|
|
24889
|
-
0.5,
|
|
24890
|
-
0,
|
|
24891
|
-
0.5
|
|
24892
|
-
],
|
|
24893
|
-
centerTop: [
|
|
24894
|
-
0.5,
|
|
24895
|
-
1,
|
|
24896
|
-
0.5,
|
|
24897
|
-
1
|
|
24898
|
-
],
|
|
24899
|
-
centerRight: [
|
|
24900
|
-
1,
|
|
24901
|
-
0.5,
|
|
24902
|
-
1,
|
|
24903
|
-
0.5
|
|
24904
|
-
],
|
|
24905
|
-
centerBottom: [
|
|
24906
|
-
0.5,
|
|
24907
|
-
0,
|
|
24908
|
-
0.5,
|
|
24909
|
-
0
|
|
24910
|
-
],
|
|
24911
|
-
center: [
|
|
24912
|
-
0.5,
|
|
24913
|
-
0.5,
|
|
24914
|
-
0.5,
|
|
24915
|
-
0.5
|
|
24916
|
-
],
|
|
24917
|
-
leftWide: [
|
|
24918
|
-
0,
|
|
24919
|
-
0,
|
|
24920
|
-
0,
|
|
24921
|
-
1
|
|
24922
|
-
],
|
|
24923
|
-
topWide: [
|
|
24924
|
-
0,
|
|
24925
|
-
1,
|
|
24926
|
-
1,
|
|
24927
|
-
1
|
|
24928
|
-
],
|
|
24929
|
-
rightWide: [
|
|
24930
|
-
1,
|
|
24931
|
-
0,
|
|
24932
|
-
1,
|
|
24933
|
-
1
|
|
24934
|
-
],
|
|
24935
|
-
bottomWide: [
|
|
24936
|
-
0,
|
|
24937
|
-
0,
|
|
24938
|
-
1,
|
|
24939
|
-
0
|
|
24940
|
-
],
|
|
24941
|
-
vcenterWide: [
|
|
24942
|
-
0.5,
|
|
24943
|
-
0,
|
|
24944
|
-
0.5,
|
|
24945
|
-
1
|
|
24946
|
-
],
|
|
24947
|
-
hcenterWide: [
|
|
24948
|
-
0,
|
|
24949
|
-
0.5,
|
|
24950
|
-
1,
|
|
24951
|
-
0.5
|
|
24952
|
-
],
|
|
24953
|
-
fullRect: [
|
|
24954
|
-
0,
|
|
24955
|
-
0,
|
|
24956
|
-
1,
|
|
24957
|
-
1
|
|
24958
|
-
]
|
|
24959
|
-
};
|
|
24960
|
-
/**
|
|
24961
|
-
* A drawable GUI object. Controls form a tree independent from the VFXItem
|
|
24962
|
-
* scene tree. UIControl is the bridge between both trees.
|
|
24963
|
-
*/ var Control = /*#__PURE__*/ function() {
|
|
24964
|
-
function Control(engine) {
|
|
24965
|
-
this.engine = engine;
|
|
24966
|
-
this._parent = null;
|
|
24967
|
-
this._visible = true;
|
|
24968
|
-
this._enabled = true;
|
|
24969
|
-
this._mouseFilter = MouseFilter.Stop;
|
|
24970
|
-
this._mouseBehaviorRecursive = MouseBehaviorRecursive.Inherited;
|
|
24971
|
-
this._focusMode = FocusMode.None;
|
|
24972
|
-
this._focusBehaviorRecursive = FocusBehaviorRecursive.Inherited;
|
|
24973
|
-
this._defaultCursorShape = CursorShape.Arrow;
|
|
24974
|
-
this._rotation = 0;
|
|
24975
|
-
this.transformDirty = true;
|
|
24976
|
-
this.cachedTransform = new Matrix3();
|
|
24977
|
-
this.eventEmitter = new EventEmitter();
|
|
24978
|
-
this.disposed = false;
|
|
24979
|
-
this./** Scene-tree bridge that owns this GUI object, if any. */ owner = null;
|
|
24980
|
-
this.position = new Vector2();
|
|
24981
|
-
this.size = new Vector2(1, 1);
|
|
24982
|
-
this.anchorMin = new Vector2();
|
|
24983
|
-
this.anchorMax = new Vector2();
|
|
24984
|
-
this.offsetMin = new Vector2();
|
|
24985
|
-
this.offsetMax = new Vector2(1, 1);
|
|
24986
|
-
this.pivot = new Vector2(0.5, 0.5);
|
|
24987
|
-
this.scale = new Vector2(1, 1);
|
|
24988
|
-
this.shear = new Vector2();
|
|
24989
|
-
this.mouseForcePassScrollEvents = true;
|
|
24990
|
-
this.clipContents = false;
|
|
24991
|
-
}
|
|
24992
|
-
var _proto = Control.prototype;
|
|
24993
|
-
_proto.on = function on(eventName, listener, options) {
|
|
24994
|
-
this.eventEmitter.on(eventName, listener, options);
|
|
24995
|
-
};
|
|
24996
|
-
_proto.off = function off(eventName, listener) {
|
|
24997
|
-
this.eventEmitter.off(eventName, listener);
|
|
24998
|
-
};
|
|
24999
|
-
_proto.setPosition = function setPosition(x, y, keepOffsets) {
|
|
25000
|
-
if (keepOffsets === void 0) keepOffsets = false;
|
|
25001
|
-
if (this.position.x === x && this.position.y === y) {
|
|
25002
|
-
return;
|
|
25003
|
-
}
|
|
25004
|
-
var rect = {
|
|
25005
|
-
position: new Vector2(x, y),
|
|
25006
|
-
size: this.size.clone()
|
|
25007
|
-
};
|
|
25008
|
-
if (keepOffsets && this.parent) {
|
|
25009
|
-
this.computeAnchors(rect, this.getParentRect());
|
|
25010
|
-
} else {
|
|
25011
|
-
this.computeOffsets(rect, this.getParentRect());
|
|
25012
|
-
}
|
|
25013
|
-
this.updateLayout();
|
|
25014
|
-
};
|
|
25015
|
-
_proto.setSize = function setSize(width, height) {
|
|
25016
|
-
if (this.size.x === width && this.size.y === height) {
|
|
25017
|
-
return;
|
|
25018
|
-
}
|
|
25019
|
-
var rect = {
|
|
25020
|
-
position: this.position.clone(),
|
|
25021
|
-
size: new Vector2(width, height)
|
|
25022
|
-
};
|
|
25023
|
-
this.computeOffsets(rect, this.getParentRect());
|
|
25024
|
-
this.updateLayout();
|
|
25025
|
-
};
|
|
25026
|
-
_proto.setScale = function setScale(x, y) {
|
|
25027
|
-
if (this.scale.x !== x || this.scale.y !== y) {
|
|
25028
|
-
this.scale.set(x, y);
|
|
25029
|
-
this.markTransformDirty();
|
|
25030
|
-
}
|
|
25031
|
-
};
|
|
25032
|
-
_proto.setRotation = function setRotation(degrees) {
|
|
25033
|
-
if (this._rotation !== degrees) {
|
|
25034
|
-
this._rotation = degrees;
|
|
25035
|
-
this.markTransformDirty();
|
|
25036
|
-
}
|
|
25037
|
-
};
|
|
25038
|
-
_proto.setShear = function setShear(x, y) {
|
|
25039
|
-
if (this.shear.x !== x || this.shear.y !== y) {
|
|
25040
|
-
this.shear.set(x, y);
|
|
25041
|
-
this.markTransformDirty();
|
|
25042
|
-
}
|
|
25043
|
-
};
|
|
25044
|
-
_proto.setPivot = function setPivot(x, y) {
|
|
25045
|
-
if (this.pivot.x !== x || this.pivot.y !== y) {
|
|
25046
|
-
this.pivot.set(x, y);
|
|
25047
|
-
this.markTransformDirty();
|
|
25048
|
-
}
|
|
25049
|
-
};
|
|
25050
|
-
_proto.setAnchorMin = function setAnchorMin(x, y) {
|
|
25051
|
-
if (this.anchorMin.x !== x || this.anchorMin.y !== y) {
|
|
25052
|
-
this.anchorMin.set(x, y);
|
|
25053
|
-
this.updateLayout();
|
|
25054
|
-
}
|
|
25055
|
-
};
|
|
25056
|
-
_proto.setAnchorMax = function setAnchorMax(x, y) {
|
|
25057
|
-
if (this.anchorMax.x !== x || this.anchorMax.y !== y) {
|
|
25058
|
-
this.anchorMax.set(x, y);
|
|
25059
|
-
this.updateLayout();
|
|
25060
|
-
}
|
|
25061
|
-
};
|
|
25062
|
-
_proto.setOffsetMin = function setOffsetMin(x, y) {
|
|
25063
|
-
if (this.offsetMin.x !== x || this.offsetMin.y !== y) {
|
|
25064
|
-
this.offsetMin.set(x, y);
|
|
25065
|
-
this.updateLayout();
|
|
25066
|
-
}
|
|
25067
|
-
};
|
|
25068
|
-
_proto.setOffsetMax = function setOffsetMax(x, y) {
|
|
25069
|
-
if (this.offsetMax.x !== x || this.offsetMax.y !== y) {
|
|
25070
|
-
this.offsetMax.set(x, y);
|
|
25071
|
-
this.updateLayout();
|
|
25072
|
-
}
|
|
25073
|
-
};
|
|
25074
|
-
_proto.getRect = function getRect() {
|
|
25075
|
-
return {
|
|
25076
|
-
position: this.position.clone(),
|
|
25077
|
-
size: this.size.clone()
|
|
25078
|
-
};
|
|
25079
|
-
};
|
|
25080
|
-
_proto.getTransform2D = function getTransform2D() {
|
|
25081
|
-
if (this.transformDirty) {
|
|
25082
|
-
var radians = this._rotation * Math.PI / 180;
|
|
25083
|
-
var sin = Math.sin(radians);
|
|
25084
|
-
var cos = Math.cos(radians);
|
|
25085
|
-
var shearX = Math.tan(Math.max(-89, Math.min(89, this.shear.x)) * Math.PI / 180);
|
|
25086
|
-
var shearY = Math.tan(Math.max(-89, Math.min(89, this.shear.y)) * Math.PI / 180);
|
|
25087
|
-
var a = this.scale.x * (cos - sin * shearY);
|
|
25088
|
-
var b = this.scale.x * (sin + cos * shearY);
|
|
25089
|
-
var c = this.scale.y * (cos * shearX - sin);
|
|
25090
|
-
var d = this.scale.y * (sin * shearX + cos);
|
|
25091
|
-
var pivotX = this.pivot.x * this.size.x;
|
|
25092
|
-
var pivotY = this.pivot.y * this.size.y;
|
|
25093
|
-
var tx = this.position.x + pivotX - a * pivotX - c * pivotY;
|
|
25094
|
-
var ty = this.position.y + pivotY - b * pivotX - d * pivotY;
|
|
25095
|
-
this.cachedTransform.set(a, b, 0, c, d, 0, tx, ty, 1);
|
|
25096
|
-
this.transformDirty = false;
|
|
25097
|
-
}
|
|
25098
|
-
return this.cachedTransform;
|
|
25099
|
-
};
|
|
25100
|
-
_proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
|
|
25101
|
-
if (keepOffsets === void 0) keepOffsets = true;
|
|
25102
|
-
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];
|
|
25103
|
-
if (keepOffsets) {
|
|
25104
|
-
this.anchorMin.set(minX, minY);
|
|
25105
|
-
this.anchorMax.set(maxX, maxY);
|
|
25106
|
-
} else {
|
|
25107
|
-
var rect = this.getRect();
|
|
25108
|
-
this.anchorMin.set(minX, minY);
|
|
25109
|
-
this.anchorMax.set(maxX, maxY);
|
|
25110
|
-
this.computeOffsets(rect, this.getParentRect());
|
|
25111
|
-
}
|
|
25112
|
-
this.updateLayout();
|
|
25113
|
-
};
|
|
25114
|
-
_proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
|
|
25115
|
-
if (margin === void 0) margin = 0;
|
|
25116
|
-
if (!this.parent) {
|
|
25117
|
-
return;
|
|
25118
|
-
}
|
|
25119
|
-
var parentSize = this.parent.size;
|
|
25120
|
-
var width = this.size.x;
|
|
25121
|
-
var height = this.size.y;
|
|
25122
|
-
var a = this.anchorMin;
|
|
25123
|
-
var b = this.anchorMax;
|
|
25124
|
-
var minX = 0, maxX = 0, minY = 0, maxY = 0;
|
|
25125
|
-
switch(preset){
|
|
25126
|
-
case "topLeft":
|
|
25127
|
-
case "bottomLeft":
|
|
25128
|
-
case "centerLeft":
|
|
25129
|
-
case "topWide":
|
|
25130
|
-
case "bottomWide":
|
|
25131
|
-
case "leftWide":
|
|
25132
|
-
case "hcenterWide":
|
|
25133
|
-
case "fullRect":
|
|
25134
|
-
minX = margin - a.x * parentSize.x;
|
|
25135
|
-
maxX = margin + width - b.x * parentSize.x;
|
|
25136
|
-
break;
|
|
25137
|
-
case "centerTop":
|
|
25138
|
-
case "centerBottom":
|
|
25139
|
-
case "center":
|
|
25140
|
-
case "vcenterWide":
|
|
25141
|
-
minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
|
|
25142
|
-
maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
|
|
25143
|
-
break;
|
|
25144
|
-
default:
|
|
25145
|
-
minX = parentSize.x - margin - width - a.x * parentSize.x;
|
|
25146
|
-
maxX = parentSize.x - margin - b.x * parentSize.x;
|
|
25147
|
-
break;
|
|
25148
|
-
}
|
|
25149
|
-
switch(preset){
|
|
25150
|
-
case "bottomLeft":
|
|
25151
|
-
case "bottomRight":
|
|
25152
|
-
case "centerBottom":
|
|
25153
|
-
case "leftWide":
|
|
25154
|
-
case "rightWide":
|
|
25155
|
-
case "bottomWide":
|
|
25156
|
-
case "vcenterWide":
|
|
25157
|
-
case "fullRect":
|
|
25158
|
-
minY = margin - a.y * parentSize.y;
|
|
25159
|
-
maxY = margin + height - b.y * parentSize.y;
|
|
25160
|
-
break;
|
|
25161
|
-
case "centerLeft":
|
|
25162
|
-
case "centerRight":
|
|
25163
|
-
case "center":
|
|
25164
|
-
case "hcenterWide":
|
|
25165
|
-
minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
|
|
25166
|
-
maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
|
|
25167
|
-
break;
|
|
25168
|
-
default:
|
|
25169
|
-
minY = parentSize.y - margin - height - a.y * parentSize.y;
|
|
25170
|
-
maxY = parentSize.y - margin - b.y * parentSize.y;
|
|
25171
|
-
break;
|
|
25172
|
-
}
|
|
25173
|
-
this.offsetMin.set(minX, minY);
|
|
25174
|
-
this.offsetMax.set(maxX, maxY);
|
|
25175
|
-
this.updateLayout();
|
|
25176
|
-
};
|
|
25177
|
-
_proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
|
|
25178
|
-
if (margin === void 0) margin = 0;
|
|
25179
|
-
this.setAnchorsPreset(preset, false);
|
|
25180
|
-
this.setOffsetsPreset(preset, margin);
|
|
25181
|
-
};
|
|
25182
|
-
_proto.getGlobalTransform2D = function getGlobalTransform2D() {
|
|
25183
|
-
var local = this.getTransform2D();
|
|
25184
|
-
return this.parent ? new Matrix3().multiplyMatrices(this.parent.getGlobalTransform2D(), local) : local.clone();
|
|
25185
|
-
};
|
|
25186
|
-
_proto.hasPoint = function hasPoint(point) {
|
|
25187
|
-
return point.x >= 0 && point.y >= 0 && point.x <= this.size.x && point.y <= this.size.y;
|
|
25188
|
-
};
|
|
25189
|
-
_proto.getEffectiveMouseFilter = function getEffectiveMouseFilter() {
|
|
25190
|
-
return this.enabledInHierarchy && this.isMouseRecursiveEnabled() ? this.mouseFilter : MouseFilter.Ignore;
|
|
25191
|
-
};
|
|
25192
|
-
_proto.getFocusModeWithOverride = function getFocusModeWithOverride() {
|
|
25193
|
-
return this.enabledInHierarchy && this.isFocusRecursiveEnabled() ? this.focusMode : FocusMode.None;
|
|
25194
|
-
};
|
|
25195
|
-
_proto.getCursorShape = function getCursorShape(position) {
|
|
25196
|
-
return this.defaultCursorShape;
|
|
25197
|
-
};
|
|
25198
|
-
_proto.acceptEvent = function acceptEvent() {
|
|
25199
|
-
var _this_root;
|
|
25200
|
-
(_this_root = this.root) == null ? void 0 : _this_root.acceptControlEvent(this);
|
|
25201
|
-
};
|
|
25202
|
-
_proto.focus = function focus() {
|
|
25203
|
-
var _this_root;
|
|
25204
|
-
(_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
|
|
25205
|
-
};
|
|
25206
|
-
_proto.grabFocus = function grabFocus() {
|
|
25207
|
-
this.focus();
|
|
25208
|
-
};
|
|
25209
|
-
_proto.grabClickFocus = function grabClickFocus() {
|
|
25210
|
-
var _this_root;
|
|
25211
|
-
(_this_root = this.root) == null ? void 0 : _this_root.grabControlClickFocus(this);
|
|
25212
|
-
};
|
|
25213
|
-
_proto.releaseFocus = function releaseFocus() {
|
|
25214
|
-
var _this_root;
|
|
25215
|
-
(_this_root = this.root) == null ? void 0 : _this_root.releaseControlFocus(this);
|
|
25216
|
-
};
|
|
25217
|
-
_proto.warpMouse = function warpMouse(position) {
|
|
25218
|
-
var _this_root;
|
|
25219
|
-
var matrix = this.getGlobalTransform2D().elements;
|
|
25220
|
-
(_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]));
|
|
25221
|
-
};
|
|
25222
|
-
/** Converts a window-space position into this control's local coordinates. */ _proto.makePositionLocal = function makePositionLocal(position) {
|
|
25223
|
-
var transform = this.getGlobalTransform2D().clone();
|
|
25224
|
-
if (Math.abs(transform.determinant()) < 1e-12) {
|
|
25225
|
-
return new Vector2();
|
|
25226
|
-
}
|
|
25227
|
-
var elements = transform.invert().elements;
|
|
25228
|
-
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
25229
|
-
};
|
|
25230
|
-
/** Gets the current mouse position transformed into this control's coordinates. */ _proto.getLocalMousePosition = function getLocalMousePosition() {
|
|
25231
|
-
var root = this.root;
|
|
25232
|
-
return root ? this.makePositionLocal(root.getMousePosition()) : new Vector2();
|
|
25233
|
-
};
|
|
25234
|
-
_proto.update = function update(deltaTime) {};
|
|
25235
|
-
_proto.draw = function draw() {
|
|
25236
|
-
// OVERRIDE
|
|
25237
|
-
};
|
|
25238
|
-
_proto.onDestroy = function onDestroy() {};
|
|
25239
|
-
/** @internal */ _proto.drawInternal = function drawInternal() {
|
|
25240
|
-
if (!this.visibleInHierarchy || this.disposed) {
|
|
25241
|
-
return;
|
|
25242
|
-
}
|
|
25243
|
-
var graphics = this.engine.graphics;
|
|
25244
|
-
graphics.pushTransform(this.getTransform2D());
|
|
25245
|
-
this.draw();
|
|
25246
|
-
graphics.popTransform();
|
|
25247
|
-
};
|
|
25248
|
-
_proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
|
|
25249
|
-
this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
|
|
25250
|
-
};
|
|
25251
|
-
_proto.drawPolyline = function drawPolyline(points, color, thickness) {
|
|
25252
|
-
this.engine.graphics.drawLines(points, color, thickness);
|
|
25253
|
-
};
|
|
25254
|
-
_proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
|
|
25255
|
-
this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
|
|
25256
|
-
};
|
|
25257
|
-
_proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
|
|
25258
|
-
this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
|
|
25259
|
-
};
|
|
25260
|
-
_proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
|
|
25261
|
-
this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
|
|
25262
|
-
};
|
|
25263
|
-
_proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
|
|
25264
|
-
this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
|
|
25265
|
-
};
|
|
25266
|
-
_proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
|
|
25267
|
-
this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
|
|
25268
|
-
};
|
|
25269
|
-
_proto.fillRect = function fillRect(x, y, width, height, color) {
|
|
25270
|
-
this.engine.graphics.fillRectangle(x, y, width, height, color);
|
|
25271
|
-
};
|
|
25272
|
-
_proto.fillCircle = function fillCircle(cx, cy, radius, color) {
|
|
25273
|
-
this.engine.graphics.fillCircle(cx, cy, radius, color);
|
|
25274
|
-
};
|
|
25275
|
-
_proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
|
|
25276
|
-
this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
|
|
25277
|
-
};
|
|
25278
|
-
_proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
|
|
25279
|
-
this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
|
|
25280
|
-
};
|
|
25281
|
-
_proto.onMouseEnter = function onMouseEnter(location) {};
|
|
25282
|
-
_proto.onMouseMove = function onMouseMove(location, event) {};
|
|
25283
|
-
_proto.onMouseLeave = function onMouseLeave() {};
|
|
25284
|
-
_proto.onMouseWheel = function onMouseWheel(location, delta, event) {};
|
|
25285
|
-
_proto.onMouseDown = function onMouseDown(location, button, event) {};
|
|
25286
|
-
_proto.onMouseUp = function onMouseUp(location, button, event) {};
|
|
25287
|
-
_proto.onTouchDown = function onTouchDown(location, pointerId, event) {};
|
|
25288
|
-
_proto.onTouchMove = function onTouchMove(location, pointerId, event) {};
|
|
25289
|
-
_proto.onTouchUp = function onTouchUp(location, pointerId, event) {};
|
|
25290
|
-
_proto.onKeyDown = function onKeyDown(event) {};
|
|
25291
|
-
_proto.onKeyUp = function onKeyUp(event) {};
|
|
25292
|
-
_proto.onGotFocus = function onGotFocus() {};
|
|
25293
|
-
_proto.onLostFocus = function onLostFocus() {};
|
|
25294
|
-
/** @internal */ _proto.invokeGetDragData = function invokeGetDragData(position) {
|
|
25295
|
-
return this.getDragData(position);
|
|
25296
|
-
};
|
|
25297
|
-
/** @internal */ _proto.invokeCanDropData = function invokeCanDropData(position, data) {
|
|
25298
|
-
return this.canDropData(position, data);
|
|
25299
|
-
};
|
|
25300
|
-
/** @internal */ _proto.invokeDropData = function invokeDropData(position, data) {
|
|
25301
|
-
this.dropData(position, data);
|
|
25302
|
-
};
|
|
25303
|
-
_proto.getDragData = function getDragData(position) {
|
|
25304
|
-
return null;
|
|
25305
|
-
};
|
|
25306
|
-
_proto.canDropData = function canDropData(position, data) {
|
|
25307
|
-
return false;
|
|
25308
|
-
};
|
|
25309
|
-
_proto.dropData = function dropData(position, data) {};
|
|
25310
|
-
_proto.dispose = function dispose() {
|
|
25311
|
-
if (this.disposed) {
|
|
25312
|
-
return;
|
|
25313
|
-
}
|
|
25314
|
-
this.disposed = true;
|
|
25315
|
-
this.onDestroy();
|
|
25316
|
-
this.parent = null;
|
|
25317
|
-
this.owner = null;
|
|
25318
|
-
};
|
|
25319
|
-
/** @internal */ _proto.updateLayout = function updateLayout() {
|
|
25320
|
-
var _this_parent;
|
|
25321
|
-
var _this_parent_size;
|
|
25322
|
-
var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
|
|
25323
|
-
var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
|
|
25324
|
-
var bottom = this.offsetMin.y + this.anchorMin.y * parentSize.y;
|
|
25325
|
-
var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
|
|
25326
|
-
var top = this.offsetMax.y + this.anchorMax.y * parentSize.y;
|
|
25327
|
-
this.applyBounds(left, bottom, right - left, top - bottom);
|
|
25328
|
-
};
|
|
25329
|
-
_proto.applyBounds = function applyBounds(x, y, width, height) {
|
|
25330
|
-
var locationChanged = this.position.x !== x || this.position.y !== y;
|
|
25331
|
-
var sizeChanged = this.size.x !== width || this.size.y !== height;
|
|
25332
|
-
if (!locationChanged && !sizeChanged) {
|
|
25333
|
-
return;
|
|
25334
|
-
}
|
|
25335
|
-
this.position.set(x, y);
|
|
25336
|
-
this.size.set(width, height);
|
|
25337
|
-
this.markTransformDirty();
|
|
25338
|
-
if (locationChanged) {
|
|
25339
|
-
this.eventEmitter.emit("locationChanged", this);
|
|
25340
|
-
}
|
|
25341
|
-
if (sizeChanged) {
|
|
25342
|
-
this.eventEmitter.emit("sizeChanged", this);
|
|
25343
|
-
if (_instanceof1(this, ContainerControl)) {
|
|
25344
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25345
|
-
var child = _step.value;
|
|
25346
|
-
child.updateLayout();
|
|
25347
|
-
}
|
|
25348
|
-
}
|
|
25349
|
-
}
|
|
25350
|
-
};
|
|
25351
|
-
_proto.markTransformDirty = function markTransformDirty() {
|
|
25352
|
-
var _this_root;
|
|
25353
|
-
this.transformDirty = true;
|
|
25354
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25355
|
-
};
|
|
25356
|
-
_proto.getParentRect = function getParentRect() {
|
|
25357
|
-
var _this_parent;
|
|
25358
|
-
var _this_parent_size_clone;
|
|
25359
|
-
return {
|
|
25360
|
-
position: new Vector2(),
|
|
25361
|
-
size: (_this_parent_size_clone = (_this_parent = this.parent) == null ? void 0 : _this_parent.size.clone()) != null ? _this_parent_size_clone : new Vector2()
|
|
25362
|
-
};
|
|
25363
|
-
};
|
|
25364
|
-
_proto.computeOffsets = function computeOffsets(rect, parentRect) {
|
|
25365
|
-
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);
|
|
25366
|
-
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);
|
|
25367
|
-
};
|
|
25368
|
-
_proto.computeAnchors = function computeAnchors(rect, parentRect) {
|
|
25369
|
-
if (parentRect.size.x !== 0) {
|
|
25370
|
-
this.anchorMin.x = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
|
|
25371
|
-
this.anchorMax.x = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
|
|
25372
|
-
}
|
|
25373
|
-
if (parentRect.size.y !== 0) {
|
|
25374
|
-
this.anchorMin.y = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
|
|
25375
|
-
this.anchorMax.y = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
|
|
25376
|
-
}
|
|
25377
|
-
};
|
|
25378
|
-
_proto.isMouseRecursiveEnabled = function isMouseRecursiveEnabled() {
|
|
25379
|
-
if (this.mouseBehaviorRecursive === MouseBehaviorRecursive.Inherited) {
|
|
25380
|
-
var _this_parent;
|
|
25381
|
-
var _this_parent_isMouseRecursiveEnabled;
|
|
25382
|
-
return (_this_parent_isMouseRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isMouseRecursiveEnabled()) != null ? _this_parent_isMouseRecursiveEnabled : true;
|
|
25383
|
-
}
|
|
25384
|
-
return this.mouseBehaviorRecursive === MouseBehaviorRecursive.Enabled;
|
|
25385
|
-
};
|
|
25386
|
-
_proto.isFocusRecursiveEnabled = function isFocusRecursiveEnabled() {
|
|
25387
|
-
if (this.focusBehaviorRecursive === FocusBehaviorRecursive.Inherited) {
|
|
25388
|
-
var _this_parent;
|
|
25389
|
-
var _this_parent_isFocusRecursiveEnabled;
|
|
25390
|
-
return (_this_parent_isFocusRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isFocusRecursiveEnabled()) != null ? _this_parent_isFocusRecursiveEnabled : true;
|
|
25391
|
-
}
|
|
25392
|
-
return this.focusBehaviorRecursive === FocusBehaviorRecursive.Enabled;
|
|
25393
|
-
};
|
|
25394
|
-
_create_class(Control, [
|
|
25395
|
-
{
|
|
25396
|
-
key: "parent",
|
|
25397
|
-
get: function get() {
|
|
25398
|
-
return this._parent;
|
|
25399
|
-
},
|
|
25400
|
-
set: function set(value) {
|
|
25401
|
-
var _this__parent;
|
|
25402
|
-
if (value === this._parent) {
|
|
25403
|
-
return;
|
|
25404
|
-
}
|
|
25405
|
-
var previousRoot = this.root;
|
|
25406
|
-
(_this__parent = this._parent) == null ? void 0 : _this__parent.removeChildInternal(this);
|
|
25407
|
-
this._parent = value;
|
|
25408
|
-
value == null ? void 0 : value.addChildInternal(this);
|
|
25409
|
-
this.updateLayout();
|
|
25410
|
-
var nextRoot = this.root;
|
|
25411
|
-
if (previousRoot && previousRoot !== nextRoot) {
|
|
25412
|
-
previousRoot.controlRemoved(this);
|
|
25413
|
-
}
|
|
25414
|
-
nextRoot == null ? void 0 : nextRoot.controlTreeChanged();
|
|
25415
|
-
this.eventEmitter.emit("parentChanged", this);
|
|
25416
|
-
}
|
|
25417
|
-
},
|
|
25418
|
-
{
|
|
25419
|
-
key: "item",
|
|
25420
|
-
get: /** Scene item exposed through the optional UIControl bridge. */ function get() {
|
|
25421
|
-
var _this_owner;
|
|
25422
|
-
var _this_owner_item;
|
|
25423
|
-
return (_this_owner_item = (_this_owner = this.owner) == null ? void 0 : _this_owner.item) != null ? _this_owner_item : null;
|
|
25424
|
-
}
|
|
25425
|
-
},
|
|
25426
|
-
{
|
|
25427
|
-
key: "indexInParent",
|
|
25428
|
-
get: function get() {
|
|
25429
|
-
var _this_parent;
|
|
25430
|
-
var _this_parent_getChildIndex;
|
|
25431
|
-
return (_this_parent_getChildIndex = (_this_parent = this.parent) == null ? void 0 : _this_parent.getChildIndex(this)) != null ? _this_parent_getChildIndex : -1;
|
|
25432
|
-
},
|
|
25433
|
-
set: function set(value) {
|
|
25434
|
-
var _this_parent;
|
|
25435
|
-
(_this_parent = this.parent) == null ? void 0 : _this_parent.changeChildIndex(this, value);
|
|
25436
|
-
}
|
|
25437
|
-
},
|
|
25438
|
-
{
|
|
25439
|
-
key: "visible",
|
|
25440
|
-
get: function get() {
|
|
25441
|
-
return this._visible;
|
|
25442
|
-
},
|
|
25443
|
-
set: function set(value) {
|
|
25444
|
-
if (this._visible !== value) {
|
|
25445
|
-
var _this_root;
|
|
25446
|
-
this._visible = value;
|
|
25447
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25448
|
-
}
|
|
25449
|
-
}
|
|
25450
|
-
},
|
|
25451
|
-
{
|
|
25452
|
-
key: "visibleInHierarchy",
|
|
25453
|
-
get: function get() {
|
|
25454
|
-
var _this_parent;
|
|
25455
|
-
var _this_parent_visibleInHierarchy;
|
|
25456
|
-
return this.visible && ((_this_parent_visibleInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.visibleInHierarchy) != null ? _this_parent_visibleInHierarchy : true);
|
|
25457
|
-
}
|
|
25458
|
-
},
|
|
25459
|
-
{
|
|
25460
|
-
key: "enabled",
|
|
25461
|
-
get: function get() {
|
|
25462
|
-
return this._enabled;
|
|
25463
|
-
},
|
|
25464
|
-
set: function set(value) {
|
|
25465
|
-
if (this._enabled !== value) {
|
|
25466
|
-
var _this_root;
|
|
25467
|
-
this._enabled = value;
|
|
25468
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25469
|
-
}
|
|
25470
|
-
}
|
|
25471
|
-
},
|
|
25472
|
-
{
|
|
25473
|
-
key: "enabledInHierarchy",
|
|
25474
|
-
get: function get() {
|
|
25475
|
-
var _this_parent;
|
|
25476
|
-
var _this_parent_enabledInHierarchy;
|
|
25477
|
-
return this.enabled && ((_this_parent_enabledInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.enabledInHierarchy) != null ? _this_parent_enabledInHierarchy : true);
|
|
25478
|
-
}
|
|
25479
|
-
},
|
|
25480
|
-
{
|
|
25481
|
-
key: "mouseFilter",
|
|
25482
|
-
get: function get() {
|
|
25483
|
-
return this._mouseFilter;
|
|
25484
|
-
},
|
|
25485
|
-
set: function set(value) {
|
|
25486
|
-
if (this._mouseFilter !== value) {
|
|
25487
|
-
var _this_root;
|
|
25488
|
-
this._mouseFilter = value;
|
|
25489
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25490
|
-
}
|
|
25491
|
-
}
|
|
25492
|
-
},
|
|
25493
|
-
{
|
|
25494
|
-
key: "mouseBehaviorRecursive",
|
|
25495
|
-
get: function get() {
|
|
25496
|
-
return this._mouseBehaviorRecursive;
|
|
25497
|
-
},
|
|
25498
|
-
set: function set(value) {
|
|
25499
|
-
if (this._mouseBehaviorRecursive !== value) {
|
|
25500
|
-
var _this_root;
|
|
25501
|
-
this._mouseBehaviorRecursive = value;
|
|
25502
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25503
|
-
}
|
|
25504
|
-
}
|
|
25505
|
-
},
|
|
25506
|
-
{
|
|
25507
|
-
key: "focusMode",
|
|
25508
|
-
get: function get() {
|
|
25509
|
-
return this._focusMode;
|
|
25510
|
-
},
|
|
25511
|
-
set: function set(value) {
|
|
25512
|
-
if (this._focusMode !== value) {
|
|
25513
|
-
var _this_root;
|
|
25514
|
-
this._focusMode = value;
|
|
25515
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25516
|
-
}
|
|
25517
|
-
}
|
|
25518
|
-
},
|
|
25519
|
-
{
|
|
25520
|
-
key: "focusBehaviorRecursive",
|
|
25521
|
-
get: function get() {
|
|
25522
|
-
return this._focusBehaviorRecursive;
|
|
25523
|
-
},
|
|
25524
|
-
set: function set(value) {
|
|
25525
|
-
if (this._focusBehaviorRecursive !== value) {
|
|
25526
|
-
var _this_root;
|
|
25527
|
-
this._focusBehaviorRecursive = value;
|
|
25528
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
|
|
25529
|
-
}
|
|
25530
|
-
}
|
|
25531
|
-
},
|
|
25532
|
-
{
|
|
25533
|
-
key: "defaultCursorShape",
|
|
25534
|
-
get: function get() {
|
|
25535
|
-
return this._defaultCursorShape;
|
|
25536
|
-
},
|
|
25537
|
-
set: function set(value) {
|
|
25538
|
-
this._defaultCursorShape = value;
|
|
25539
|
-
}
|
|
25540
|
-
},
|
|
25541
|
-
{
|
|
25542
|
-
key: "location",
|
|
25543
|
-
get: function get() {
|
|
25544
|
-
return this.position;
|
|
25545
|
-
},
|
|
25546
|
-
set: function set(value) {
|
|
25547
|
-
this.setPosition(value.x, value.y);
|
|
25548
|
-
}
|
|
25549
|
-
},
|
|
25550
|
-
{
|
|
25551
|
-
key: "rotation",
|
|
25552
|
-
get: function get() {
|
|
25553
|
-
return this._rotation;
|
|
25554
|
-
}
|
|
25555
|
-
},
|
|
25556
|
-
{
|
|
25557
|
-
key: "x",
|
|
25558
|
-
get: function get() {
|
|
25559
|
-
return this.position.x;
|
|
25560
|
-
},
|
|
25561
|
-
set: function set(value) {
|
|
25562
|
-
this.setPosition(value, this.position.y);
|
|
25563
|
-
}
|
|
25564
|
-
},
|
|
25565
|
-
{
|
|
25566
|
-
key: "y",
|
|
25567
|
-
get: function get() {
|
|
25568
|
-
return this.position.y;
|
|
25569
|
-
},
|
|
25570
|
-
set: function set(value) {
|
|
25571
|
-
this.setPosition(this.position.x, value);
|
|
25572
|
-
}
|
|
25573
|
-
},
|
|
25574
|
-
{
|
|
25575
|
-
key: "width",
|
|
25576
|
-
get: function get() {
|
|
25577
|
-
return this.size.x;
|
|
25578
|
-
},
|
|
25579
|
-
set: function set(value) {
|
|
25580
|
-
this.setSize(value, this.size.y);
|
|
25581
|
-
}
|
|
25582
|
-
},
|
|
25583
|
-
{
|
|
25584
|
-
key: "height",
|
|
25585
|
-
get: function get() {
|
|
25586
|
-
return this.size.y;
|
|
25587
|
-
},
|
|
25588
|
-
set: function set(value) {
|
|
25589
|
-
this.setSize(this.size.x, value);
|
|
25590
|
-
}
|
|
25591
|
-
},
|
|
25592
|
-
{
|
|
25593
|
-
key: "root",
|
|
25594
|
-
get: function get() {
|
|
25595
|
-
var _this_parent;
|
|
25596
|
-
var _this_parent_root;
|
|
25597
|
-
return _instanceof1(this, RootControl) ? this : (_this_parent_root = (_this_parent = this.parent) == null ? void 0 : _this_parent.root) != null ? _this_parent_root : null;
|
|
25598
|
-
}
|
|
25599
|
-
},
|
|
25600
|
-
{
|
|
25601
|
-
key: "isDisposed",
|
|
25602
|
-
get: function get() {
|
|
25603
|
-
return this.disposed;
|
|
25604
|
-
}
|
|
25605
|
-
}
|
|
25606
|
-
]);
|
|
25607
|
-
return Control;
|
|
25608
|
-
}();
|
|
25609
|
-
/** A Control that owns child Controls. */ var ContainerControl = /*#__PURE__*/ function(Control) {
|
|
25610
|
-
_inherits(ContainerControl, Control);
|
|
25611
|
-
function ContainerControl() {
|
|
25612
|
-
var _this;
|
|
25613
|
-
_this = Control.apply(this, arguments) || this;
|
|
25614
|
-
_this.children = [];
|
|
25615
|
-
return _this;
|
|
25616
|
-
}
|
|
25617
|
-
var _proto = ContainerControl.prototype;
|
|
25618
|
-
_proto.addChild = function addChild(child) {
|
|
25619
|
-
child.parent = this;
|
|
25620
|
-
return child;
|
|
25621
|
-
};
|
|
25622
|
-
_proto.removeChild = function removeChild(child) {
|
|
25623
|
-
if (child.parent === this) {
|
|
25624
|
-
child.parent = null;
|
|
25625
|
-
}
|
|
25626
|
-
};
|
|
25627
|
-
_proto.getChildIndex = function getChildIndex(child) {
|
|
25628
|
-
return this.children.indexOf(child);
|
|
25629
|
-
};
|
|
25630
|
-
/** @internal */ _proto.changeChildIndex = function changeChildIndex(child, newIndex) {
|
|
25631
|
-
var _this_root;
|
|
25632
|
-
var oldIndex = this.children.indexOf(child);
|
|
25633
|
-
if (oldIndex === newIndex || oldIndex === -1) {
|
|
25634
|
-
return;
|
|
25635
|
-
}
|
|
25636
|
-
this.children.splice(oldIndex, 1);
|
|
25637
|
-
if (newIndex < 0 || newIndex >= this.children.length) {
|
|
25638
|
-
this.children.push(child);
|
|
25639
|
-
} else {
|
|
25640
|
-
this.children.splice(newIndex, 0, child);
|
|
25641
|
-
}
|
|
25642
|
-
(_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
|
|
25643
|
-
};
|
|
25644
|
-
/** @internal */ _proto.addChildInternal = function addChildInternal(child) {
|
|
25645
|
-
if (!this.children.includes(child)) {
|
|
25646
|
-
this.children.push(child);
|
|
25647
|
-
}
|
|
25648
|
-
};
|
|
25649
|
-
/** @internal */ _proto.removeChildInternal = function removeChildInternal(child) {
|
|
25650
|
-
var index = this.children.indexOf(child);
|
|
25651
|
-
if (index !== -1) {
|
|
25652
|
-
this.children.splice(index, 1);
|
|
25653
|
-
}
|
|
25654
|
-
};
|
|
25655
|
-
_proto.drawSelf = function drawSelf() {
|
|
25656
|
-
Control.prototype.draw.call(this);
|
|
25657
|
-
};
|
|
25658
|
-
_proto.draw = function draw() {
|
|
25659
|
-
this.drawSelf();
|
|
25660
|
-
this.drawChildren();
|
|
25661
|
-
};
|
|
25662
|
-
_proto.drawChildren = function drawChildren() {
|
|
25663
|
-
var graphics = this.engine.graphics;
|
|
25664
|
-
if (this.clipContents) ;
|
|
25665
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25666
|
-
var child = _step.value;
|
|
25667
|
-
if (!child.visible || child.isDisposed) {
|
|
25668
|
-
continue;
|
|
25669
|
-
}
|
|
25670
|
-
graphics.pushTransform(child.getTransform2D());
|
|
25671
|
-
child.draw();
|
|
25672
|
-
graphics.popTransform();
|
|
25673
|
-
}
|
|
25674
|
-
};
|
|
25675
|
-
_proto.update = function update(deltaTime) {
|
|
25676
|
-
Control.prototype.update.call(this, deltaTime);
|
|
25677
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25678
|
-
var child = _step.value;
|
|
25679
|
-
if (child.enabled && !child.isDisposed) {
|
|
25680
|
-
child.update(deltaTime);
|
|
25681
|
-
}
|
|
25682
|
-
}
|
|
25683
|
-
};
|
|
25684
|
-
_proto.dispose = function dispose() {
|
|
25685
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
|
|
25686
|
-
var child = _step.value;
|
|
25687
|
-
child.dispose();
|
|
25688
|
-
}
|
|
25689
|
-
Control.prototype.dispose.call(this);
|
|
25690
|
-
};
|
|
25691
|
-
return ContainerControl;
|
|
25692
|
-
}(Control);
|
|
25693
|
-
/** Base class for GUI tree roots and input dispatchers. */ var RootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25694
|
-
_inherits(RootControl, ContainerControl);
|
|
25695
|
-
function RootControl() {
|
|
25696
|
-
return ContainerControl.apply(this, arguments);
|
|
25697
|
-
}
|
|
25698
|
-
return RootControl;
|
|
25699
|
-
}(ContainerControl);
|
|
25700
|
-
|
|
25701
|
-
var _obj$4;
|
|
25702
|
-
var cursorNames = (_obj$4 = {}, _obj$4[CursorShape.Arrow] = "default", _obj$4[CursorShape.Ibeam] = "text", _obj$4[CursorShape.PointingHand] = "pointer", _obj$4[CursorShape.Cross] = "crosshair", _obj$4[CursorShape.Wait] = "wait", _obj$4[CursorShape.Busy] = "progress", _obj$4[CursorShape.Drag] = "grab", _obj$4[CursorShape.CanDrop] = "copy", _obj$4[CursorShape.Forbidden] = "not-allowed", _obj$4[CursorShape.Vsize] = "ns-resize", _obj$4[CursorShape.Hsize] = "ew-resize", _obj$4[CursorShape.Bdiagsize] = "nesw-resize", _obj$4[CursorShape.Fdiagsize] = "nwse-resize", _obj$4[CursorShape.Move] = "move", _obj$4[CursorShape.Vsplit] = "row-resize", _obj$4[CursorShape.Hsplit] = "col-resize", _obj$4[CursorShape.Help] = "help", _obj$4);
|
|
25703
|
-
function getButtonMask(button) {
|
|
25704
|
-
switch(button){
|
|
25705
|
-
case MouseButton.Left:
|
|
25706
|
-
return MouseButtonMask.Left;
|
|
25707
|
-
case MouseButton.Right:
|
|
25708
|
-
return MouseButtonMask.Right;
|
|
25709
|
-
case MouseButton.Middle:
|
|
25710
|
-
return MouseButtonMask.Middle;
|
|
25711
|
-
case MouseButton.Xbutton1:
|
|
25712
|
-
return MouseButtonMask.Xbutton1;
|
|
25713
|
-
case MouseButton.Xbutton2:
|
|
25714
|
-
return MouseButtonMask.Xbutton2;
|
|
25715
|
-
default:
|
|
25716
|
-
return MouseButtonMask.None;
|
|
25717
|
-
}
|
|
25718
|
-
}
|
|
25719
|
-
function isWheelButton(button) {
|
|
25720
|
-
return button >= MouseButton.WheelUp && button <= MouseButton.WheelRight;
|
|
25721
|
-
}
|
|
25722
|
-
function getWheelDelta(event) {
|
|
25723
|
-
return event.buttonIndex === MouseButton.WheelUp || event.buttonIndex === MouseButton.WheelLeft ? event.factor : -event.factor;
|
|
25724
|
-
}
|
|
25725
|
-
/** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
|
|
25726
|
-
_inherits(CanvasRootControl, ContainerControl);
|
|
25727
|
-
function CanvasRootControl(engine, canvas) {
|
|
25728
|
-
var _this;
|
|
25729
|
-
_this = ContainerControl.call(this, engine) || this;
|
|
25730
|
-
_this.canvas = canvas;
|
|
25731
|
-
_this.mouseFilter = MouseFilter.Ignore;
|
|
25732
|
-
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25733
|
-
return _this;
|
|
25734
|
-
}
|
|
25735
|
-
_create_class(CanvasRootControl, [
|
|
25736
|
-
{
|
|
25737
|
-
key: "inputDisabled",
|
|
25738
|
-
get: function get() {
|
|
25739
|
-
var _this_canvas_item;
|
|
25740
|
-
return !this.canvas.receivesEvents || !this.canvas.enabled || !((_this_canvas_item = this.canvas.item) == null ? void 0 : _this_canvas_item.isActive);
|
|
25741
|
-
}
|
|
25742
|
-
}
|
|
25743
|
-
]);
|
|
25744
|
-
return CanvasRootControl;
|
|
25745
|
-
}(ContainerControl);
|
|
25746
|
-
/** Global ordered collection of UICanvas roots. */ var CanvasContainer = /*#__PURE__*/ function(ContainerControl) {
|
|
25747
|
-
_inherits(CanvasContainer, ContainerControl);
|
|
25748
|
-
function CanvasContainer(engine) {
|
|
25749
|
-
var _this;
|
|
25750
|
-
_this = ContainerControl.call(this, engine) || this;
|
|
25751
|
-
_this.mouseFilter = MouseFilter.Ignore;
|
|
25752
|
-
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25753
|
-
return _this;
|
|
25754
|
-
}
|
|
25755
|
-
var _proto = CanvasContainer.prototype;
|
|
25756
|
-
_proto.sortCanvases = function sortCanvases() {
|
|
25757
|
-
this.children.sort(function(left, right) {
|
|
25758
|
-
return left.canvas.order - right.canvas.order;
|
|
25759
|
-
});
|
|
25760
|
-
};
|
|
25761
|
-
_proto.addChildInternal = function addChildInternal(child) {
|
|
25762
|
-
ContainerControl.prototype.addChildInternal.call(this, child);
|
|
25763
|
-
this.sortCanvases();
|
|
25764
|
-
};
|
|
25765
|
-
_proto.draw = function draw() {
|
|
25766
|
-
this.sortCanvases();
|
|
25767
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
25768
|
-
var child = _step.value;
|
|
25769
|
-
var root = child;
|
|
25770
|
-
if (root.canvas.isVisible) {
|
|
25771
|
-
root.draw();
|
|
25772
|
-
}
|
|
25773
|
-
}
|
|
25774
|
-
};
|
|
25775
|
-
return CanvasContainer;
|
|
25776
|
-
}(ContainerControl);
|
|
25777
|
-
/** Engine window GUI root. Routes events across all UICanvas roots. */ var WindowRootControl = /*#__PURE__*/ function(RootControl) {
|
|
25778
|
-
_inherits(WindowRootControl, RootControl);
|
|
25779
|
-
function WindowRootControl(engine) {
|
|
25780
|
-
var _this;
|
|
25781
|
-
_this = RootControl.call(this, engine) || this;
|
|
25782
|
-
_this.dragThreshold = 10;
|
|
25783
|
-
_this.inputHandled = false;
|
|
25784
|
-
_this.gui = {
|
|
25785
|
-
mouseFocus: null,
|
|
25786
|
-
mouseClickGrabber: null,
|
|
25787
|
-
mouseFocusMask: MouseButtonMask.None,
|
|
25788
|
-
mouseOver: null,
|
|
25789
|
-
mouseOverHierarchy: [],
|
|
25790
|
-
touchFocus: new Map(),
|
|
25791
|
-
keyFocus: null,
|
|
25792
|
-
dragAccum: new Vector2(),
|
|
25793
|
-
dragAttempted: false,
|
|
25794
|
-
dragging: false,
|
|
25795
|
-
dragData: null,
|
|
25796
|
-
dragMouseOver: null,
|
|
25797
|
-
dragSuccessful: false,
|
|
25798
|
-
lastMousePosition: new Vector2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY),
|
|
25799
|
-
sendingMouseEnterExit: false,
|
|
25800
|
-
mouseOverUpdatePending: false
|
|
25801
|
-
};
|
|
25802
|
-
_this.mouseFilter = MouseFilter.Ignore;
|
|
25803
|
-
_this.setSize(engine.canvas.width, engine.canvas.height);
|
|
25804
|
-
_this.canvases = new CanvasContainer(engine);
|
|
25805
|
-
_this.canvases.parent = _assert_this_initialized(_this);
|
|
25806
|
-
return _this;
|
|
25807
|
-
}
|
|
25808
|
-
var _proto = WindowRootControl.prototype;
|
|
25809
|
-
_proto.pushInput = function pushInput(event) {
|
|
25810
|
-
this.inputHandled = false;
|
|
25811
|
-
this.cleanupInternalState();
|
|
25812
|
-
this.processGUIInput(event);
|
|
25813
|
-
this.postGrabClickFocus();
|
|
25814
|
-
};
|
|
25815
|
-
_proto.isInputHandled = function isInputHandled() {
|
|
25816
|
-
return this.inputHandled;
|
|
25817
|
-
};
|
|
25818
|
-
_proto.getMousePosition = function getMousePosition() {
|
|
25819
|
-
return this.gui.lastMousePosition.clone();
|
|
25820
|
-
};
|
|
25821
|
-
_proto.guiGetFocusOwner = function guiGetFocusOwner() {
|
|
25822
|
-
return this.isFocusTargetUsable(this.gui.keyFocus) ? this.gui.keyFocus : null;
|
|
25823
|
-
};
|
|
25824
|
-
_proto.guiReleaseFocus = function guiReleaseFocus() {
|
|
25825
|
-
this.releaseControlFocus();
|
|
25826
|
-
};
|
|
25827
|
-
_proto.guiIsDragging = function guiIsDragging() {
|
|
25828
|
-
return this.gui.dragging;
|
|
25829
|
-
};
|
|
25830
|
-
_proto.guiGetDragData = function guiGetDragData() {
|
|
25831
|
-
return this.gui.dragData;
|
|
25832
|
-
};
|
|
25833
|
-
_proto.guiIsDragSuccessful = function guiIsDragSuccessful() {
|
|
25834
|
-
return this.gui.dragSuccessful;
|
|
25835
|
-
};
|
|
25836
|
-
_proto.guiCancelDrag = function guiCancelDrag() {
|
|
25837
|
-
this.endDragging(false);
|
|
25838
|
-
};
|
|
25839
|
-
_proto.acceptControlEvent = function acceptControlEvent(control) {
|
|
25840
|
-
if (this.isControlUsable(control)) {
|
|
25841
|
-
this.inputHandled = true;
|
|
25842
|
-
}
|
|
25843
|
-
};
|
|
25844
|
-
_proto.grabControlFocus = function grabControlFocus(control) {
|
|
25845
|
-
if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
|
|
25846
|
-
return;
|
|
25847
|
-
}
|
|
25848
|
-
var previous = this.gui.keyFocus;
|
|
25849
|
-
this.gui.keyFocus = control;
|
|
25850
|
-
if (previous && !previous.isDisposed) {
|
|
25851
|
-
previous.onLostFocus();
|
|
25852
|
-
}
|
|
25853
|
-
control.onGotFocus();
|
|
25854
|
-
};
|
|
25855
|
-
_proto.grabControlClickFocus = function grabControlClickFocus(control) {
|
|
25856
|
-
var _this = this;
|
|
25857
|
-
if (this.isControlValid(control)) {
|
|
25858
|
-
this.gui.mouseClickGrabber = control;
|
|
25859
|
-
queueMicrotask(function() {
|
|
25860
|
-
return _this.postGrabClickFocus();
|
|
25861
|
-
});
|
|
25862
|
-
}
|
|
25863
|
-
};
|
|
25864
|
-
_proto.releaseControlFocus = function releaseControlFocus(control) {
|
|
25865
|
-
var previous = this.gui.keyFocus;
|
|
25866
|
-
if (!previous || control && previous !== control) {
|
|
25867
|
-
return;
|
|
25868
|
-
}
|
|
25869
|
-
this.gui.keyFocus = null;
|
|
25870
|
-
if (!previous.isDisposed) {
|
|
25871
|
-
previous.onLostFocus();
|
|
25872
|
-
}
|
|
25873
|
-
};
|
|
25874
|
-
_proto.warpControlMouse = function warpControlMouse(position) {
|
|
25875
|
-
this.gui.lastMousePosition.copyFrom(position);
|
|
25876
|
-
this.updateMouseOver(position);
|
|
25877
|
-
};
|
|
25878
|
-
_proto.controlStateChanged = function controlStateChanged(control) {
|
|
25879
|
-
if (!this.isControlUsable(control)) {
|
|
25880
|
-
this.dropControlState(control);
|
|
25881
|
-
}
|
|
25882
|
-
this.requestMouseOverUpdate();
|
|
25883
|
-
};
|
|
25884
|
-
_proto.controlRemoved = function controlRemoved(control) {
|
|
25885
|
-
this.dropControlState(control);
|
|
25886
|
-
this.cleanupInternalState();
|
|
25887
|
-
this.requestMouseOverUpdate();
|
|
25888
|
-
};
|
|
25889
|
-
_proto.controlTreeChanged = function controlTreeChanged() {
|
|
25890
|
-
this.requestMouseOverUpdate();
|
|
25891
|
-
};
|
|
25892
|
-
_proto.cancelPointerInput = function cancelPointerInput() {
|
|
25893
|
-
this.dropMouseFocus();
|
|
25894
|
-
this.dropMouseOver();
|
|
25895
|
-
this.gui.touchFocus.clear();
|
|
25896
|
-
this.endDragging(false);
|
|
25897
|
-
this.releaseControlFocus();
|
|
25898
|
-
};
|
|
25899
|
-
_proto.resize = function resize(width, height) {
|
|
25900
|
-
this.setSize(width, height);
|
|
25901
|
-
this.canvases.setSize(width, height);
|
|
25902
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.canvases.children), _step; !(_step = _iterator()).done;){
|
|
25903
|
-
var root = _step.value;
|
|
25904
|
-
root.setSize(width, height);
|
|
25905
|
-
}
|
|
25906
|
-
};
|
|
25907
|
-
_proto.render = function render() {
|
|
25908
|
-
if (this.canvases.children.length === 0) {
|
|
25909
|
-
return;
|
|
25910
|
-
}
|
|
25911
|
-
this.engine.graphics.begin();
|
|
25912
|
-
this.draw();
|
|
25913
|
-
this.engine.graphics.end();
|
|
25914
|
-
};
|
|
25915
|
-
_proto.update = function update(deltaTime) {
|
|
25916
|
-
if (this.gui.mouseOverUpdatePending) {
|
|
25917
|
-
this.gui.mouseOverUpdatePending = false;
|
|
25918
|
-
this.updateMouseOver(this.gui.lastMousePosition);
|
|
25919
|
-
}
|
|
25920
|
-
RootControl.prototype.update.call(this, deltaTime);
|
|
25921
|
-
};
|
|
25922
|
-
_proto.dispose = function dispose() {
|
|
25923
|
-
this.cancelPointerInput();
|
|
25924
|
-
RootControl.prototype.dispose.call(this);
|
|
25925
|
-
};
|
|
25926
|
-
_proto.processGUIInput = function processGUIInput(event) {
|
|
25927
|
-
if (_instanceof1(event, InputEventKey)) {
|
|
25928
|
-
var target = this.guiGetFocusOwner();
|
|
25929
|
-
if (target) {
|
|
25930
|
-
this.callControlInput(target, event);
|
|
25931
|
-
}
|
|
25932
|
-
} else if (_instanceof1(event, InputEventMouse)) {
|
|
25933
|
-
this.gui.lastMousePosition.copyFrom(event.globalPosition);
|
|
25934
|
-
this.updateMouseOver(event.globalPosition);
|
|
25935
|
-
if (_instanceof1(event, InputEventMouseButton)) {
|
|
25936
|
-
this.processMouseButton(event);
|
|
25937
|
-
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
25938
|
-
this.processMouseMotion(event);
|
|
25939
|
-
}
|
|
25940
|
-
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
25941
|
-
this.processScreenTouch(event);
|
|
25942
|
-
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
25943
|
-
this.processScreenDrag(event);
|
|
25944
|
-
}
|
|
25945
|
-
};
|
|
25946
|
-
_proto.processMouseButton = function processMouseButton(event) {
|
|
25947
|
-
if (isWheelButton(event.buttonIndex)) {
|
|
25948
|
-
var target = this.findInputControl(event.globalPosition);
|
|
25949
|
-
if (target) {
|
|
25950
|
-
this.callGUIInput(target, event);
|
|
25951
|
-
}
|
|
25952
|
-
return;
|
|
25953
|
-
}
|
|
25954
|
-
var mask = getButtonMask(event.buttonIndex);
|
|
25955
|
-
if (event.isPressed()) {
|
|
25956
|
-
var target1 = this.gui.mouseFocusMask !== 0 ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
25957
|
-
this.gui.mouseFocus = target1;
|
|
25958
|
-
if (!target1) {
|
|
25959
|
-
return;
|
|
25960
|
-
}
|
|
25961
|
-
this.gui.mouseFocusMask |= mask;
|
|
25962
|
-
if (event.buttonIndex === MouseButton.Left) {
|
|
25963
|
-
this.gui.dragAccum.setZero();
|
|
25964
|
-
this.gui.dragAttempted = false;
|
|
25965
|
-
this.findClickFocus(target1);
|
|
25966
|
-
}
|
|
25967
|
-
this.callGUIInput(target1, event);
|
|
25968
|
-
} else {
|
|
25969
|
-
if (event.buttonIndex === MouseButton.Left && this.gui.dragging) {
|
|
25970
|
-
this.finishDrop(event.globalPosition);
|
|
25971
|
-
}
|
|
25972
|
-
this.gui.mouseFocusMask &= ~mask;
|
|
25973
|
-
var target2 = this.gui.mouseFocus;
|
|
25974
|
-
if (this.gui.mouseFocusMask === 0) {
|
|
25975
|
-
this.gui.mouseFocus = null;
|
|
25976
|
-
}
|
|
25977
|
-
if (this.isControlUsable(target2)) {
|
|
25978
|
-
this.callGUIInput(target2, event);
|
|
25979
|
-
}
|
|
25980
|
-
}
|
|
25981
|
-
};
|
|
25982
|
-
_proto.processMouseMotion = function processMouseMotion(event) {
|
|
25983
|
-
if (!this.gui.dragging && !this.gui.dragAttempted && this.gui.mouseFocus && (this.gui.mouseFocusMask & MouseButtonMask.Left) !== 0) {
|
|
25984
|
-
this.gui.dragAccum.add(event.relative);
|
|
25985
|
-
if (this.gui.dragAccum.length() > this.dragThreshold) {
|
|
25986
|
-
var origin = event.globalPosition.clone().subtract(this.gui.dragAccum);
|
|
25987
|
-
this.beginDragging(this.gui.mouseFocus, origin);
|
|
25988
|
-
this.gui.dragAttempted = true;
|
|
25989
|
-
}
|
|
25990
|
-
}
|
|
25991
|
-
var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
|
|
25992
|
-
if (target) {
|
|
25993
|
-
this.callGUIInput(target, event);
|
|
25994
|
-
}
|
|
25995
|
-
if (this.gui.dragging) {
|
|
25996
|
-
this.gui.dragMouseOver = this.findDropTarget(this.findInputControl(event.globalPosition), event.globalPosition);
|
|
25997
|
-
}
|
|
25998
|
-
this.updateCursor(target, event.globalPosition);
|
|
25999
|
-
};
|
|
26000
|
-
_proto.processScreenTouch = function processScreenTouch(event) {
|
|
26001
|
-
var target;
|
|
26002
|
-
if (event.isPressed()) {
|
|
26003
|
-
target = this.findInputControl(event.position);
|
|
26004
|
-
if (target) {
|
|
26005
|
-
this.gui.touchFocus.set(event.index, target);
|
|
26006
|
-
}
|
|
26007
|
-
} else {
|
|
26008
|
-
var _this_gui_touchFocus_get;
|
|
26009
|
-
target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : null;
|
|
26010
|
-
this.gui.touchFocus.delete(event.index);
|
|
26011
|
-
}
|
|
26012
|
-
if (this.isControlUsable(target)) {
|
|
26013
|
-
this.callGUIInput(target, event);
|
|
26014
|
-
}
|
|
26015
|
-
};
|
|
26016
|
-
_proto.processScreenDrag = function processScreenDrag(event) {
|
|
26017
|
-
var _this_gui_touchFocus_get;
|
|
26018
|
-
var target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : this.findInputControl(event.position);
|
|
26019
|
-
if (this.isControlUsable(target)) {
|
|
26020
|
-
this.callGUIInput(target, event);
|
|
26021
|
-
}
|
|
26022
|
-
};
|
|
26023
|
-
_proto.callGUIInput = function callGUIInput(target, event) {
|
|
26024
|
-
var current = target;
|
|
26025
|
-
var pointerEvent = _instanceof1(event, InputEventMouse) || _instanceof1(event, InputEventScreenTouch) || _instanceof1(event, InputEventScreenDrag);
|
|
26026
|
-
while(current && current !== this && this.isControlUsable(current)){
|
|
26027
|
-
var filter = current.getEffectiveMouseFilter();
|
|
26028
|
-
if (filter !== MouseFilter.Ignore) {
|
|
26029
|
-
this.callControlInput(current, event.xformedBy(this.getGlobalInverse(current)));
|
|
26030
|
-
}
|
|
26031
|
-
var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
|
|
26032
|
-
if (this.inputHandled || filter === MouseFilter.Stop && pointerEvent && !forcePassWheel) {
|
|
26033
|
-
this.inputHandled = true;
|
|
26034
|
-
return;
|
|
26035
|
-
}
|
|
26036
|
-
current = current.parent;
|
|
26037
|
-
}
|
|
26038
|
-
};
|
|
26039
|
-
_proto.callControlInput = function callControlInput(control, event) {
|
|
26040
|
-
if (_instanceof1(event, InputEventMouseButton)) {
|
|
26041
|
-
if (isWheelButton(event.buttonIndex)) {
|
|
26042
|
-
control.onMouseWheel(event.position, getWheelDelta(event), event);
|
|
26043
|
-
} else if (event.isPressed()) {
|
|
26044
|
-
control.onMouseDown(event.position, event.buttonIndex, event);
|
|
26045
|
-
} else {
|
|
26046
|
-
control.onMouseUp(event.position, event.buttonIndex, event);
|
|
26047
|
-
}
|
|
26048
|
-
} else if (_instanceof1(event, InputEventMouseMotion)) {
|
|
26049
|
-
control.onMouseMove(event.position, event);
|
|
26050
|
-
} else if (_instanceof1(event, InputEventScreenTouch)) {
|
|
26051
|
-
if (event.isPressed()) {
|
|
26052
|
-
control.onTouchDown(event.position, event.index, event);
|
|
26053
|
-
} else {
|
|
26054
|
-
control.onTouchUp(event.position, event.index, event);
|
|
26055
|
-
}
|
|
26056
|
-
} else if (_instanceof1(event, InputEventScreenDrag)) {
|
|
26057
|
-
control.onTouchMove(event.position, event.index, event);
|
|
26058
|
-
} else if (_instanceof1(event, InputEventKey)) {
|
|
26059
|
-
if (event.isPressed()) {
|
|
26060
|
-
control.onKeyDown(event);
|
|
26061
|
-
} else if (event.isReleased()) {
|
|
26062
|
-
control.onKeyUp(event);
|
|
26063
|
-
}
|
|
26064
|
-
}
|
|
26065
|
-
};
|
|
26066
|
-
_proto.findInputControl = function findInputControl(position) {
|
|
26067
|
-
this.canvases.sortCanvases();
|
|
26068
|
-
for(var index = this.canvases.children.length - 1; index >= 0; index--){
|
|
26069
|
-
var root = this.canvases.children[index];
|
|
26070
|
-
if (!root.canvas.isVisible || root.inputDisabled) {
|
|
26071
|
-
continue;
|
|
26072
|
-
}
|
|
26073
|
-
var target = this.findControlAtPosition(root, position, true);
|
|
26074
|
-
if (target) {
|
|
26075
|
-
return target;
|
|
26076
|
-
}
|
|
26077
|
-
}
|
|
26078
|
-
return null;
|
|
26079
|
-
};
|
|
26080
|
-
_proto.findControlAtPosition = function findControlAtPosition(container, position, skipSelf) {
|
|
26081
|
-
if (skipSelf === void 0) skipSelf = false;
|
|
26082
|
-
if (!container.visibleInHierarchy || container.isDisposed) {
|
|
26083
|
-
return null;
|
|
26084
|
-
}
|
|
26085
|
-
var localPosition = this.toLocal(container, position);
|
|
26086
|
-
if (container.clipContents && !container.hasPoint(localPosition)) {
|
|
26087
|
-
return null;
|
|
26088
|
-
}
|
|
26089
|
-
for(var index = container.children.length - 1; index >= 0; index--){
|
|
26090
|
-
var child = container.children[index];
|
|
26091
|
-
if (!child.visibleInHierarchy || child.isDisposed) {
|
|
26092
|
-
continue;
|
|
26093
|
-
}
|
|
26094
|
-
if (_instanceof1(child, ContainerControl)) {
|
|
26095
|
-
var found = this.findControlAtPosition(child, position);
|
|
26096
|
-
if (found) {
|
|
26097
|
-
return found;
|
|
26098
|
-
}
|
|
26099
|
-
} else if (child.getEffectiveMouseFilter() !== MouseFilter.Ignore && child.hasPoint(this.toLocal(child, position))) {
|
|
26100
|
-
return child;
|
|
26101
|
-
}
|
|
26102
|
-
}
|
|
26103
|
-
if (!skipSelf && container.getEffectiveMouseFilter() !== MouseFilter.Ignore && container.hasPoint(localPosition)) {
|
|
26104
|
-
return container;
|
|
26105
|
-
}
|
|
26106
|
-
return null;
|
|
26107
|
-
};
|
|
26108
|
-
_proto.updateMouseOver = function updateMouseOver(position) {
|
|
26109
|
-
if (this.gui.sendingMouseEnterExit) {
|
|
26110
|
-
this.gui.mouseOverUpdatePending = true;
|
|
26111
|
-
return;
|
|
26112
|
-
}
|
|
26113
|
-
this.gui.mouseOverUpdatePending = false;
|
|
26114
|
-
var target = this.findInputControl(position);
|
|
26115
|
-
var next = this.buildHoverHierarchy(target);
|
|
26116
|
-
var previous = this.gui.mouseOverHierarchy;
|
|
26117
|
-
var common = 0;
|
|
26118
|
-
while(common < previous.length && common < next.length && previous[common] === next[common]){
|
|
26119
|
-
common++;
|
|
26120
|
-
}
|
|
26121
|
-
this.gui.sendingMouseEnterExit = true;
|
|
26122
|
-
for(var index = previous.length - 1; index >= common; index--){
|
|
26123
|
-
if (!previous[index].isDisposed) {
|
|
26124
|
-
previous[index].onMouseLeave();
|
|
26125
|
-
}
|
|
26126
|
-
}
|
|
26127
|
-
for(var index1 = common; index1 < next.length; index1++){
|
|
26128
|
-
next[index1].onMouseEnter(this.toLocal(next[index1], position));
|
|
26129
|
-
}
|
|
26130
|
-
this.gui.sendingMouseEnterExit = false;
|
|
26131
|
-
this.gui.mouseOver = target;
|
|
26132
|
-
this.gui.mouseOverHierarchy = next;
|
|
26133
|
-
};
|
|
26134
|
-
_proto.buildHoverHierarchy = function buildHoverHierarchy(target) {
|
|
26135
|
-
var hierarchy = [];
|
|
26136
|
-
var current = target;
|
|
26137
|
-
while(current && current !== this){
|
|
26138
|
-
if (current.getEffectiveMouseFilter() !== MouseFilter.Ignore) {
|
|
26139
|
-
hierarchy.push(current);
|
|
26140
|
-
}
|
|
26141
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26142
|
-
break;
|
|
26143
|
-
}
|
|
26144
|
-
current = current.parent;
|
|
26145
|
-
}
|
|
26146
|
-
hierarchy.reverse();
|
|
26147
|
-
return hierarchy;
|
|
26148
|
-
};
|
|
26149
|
-
_proto.findClickFocus = function findClickFocus(target) {
|
|
26150
|
-
var current = target;
|
|
26151
|
-
while(current && current !== this){
|
|
26152
|
-
var mode = current.getFocusModeWithOverride();
|
|
26153
|
-
if (mode === FocusMode.Click || mode === FocusMode.All) {
|
|
26154
|
-
this.grabControlFocus(current);
|
|
26155
|
-
return;
|
|
26156
|
-
}
|
|
26157
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26158
|
-
return;
|
|
26159
|
-
}
|
|
26160
|
-
current = current.parent;
|
|
26161
|
-
}
|
|
26162
|
-
};
|
|
26163
|
-
_proto.beginDragging = function beginDragging(source, position) {
|
|
26164
|
-
var current = source;
|
|
26165
|
-
while(current && current !== this){
|
|
26166
|
-
var data = current.invokeGetDragData(this.toLocal(current, position));
|
|
26167
|
-
if (data !== null && data !== undefined) {
|
|
26168
|
-
this.gui.dragging = true;
|
|
26169
|
-
this.gui.dragData = data;
|
|
26170
|
-
this.gui.mouseFocus = null;
|
|
26171
|
-
this.gui.mouseFocusMask = MouseButtonMask.None;
|
|
26172
|
-
return;
|
|
26173
|
-
}
|
|
26174
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26175
|
-
return;
|
|
26176
|
-
}
|
|
26177
|
-
current = current.parent;
|
|
26178
|
-
}
|
|
26179
|
-
};
|
|
26180
|
-
_proto.finishDrop = function finishDrop(position) {
|
|
26181
|
-
var target = this.findDropTarget(this.findInputControl(position), position);
|
|
26182
|
-
if (target) {
|
|
26183
|
-
target.invokeDropData(this.toLocal(target, position), this.gui.dragData);
|
|
26184
|
-
}
|
|
26185
|
-
this.endDragging(!!target);
|
|
26186
|
-
};
|
|
26187
|
-
_proto.findDropTarget = function findDropTarget(target, position) {
|
|
26188
|
-
var current = target;
|
|
26189
|
-
while(current && current !== this){
|
|
26190
|
-
if (current.invokeCanDropData(this.toLocal(current, position), this.gui.dragData)) {
|
|
26191
|
-
return current;
|
|
26192
|
-
}
|
|
26193
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26194
|
-
return null;
|
|
26195
|
-
}
|
|
26196
|
-
current = current.parent;
|
|
26197
|
-
}
|
|
26198
|
-
return null;
|
|
26199
|
-
};
|
|
26200
|
-
_proto.endDragging = function endDragging(successful) {
|
|
26201
|
-
this.gui.dragSuccessful = successful;
|
|
26202
|
-
this.gui.dragging = false;
|
|
26203
|
-
this.gui.dragData = null;
|
|
26204
|
-
this.gui.dragMouseOver = null;
|
|
26205
|
-
};
|
|
26206
|
-
_proto.updateCursor = function updateCursor(target, position) {
|
|
26207
|
-
var current = target;
|
|
26208
|
-
var shape = CursorShape.Arrow;
|
|
26209
|
-
while(current && current !== this){
|
|
26210
|
-
var candidate = current.getCursorShape(this.toLocal(current, position));
|
|
26211
|
-
if (candidate !== CursorShape.Arrow) {
|
|
26212
|
-
shape = candidate;
|
|
26213
|
-
break;
|
|
26214
|
-
}
|
|
26215
|
-
if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
|
|
26216
|
-
break;
|
|
26217
|
-
}
|
|
26218
|
-
current = current.parent;
|
|
26219
|
-
}
|
|
26220
|
-
this.engine.canvas.style.cursor = cursorNames[shape];
|
|
26221
|
-
};
|
|
26222
|
-
_proto.postGrabClickFocus = function postGrabClickFocus() {
|
|
26223
|
-
var target = this.gui.mouseClickGrabber;
|
|
26224
|
-
this.gui.mouseClickGrabber = null;
|
|
26225
|
-
if (this.isControlUsable(target)) {
|
|
26226
|
-
this.gui.mouseFocus = target;
|
|
26227
|
-
}
|
|
26228
|
-
};
|
|
26229
|
-
_proto.cleanupInternalState = function cleanupInternalState() {
|
|
26230
|
-
if (!this.isControlUsable(this.gui.mouseFocus)) {
|
|
26231
|
-
this.dropMouseFocus();
|
|
26232
|
-
}
|
|
26233
|
-
if (this.gui.keyFocus && !this.isFocusTargetUsable(this.gui.keyFocus)) {
|
|
26234
|
-
this.releaseControlFocus(this.gui.keyFocus);
|
|
26235
|
-
}
|
|
26236
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26237
|
-
var _step_value = _step.value, index = _step_value[0], control = _step_value[1];
|
|
26238
|
-
if (!this.isControlUsable(control)) {
|
|
26239
|
-
this.gui.touchFocus.delete(index);
|
|
26240
|
-
}
|
|
26241
|
-
}
|
|
26242
|
-
};
|
|
26243
|
-
_proto.dropMouseFocus = function dropMouseFocus() {
|
|
26244
|
-
this.gui.mouseFocus = null;
|
|
26245
|
-
this.gui.mouseFocusMask = MouseButtonMask.None;
|
|
26246
|
-
};
|
|
26247
|
-
_proto.dropMouseOver = function dropMouseOver() {
|
|
26248
|
-
for(var index = this.gui.mouseOverHierarchy.length - 1; index >= 0; index--){
|
|
26249
|
-
var control = this.gui.mouseOverHierarchy[index];
|
|
26250
|
-
if (!control.isDisposed) {
|
|
26251
|
-
control.onMouseLeave();
|
|
26252
|
-
}
|
|
26253
|
-
}
|
|
26254
|
-
this.gui.mouseOver = null;
|
|
26255
|
-
this.gui.mouseOverHierarchy = [];
|
|
26256
|
-
};
|
|
26257
|
-
_proto.dropControlState = function dropControlState(control) {
|
|
26258
|
-
if (this.controlBelongsToSubtree(this.gui.mouseFocus, control)) {
|
|
26259
|
-
this.dropMouseFocus();
|
|
26260
|
-
}
|
|
26261
|
-
if (this.controlBelongsToSubtree(this.gui.mouseClickGrabber, control)) {
|
|
26262
|
-
this.gui.mouseClickGrabber = null;
|
|
26263
|
-
}
|
|
26264
|
-
if (this.controlBelongsToSubtree(this.gui.keyFocus, control)) {
|
|
26265
|
-
var _this_gui_keyFocus;
|
|
26266
|
-
this.releaseControlFocus((_this_gui_keyFocus = this.gui.keyFocus) != null ? _this_gui_keyFocus : undefined);
|
|
26267
|
-
}
|
|
26268
|
-
if (this.controlBelongsToSubtree(this.gui.mouseOver, control)) {
|
|
26269
|
-
this.dropMouseOver();
|
|
26270
|
-
}
|
|
26271
|
-
if (this.controlBelongsToSubtree(this.gui.dragMouseOver, control)) {
|
|
26272
|
-
this.gui.dragMouseOver = null;
|
|
26273
|
-
}
|
|
26274
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
|
|
26275
|
-
var _step_value = _step.value, index = _step_value[0], target = _step_value[1];
|
|
26276
|
-
if (this.controlBelongsToSubtree(target, control)) {
|
|
26277
|
-
this.gui.touchFocus.delete(index);
|
|
26278
|
-
}
|
|
26279
|
-
}
|
|
26280
|
-
};
|
|
26281
|
-
_proto.requestMouseOverUpdate = function requestMouseOverUpdate() {
|
|
26282
|
-
if (Number.isFinite(this.gui.lastMousePosition.x)) {
|
|
26283
|
-
this.updateMouseOver(this.gui.lastMousePosition);
|
|
26284
|
-
}
|
|
26285
|
-
};
|
|
26286
|
-
_proto.getGlobalInverse = function getGlobalInverse(control) {
|
|
26287
|
-
var transform = control.getGlobalTransform2D().clone();
|
|
26288
|
-
return Math.abs(transform.determinant()) < 1e-12 ? new Matrix3() : transform.invert();
|
|
26289
|
-
};
|
|
26290
|
-
_proto.toLocal = function toLocal(control, position) {
|
|
26291
|
-
var elements = this.getGlobalInverse(control).elements;
|
|
26292
|
-
return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
|
|
26293
|
-
};
|
|
26294
|
-
_proto.controlBelongsToSubtree = function controlBelongsToSubtree(control, subtree) {
|
|
26295
|
-
var current = control;
|
|
26296
|
-
while(current){
|
|
26297
|
-
if (current === subtree) {
|
|
26298
|
-
return true;
|
|
26299
|
-
}
|
|
26300
|
-
current = current.parent;
|
|
26301
|
-
}
|
|
26302
|
-
return false;
|
|
26303
|
-
};
|
|
26304
|
-
_proto.isControlValid = function isControlValid(control) {
|
|
26305
|
-
return !!control && !control.isDisposed && control.root === this;
|
|
26306
|
-
};
|
|
26307
|
-
_proto.isControlUsable = function isControlUsable(control) {
|
|
26308
|
-
if (!this.isControlValid(control) || !control.visibleInHierarchy || !control.enabledInHierarchy) {
|
|
26309
|
-
return false;
|
|
26310
|
-
}
|
|
26311
|
-
var root = this.findCanvasRoot(control);
|
|
26312
|
-
return !root || !root.inputDisabled;
|
|
26313
|
-
};
|
|
26314
|
-
_proto.findCanvasRoot = function findCanvasRoot(control) {
|
|
26315
|
-
var current = control;
|
|
26316
|
-
while(current && current !== this){
|
|
26317
|
-
if (_instanceof1(current, CanvasRootControl)) {
|
|
26318
|
-
return current;
|
|
26319
|
-
}
|
|
26320
|
-
current = current.parent;
|
|
26321
|
-
}
|
|
26322
|
-
return null;
|
|
26323
|
-
};
|
|
26324
|
-
_proto.isFocusTargetUsable = function isFocusTargetUsable(control) {
|
|
26325
|
-
return this.isControlUsable(control) && control.getFocusModeWithOverride() !== FocusMode.None;
|
|
26326
|
-
};
|
|
26327
|
-
return WindowRootControl;
|
|
26328
|
-
}(RootControl);
|
|
26329
|
-
|
|
26330
|
-
var CanvasRenderMode;
|
|
26331
|
-
(function(CanvasRenderMode) {
|
|
26332
|
-
CanvasRenderMode[CanvasRenderMode["ScreenSpace"] = 0] = "ScreenSpace";
|
|
26333
|
-
CanvasRenderMode[CanvasRenderMode["CameraSpace"] = 1] = "CameraSpace";
|
|
26334
|
-
CanvasRenderMode[CanvasRenderMode["WorldSpace"] = 2] = "WorldSpace";
|
|
26335
|
-
CanvasRenderMode[CanvasRenderMode["WorldSpaceFaceCamera"] = 3] = "WorldSpaceFaceCamera";
|
|
26336
|
-
})(CanvasRenderMode || (CanvasRenderMode = {}));
|
|
26337
|
-
/** Canvas-layer boundary attached to a VFXItem. Input state remains owned by the window root. */ var UICanvas = /*#__PURE__*/ function(Component) {
|
|
26338
|
-
_inherits(UICanvas, Component);
|
|
26339
|
-
function UICanvas(engine) {
|
|
26340
|
-
var _this;
|
|
26341
|
-
_this = Component.call(this, engine) || this;
|
|
26342
|
-
_this.renderMode = 0;
|
|
26343
|
-
_this.receivesEvents = true;
|
|
26344
|
-
_this._order = 0;
|
|
26345
|
-
_this.registered = false;
|
|
26346
|
-
_this.rootControl = new CanvasRootControl(engine, _assert_this_initialized(_this));
|
|
26347
|
-
return _this;
|
|
26348
|
-
}
|
|
26349
|
-
var _proto = UICanvas.prototype;
|
|
26350
|
-
_proto.onEnable = function onEnable() {
|
|
26351
|
-
this.register();
|
|
26352
|
-
};
|
|
26353
|
-
_proto.onDisable = function onDisable() {
|
|
26354
|
-
this.unregister();
|
|
26355
|
-
};
|
|
26356
|
-
_proto.onDestroy = function onDestroy() {
|
|
26357
|
-
this.destroyCanvas();
|
|
26358
|
-
};
|
|
26359
|
-
_proto.dispose = function dispose() {
|
|
26360
|
-
this.destroyCanvas();
|
|
26361
|
-
Component.prototype.dispose.call(this);
|
|
26362
|
-
};
|
|
26363
|
-
_proto.register = function register() {
|
|
26364
|
-
if (!this.registered) {
|
|
26365
|
-
this.rootControl.parent = this.engine.windowRoot.canvases;
|
|
26366
|
-
this.registered = true;
|
|
26367
|
-
}
|
|
26368
|
-
};
|
|
26369
|
-
_proto.unregister = function unregister() {
|
|
26370
|
-
if (this.registered) {
|
|
26371
|
-
this.rootControl.parent = null;
|
|
26372
|
-
this.registered = false;
|
|
26373
|
-
}
|
|
26374
|
-
};
|
|
26375
|
-
_proto.destroyCanvas = function destroyCanvas() {
|
|
26376
|
-
this.unregister();
|
|
26377
|
-
if (!this.rootControl.isDisposed) {
|
|
26378
|
-
this.rootControl.dispose();
|
|
26379
|
-
}
|
|
26380
|
-
};
|
|
26381
|
-
_create_class(UICanvas, [
|
|
26382
|
-
{
|
|
26383
|
-
key: "order",
|
|
26384
|
-
get: function get() {
|
|
26385
|
-
return this._order;
|
|
26386
|
-
},
|
|
26387
|
-
set: function set(value) {
|
|
26388
|
-
if (this._order !== value) {
|
|
26389
|
-
this._order = value;
|
|
26390
|
-
this.engine.windowRoot.canvases.sortCanvases();
|
|
26391
|
-
}
|
|
26392
|
-
}
|
|
26393
|
-
},
|
|
26394
|
-
{
|
|
26395
|
-
key: "isVisible",
|
|
26396
|
-
get: function get() {
|
|
26397
|
-
var _this_item;
|
|
26398
|
-
return this.renderMode === 0 && this.enabled && !!((_this_item = this.item) == null ? void 0 : _this_item.isActive);
|
|
26399
|
-
}
|
|
26400
|
-
}
|
|
26401
|
-
]);
|
|
26402
|
-
return UICanvas;
|
|
26403
|
-
}(Component);
|
|
26404
|
-
|
|
26405
|
-
/**
|
|
26406
|
-
* Scene-tree bridge for a GUI Control. The VFXItem tree owns lifecycle and
|
|
26407
|
-
* serialization while the Control tree owns layout, drawing and input.
|
|
26408
|
-
*/ var UIControl = /*#__PURE__*/ function(Component) {
|
|
26409
|
-
_inherits(UIControl, Component);
|
|
26410
|
-
function UIControl(engine) {
|
|
26411
|
-
var _this;
|
|
26412
|
-
_this = Component.call(this, engine) || this;
|
|
26413
|
-
_this.controlNode = null;
|
|
26414
|
-
_this.linkedItemTransform = null;
|
|
26415
|
-
_this.linkedControl = null;
|
|
26416
|
-
_this.syncingLocation = false;
|
|
26417
|
-
_this.itemTransformChanged = function() {
|
|
26418
|
-
return _this.syncItemLocationToControl();
|
|
26419
|
-
};
|
|
26420
|
-
_this.controlLocationChanged = function() {
|
|
26421
|
-
return _this.syncControlLocationToItem();
|
|
26422
|
-
};
|
|
26423
|
-
return _this;
|
|
26424
|
-
}
|
|
26425
|
-
var _proto = UIControl.prototype;
|
|
26426
|
-
_proto.onAwake = function onAwake() {
|
|
26427
|
-
this.syncControl();
|
|
26428
|
-
};
|
|
26429
|
-
_proto.onEnable = function onEnable() {
|
|
26430
|
-
if (this.controlNode) {
|
|
26431
|
-
this.controlNode.visible = this.item.isActive;
|
|
26432
|
-
this.controlNode.enabled = true;
|
|
26433
|
-
}
|
|
26434
|
-
};
|
|
26435
|
-
_proto.onDisable = function onDisable() {
|
|
26436
|
-
if (this.controlNode) {
|
|
26437
|
-
this.controlNode.visible = this.item.isActive;
|
|
26438
|
-
this.controlNode.enabled = false;
|
|
26439
|
-
}
|
|
26440
|
-
};
|
|
26441
|
-
_proto.onParentChanged = function onParentChanged() {
|
|
26442
|
-
this.syncControl();
|
|
26443
|
-
};
|
|
26444
|
-
_proto.onOrderInParentChanged = function onOrderInParentChanged() {
|
|
26445
|
-
this.syncControlOrder();
|
|
26446
|
-
};
|
|
26447
|
-
_proto.onDestroy = function onDestroy() {
|
|
26448
|
-
this.disposeControl();
|
|
26449
|
-
};
|
|
26450
|
-
_proto.dispose = function dispose() {
|
|
26451
|
-
this.disposeControl();
|
|
26452
|
-
Component.prototype.dispose.call(this);
|
|
26453
|
-
};
|
|
26454
|
-
/** Unlinks the GUI object without disposing or modifying it. */ _proto.unlinkControl = function unlinkControl() {
|
|
26455
|
-
if (this.controlNode) {
|
|
26456
|
-
this.unbindLocationSync();
|
|
26457
|
-
this.controlNode = null;
|
|
26458
|
-
}
|
|
26459
|
-
};
|
|
26460
|
-
_proto.disposeControl = function disposeControl() {
|
|
26461
|
-
var control = this.controlNode;
|
|
26462
|
-
if (control) {
|
|
26463
|
-
this.unbindLocationSync();
|
|
26464
|
-
this.controlNode = null;
|
|
26465
|
-
control.dispose();
|
|
26466
|
-
}
|
|
26467
|
-
};
|
|
26468
|
-
_proto.syncControl = function syncControl() {
|
|
26469
|
-
var control = this.controlNode;
|
|
26470
|
-
if (!control || !this.item) {
|
|
26471
|
-
return;
|
|
26472
|
-
}
|
|
26473
|
-
this.syncingLocation = true;
|
|
26474
|
-
try {
|
|
26475
|
-
control.visible = this.item.isActive;
|
|
26476
|
-
control.enabled = this.enabled;
|
|
26477
|
-
control.parent = this.resolveParent();
|
|
26478
|
-
this.syncControlOrder();
|
|
26479
|
-
this.copyItemLocationToControl();
|
|
26480
|
-
} finally{
|
|
26481
|
-
this.syncingLocation = false;
|
|
26482
|
-
}
|
|
26483
|
-
this.bindLocationSync();
|
|
26484
|
-
};
|
|
26485
|
-
_proto.syncControlOrder = function syncControlOrder() {
|
|
26486
|
-
if (this.controlNode && this.item) {
|
|
26487
|
-
this.controlNode.indexInParent = this.item.orderInParent;
|
|
26488
|
-
}
|
|
26489
|
-
};
|
|
26490
|
-
_proto.resolveParent = function resolveParent() {
|
|
26491
|
-
var parentItem = this.item.parent;
|
|
26492
|
-
if (!parentItem) {
|
|
26493
|
-
var _UIControl_fallbackParentGetDelegate;
|
|
26494
|
-
return (_UIControl_fallbackParentGetDelegate = UIControl.fallbackParentGetDelegate == null ? void 0 : UIControl.fallbackParentGetDelegate.call(UIControl, this)) != null ? _UIControl_fallbackParentGetDelegate : null;
|
|
26495
|
-
}
|
|
26496
|
-
var uiControl = parentItem.getComponent(UIControl);
|
|
26497
|
-
if ((uiControl == null ? void 0 : uiControl.control) && "children" in uiControl.control) {
|
|
26498
|
-
return uiControl.control;
|
|
26499
|
-
}
|
|
26500
|
-
var canvas = parentItem.getComponent(UICanvas);
|
|
26501
|
-
var _canvas_rootControl, _ref;
|
|
26502
|
-
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;
|
|
26503
|
-
};
|
|
26504
|
-
_proto.bindLocationSync = function bindLocationSync() {
|
|
26505
|
-
var itemTransform = this.item.transform;
|
|
26506
|
-
var control = this.controlNode;
|
|
26507
|
-
if (this.linkedItemTransform === itemTransform && this.linkedControl === control) {
|
|
26508
|
-
return;
|
|
26509
|
-
}
|
|
26510
|
-
this.unbindLocationSync();
|
|
26511
|
-
if (control) {
|
|
26512
|
-
this.linkedItemTransform = itemTransform;
|
|
26513
|
-
this.linkedControl = control;
|
|
26514
|
-
itemTransform.on("changed", this.itemTransformChanged);
|
|
26515
|
-
control.on("locationChanged", this.controlLocationChanged);
|
|
26516
|
-
}
|
|
26517
|
-
};
|
|
26518
|
-
_proto.unbindLocationSync = function unbindLocationSync() {
|
|
26519
|
-
var _this_linkedItemTransform, _this_linkedControl;
|
|
26520
|
-
(_this_linkedItemTransform = this.linkedItemTransform) == null ? void 0 : _this_linkedItemTransform.off("changed", this.itemTransformChanged);
|
|
26521
|
-
(_this_linkedControl = this.linkedControl) == null ? void 0 : _this_linkedControl.off("locationChanged", this.controlLocationChanged);
|
|
26522
|
-
this.linkedItemTransform = null;
|
|
26523
|
-
this.linkedControl = null;
|
|
26524
|
-
};
|
|
26525
|
-
_proto.syncItemLocationToControl = function syncItemLocationToControl() {
|
|
26526
|
-
if (!this.syncingLocation && this.controlNode) {
|
|
26527
|
-
this.syncingLocation = true;
|
|
26528
|
-
try {
|
|
26529
|
-
this.copyItemLocationToControl();
|
|
26530
|
-
} finally{
|
|
26531
|
-
this.syncingLocation = false;
|
|
26532
|
-
}
|
|
26533
|
-
}
|
|
26534
|
-
};
|
|
26535
|
-
_proto.syncControlLocationToItem = function syncControlLocationToItem() {
|
|
26536
|
-
var control = this.controlNode;
|
|
26537
|
-
if (!this.syncingLocation && control) {
|
|
26538
|
-
var source = control.location;
|
|
26539
|
-
var target = this.item.transform.position;
|
|
26540
|
-
if (source.x !== target.x || source.y !== target.y) {
|
|
26541
|
-
this.syncingLocation = true;
|
|
26542
|
-
try {
|
|
26543
|
-
this.item.transform.setPosition(source.x, source.y, target.z);
|
|
26544
|
-
} finally{
|
|
26545
|
-
this.syncingLocation = false;
|
|
26546
|
-
}
|
|
26547
|
-
}
|
|
26548
|
-
}
|
|
26549
|
-
};
|
|
26550
|
-
_proto.copyItemLocationToControl = function copyItemLocationToControl() {
|
|
26551
|
-
var control = this.controlNode;
|
|
26552
|
-
if (control) {
|
|
26553
|
-
var source = this.item.transform.position;
|
|
26554
|
-
var target = control.location;
|
|
26555
|
-
if (source.x !== target.x || source.y !== target.y) {
|
|
26556
|
-
control.setPosition(source.x, source.y);
|
|
26557
|
-
}
|
|
26558
|
-
}
|
|
26559
|
-
};
|
|
26560
|
-
_create_class(UIControl, [
|
|
26561
|
-
{
|
|
26562
|
-
key: "control",
|
|
26563
|
-
get: function get() {
|
|
26564
|
-
return this.controlNode;
|
|
26565
|
-
},
|
|
26566
|
-
set: function set(value) {
|
|
26567
|
-
if (value === this.controlNode) {
|
|
26568
|
-
return;
|
|
26569
|
-
}
|
|
26570
|
-
this.disposeControl();
|
|
26571
|
-
if (value) {
|
|
26572
|
-
if (value.owner && value.owner !== this && value.owner.control === value) {
|
|
26573
|
-
throw new Error("A Control can only be owned by one UIControl.");
|
|
26574
|
-
}
|
|
26575
|
-
this.controlNode = value;
|
|
26576
|
-
value.owner = this;
|
|
26577
|
-
this.syncControl();
|
|
26578
|
-
}
|
|
26579
|
-
}
|
|
26580
|
-
},
|
|
26581
|
-
{
|
|
26582
|
-
key: "hasControl",
|
|
26583
|
-
get: function get() {
|
|
26584
|
-
return this.controlNode !== null;
|
|
26585
|
-
}
|
|
26586
|
-
}
|
|
26587
|
-
]);
|
|
26588
|
-
return UIControl;
|
|
26589
|
-
}(Component);
|
|
26590
|
-
|
|
26591
24755
|
var CameraController = /*#__PURE__*/ function(Component) {
|
|
26592
24756
|
_inherits(CameraController, Component);
|
|
26593
24757
|
function CameraController(engine, props) {
|
|
@@ -26622,6 +24786,42 @@ CameraController = __decorate([
|
|
|
26622
24786
|
effectsClass(DataType.CameraController)
|
|
26623
24787
|
], CameraController);
|
|
26624
24788
|
|
|
24789
|
+
function _get_prototype_of(o) {
|
|
24790
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
24791
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
24792
|
+
};
|
|
24793
|
+
return _get_prototype_of(o);
|
|
24794
|
+
}
|
|
24795
|
+
|
|
24796
|
+
function _is_native_function(fn) {
|
|
24797
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
24798
|
+
}
|
|
24799
|
+
|
|
24800
|
+
function _wrap_native_super(Class) {
|
|
24801
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
24802
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
24803
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
24804
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
24805
|
+
if (typeof _cache !== "undefined") {
|
|
24806
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
24807
|
+
_cache.set(Class, Wrapper);
|
|
24808
|
+
}
|
|
24809
|
+
function Wrapper() {
|
|
24810
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
24811
|
+
}
|
|
24812
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
24813
|
+
constructor: {
|
|
24814
|
+
value: Wrapper,
|
|
24815
|
+
enumerable: false,
|
|
24816
|
+
writable: true,
|
|
24817
|
+
configurable: true
|
|
24818
|
+
}
|
|
24819
|
+
});
|
|
24820
|
+
return _set_prototype_of(Wrapper, Class);
|
|
24821
|
+
};
|
|
24822
|
+
return _wrap_native_super(Class);
|
|
24823
|
+
}
|
|
24824
|
+
|
|
26625
24825
|
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
26626
24826
|
_inherits(CameraVFXItemLoader, Plugin);
|
|
26627
24827
|
function CameraVFXItemLoader() {
|
|
@@ -26630,6 +24830,255 @@ var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
|
26630
24830
|
return CameraVFXItemLoader;
|
|
26631
24831
|
}(_wrap_native_super(Plugin));
|
|
26632
24832
|
|
|
24833
|
+
var MouseButton;
|
|
24834
|
+
(function(MouseButton) {
|
|
24835
|
+
MouseButton[MouseButton["None"] = 0] = "None";
|
|
24836
|
+
MouseButton[MouseButton["Left"] = 1] = "Left";
|
|
24837
|
+
MouseButton[MouseButton["Right"] = 2] = "Right";
|
|
24838
|
+
MouseButton[MouseButton["Middle"] = 3] = "Middle";
|
|
24839
|
+
MouseButton[MouseButton["WheelUp"] = 4] = "WheelUp";
|
|
24840
|
+
MouseButton[MouseButton["WheelDown"] = 5] = "WheelDown";
|
|
24841
|
+
MouseButton[MouseButton["WheelLeft"] = 6] = "WheelLeft";
|
|
24842
|
+
MouseButton[MouseButton["WheelRight"] = 7] = "WheelRight";
|
|
24843
|
+
MouseButton[MouseButton["Xbutton1"] = 8] = "Xbutton1";
|
|
24844
|
+
MouseButton[MouseButton["Xbutton2"] = 9] = "Xbutton2";
|
|
24845
|
+
})(MouseButton || (MouseButton = {}));
|
|
24846
|
+
var MouseButtonMask;
|
|
24847
|
+
(function(MouseButtonMask) {
|
|
24848
|
+
MouseButtonMask[MouseButtonMask["None"] = 0] = "None";
|
|
24849
|
+
MouseButtonMask[MouseButtonMask["Left"] = 1] = "Left";
|
|
24850
|
+
MouseButtonMask[MouseButtonMask["Right"] = 2] = "Right";
|
|
24851
|
+
MouseButtonMask[MouseButtonMask["Middle"] = 4] = "Middle";
|
|
24852
|
+
MouseButtonMask[MouseButtonMask["Xbutton1"] = 128] = "Xbutton1";
|
|
24853
|
+
MouseButtonMask[MouseButtonMask["Xbutton2"] = 256] = "Xbutton2";
|
|
24854
|
+
})(MouseButtonMask || (MouseButtonMask = {}));
|
|
24855
|
+
var KeyLocation;
|
|
24856
|
+
(function(KeyLocation) {
|
|
24857
|
+
KeyLocation[KeyLocation["Unspecified"] = 0] = "Unspecified";
|
|
24858
|
+
KeyLocation[KeyLocation["Left"] = 1] = "Left";
|
|
24859
|
+
KeyLocation[KeyLocation["Right"] = 2] = "Right";
|
|
24860
|
+
})(KeyLocation || (KeyLocation = {}));
|
|
24861
|
+
|
|
24862
|
+
function transformPoint(transform, value) {
|
|
24863
|
+
var elements = transform.elements;
|
|
24864
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y + elements[6], elements[1] * value.x + elements[4] * value.y + elements[7]);
|
|
24865
|
+
}
|
|
24866
|
+
function transformVector(transform, value) {
|
|
24867
|
+
var elements = transform.elements;
|
|
24868
|
+
return new Vector2(elements[0] * value.x + elements[3] * value.y, elements[1] * value.x + elements[4] * value.y);
|
|
24869
|
+
}
|
|
24870
|
+
var InputEvent = /*#__PURE__*/ function() {
|
|
24871
|
+
function InputEvent() {
|
|
24872
|
+
this.device = 0;
|
|
24873
|
+
this.pressed = false;
|
|
24874
|
+
this.canceled = false;
|
|
24875
|
+
this._accepted = false;
|
|
24876
|
+
}
|
|
24877
|
+
var _proto = InputEvent.prototype;
|
|
24878
|
+
_proto.accept = function accept() {
|
|
24879
|
+
this._accepted = true;
|
|
24880
|
+
};
|
|
24881
|
+
_proto.clearAccepted = function clearAccepted() {
|
|
24882
|
+
this._accepted = false;
|
|
24883
|
+
};
|
|
24884
|
+
_proto.isAccepted = function isAccepted() {
|
|
24885
|
+
return this._accepted;
|
|
24886
|
+
};
|
|
24887
|
+
_proto.isPressed = function isPressed() {
|
|
24888
|
+
return this.pressed && !this.canceled;
|
|
24889
|
+
};
|
|
24890
|
+
_proto.isReleased = function isReleased() {
|
|
24891
|
+
return !this.pressed && !this.canceled;
|
|
24892
|
+
};
|
|
24893
|
+
_proto.isCanceled = function isCanceled() {
|
|
24894
|
+
return this.canceled;
|
|
24895
|
+
};
|
|
24896
|
+
_proto.isEcho = function isEcho() {
|
|
24897
|
+
return false;
|
|
24898
|
+
};
|
|
24899
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24900
|
+
return this;
|
|
24901
|
+
};
|
|
24902
|
+
return InputEvent;
|
|
24903
|
+
}();
|
|
24904
|
+
InputEvent.deviceIdEmulation = -1;
|
|
24905
|
+
InputEvent.deviceIdInternal = -2;
|
|
24906
|
+
InputEvent.deviceIdKeyboard = 16;
|
|
24907
|
+
InputEvent.deviceIdMouse = 32;
|
|
24908
|
+
var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
|
|
24909
|
+
_inherits(InputEventWithModifiers, InputEvent);
|
|
24910
|
+
function InputEventWithModifiers() {
|
|
24911
|
+
var _this;
|
|
24912
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
24913
|
+
_this.commandOrControlAutoremap = false;
|
|
24914
|
+
_this.shiftPressed = false;
|
|
24915
|
+
_this.altPressed = false;
|
|
24916
|
+
_this.metaPressed = false;
|
|
24917
|
+
_this.ctrlPressed = false;
|
|
24918
|
+
return _this;
|
|
24919
|
+
}
|
|
24920
|
+
var _proto = InputEventWithModifiers.prototype;
|
|
24921
|
+
_proto.copyModifiersTo = function copyModifiersTo(event) {
|
|
24922
|
+
event.device = this.device;
|
|
24923
|
+
event.pressed = this.pressed;
|
|
24924
|
+
event.canceled = this.canceled;
|
|
24925
|
+
event.commandOrControlAutoremap = this.commandOrControlAutoremap;
|
|
24926
|
+
event.shiftPressed = this.shiftPressed;
|
|
24927
|
+
event.altPressed = this.altPressed;
|
|
24928
|
+
event.metaPressed = this.metaPressed;
|
|
24929
|
+
event.ctrlPressed = this.ctrlPressed;
|
|
24930
|
+
};
|
|
24931
|
+
return InputEventWithModifiers;
|
|
24932
|
+
}(_wrap_native_super(InputEvent));
|
|
24933
|
+
var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24934
|
+
_inherits(InputEventKey, InputEventWithModifiers);
|
|
24935
|
+
function InputEventKey() {
|
|
24936
|
+
var _this;
|
|
24937
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24938
|
+
_this.keycode = "";
|
|
24939
|
+
_this.physicalKeycode = "";
|
|
24940
|
+
_this.keyLabel = "";
|
|
24941
|
+
_this.unicode = 0;
|
|
24942
|
+
_this.location = KeyLocation.Unspecified;
|
|
24943
|
+
_this.echo = false;
|
|
24944
|
+
return _this;
|
|
24945
|
+
}
|
|
24946
|
+
var _proto = InputEventKey.prototype;
|
|
24947
|
+
_proto.isEcho = function isEcho() {
|
|
24948
|
+
return this.echo;
|
|
24949
|
+
};
|
|
24950
|
+
return InputEventKey;
|
|
24951
|
+
}(InputEventWithModifiers);
|
|
24952
|
+
var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
|
|
24953
|
+
_inherits(InputEventMouse, InputEventWithModifiers);
|
|
24954
|
+
function InputEventMouse() {
|
|
24955
|
+
var _this;
|
|
24956
|
+
_this = InputEventWithModifiers.apply(this, arguments) || this;
|
|
24957
|
+
_this.buttonMask = MouseButtonMask.None;
|
|
24958
|
+
_this.position = new Vector2();
|
|
24959
|
+
_this.globalPosition = new Vector2();
|
|
24960
|
+
return _this;
|
|
24961
|
+
}
|
|
24962
|
+
var _proto = InputEventMouse.prototype;
|
|
24963
|
+
_proto.copyMouseTo = function copyMouseTo(event) {
|
|
24964
|
+
this.copyModifiersTo(event);
|
|
24965
|
+
event.buttonMask = this.buttonMask;
|
|
24966
|
+
event.position.copyFrom(this.position);
|
|
24967
|
+
event.globalPosition.copyFrom(this.globalPosition);
|
|
24968
|
+
};
|
|
24969
|
+
return InputEventMouse;
|
|
24970
|
+
}(InputEventWithModifiers);
|
|
24971
|
+
var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
|
|
24972
|
+
_inherits(InputEventMouseButton, InputEventMouse);
|
|
24973
|
+
function InputEventMouseButton() {
|
|
24974
|
+
var _this;
|
|
24975
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24976
|
+
_this.factor = 1;
|
|
24977
|
+
_this.buttonIndex = MouseButton.None;
|
|
24978
|
+
_this.doubleClick = false;
|
|
24979
|
+
return _this;
|
|
24980
|
+
}
|
|
24981
|
+
var _proto = InputEventMouseButton.prototype;
|
|
24982
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
24983
|
+
var event = new InputEventMouseButton();
|
|
24984
|
+
this.copyMouseTo(event);
|
|
24985
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
24986
|
+
event.factor = this.factor;
|
|
24987
|
+
event.buttonIndex = this.buttonIndex;
|
|
24988
|
+
event.doubleClick = this.doubleClick;
|
|
24989
|
+
return event;
|
|
24990
|
+
};
|
|
24991
|
+
return InputEventMouseButton;
|
|
24992
|
+
}(InputEventMouse);
|
|
24993
|
+
var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
|
|
24994
|
+
_inherits(InputEventMouseMotion, InputEventMouse);
|
|
24995
|
+
function InputEventMouseMotion() {
|
|
24996
|
+
var _this;
|
|
24997
|
+
_this = InputEventMouse.apply(this, arguments) || this;
|
|
24998
|
+
_this.tilt = new Vector2();
|
|
24999
|
+
_this.pressure = 0;
|
|
25000
|
+
_this.relative = new Vector2();
|
|
25001
|
+
_this.screenRelative = new Vector2();
|
|
25002
|
+
_this.velocity = new Vector2();
|
|
25003
|
+
_this.screenVelocity = new Vector2();
|
|
25004
|
+
_this.penInverted = false;
|
|
25005
|
+
return _this;
|
|
25006
|
+
}
|
|
25007
|
+
var _proto = InputEventMouseMotion.prototype;
|
|
25008
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
25009
|
+
var event = new InputEventMouseMotion();
|
|
25010
|
+
this.copyMouseTo(event);
|
|
25011
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
25012
|
+
event.tilt.copyFrom(this.tilt);
|
|
25013
|
+
event.pressure = this.pressure;
|
|
25014
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
25015
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
25016
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
25017
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
25018
|
+
event.penInverted = this.penInverted;
|
|
25019
|
+
return event;
|
|
25020
|
+
};
|
|
25021
|
+
return InputEventMouseMotion;
|
|
25022
|
+
}(InputEventMouse);
|
|
25023
|
+
var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
|
|
25024
|
+
_inherits(InputEventScreenTouch, InputEvent);
|
|
25025
|
+
function InputEventScreenTouch() {
|
|
25026
|
+
var _this;
|
|
25027
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
25028
|
+
_this.index = 0;
|
|
25029
|
+
_this.position = new Vector2();
|
|
25030
|
+
_this.doubleTap = false;
|
|
25031
|
+
return _this;
|
|
25032
|
+
}
|
|
25033
|
+
var _proto = InputEventScreenTouch.prototype;
|
|
25034
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
25035
|
+
var event = new InputEventScreenTouch();
|
|
25036
|
+
event.device = this.device;
|
|
25037
|
+
event.pressed = this.pressed;
|
|
25038
|
+
event.canceled = this.canceled;
|
|
25039
|
+
event.index = this.index;
|
|
25040
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
25041
|
+
event.doubleTap = this.doubleTap;
|
|
25042
|
+
return event;
|
|
25043
|
+
};
|
|
25044
|
+
return InputEventScreenTouch;
|
|
25045
|
+
}(_wrap_native_super(InputEvent));
|
|
25046
|
+
var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
|
|
25047
|
+
_inherits(InputEventScreenDrag, InputEvent);
|
|
25048
|
+
function InputEventScreenDrag() {
|
|
25049
|
+
var _this;
|
|
25050
|
+
_this = InputEvent.apply(this, arguments) || this;
|
|
25051
|
+
_this.index = 0;
|
|
25052
|
+
_this.position = new Vector2();
|
|
25053
|
+
_this.relative = new Vector2();
|
|
25054
|
+
_this.screenRelative = new Vector2();
|
|
25055
|
+
_this.velocity = new Vector2();
|
|
25056
|
+
_this.screenVelocity = new Vector2();
|
|
25057
|
+
_this.pressure = 0;
|
|
25058
|
+
_this.tilt = new Vector2();
|
|
25059
|
+
_this.penInverted = false;
|
|
25060
|
+
return _this;
|
|
25061
|
+
}
|
|
25062
|
+
var _proto = InputEventScreenDrag.prototype;
|
|
25063
|
+
_proto.xformedBy = function xformedBy(transform) {
|
|
25064
|
+
var event = new InputEventScreenDrag();
|
|
25065
|
+
event.device = this.device;
|
|
25066
|
+
event.pressed = this.pressed;
|
|
25067
|
+
event.canceled = this.canceled;
|
|
25068
|
+
event.index = this.index;
|
|
25069
|
+
event.position.copyFrom(transformPoint(transform, this.position));
|
|
25070
|
+
event.relative.copyFrom(transformVector(transform, this.relative));
|
|
25071
|
+
event.screenRelative.copyFrom(this.screenRelative);
|
|
25072
|
+
event.velocity.copyFrom(transformVector(transform, this.velocity));
|
|
25073
|
+
event.screenVelocity.copyFrom(this.screenVelocity);
|
|
25074
|
+
event.pressure = this.pressure;
|
|
25075
|
+
event.tilt.copyFrom(this.tilt);
|
|
25076
|
+
event.penInverted = this.penInverted;
|
|
25077
|
+
return event;
|
|
25078
|
+
};
|
|
25079
|
+
return InputEventScreenDrag;
|
|
25080
|
+
}(_wrap_native_super(InputEvent));
|
|
25081
|
+
|
|
26633
25082
|
var EVENT_TYPE_CLICK = "click";
|
|
26634
25083
|
var EVENT_TYPE_TOUCH_START = "touchstart";
|
|
26635
25084
|
var EVENT_TYPE_TOUCH_MOVE = "touchmove";
|
|
@@ -26640,49 +25089,52 @@ var PointerEventType;
|
|
|
26640
25089
|
PointerEventType[PointerEventType["PointerUp"] = 1] = "PointerUp";
|
|
26641
25090
|
PointerEventType[PointerEventType["PointerMove"] = 2] = "PointerMove";
|
|
26642
25091
|
})(PointerEventType || (PointerEventType = {}));
|
|
26643
|
-
var EventSystem = /*#__PURE__*/ function() {
|
|
25092
|
+
var EventSystem = /*#__PURE__*/ function(EventEmitter) {
|
|
25093
|
+
_inherits(EventSystem, EventEmitter);
|
|
26644
25094
|
function EventSystem(engine, allowPropagation) {
|
|
26645
|
-
var _this = this;
|
|
26646
25095
|
if (allowPropagation === void 0) allowPropagation = false;
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
|
|
25096
|
+
var _this;
|
|
25097
|
+
_this = EventEmitter.call(this) || this;
|
|
25098
|
+
_this.engine = engine;
|
|
25099
|
+
_this.allowPropagation = allowPropagation;
|
|
25100
|
+
_this.skipPointerMovePicking = true;
|
|
25101
|
+
_this.emulateMouseFromTouch = true;
|
|
25102
|
+
_this.emulateTouchFromMouse = false;
|
|
25103
|
+
_this._enabled = true;
|
|
25104
|
+
_this.handlers = {};
|
|
25105
|
+
_this.nativeHandlers = [];
|
|
25106
|
+
_this.target = null;
|
|
25107
|
+
_this.mouseState = null;
|
|
25108
|
+
_this.mouseButtonMask = MouseButtonMask.None;
|
|
25109
|
+
_this.touchStates = new Map();
|
|
25110
|
+
_this.mouseFromTouchIndex = null;
|
|
25111
|
+
_this.touchFromMousePressed = false;
|
|
25112
|
+
_this.addedTabIndex = false;
|
|
25113
|
+
_this.addedOutlineStyle = false;
|
|
25114
|
+
_this.onNativeWheel = function(event) {
|
|
26663
25115
|
if (!_this.enabled || !_this.target) {
|
|
26664
25116
|
return;
|
|
26665
25117
|
}
|
|
26666
25118
|
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26667
25119
|
var handled = false;
|
|
26668
25120
|
if (event.deltaY !== 0) {
|
|
26669
|
-
handled = _this.pushWheelButton(event.deltaY < 0 ? MouseButton.WheelUp : MouseButton.WheelDown,
|
|
25121
|
+
handled = _this.pushWheelButton(event.deltaY < 0 ? MouseButton.WheelUp : MouseButton.WheelDown, normalizeWheelFactor(event.deltaY, event.deltaMode), position, event) || handled;
|
|
26670
25122
|
}
|
|
26671
25123
|
if (event.deltaX !== 0) {
|
|
26672
|
-
handled = _this.pushWheelButton(event.deltaX < 0 ? MouseButton.WheelLeft : MouseButton.WheelRight,
|
|
25124
|
+
handled = _this.pushWheelButton(event.deltaX < 0 ? MouseButton.WheelLeft : MouseButton.WheelRight, normalizeWheelFactor(event.deltaX, event.deltaMode), position, event) || handled;
|
|
26673
25125
|
}
|
|
26674
25126
|
_this.consumeNativeEvent(event, handled);
|
|
26675
25127
|
};
|
|
26676
|
-
|
|
25128
|
+
_this.onNativeKeyDown = function(event) {
|
|
26677
25129
|
_this.handleNativeKey(event, true);
|
|
26678
25130
|
};
|
|
26679
|
-
|
|
25131
|
+
_this.onNativeKeyUp = function(event) {
|
|
26680
25132
|
_this.handleNativeKey(event, false);
|
|
26681
25133
|
};
|
|
26682
|
-
|
|
25134
|
+
_this.onNativeMouseDown = function(event) {
|
|
26683
25135
|
_this.handleNativeMouseDown(event);
|
|
26684
25136
|
};
|
|
26685
|
-
|
|
25137
|
+
_this.onNativeMouseMove = function(event) {
|
|
26686
25138
|
var _state;
|
|
26687
25139
|
if (!_this.enabled || !_this.target) {
|
|
26688
25140
|
return;
|
|
@@ -26694,18 +25146,22 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26694
25146
|
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26695
25147
|
var velocity = _this.getVelocity(state, position);
|
|
26696
25148
|
var handled = _this.pushNativeMouseMotion(event, position, relative, velocity);
|
|
26697
|
-
(_state = state).
|
|
26698
|
-
if (!handled && (!state.pressed || !state.
|
|
25149
|
+
(_state = state).inputHandled || (_state.inputHandled = handled);
|
|
25150
|
+
if (!handled && (!state.pressed || !state.inputHandled)) {
|
|
26699
25151
|
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26700
25152
|
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
26701
25153
|
}
|
|
26702
25154
|
_this.updatePointerState(state, position);
|
|
26703
25155
|
_this.consumeNativeEvent(event, handled);
|
|
26704
25156
|
};
|
|
26705
|
-
|
|
25157
|
+
_this.onNativeMouseUp = function(event) {
|
|
26706
25158
|
if (!_this.enabled || !_this.target) {
|
|
26707
25159
|
return;
|
|
26708
25160
|
}
|
|
25161
|
+
// Keep the canonical mask in sync even when mouseState already ended on a
|
|
25162
|
+
// previous button release. The target and Window listeners may see the
|
|
25163
|
+
// same mouseup, but clearing a bit twice is intentionally idempotent.
|
|
25164
|
+
_this.setMouseButtonPressed(event.button, false);
|
|
26709
25165
|
var position = _this.getCanvasPosition(event.clientX, event.clientY);
|
|
26710
25166
|
var existingState = _this.mouseState;
|
|
26711
25167
|
if (!(existingState == null ? void 0 : existingState.pressed)) {
|
|
@@ -26714,16 +25170,16 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26714
25170
|
var state = existingState;
|
|
26715
25171
|
var handled = _this.pushNativeMouseButton(event, position, false);
|
|
26716
25172
|
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26717
|
-
if (!state.
|
|
25173
|
+
if (!state.inputHandled && !handled && _this.isClick(state, position)) {
|
|
26718
25174
|
_this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26719
25175
|
}
|
|
26720
|
-
if (!handled && !state.
|
|
25176
|
+
if (!handled && !state.inputHandled) {
|
|
26721
25177
|
_this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26722
25178
|
}
|
|
26723
25179
|
_this.mouseState = null;
|
|
26724
|
-
_this.consumeNativeEvent(event, handled || state.
|
|
25180
|
+
_this.consumeNativeEvent(event, handled || state.inputHandled || !_this.allowPropagation);
|
|
26725
25181
|
};
|
|
26726
|
-
|
|
25182
|
+
_this.onNativeTouchStart = function(event) {
|
|
26727
25183
|
if (!_this.enabled) {
|
|
26728
25184
|
return;
|
|
26729
25185
|
}
|
|
@@ -26735,7 +25191,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26735
25191
|
_this.touchStates.set(touch.identifier, state);
|
|
26736
25192
|
state.pressed = true;
|
|
26737
25193
|
var handled = _this.pushNativeScreenTouch(touch.identifier, position, true, false, false);
|
|
26738
|
-
state.
|
|
25194
|
+
state.inputHandled = handled;
|
|
26739
25195
|
if (!handled) {
|
|
26740
25196
|
var pointerEvent = _this.createPointerEvent(event, position, state);
|
|
26741
25197
|
_this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
@@ -26744,7 +25200,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26744
25200
|
}
|
|
26745
25201
|
_this.preventTouchDefaults(event);
|
|
26746
25202
|
};
|
|
26747
|
-
|
|
25203
|
+
_this.onNativeTouchMove = function(event) {
|
|
26748
25204
|
if (!_this.enabled) {
|
|
26749
25205
|
return;
|
|
26750
25206
|
}
|
|
@@ -26758,8 +25214,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26758
25214
|
var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
|
|
26759
25215
|
var velocity = _this.getVelocity(state, position);
|
|
26760
25216
|
var handled = _this.pushNativeScreenDrag(touch.identifier, position, relative, velocity);
|
|
26761
|
-
(_state = state).
|
|
26762
|
-
if (!handled && !state.
|
|
25217
|
+
(_state = state).inputHandled || (_state.inputHandled = handled);
|
|
25218
|
+
if (!handled && !state.inputHandled) {
|
|
26763
25219
|
var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
|
|
26764
25220
|
_this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
|
|
26765
25221
|
}
|
|
@@ -26768,24 +25224,26 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26768
25224
|
}
|
|
26769
25225
|
_this.preventTouchDefaults(event);
|
|
26770
25226
|
};
|
|
26771
|
-
|
|
25227
|
+
_this.onNativeTouchEnd = function(event) {
|
|
26772
25228
|
_this.handleNativeTouchEnd(event, false);
|
|
26773
25229
|
};
|
|
26774
|
-
|
|
25230
|
+
_this.onNativeTouchCancel = function(event) {
|
|
26775
25231
|
_this.handleNativeTouchEnd(event, true);
|
|
26776
25232
|
};
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
|
|
26781
|
-
|
|
26782
|
-
_this.touchFromMousePressed = false;
|
|
26783
|
-
_this.engine.windowRoot.cancelPointerInput();
|
|
26784
|
-
}
|
|
25233
|
+
_this.onCanvasFocus = function() {
|
|
25234
|
+
_this.emit("canvasFocus");
|
|
25235
|
+
};
|
|
25236
|
+
_this.onCanvasBlur = function() {
|
|
25237
|
+
_this.emit("canvasBlur");
|
|
26785
25238
|
};
|
|
25239
|
+
return _this;
|
|
26786
25240
|
}
|
|
26787
25241
|
var _proto = EventSystem.prototype;
|
|
26788
|
-
|
|
25242
|
+
/**
|
|
25243
|
+
* Rebinds native input listeners to a canvas.
|
|
25244
|
+
*
|
|
25245
|
+
* Rebind or unbind only while there are no active key, mouse, touch, or drag sessions.
|
|
25246
|
+
*/ _proto.bindListeners = function bindListeners(target) {
|
|
26789
25247
|
this.unbindListeners();
|
|
26790
25248
|
this.target = target;
|
|
26791
25249
|
if (!target || typeof window === "undefined") {
|
|
@@ -26822,7 +25280,8 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26822
25280
|
});
|
|
26823
25281
|
this.addNativeHandler(target, "keydown", this.onNativeKeyDown);
|
|
26824
25282
|
this.addNativeHandler(target, "keyup", this.onNativeKeyUp);
|
|
26825
|
-
this.addNativeHandler(
|
|
25283
|
+
this.addNativeHandler(target, "focus", this.onCanvasFocus);
|
|
25284
|
+
this.addNativeHandler(target, "blur", this.onCanvasBlur);
|
|
26826
25285
|
};
|
|
26827
25286
|
_proto.dispatchEvent = function dispatchEvent(type, event) {
|
|
26828
25287
|
var handlers = this.handlers[type];
|
|
@@ -26856,11 +25315,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26856
25315
|
}
|
|
26857
25316
|
};
|
|
26858
25317
|
_proto.dispose = function dispose() {
|
|
26859
|
-
this.
|
|
26860
|
-
this.mouseState = null;
|
|
26861
|
-
this.touchStates.clear();
|
|
26862
|
-
this.mouseFromTouchIndex = null;
|
|
26863
|
-
this.touchFromMousePressed = false;
|
|
25318
|
+
this.resetInputState();
|
|
26864
25319
|
this.handlers = {};
|
|
26865
25320
|
this.unbindListeners();
|
|
26866
25321
|
this.target = null;
|
|
@@ -26869,13 +25324,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26869
25324
|
if (!this.enabled || !this.target) {
|
|
26870
25325
|
return;
|
|
26871
25326
|
}
|
|
26872
|
-
this.
|
|
25327
|
+
this.setMouseButtonPressed(event.button, true);
|
|
26873
25328
|
var position = this.getCanvasPosition(event.clientX, event.clientY);
|
|
25329
|
+
this.focusTarget();
|
|
26874
25330
|
var state = this.createPointerState(position);
|
|
26875
25331
|
this.mouseState = state;
|
|
26876
25332
|
state.pressed = true;
|
|
26877
25333
|
var handled = this.pushNativeMouseButton(event, position, true);
|
|
26878
|
-
state.
|
|
25334
|
+
state.inputHandled = handled;
|
|
26879
25335
|
if (!handled) {
|
|
26880
25336
|
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26881
25337
|
this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
|
|
@@ -26899,8 +25355,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26899
25355
|
input.altPressed = event.altKey;
|
|
26900
25356
|
input.metaPressed = event.metaKey;
|
|
26901
25357
|
input.ctrlPressed = event.ctrlKey;
|
|
26902
|
-
this.
|
|
26903
|
-
this.consumeNativeEvent(event, this.engine.windowRoot.isInputHandled());
|
|
25358
|
+
this.consumeNativeEvent(event, this.pushInput(input));
|
|
26904
25359
|
};
|
|
26905
25360
|
_proto.handleNativeTouchEnd = function handleNativeTouchEnd(event, canceled) {
|
|
26906
25361
|
if (!this.enabled) {
|
|
@@ -26915,14 +25370,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26915
25370
|
}
|
|
26916
25371
|
var handled = this.pushNativeScreenTouch(touch.identifier, position, false, canceled, false);
|
|
26917
25372
|
var pointerEvent = this.createPointerEvent(event, position, state);
|
|
26918
|
-
if (!canceled && !state.
|
|
25373
|
+
if (!canceled && !state.inputHandled && !handled && this.isClick(state, position)) {
|
|
26919
25374
|
this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
|
|
26920
25375
|
}
|
|
26921
|
-
if (!handled && !canceled && !state.
|
|
25376
|
+
if (!handled && !canceled && !state.inputHandled) {
|
|
26922
25377
|
this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
|
|
26923
25378
|
}
|
|
26924
25379
|
this.touchStates.delete(touch.identifier);
|
|
26925
|
-
this.consumeNativeEvent(event, handled || state.
|
|
25380
|
+
this.consumeNativeEvent(event, handled || state.inputHandled || !this.allowPropagation);
|
|
26926
25381
|
}
|
|
26927
25382
|
this.preventTouchDefaults(event);
|
|
26928
25383
|
};
|
|
@@ -26942,7 +25397,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26942
25397
|
};
|
|
26943
25398
|
_proto.pushNativeMouseMotion = function pushNativeMouseMotion(event, position, relative, velocity) {
|
|
26944
25399
|
var handled = false;
|
|
26945
|
-
if (this.touchFromMousePressed && (
|
|
25400
|
+
if (this.touchFromMousePressed && (this.mouseButtonMask & MouseButtonMask.Left) !== 0) {
|
|
26946
25401
|
handled = this.pushScreenDrag(0, position, relative, velocity, InputEvent.deviceIdEmulation);
|
|
26947
25402
|
}
|
|
26948
25403
|
return this.pushMouseMotion(event, position, relative, velocity) || handled;
|
|
@@ -26979,8 +25434,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26979
25434
|
input.pressed = pressed;
|
|
26980
25435
|
input.canceled = canceled;
|
|
26981
25436
|
input.doubleClick = doubleClick;
|
|
26982
|
-
this.
|
|
26983
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25437
|
+
return this.pushInput(input);
|
|
26984
25438
|
};
|
|
26985
25439
|
_proto.pushEmulatedMouseMotion = function pushEmulatedMouseMotion(position, relative, velocity) {
|
|
26986
25440
|
var input = new InputEventMouseMotion();
|
|
@@ -26993,42 +25447,42 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
26993
25447
|
input.screenRelative.copyFrom(relative);
|
|
26994
25448
|
input.velocity.copyFrom(velocity);
|
|
26995
25449
|
input.screenVelocity.copyFrom(velocity);
|
|
26996
|
-
this.
|
|
26997
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25450
|
+
return this.pushInput(input);
|
|
26998
25451
|
};
|
|
26999
25452
|
_proto.pushMouseButton = function pushMouseButton(event, position, pressed) {
|
|
27000
25453
|
var input = new InputEventMouseButton();
|
|
27001
25454
|
this.copyMouseFields(input, event, position);
|
|
27002
25455
|
input.device = InputEvent.deviceIdMouse;
|
|
27003
25456
|
input.buttonIndex = getMouseButton(event.button);
|
|
27004
|
-
input.buttonMask =
|
|
25457
|
+
input.buttonMask = this.mouseButtonMask;
|
|
25458
|
+
input.pressed = pressed;
|
|
25459
|
+
input.doubleClick = event.detail > 1;
|
|
25460
|
+
return this.pushInput(input);
|
|
25461
|
+
};
|
|
25462
|
+
_proto.setMouseButtonPressed = function setMouseButtonPressed(button, pressed) {
|
|
25463
|
+
var buttonBit = getMouseButtonBit(getMouseButton(button));
|
|
27005
25464
|
if (pressed) {
|
|
27006
|
-
|
|
25465
|
+
this.mouseButtonMask |= buttonBit;
|
|
27007
25466
|
} else {
|
|
27008
|
-
|
|
25467
|
+
this.mouseButtonMask &= ~buttonBit;
|
|
27009
25468
|
}
|
|
27010
|
-
input.pressed = pressed;
|
|
27011
|
-
input.doubleClick = event.detail > 1;
|
|
27012
|
-
this.engine.windowRoot.pushInput(input);
|
|
27013
|
-
return this.engine.windowRoot.isInputHandled();
|
|
27014
25469
|
};
|
|
27015
25470
|
_proto.pushWheelButton = function pushWheelButton(button, factor, position, event) {
|
|
27016
25471
|
var input = new InputEventMouseButton();
|
|
27017
25472
|
this.copyMouseFields(input, event, position);
|
|
27018
25473
|
input.device = InputEvent.deviceIdMouse;
|
|
27019
25474
|
input.buttonIndex = button;
|
|
27020
|
-
input.buttonMask =
|
|
25475
|
+
input.buttonMask = this.mouseButtonMask;
|
|
27021
25476
|
input.factor = factor;
|
|
27022
25477
|
input.pressed = true;
|
|
27023
|
-
this.
|
|
27024
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25478
|
+
return this.pushInput(input);
|
|
27025
25479
|
};
|
|
27026
25480
|
_proto.pushMouseMotion = function pushMouseMotion(event, position, relative, velocity) {
|
|
27027
25481
|
var input = new InputEventMouseMotion();
|
|
27028
25482
|
this.copyMouseFields(input, event, position);
|
|
27029
25483
|
input.device = InputEvent.deviceIdMouse;
|
|
27030
|
-
input.buttonMask =
|
|
27031
|
-
input.pressed =
|
|
25484
|
+
input.buttonMask = this.mouseButtonMask;
|
|
25485
|
+
input.pressed = this.mouseButtonMask !== MouseButtonMask.None;
|
|
27032
25486
|
input.relative.copyFrom(relative);
|
|
27033
25487
|
input.screenRelative.copyFrom(relative);
|
|
27034
25488
|
input.velocity.copyFrom(velocity);
|
|
@@ -27037,8 +25491,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27037
25491
|
input.pressure = event.pressure;
|
|
27038
25492
|
input.tilt.set(event.tiltX, event.tiltY);
|
|
27039
25493
|
}
|
|
27040
|
-
this.
|
|
27041
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25494
|
+
return this.pushInput(input);
|
|
27042
25495
|
};
|
|
27043
25496
|
_proto.pushScreenTouch = function pushScreenTouch(index, position, pressed, canceled, doubleTap, device) {
|
|
27044
25497
|
var input = new InputEventScreenTouch();
|
|
@@ -27048,8 +25501,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27048
25501
|
input.pressed = pressed;
|
|
27049
25502
|
input.canceled = canceled;
|
|
27050
25503
|
input.doubleTap = doubleTap;
|
|
27051
|
-
this.
|
|
27052
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25504
|
+
return this.pushInput(input);
|
|
27053
25505
|
};
|
|
27054
25506
|
_proto.pushScreenDrag = function pushScreenDrag(index, position, relative, velocity, device) {
|
|
27055
25507
|
var input = new InputEventScreenDrag();
|
|
@@ -27061,8 +25513,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27061
25513
|
input.velocity.copyFrom(velocity);
|
|
27062
25514
|
input.screenVelocity.copyFrom(velocity);
|
|
27063
25515
|
input.pressed = true;
|
|
27064
|
-
this.
|
|
27065
|
-
return this.engine.windowRoot.isInputHandled();
|
|
25516
|
+
return this.pushInput(input);
|
|
27066
25517
|
};
|
|
27067
25518
|
_proto.copyMouseFields = function copyMouseFields(input, event, position) {
|
|
27068
25519
|
input.position.copyFrom(position);
|
|
@@ -27137,7 +25588,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27137
25588
|
start: position.clone(),
|
|
27138
25589
|
last: position.clone(),
|
|
27139
25590
|
lastTime: performance.now(),
|
|
27140
|
-
|
|
25591
|
+
inputHandled: false,
|
|
27141
25592
|
pressed: false
|
|
27142
25593
|
};
|
|
27143
25594
|
return state;
|
|
@@ -27162,12 +25613,14 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27162
25613
|
var _target_width, _target_height;
|
|
27163
25614
|
return {
|
|
27164
25615
|
x: position.x / cssWidth * 2 - 1,
|
|
27165
|
-
|
|
25616
|
+
// Legacy composition picking uses bottom-left, Y-up NDC even though
|
|
25617
|
+
// standardized input follows the DOM convention of top-left, Y-down pixels.
|
|
25618
|
+
y: 1 - position.y / cssHeight * 2,
|
|
27166
25619
|
vx: velocity.x / cssWidth * 2,
|
|
27167
|
-
vy: velocity.y / cssHeight * 2,
|
|
25620
|
+
vy: -velocity.y / cssHeight * 2,
|
|
27168
25621
|
ts: performance.now(),
|
|
27169
25622
|
dx: (position.x - state.start.x) / cssWidth * 2,
|
|
27170
|
-
dy: (position.y - state.start.y) / cssHeight * 2,
|
|
25623
|
+
dy: -(position.y - state.start.y) / cssHeight * 2,
|
|
27171
25624
|
width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
|
|
27172
25625
|
height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
|
|
27173
25626
|
origin: origin
|
|
@@ -27179,7 +25632,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27179
25632
|
if (!rect) {
|
|
27180
25633
|
return new Vector2();
|
|
27181
25634
|
}
|
|
27182
|
-
return new Vector2(clientX - rect.left,
|
|
25635
|
+
return new Vector2(clientX - rect.left, clientY - rect.top);
|
|
27183
25636
|
};
|
|
27184
25637
|
_proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
|
|
27185
25638
|
if (handled && !this.allowPropagation) {
|
|
@@ -27189,15 +25642,26 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27189
25642
|
event.stopPropagation();
|
|
27190
25643
|
}
|
|
27191
25644
|
};
|
|
25645
|
+
_proto.pushInput = function pushInput(input) {
|
|
25646
|
+
input.clearAccepted();
|
|
25647
|
+
this.emit("input", input);
|
|
25648
|
+
return input.isAccepted();
|
|
25649
|
+
};
|
|
27192
25650
|
_proto.preventTouchDefaults = function preventTouchDefaults(event) {
|
|
27193
25651
|
if (event.cancelable) {
|
|
27194
25652
|
event.preventDefault();
|
|
27195
25653
|
}
|
|
27196
25654
|
};
|
|
27197
25655
|
_proto.focusTarget = function focusTarget() {
|
|
27198
|
-
|
|
27199
|
-
|
|
27200
|
-
|
|
25656
|
+
var _this_target;
|
|
25657
|
+
(_this_target = this.target) == null ? void 0 : _this_target.focus();
|
|
25658
|
+
};
|
|
25659
|
+
_proto.resetInputState = function resetInputState() {
|
|
25660
|
+
this.mouseState = null;
|
|
25661
|
+
this.mouseButtonMask = MouseButtonMask.None;
|
|
25662
|
+
this.touchStates.clear();
|
|
25663
|
+
this.mouseFromTouchIndex = null;
|
|
25664
|
+
this.touchFromMousePressed = false;
|
|
27201
25665
|
};
|
|
27202
25666
|
_proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
|
|
27203
25667
|
target.addEventListener(name, handler, options);
|
|
@@ -27229,23 +25693,20 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
27229
25693
|
get: function get() {
|
|
27230
25694
|
return this._enabled;
|
|
27231
25695
|
},
|
|
27232
|
-
set:
|
|
25696
|
+
set: /**
|
|
25697
|
+
* Enables native input processing.
|
|
25698
|
+
*
|
|
25699
|
+
* Change this only while there are no active key, mouse, touch, or drag sessions.
|
|
25700
|
+
*/ function set(value) {
|
|
27233
25701
|
if (this._enabled === value) {
|
|
27234
25702
|
return;
|
|
27235
25703
|
}
|
|
27236
25704
|
this._enabled = value;
|
|
27237
|
-
if (!value) {
|
|
27238
|
-
this.mouseState = null;
|
|
27239
|
-
this.touchStates.clear();
|
|
27240
|
-
this.mouseFromTouchIndex = null;
|
|
27241
|
-
this.touchFromMousePressed = false;
|
|
27242
|
-
this.engine.windowRoot.cancelPointerInput();
|
|
27243
|
-
}
|
|
27244
25705
|
}
|
|
27245
25706
|
}
|
|
27246
25707
|
]);
|
|
27247
25708
|
return EventSystem;
|
|
27248
|
-
}();
|
|
25709
|
+
}(EventEmitter);
|
|
27249
25710
|
function getKeyLocation(location) {
|
|
27250
25711
|
if (location === 1) {
|
|
27251
25712
|
return KeyLocation.Left;
|
|
@@ -27276,25 +25737,6 @@ function getMouseButton(button) {
|
|
|
27276
25737
|
return MouseButton.None;
|
|
27277
25738
|
}
|
|
27278
25739
|
}
|
|
27279
|
-
function getMouseButtonMask(buttons) {
|
|
27280
|
-
var mask = MouseButtonMask.None;
|
|
27281
|
-
if ((buttons & 1) !== 0) {
|
|
27282
|
-
mask |= MouseButtonMask.Left;
|
|
27283
|
-
}
|
|
27284
|
-
if ((buttons & 2) !== 0) {
|
|
27285
|
-
mask |= MouseButtonMask.Right;
|
|
27286
|
-
}
|
|
27287
|
-
if ((buttons & 4) !== 0) {
|
|
27288
|
-
mask |= MouseButtonMask.Middle;
|
|
27289
|
-
}
|
|
27290
|
-
if ((buttons & 8) !== 0) {
|
|
27291
|
-
mask |= MouseButtonMask.Xbutton1;
|
|
27292
|
-
}
|
|
27293
|
-
if ((buttons & 16) !== 0) {
|
|
27294
|
-
mask |= MouseButtonMask.Xbutton2;
|
|
27295
|
-
}
|
|
27296
|
-
return mask;
|
|
27297
|
-
}
|
|
27298
25740
|
function getMouseButtonBit(button) {
|
|
27299
25741
|
switch(button){
|
|
27300
25742
|
case MouseButton.Left:
|
|
@@ -27311,6 +25753,16 @@ function getMouseButtonBit(button) {
|
|
|
27311
25753
|
return MouseButtonMask.None;
|
|
27312
25754
|
}
|
|
27313
25755
|
}
|
|
25756
|
+
function normalizeWheelFactor(delta, mode) {
|
|
25757
|
+
var magnitude = Math.abs(delta);
|
|
25758
|
+
if (mode === 1) {
|
|
25759
|
+
return magnitude / 3;
|
|
25760
|
+
}
|
|
25761
|
+
if (mode === 2) {
|
|
25762
|
+
return magnitude;
|
|
25763
|
+
}
|
|
25764
|
+
return magnitude / 100;
|
|
25765
|
+
}
|
|
27314
25766
|
|
|
27315
25767
|
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
27316
25768
|
_inherits(InteractLoader, Plugin);
|
|
@@ -29330,6 +27782,11 @@ SpritePropertyTrack = __decorate([
|
|
|
29330
27782
|
effectsClass("SpritePropertyTrack")
|
|
29331
27783
|
], SpritePropertyTrack);
|
|
29332
27784
|
|
|
27785
|
+
function _assert_this_initialized(self) {
|
|
27786
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
27787
|
+
return self;
|
|
27788
|
+
}
|
|
27789
|
+
|
|
29333
27790
|
var Cone = /*#__PURE__*/ function() {
|
|
29334
27791
|
function Cone(props) {
|
|
29335
27792
|
var _this = this;
|
|
@@ -39334,7 +37791,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
39334
37791
|
return ret;
|
|
39335
37792
|
}
|
|
39336
37793
|
|
|
39337
|
-
var version$2 = "2.10.0-alpha.
|
|
37794
|
+
var version$2 = "2.10.0-alpha.5";
|
|
39338
37795
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
39339
37796
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
39340
37797
|
var reverseParticle = false;
|
|
@@ -41330,9 +39787,11 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
41330
39787
|
// Instantiate composition rootItem
|
|
41331
39788
|
_this.sceneRoot = new VFXItem(_this.engine);
|
|
41332
39789
|
_this.sceneRoot.setParent(_this.root);
|
|
41333
|
-
_this.uiCanvas = _this.sceneRoot.addComponent(UICanvas);
|
|
41334
39790
|
if (sourceContent) {
|
|
41335
39791
|
_this.sceneRoot.setInstanceId(sourceContent.id);
|
|
39792
|
+
}
|
|
39793
|
+
PluginSystem.notifyCompositionCreating(_assert_this_initialized(_this), scene);
|
|
39794
|
+
if (sourceContent) {
|
|
41336
39795
|
_this.sceneRoot.instantiatePreComposition(sourceContent, false);
|
|
41337
39796
|
}
|
|
41338
39797
|
// 在 instantiatePreComposition 后设置 rootItem 的 name,避免 name 被覆盖
|
|
@@ -41901,9 +40360,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
41901
40360
|
},
|
|
41902
40361
|
set: function set(value) {
|
|
41903
40362
|
this._renderOrder = value;
|
|
41904
|
-
if (this.uiCanvas) {
|
|
41905
|
-
this.uiCanvas.order = value;
|
|
41906
|
-
}
|
|
41907
40363
|
}
|
|
41908
40364
|
},
|
|
41909
40365
|
{
|
|
@@ -41916,9 +40372,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
|
|
|
41916
40372
|
},
|
|
41917
40373
|
set: function set(value) {
|
|
41918
40374
|
this._interactive = !!value;
|
|
41919
|
-
if (this.uiCanvas) {
|
|
41920
|
-
this.uiCanvas.receivesEvents = this._interactive;
|
|
41921
|
-
}
|
|
41922
40375
|
}
|
|
41923
40376
|
},
|
|
41924
40377
|
{
|
|
@@ -43746,7 +42199,6 @@ var DEFAULT_FPS = 60;
|
|
|
43746
42199
|
_this.objectInstance = {};
|
|
43747
42200
|
_this.root = new VFXItem(_assert_this_initialized(_this));
|
|
43748
42201
|
_this.root.name = "root";
|
|
43749
|
-
_this.windowRoot = new WindowRootControl(_assert_this_initialized(_this));
|
|
43750
42202
|
_this.whiteTexture = generateWhiteTexture(_assert_this_initialized(_this));
|
|
43751
42203
|
_this.transparentTexture = generateEmptyTexture(_assert_this_initialized(_this));
|
|
43752
42204
|
if (!(options == null ? void 0 : options.manualRender)) {
|
|
@@ -43899,7 +42351,7 @@ var DEFAULT_FPS = 60;
|
|
|
43899
42351
|
(_this_ticker1 = this.ticker) == null ? void 0 : _this_ticker1.pause();
|
|
43900
42352
|
return;
|
|
43901
42353
|
}
|
|
43902
|
-
this.
|
|
42354
|
+
this.emit("update", dt);
|
|
43903
42355
|
// Tick compositions onPreRender
|
|
43904
42356
|
//-------------------------------------------------------------------------
|
|
43905
42357
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -43914,7 +42366,7 @@ var DEFAULT_FPS = 60;
|
|
|
43914
42366
|
var composition2 = _step2.value;
|
|
43915
42367
|
composition2.renderContent();
|
|
43916
42368
|
}
|
|
43917
|
-
this.
|
|
42369
|
+
this.emit("postrender");
|
|
43918
42370
|
this.renderTargetPool.flush();
|
|
43919
42371
|
};
|
|
43920
42372
|
/**
|
|
@@ -43956,7 +42408,6 @@ var DEFAULT_FPS = 60;
|
|
|
43956
42408
|
this.canvas.style.height = containerHeight + "px";
|
|
43957
42409
|
logger.info("Resize engine " + this.name + " [" + canvasWidth + "," + canvasHeight + "," + containerWidth + "," + containerHeight + "].");
|
|
43958
42410
|
this.setSize(canvasWidth, canvasHeight);
|
|
43959
|
-
this.windowRoot.resize(canvasWidth, canvasHeight);
|
|
43960
42411
|
}
|
|
43961
42412
|
};
|
|
43962
42413
|
_proto.setSize = function setSize(width, height) {
|
|
@@ -44162,6 +42613,12 @@ var DEFAULT_FPS = 60;
|
|
|
44162
42613
|
_proto.setStencilTest = function setStencilTest(enable) {
|
|
44163
42614
|
// OVERRIDE
|
|
44164
42615
|
};
|
|
42616
|
+
_proto.setScissorTest = function setScissorTest(enable) {
|
|
42617
|
+
// OVERRIDE
|
|
42618
|
+
};
|
|
42619
|
+
_proto.setScissor = function setScissor(x, y, width, height) {
|
|
42620
|
+
// OVERRIDE
|
|
42621
|
+
};
|
|
44165
42622
|
_proto.setCulling = function setCulling(enable) {
|
|
44166
42623
|
// OVERRIDE
|
|
44167
42624
|
};
|
|
@@ -44239,7 +42696,6 @@ var DEFAULT_FPS = 60;
|
|
|
44239
42696
|
composition.dispose();
|
|
44240
42697
|
}
|
|
44241
42698
|
this.root.dispose();
|
|
44242
|
-
this.windowRoot.dispose();
|
|
44243
42699
|
(_this_assetService = this.assetService) == null ? void 0 : _this_assetService.dispose();
|
|
44244
42700
|
(_this__graphics = this._graphics) == null ? void 0 : _this__graphics.dispose();
|
|
44245
42701
|
this.renderPasses.forEach(function(pass) {
|
|
@@ -44564,7 +43020,7 @@ registerPlugin("text", TextLoader);
|
|
|
44564
43020
|
registerPlugin("sprite", SpriteLoader);
|
|
44565
43021
|
registerPlugin("particle", ParticleLoader);
|
|
44566
43022
|
registerPlugin("interact", InteractLoader);
|
|
44567
|
-
var version$1 = "2.10.0-alpha.
|
|
43023
|
+
var version$1 = "2.10.0-alpha.5";
|
|
44568
43024
|
logger.info("Core version: " + version$1 + ".");
|
|
44569
43025
|
|
|
44570
43026
|
var _obj;
|
|
@@ -46057,8 +44513,8 @@ applyMixins(ThreeTextComponent, [
|
|
|
46057
44513
|
*/ Mesh.create = function(engine, props) {
|
|
46058
44514
|
return new ThreeMesh(engine, props);
|
|
46059
44515
|
};
|
|
46060
|
-
var version = "2.10.0-alpha.
|
|
44516
|
+
var version = "2.10.0-alpha.5";
|
|
46061
44517
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
46062
44518
|
|
|
46063
|
-
export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader,
|
|
44519
|
+
export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader, 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, TEXTURE_UNIFORM_MAP, TangentMode, TextCache, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, Triangle, TrimPath, TrimPathMode, 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, setUniformValue, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, toBufferView, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
46064
44520
|
//# sourceMappingURL=index.mjs.map
|