@galacean/effects-core 2.10.0-alpha.4 → 2.10.0

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.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.10.0-alpha.4
6
+ * Version: v2.10.0
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -2228,10 +2228,10 @@ var Color = /*#__PURE__*/ function() {
2228
2228
  };
2229
2229
  _proto.toHexString = function toHexString(includeAlpha) {
2230
2230
  if (includeAlpha === void 0) includeAlpha = true;
2231
- var R = Color.ToHex(Math.round(this.r * 255));
2232
- var G = Color.ToHex(Math.round(this.g * 255));
2233
- var B = Color.ToHex(Math.round(this.b * 255));
2234
- var A = Color.ToHex(Math.round(this.a * 255));
2231
+ var R = Color.ToHex(Math.round(Math.min(Math.max(this.r, 0), 1) * 255));
2232
+ var G = Color.ToHex(Math.round(Math.min(Math.max(this.g, 0), 1) * 255));
2233
+ var B = Color.ToHex(Math.round(Math.min(Math.max(this.b, 0), 1) * 255));
2234
+ var A = Color.ToHex(Math.round(Math.min(Math.max(this.a, 0), 1) * 255));
2235
2235
  if (includeAlpha) {
2236
2236
  return "#" + R + G + B + A;
2237
2237
  } else {
@@ -2277,30 +2277,14 @@ var Color = /*#__PURE__*/ function() {
2277
2277
  * @param v - Gamma 空间颜色值
2278
2278
  * @returns 线性空间颜色值
2279
2279
  */ Color.gammaToLinear = function gammaToLinear(v) {
2280
- if (v <= 0.0) {
2281
- return 0.0;
2282
- } else if (v <= 0.04045) {
2283
- return v / 12.92;
2284
- } else if (v < 1.0) {
2285
- return Math.pow((v + 0.055) / 1.055, 2.4);
2286
- } else {
2287
- return Math.pow(v, 2.4);
2288
- }
2280
+ return v < 0.04045 ? v * 0.0773993808 : Math.pow(v * 0.9478672986 + 0.0521327014, 2.4);
2289
2281
  };
2290
2282
  /**
2291
2283
  * 颜色值从线性空间转到 Gamma 空间
2292
2284
  * @param value - 线性空间颜色值
2293
2285
  * @returns Gamma 空间颜色值
2294
2286
  */ Color.linearToGamma = function linearToGamma(value) {
2295
- if (value <= 0.0) {
2296
- return 0.0;
2297
- } else if (value < 0.0031308) {
2298
- return 12.92 * value;
2299
- } else if (value < 1.0) {
2300
- return 1.055 * Math.pow(value, 0.41666) - 0.055;
2301
- } else {
2302
- return Math.pow(value, 0.41666);
2303
- }
2287
+ return value < 0.0031308 ? value * 12.92 : 1.055 * Math.pow(value, 0.41666) - 0.055;
2304
2288
  };
2305
2289
  Color.ToHex = function ToHex(i) {
2306
2290
  var str = i.toString(16);
@@ -2927,6 +2911,11 @@ var PluginSystem = /*#__PURE__*/ function() {
2927
2911
  PluginSystem.getPlugins = function getPlugins() {
2928
2912
  return plugins;
2929
2913
  };
2914
+ PluginSystem.notifyCompositionCreating = function notifyCompositionCreating(composition, scene) {
2915
+ plugins.forEach(function(plugin) {
2916
+ return plugin.onCompositionCreating(composition, scene);
2917
+ });
2918
+ };
2930
2919
  PluginSystem.notifyCompositionCreated = function notifyCompositionCreated(composition, scene) {
2931
2920
  plugins.forEach(function(plugin) {
2932
2921
  return plugin.onCompositionCreated(composition, scene);
@@ -3019,6 +3008,12 @@ function getPluginUsageInfo(name) {
3019
3008
  * @param engine - 引擎实例
3020
3009
  */ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
3021
3010
  /**
3011
+ * 合成内容开始创建前触发。
3012
+ * 此时 root、pluginRoot 和 sceneRoot 已创建,但场景内容尚未实例化。
3013
+ * @param composition - 正在创建的合成对象
3014
+ * @param scene - 场景对象
3015
+ */ _proto.onCompositionCreating = function onCompositionCreating(composition, scene) {};
3016
+ /**
3022
3017
  * 合成创建完成后触发。
3023
3018
  * @param composition - 合成对象
3024
3019
  * @param scene - 场景对象
@@ -3087,7 +3082,8 @@ function _inherits(subClass, superClass) {
3087
3082
  JSONSceneVersion["3_5"] = "3.5";
3088
3083
  JSONSceneVersion["3_6"] = "3.6";
3089
3084
  JSONSceneVersion["3_7"] = "3.7";
3090
- JSONSceneVersion["LATEST"] = "3.7";
3085
+ JSONSceneVersion["3_8"] = "3.8";
3086
+ JSONSceneVersion["LATEST"] = "3.8";
3091
3087
  })(JSONSceneVersion || (JSONSceneVersion = {}));
3092
3088
 
3093
3089
  /*********************************************/ /* 元素属性参数类型 */ /*********************************************/ /**
@@ -3483,6 +3479,9 @@ var CameraClipMode;
3483
3479
  /**
3484
3480
  * Vector3 曲线
3485
3481
  */ ValueType[ValueType["VECTOR3_CURVE"] = 27] = "VECTOR3_CURVE";
3482
+ /**
3483
+ * 对象引用阶梯曲线(不插值)
3484
+ */ ValueType[ValueType["REFERENCE_CURVE"] = 28] = "REFERENCE_CURVE";
3486
3485
  })(ValueType || (ValueType = {}));
3487
3486
  /**
3488
3487
  * 关键帧类型
@@ -3726,6 +3725,15 @@ var BuiltinObjectGUID = {
3726
3725
  UnlitShader: "unlit000000000000000000000000000"
3727
3726
  };
3728
3727
 
3728
+ /**
3729
+ * Sprite UV 旋转方式。序列化为整数(兼容老 splits 的 flip 0/1)。
3730
+ * None 不旋转、Rotate90 将 UV 顺时针旋转 90°(width/height 互换)。
3731
+ */ var SpriteRotation$1;
3732
+ (function(SpriteRotation) {
3733
+ /** 不旋转 */ SpriteRotation[SpriteRotation["None"] = 0] = "None";
3734
+ /** UV 旋转 90°(对应老 splits flip=1) */ SpriteRotation[SpriteRotation["Rotate90"] = 1] = "Rotate90";
3735
+ })(SpriteRotation$1 || (SpriteRotation$1 = {}));
3736
+
3729
3737
  var FillType;
3730
3738
  (function(FillType) {
3731
3739
  FillType[FillType["Solid"] = 0] = "Solid";
@@ -3837,6 +3845,7 @@ var DataType;
3837
3845
  DataType["Image"] = "Image";
3838
3846
  DataType["AnimationClip"] = "AnimationClip";
3839
3847
  DataType["BinaryAsset"] = "BinaryAsset";
3848
+ DataType["Sprite"] = "Sprite";
3840
3849
  // Timeline
3841
3850
  DataType["TrackAsset"] = "TrackAsset";
3842
3851
  DataType["TimelineAsset"] = "TimelineAsset";
@@ -3850,6 +3859,7 @@ var DataType;
3850
3859
  DataType["Vector2PropertyTrack"] = "Vector2PropertyTrack";
3851
3860
  DataType["Vector3PropertyTrack"] = "Vector3PropertyTrack";
3852
3861
  DataType["Vector4PropertyTrack"] = "Vector4PropertyTrack";
3862
+ DataType["SpritePropertyTrack"] = "SpritePropertyTrack";
3853
3863
  DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
3854
3864
  DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
3855
3865
  DataType["ActivationPlayableAsset"] = "ActivationPlayableAsset";
@@ -3859,6 +3869,7 @@ var DataType;
3859
3869
  DataType["Vector2PropertyPlayableAsset"] = "Vector2PropertyPlayableAsset";
3860
3870
  DataType["Vector3PropertyPlayableAsset"] = "Vector3PropertyPlayableAsset";
3861
3871
  DataType["Vector4PropertyPlayableAsset"] = "Vector4PropertyPlayableAsset";
3872
+ DataType["SpritePropertyPlayableAsset"] = "SpritePropertyPlayableAsset";
3862
3873
  // Components
3863
3874
  DataType["MeshComponent"] = "MeshComponent";
3864
3875
  DataType["SkyboxComponent"] = "SkyboxComponent";
@@ -3885,6 +3896,42 @@ var DataType;
3885
3896
  DataType["FFDComponent"] = "FFDComponent";
3886
3897
  DataType["FrameComponent"] = "FrameComponent";
3887
3898
  DataType["Animator"] = "Animator";
3899
+ DataType["DomContentComponent"] = "DomContentComponent";
3900
+ DataType["UIControl"] = "UIControl";
3901
+ // GUI Controls
3902
+ DataType["Control"] = "Control";
3903
+ DataType["Container"] = "Container";
3904
+ DataType["HBoxContainer"] = "HBoxContainer";
3905
+ DataType["VBoxContainer"] = "VBoxContainer";
3906
+ DataType["GridContainer"] = "GridContainer";
3907
+ DataType["PanelContainer"] = "PanelContainer";
3908
+ DataType["MarginContainer"] = "MarginContainer";
3909
+ DataType["CenterContainer"] = "CenterContainer";
3910
+ DataType["AspectRatioContainer"] = "AspectRatioContainer";
3911
+ DataType["ScrollContainer"] = "ScrollContainer";
3912
+ DataType["HScrollBar"] = "HScrollBar";
3913
+ DataType["VScrollBar"] = "VScrollBar";
3914
+ DataType["HSeparator"] = "HSeparator";
3915
+ DataType["VSeparator"] = "VSeparator";
3916
+ DataType["Label"] = "Label";
3917
+ DataType["LineEdit"] = "LineEdit";
3918
+ DataType["TextEdit"] = "TextEdit";
3919
+ DataType["PopupPanel"] = "PopupPanel";
3920
+ DataType["PopupMenu"] = "PopupMenu";
3921
+ DataType["MenuButton"] = "MenuButton";
3922
+ DataType["OptionButton"] = "OptionButton";
3923
+ DataType["ColorPicker"] = "ColorPicker";
3924
+ DataType["ColorPickerButton"] = "ColorPickerButton";
3925
+ DataType["TextureRect"] = "TextureRect";
3926
+ DataType["NinePatchRect"] = "NinePatchRect";
3927
+ DataType["ColorRect"] = "ColorRect";
3928
+ DataType["Panel"] = "Panel";
3929
+ DataType["ProgressBar"] = "ProgressBar";
3930
+ DataType["Button"] = "Button";
3931
+ DataType["Checkbox"] = "Checkbox";
3932
+ DataType["CheckButton"] = "CheckButton";
3933
+ DataType["HSlider"] = "HSlider";
3934
+ DataType["VSlider"] = "VSlider";
3888
3935
  // Non-EffectObject
3889
3936
  DataType["TimelineClip"] = "TimelineClip";
3890
3937
  })(DataType || (DataType = {}));
@@ -4023,6 +4070,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
4023
4070
  get TextWeight () { return TextWeight; },
4024
4071
  get FontStyle () { return FontStyle; },
4025
4072
  BuiltinObjectGUID: BuiltinObjectGUID,
4073
+ get SpriteRotation () { return SpriteRotation$1; },
4026
4074
  get FillType () { return FillType; },
4027
4075
  get TexturePaintScaleMode () { return TexturePaintScaleMode$1; },
4028
4076
  get ShapePrimitiveType () { return ShapePrimitiveType; },
@@ -9199,7 +9247,7 @@ function isUniformStructArray(value) {
9199
9247
  return v.set(this.elements[i * 4], this.elements[i * 4 + 1], this.elements[i * 4 + 2], this.elements[i * 4 + 3]);
9200
9248
  };
9201
9249
  /**
9202
- * 设置相机矩阵
9250
+ * 设置矩阵的朝向旋转部分
9203
9251
  * @param eye - 相机位置
9204
9252
  * @param target - 目标位置
9205
9253
  * @param up - 相机方向
@@ -9209,27 +9257,32 @@ function isUniformStructArray(value) {
9209
9257
  var vY = Matrix4.tempVec1;
9210
9258
  var vZ = Matrix4.tempVec2;
9211
9259
  vZ.subtractVectors(eye, target);
9260
+ if (vZ.lengthSquared() === 0) {
9261
+ vZ.z = 1;
9262
+ }
9212
9263
  vZ.normalize();
9213
9264
  vX.crossVectors(up, vZ);
9265
+ if (vX.lengthSquared() === 0) {
9266
+ if (Math.abs(up.z) === 1) {
9267
+ vZ.x += 0.0001;
9268
+ } else {
9269
+ vZ.z += 0.0001;
9270
+ }
9271
+ vZ.normalize();
9272
+ vX.crossVectors(up, vZ);
9273
+ }
9214
9274
  vX.normalize();
9215
9275
  vY.crossVectors(vZ, vX);
9216
9276
  var te = this.elements;
9217
9277
  te[0] = vX.x;
9218
- te[1] = vY.x;
9219
- te[2] = vZ.x;
9220
- te[3] = 0;
9221
- te[4] = vX.y;
9278
+ te[4] = vY.x;
9279
+ te[8] = vZ.x;
9280
+ te[1] = vX.y;
9222
9281
  te[5] = vY.y;
9223
- te[6] = vZ.y;
9224
- te[7] = 0;
9225
- te[8] = vX.z;
9226
- te[9] = vY.z;
9282
+ te[9] = vZ.y;
9283
+ te[2] = vX.z;
9284
+ te[6] = vY.z;
9227
9285
  te[10] = vZ.z;
9228
- te[11] = 0;
9229
- te[12] = -vX.dot(eye);
9230
- te[13] = -vY.dot(eye);
9231
- te[14] = -vZ.dot(eye);
9232
- te[15] = 1;
9233
9286
  return this;
9234
9287
  };
9235
9288
  /**
@@ -9455,6 +9508,7 @@ function isUniformStructArray(value) {
9455
9508
  te[12] = l * te[0] + m * te[4] + n * te[8] - l + translation.x;
9456
9509
  te[13] = l * te[1] + m * te[5] + n * te[9] - m + translation.y;
9457
9510
  te[14] = l * te[2] + m * te[6] + n * te[10] - n + translation.z;
9511
+ te[15] = 1;
9458
9512
  return this;
9459
9513
  };
9460
9514
  /**
@@ -9746,7 +9800,7 @@ function isUniformStructArray(value) {
9746
9800
  return new Matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
9747
9801
  };
9748
9802
  /**
9749
- * 创建相机矩阵
9803
+ * 创建朝向旋转矩阵
9750
9804
  * @param eye - 相机位置
9751
9805
  * @param target - 目标位置
9752
9806
  * @param up - 相机方向
@@ -10961,6 +11015,9 @@ Euler.tempMat0 = new Matrix4();
10961
11015
  * @param [out] - 交点
10962
11016
  * @returns
10963
11017
  */ _proto.intersectSphere = function intersectSphere(sphere, out) {
11018
+ if (sphere.radius < 0) {
11019
+ return;
11020
+ }
10964
11021
  var center = sphere.center;
10965
11022
  var vector = Ray.tempVec0.subtractVectors(center, this.origin);
10966
11023
  var tca = vector.dot(this.direction);
@@ -11287,7 +11344,7 @@ Ray.tempVec3 = new Vector3();
11287
11344
  * @returns
11288
11345
  */ _proto.intersectsSphere = function intersectsSphere(sphere) {
11289
11346
  // Find the point on the AABB closest to the sphere center.
11290
- var vector = new Vector3();
11347
+ var vector = Box3.tempVec0;
11291
11348
  this.clampPoint(sphere.center, vector);
11292
11349
  // If that point is inside the sphere, the AABB and sphere intersect.
11293
11350
  return vector.distanceSquared(sphere.center) <= sphere.radius * sphere.radius;
@@ -11373,9 +11430,11 @@ Ray.tempVec3 = new Vector3();
11373
11430
  * @param target
11374
11431
  * @returns
11375
11432
  */ _proto.getBoundingSphere = function getBoundingSphere(target) {
11433
+ if (this.isEmpty()) {
11434
+ return target.makeEmpty();
11435
+ }
11376
11436
  this.getCenter(target.center);
11377
- var vector = new Vector3();
11378
- target.radius = this.getSize(vector).length() * 0.5;
11437
+ target.radius = this.getSize(Box3.tempVec0).length() * 0.5;
11379
11438
  return target;
11380
11439
  };
11381
11440
  /**
@@ -11396,6 +11455,7 @@ Ray.tempVec3 = new Vector3();
11396
11455
  };
11397
11456
  return Box3;
11398
11457
  }();
11458
+ Box3.tempVec0 = new Vector3();
11399
11459
 
11400
11460
  /**
11401
11461
  * 球
@@ -11426,16 +11486,15 @@ Ray.tempVec3 = new Vector3();
11426
11486
  var center = this.center;
11427
11487
  if (optionalCenter !== undefined) {
11428
11488
  center.copyFrom(optionalCenter);
11429
- var maxRadiusSq = 0;
11430
- for(var i = 0; i < points.length; i++){
11431
- maxRadiusSq = Math.max(maxRadiusSq, center.distanceSquared(points[i]));
11432
- }
11433
- this.radius = Math.sqrt(maxRadiusSq);
11434
11489
  } else {
11435
- var box = new Box3().setFromPoints(points);
11490
+ var box = Sphere.tempBox.setFromPoints(points);
11436
11491
  box.getCenter(center);
11437
- this.radius = box.getSize().length() / 2;
11438
11492
  }
11493
+ var maxRadiusSq = 0;
11494
+ for(var i = 0; i < points.length; i++){
11495
+ maxRadiusSq = Math.max(maxRadiusSq, center.distanceSquared(points[i]));
11496
+ }
11497
+ this.radius = Math.sqrt(maxRadiusSq);
11439
11498
  return this;
11440
11499
  };
11441
11500
  /**
@@ -11552,7 +11611,10 @@ Ray.tempVec3 = new Vector3();
11552
11611
  * @param point - 扩展点
11553
11612
  * @returns 扩展结果
11554
11613
  */ _proto.expandByPoint = function expandByPoint(point) {
11555
- var vector = new Vector3().subtractVectors(point, this.center);
11614
+ if (this.isEmpty()) {
11615
+ return this.set(point, 0);
11616
+ }
11617
+ var vector = Sphere.tempVec0.subtractVectors(point, this.center);
11556
11618
  var lengthSquared = vector.lengthSquared();
11557
11619
  if (lengthSquared > this.radius * this.radius) {
11558
11620
  var length = Math.sqrt(lengthSquared);
@@ -11570,30 +11632,42 @@ Ray.tempVec3 = new Vector3();
11570
11632
  * @param sphere - 包围球
11571
11633
  * @returns 求并结果
11572
11634
  */ _proto.union = function union(sphere) {
11573
- // To enclose another sphere into this sphere, we only need to enclose two points:
11574
- // 1) Enclose the farthest point on the other sphere into this sphere.
11575
- // 2) Enclose the opposite point of the farthest point into this sphere.
11576
- var v1 = new Vector3();
11577
- var toFarthestPoint = new Vector3();
11578
- toFarthestPoint.subtractVectors(sphere.center, this.center).normalize().multiply(sphere.radius);
11579
- this.expandByPoint(v1.copyFrom(sphere.center).add(toFarthestPoint));
11580
- this.expandByPoint(v1.copyFrom(sphere.center).subtract(toFarthestPoint));
11635
+ if (sphere.isEmpty()) {
11636
+ return this;
11637
+ }
11638
+ if (this.isEmpty()) {
11639
+ return this.copyFrom(sphere);
11640
+ }
11641
+ if (this.center.equals(sphere.center)) {
11642
+ this.radius = Math.max(this.radius, sphere.radius);
11643
+ } else {
11644
+ var point = Sphere.tempVec0;
11645
+ var offset = Sphere.tempVec1.subtractVectors(sphere.center, this.center).setLength(sphere.radius);
11646
+ this.expandByPoint(point.copyFrom(sphere.center).add(offset));
11647
+ this.expandByPoint(point.copyFrom(sphere.center).subtract(offset));
11648
+ }
11581
11649
  return this;
11582
11650
  };
11583
11651
  /**
11584
- * 包围球求交集
11652
+ * 获取两个包围球交集的保守包围球。部分重叠时,真实交集为透镜形,
11653
+ * 因此结果取两个输入中较小的包围球,并不精确表示交集。
11585
11654
  * @param other - 其它包围球
11586
11655
  * @returns 求交结果
11587
11656
  */ _proto.intersect = function intersect(other) {
11588
- var vector = new Vector3().subtractVectors(this.center, other.center);
11589
- var distance = vector.length();
11590
- var radiusSum = this.radius + other.radius;
11591
- if (distance > radiusSum) {
11657
+ if (this.isEmpty() || other.isEmpty()) {
11592
11658
  return this.makeEmpty();
11593
11659
  }
11594
- this.center = this.center.add(vector.normalize().multiply(distance / 2));
11595
- this.radius = this.radius + other.radius - distance;
11596
- return this;
11660
+ var distance = this.center.distance(other.center);
11661
+ if (distance > this.radius + other.radius) {
11662
+ return this.makeEmpty();
11663
+ }
11664
+ if (this.radius >= distance + other.radius) {
11665
+ return this.copyFrom(other);
11666
+ }
11667
+ if (other.radius >= distance + this.radius) {
11668
+ return this;
11669
+ }
11670
+ return this.radius <= other.radius ? this : this.copyFrom(other);
11597
11671
  };
11598
11672
  /**
11599
11673
  * 包围球判等
@@ -11610,6 +11684,9 @@ Ray.tempVec3 = new Vector3();
11610
11684
  };
11611
11685
  return Sphere;
11612
11686
  }();
11687
+ Sphere$1.tempBox = new Box3();
11688
+ Sphere$1.tempVec0 = new Vector3();
11689
+ Sphere$1.tempVec1 = new Vector3();
11613
11690
 
11614
11691
  var index = /*#__PURE__*/Object.freeze({
11615
11692
  __proto__: null,
@@ -15627,35 +15704,35 @@ function vecMulCombine(out, a, b) {
15627
15704
  }
15628
15705
  return out;
15629
15706
  }
15630
- var _obj$6;
15631
- var particleOriginTranslateMap$1 = (_obj$6 = {}, _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
15707
+ var _obj$5;
15708
+ var particleOriginTranslateMap$1 = (_obj$5 = {}, _obj$5[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
15632
15709
  0,
15633
15710
  0
15634
- ], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
15711
+ ], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
15635
15712
  0,
15636
15713
  -0.5
15637
- ], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
15714
+ ], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
15638
15715
  0,
15639
15716
  0.5
15640
- ], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
15717
+ ], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
15641
15718
  -0.5,
15642
15719
  0.5
15643
- ], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
15720
+ ], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
15644
15721
  -0.5,
15645
15722
  0
15646
- ], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
15723
+ ], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
15647
15724
  -0.5,
15648
15725
  -0.5
15649
- ], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
15726
+ ], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
15650
15727
  0.5,
15651
15728
  0
15652
- ], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
15729
+ ], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
15653
15730
  0.5,
15654
15731
  -0.5
15655
- ], _obj$6[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
15732
+ ], _obj$5[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
15656
15733
  0.5,
15657
15734
  0.5
15658
- ], _obj$6);
15735
+ ], _obj$5);
15659
15736
  function nearestPowerOfTwo(value) {
15660
15737
  return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
15661
15738
  }
@@ -17393,27 +17470,27 @@ function oldBezierKeyFramesToNew(props) {
17393
17470
  * 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
17394
17471
  * props 为 [[time, value], ...],value 为已解析的对象引用实例。
17395
17472
  */ var REFERENCE_CURVE = 28;
17396
- var _obj$5;
17397
- var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
17473
+ var _obj$4;
17474
+ var map$1 = (_obj$4 = {}, _obj$4[ValueType.RANDOM] = function(props) {
17398
17475
  if (_instanceof1(props[0], Array)) {
17399
17476
  return new RandomVectorValue(props);
17400
17477
  }
17401
17478
  return new RandomValue(props);
17402
- }, _obj$5[ValueType.CONSTANT] = function(props) {
17479
+ }, _obj$4[ValueType.CONSTANT] = function(props) {
17403
17480
  return new StaticValue(props);
17404
- }, _obj$5[ValueType.CONSTANT_VEC2] = function(props) {
17481
+ }, _obj$4[ValueType.CONSTANT_VEC2] = function(props) {
17405
17482
  return new StaticValue(props);
17406
- }, _obj$5[ValueType.CONSTANT_VEC3] = function(props) {
17483
+ }, _obj$4[ValueType.CONSTANT_VEC3] = function(props) {
17407
17484
  return new StaticValue(props);
17408
- }, _obj$5[ValueType.CONSTANT_VEC4] = function(props) {
17485
+ }, _obj$4[ValueType.CONSTANT_VEC4] = function(props) {
17409
17486
  return new StaticValue(props);
17410
- }, _obj$5[ValueType.RGBA_COLOR] = function(props) {
17487
+ }, _obj$4[ValueType.RGBA_COLOR] = function(props) {
17411
17488
  return new StaticValue(props);
17412
- }, _obj$5[ValueType.COLORS] = function(props) {
17489
+ }, _obj$4[ValueType.COLORS] = function(props) {
17413
17490
  return new RandomSetValue(props.map(function(c) {
17414
17491
  return colorToArr$1(c, false);
17415
17492
  }));
17416
- }, _obj$5[ValueType.LINE] = function(props) {
17493
+ }, _obj$4[ValueType.LINE] = function(props) {
17417
17494
  if (props.length === 2 && props[0][0] === 0 && props[1][0] === 1) {
17418
17495
  return new LinearValue([
17419
17496
  props[0][1],
@@ -17421,38 +17498,38 @@ var map$1 = (_obj$5 = {}, _obj$5[ValueType.RANDOM] = function(props) {
17421
17498
  ]);
17422
17499
  }
17423
17500
  return new LineSegments(props);
17424
- }, _obj$5[ValueType.GRADIENT_COLOR] = function(props) {
17501
+ }, _obj$4[ValueType.GRADIENT_COLOR] = function(props) {
17425
17502
  return new GradientValue(props);
17426
- }, _obj$5[ValueType.LINEAR_PATH] = function(pros) {
17503
+ }, _obj$4[ValueType.LINEAR_PATH] = function(pros) {
17427
17504
  return new PathSegments(pros);
17428
- }, _obj$5[ValueType.BEZIER_CURVE] = function(props) {
17505
+ }, _obj$4[ValueType.BEZIER_CURVE] = function(props) {
17429
17506
  if (props.length === 1) {
17430
17507
  return new StaticValue(props[0][1][1]);
17431
17508
  }
17432
17509
  return new BezierCurve(props);
17433
- }, _obj$5[ValueType.BEZIER_CURVE_PATH] = function(props) {
17510
+ }, _obj$4[ValueType.BEZIER_CURVE_PATH] = function(props) {
17434
17511
  if (props[0].length === 1) {
17435
17512
  return new StaticValue(_construct(Vector3, [].concat(props[1][0])));
17436
17513
  }
17437
17514
  return new BezierCurvePath(props);
17438
- }, _obj$5[ValueType.BEZIER_CURVE_QUAT] = function(props) {
17515
+ }, _obj$4[ValueType.BEZIER_CURVE_QUAT] = function(props) {
17439
17516
  if (props[0].length === 1) {
17440
17517
  return new StaticValue(_construct(Quaternion, [].concat(props[1][0])));
17441
17518
  }
17442
17519
  return new BezierCurveQuat(props);
17443
- }, _obj$5[ValueType.COLOR_CURVE] = function(props) {
17520
+ }, _obj$4[ValueType.COLOR_CURVE] = function(props) {
17444
17521
  return new ColorCurve(props);
17445
- }, _obj$5[ValueType.VECTOR4_CURVE] = function(props) {
17522
+ }, _obj$4[ValueType.VECTOR4_CURVE] = function(props) {
17446
17523
  return new Vector4Curve(props);
17447
- }, _obj$5[ValueType.VECTOR2_CURVE] = function(props) {
17524
+ }, _obj$4[ValueType.VECTOR2_CURVE] = function(props) {
17448
17525
  return new Vector2Curve(props);
17449
17526
  }, // TODO: add spec
17450
- _obj$5[VECTOR3_CURVE] = function(props) {
17527
+ _obj$4[VECTOR3_CURVE] = function(props) {
17451
17528
  return new Vector3Curve(props);
17452
17529
  }, // 对象引用阶梯曲线(不插值):props.data 为 [time, value][],value 已解析为 EffectsObject
17453
- _obj$5[REFERENCE_CURVE] = function(props) {
17530
+ _obj$4[REFERENCE_CURVE] = function(props) {
17454
17531
  return new ReferenceCurve(props);
17455
- }, _obj$5);
17532
+ }, _obj$4);
17456
17533
  function createValueGetter(args) {
17457
17534
  if (!args || !isNaN(+args)) {
17458
17535
  return new StaticValue(args || 0);
@@ -21393,8 +21470,8 @@ var vertexBufferSemanticMap = {
21393
21470
  TANGENT_BS2: "aTargetTangent2",
21394
21471
  TANGENT_BS3: "aTargetTangent3"
21395
21472
  };
21396
- var _obj$4;
21397
- var BYTES_TYPE_MAP = (_obj$4 = {}, _obj$4[BufferDataType.Float] = 4, _obj$4[BufferDataType.Int] = 4, _obj$4[BufferDataType.UnsignedInt] = 4, _obj$4[BufferDataType.Short] = 2, _obj$4[BufferDataType.UnsignedShort] = 2, _obj$4[BufferDataType.Byte] = 1, _obj$4[BufferDataType.UnsignedByte] = 1, _obj$4);
21473
+ var _obj$3;
21474
+ var BYTES_TYPE_MAP = (_obj$3 = {}, _obj$3[BufferDataType.Float] = 4, _obj$3[BufferDataType.Int] = 4, _obj$3[BufferDataType.UnsignedInt] = 4, _obj$3[BufferDataType.Short] = 2, _obj$3[BufferDataType.UnsignedShort] = 2, _obj$3[BufferDataType.Byte] = 1, _obj$3[BufferDataType.UnsignedByte] = 1, _obj$3);
21398
21475
  function generateEmptyTypedArray(type) {
21399
21476
  return createTypedArray(type, 0);
21400
21477
  }
@@ -22813,7 +22890,7 @@ var canvasPool = new CanvasPool();
22813
22890
  ctx.textBaseline = "alphabetic";
22814
22891
  ctx.fillStyle = "#ffffff";
22815
22892
  this.paddingPx = GLYPH_PADDING * resolution;
22816
- this.italicScale = fontStyle === "italic" ? 2 : 1;
22893
+ this.italicScale = fontStyle === "italic" || fontStyle === "oblique" ? 2 : 1;
22817
22894
  // ascent/descent 由探针 '|ÉqÅM' 测得 actualBoundingBox(重音字已抬高 ink 顶),
22818
22895
  // 两者内部保持浮点,仅 cell 高做一次外层 ceil — 与 padding 共同保证 cell 内不裁切
22819
22896
  var fontHeightPx = ascentPx + descentPx;
@@ -22911,7 +22988,7 @@ var canvasPool = new CanvasPool();
22911
22988
  * `ATLAS_SIZE × ATLAS_SIZE` 的离屏 canvas atlas,字符按需逐个绘制并打包,
22912
22989
  * `Graphics.drawText` 通过逐字 quad 引用 atlas 子矩形渲染。
22913
22990
  *
22914
- * - 同一段文本不同颜色不会重复 upload(颜色由顶点 `vColor` 乘上字形 alpha)
22991
+ * - 同一段文本不同颜色不会重复 upload(颜色由顶点 `vColor` 与字形 RGBA 相乘)
22915
22992
  * - 同一字体/字号下重复字符只渲染一次,显著减少 canvas → texture 上传次数
22916
22993
  *
22917
22994
  * 入参全部展开(避免调用方每帧创建临时 style 对象触发 GC)
@@ -22925,7 +23002,7 @@ var canvasPool = new CanvasPool();
22925
23002
  /**
22926
23003
  * 取(必要时新建)对应字体的字符 atlas
22927
23004
  */ _proto.getAtlas = function getAtlas(fontSize, fontFamily, fontWeight, fontStyle) {
22928
- // Pixi CanvasText 默认跟随 renderer.resolution;这里对应 Engine.pixelRatio。
23005
+ // 字形 atlas 跟随 Engine.pixelRatio。
22929
23006
  var resolution = this.engine.pixelRatio;
22930
23007
  if (resolution !== this.resolution) {
22931
23008
  this.clear();
@@ -22946,14 +23023,11 @@ var canvasPool = new CanvasPool();
22946
23023
  var probeCtx = probeCanvasAndContext.context;
22947
23024
  var ascentPx = fontSize * 0.8 * resolution;
22948
23025
  var descentPx = fontSize * 0.2 * resolution;
22949
- try {
22950
- probeCtx.font = scaledFontString;
22951
- var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
22952
- ascentPx = m.actualBoundingBoxAscent || ascentPx;
22953
- descentPx = m.actualBoundingBoxDescent || descentPx;
22954
- } finally{
22955
- canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
22956
- }
23026
+ probeCtx.font = scaledFontString;
23027
+ var m = probeCtx.measureText(METRICS_STRING + BASELINE_SYMBOL);
23028
+ ascentPx = m.actualBoundingBoxAscent || ascentPx;
23029
+ descentPx = m.actualBoundingBoxDescent || descentPx;
23030
+ canvasPool.releaseCanvasAndContext(probeCanvasAndContext);
22957
23031
  var atlas = new GlyphAtlas(this.engine, scaledFontString, ascentPx, descentPx, fontStyle, resolution);
22958
23032
  this.atlases.set(fontKey, atlas);
22959
23033
  return atlas;
@@ -22989,6 +23063,10 @@ var FULL_REGION = {
22989
23063
  u1: 1,
22990
23064
  v1: 1
22991
23065
  };
23066
+ var NINE_PATCH_DRAW_SOURCE_SIZE = "aDrawSourceSize";
23067
+ var NINE_PATCH_SOURCE_RECT = "aSourceRect";
23068
+ var NINE_PATCH_MARGINS = "aMargins";
23069
+ var NINE_PATCH_OPTIONS = "aOptions";
22992
23070
  var Graphics = /*#__PURE__*/ function() {
22993
23071
  function Graphics(engine) {
22994
23072
  this.engine = engine;
@@ -23002,6 +23080,10 @@ var Graphics = /*#__PURE__*/ function() {
23002
23080
  this.colors = [];
23003
23081
  this.uvs = [];
23004
23082
  this.indices = [];
23083
+ this.ninePatchDrawSourceSizes = [];
23084
+ this.ninePatchSourceRects = [];
23085
+ this.ninePatchMargins = [];
23086
+ this.ninePatchOptions = [];
23005
23087
  this.lineStyle = {
23006
23088
  width: 1,
23007
23089
  alignment: 0.5,
@@ -23013,6 +23095,9 @@ var Graphics = /*#__PURE__*/ function() {
23013
23095
  this.currentBatchTexture = null;
23014
23096
  this.transformStack = [];
23015
23097
  this.currentTransform = Matrix3.fromIdentity();
23098
+ this.clipStack = [];
23099
+ this.logicalWidth = 1;
23100
+ this.logicalHeight = 1;
23016
23101
  var _obj;
23017
23102
  this.geometry = Geometry.create(this.engine, {
23018
23103
  attributes: (_obj = {}, _obj[VertexBuffer.PositionKind] = {
@@ -23078,6 +23163,51 @@ var Graphics = /*#__PURE__*/ function() {
23078
23163
  drawCount: 6,
23079
23164
  bufferUsage: glContext.DYNAMIC_DRAW
23080
23165
  });
23166
+ var _obj1;
23167
+ this.ninePatchGeometry = Geometry.create(this.engine, {
23168
+ attributes: (_obj1 = {}, _obj1[VertexBuffer.PositionKind] = {
23169
+ type: glContext.FLOAT,
23170
+ size: 2,
23171
+ data: new Float32Array(8)
23172
+ }, _obj1[VertexBuffer.ColorKind] = {
23173
+ type: glContext.FLOAT,
23174
+ size: 4,
23175
+ data: new Float32Array(16)
23176
+ }, _obj1[VertexBuffer.UVKind] = {
23177
+ type: glContext.FLOAT,
23178
+ size: 2,
23179
+ data: new Float32Array(8)
23180
+ }, _obj1[NINE_PATCH_DRAW_SOURCE_SIZE] = {
23181
+ type: glContext.FLOAT,
23182
+ size: 4,
23183
+ data: new Float32Array(16)
23184
+ }, _obj1[NINE_PATCH_SOURCE_RECT] = {
23185
+ type: glContext.FLOAT,
23186
+ size: 4,
23187
+ data: new Float32Array(16)
23188
+ }, _obj1[NINE_PATCH_MARGINS] = {
23189
+ type: glContext.FLOAT,
23190
+ size: 4,
23191
+ data: new Float32Array(16)
23192
+ }, _obj1[NINE_PATCH_OPTIONS] = {
23193
+ type: glContext.FLOAT,
23194
+ size: 4,
23195
+ data: new Float32Array(16)
23196
+ }, _obj1),
23197
+ indices: {
23198
+ data: new Uint16Array([
23199
+ 0,
23200
+ 1,
23201
+ 2,
23202
+ 2,
23203
+ 1,
23204
+ 3
23205
+ ])
23206
+ },
23207
+ mode: glContext.TRIANGLES,
23208
+ drawCount: 6,
23209
+ bufferUsage: glContext.DYNAMIC_DRAW
23210
+ });
23081
23211
  this.coloredMaterial = Material.create(this.engine, {
23082
23212
  shader: {
23083
23213
  vertex: "precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n varying vec4 vColor;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",
@@ -23096,12 +23226,21 @@ var Graphics = /*#__PURE__*/ function() {
23096
23226
  this.texturedMaterial.depthTest = false;
23097
23227
  this.texturedMaterial.depthMask = false;
23098
23228
  this.texturedMaterial.blending = true;
23099
- // 文本 atlas 按 Pixi 的方式在上传时预乘 alpha,因此采样后只需应用顶点色和顶点 alpha。
23229
+ this.ninePatchMaterial = Material.create(this.engine, {
23230
+ shader: {
23231
+ 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 }",
23232
+ 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 }"
23233
+ }
23234
+ });
23235
+ this.ninePatchMaterial.depthTest = false;
23236
+ this.ninePatchMaterial.depthMask = false;
23237
+ this.ninePatchMaterial.blending = true;
23238
+ // 文本 atlas 在上传时预乘 alpha,因此纹理 RGB 只需乘顶点色和顶点 alpha。
23100
23239
  // 单独使用 material,避免改变 drawTexture 对普通非预乘纹理的处理。
23101
23240
  this.textMaterial = Material.create(this.engine, {
23102
23241
  shader: {
23103
23242
  vertex: "precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n varying vec4 vColor;\n varying vec2 vUV;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",
23104
- fragment: "precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n float alpha = texture2D(uMainTexture, vUV).a * vColor.a;\n gl_FragColor = vec4(vColor.rgb * alpha, alpha);\n }"
23243
+ fragment: "precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n vec4 textureColor = texture2D(uMainTexture, vUV);\n float alpha = textureColor.a * vColor.a;\n vec3 rgb = textureColor.rgb * vColor.rgb * vColor.a;\n gl_FragColor = vec4(rgb, alpha);\n }"
23105
23244
  }
23106
23245
  });
23107
23246
  this.textMaterial.depthTest = false;
@@ -23117,25 +23256,36 @@ var Graphics = /*#__PURE__*/ function() {
23117
23256
  this.vertices.length = 0;
23118
23257
  this.colors.length = 0;
23119
23258
  this.uvs.length = 0;
23259
+ this.ninePatchDrawSourceSizes.length = 0;
23260
+ this.ninePatchSourceRects.length = 0;
23261
+ this.ninePatchMargins.length = 0;
23262
+ this.ninePatchOptions.length = 0;
23120
23263
  this.transformStack = [];
23121
23264
  this.currentTransform = Matrix3.fromIdentity();
23265
+ this.clipStack = [];
23122
23266
  this.currentBatchType = "colored";
23123
23267
  this.currentBatchTexture = null;
23268
+ this.engine.setScissorTest(false);
23124
23269
  // 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
23125
- var _this_engine_canvas_getBoundingClientRect = this.engine.canvas.getBoundingClientRect(), width = _this_engine_canvas_getBoundingClientRect.width, height = _this_engine_canvas_getBoundingClientRect.height;
23270
+ var bounds = this.engine.canvas.getBoundingClientRect();
23271
+ var width = bounds.width || this.engine.canvas.width / this.engine.pixelRatio || 1;
23272
+ var height = bounds.height || this.engine.canvas.height / this.engine.pixelRatio || 1;
23273
+ this.logicalWidth = width;
23274
+ this.logicalHeight = height;
23126
23275
  // 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
23127
23276
  var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
23128
23277
  );
23129
23278
  this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
23130
23279
  this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
23131
23280
  this.textMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
23281
+ this.ninePatchMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
23132
23282
  };
23133
23283
  /**
23134
23284
  * 将当前变换压入栈,并设置新的变换
23135
23285
  * @param transform - 新的变换矩阵(会与当前变换相乘)
23136
23286
  */ _proto.pushTransform = function pushTransform(transform) {
23137
23287
  this.transformStack.push(this.currentTransform.clone());
23138
- this.currentTransform = this.currentTransform.premultiply(transform);
23288
+ this.currentTransform = this.currentTransform.multiply(transform);
23139
23289
  };
23140
23290
  /**
23141
23291
  * 恢复上一个变换
@@ -23147,10 +23297,81 @@ var Graphics = /*#__PURE__*/ function() {
23147
23297
  }
23148
23298
  this.currentTransform = transform;
23149
23299
  };
23300
+ /** Pushes a local rectangular child clip using a screen-space AABB scissor. */ _proto.pushClipRect = function pushClipRect(x, y, width, height) {
23301
+ var elements = this.currentTransform.elements;
23302
+ var corners = [
23303
+ [
23304
+ x,
23305
+ y
23306
+ ],
23307
+ [
23308
+ x + width,
23309
+ y
23310
+ ],
23311
+ [
23312
+ x,
23313
+ y + height
23314
+ ],
23315
+ [
23316
+ x + width,
23317
+ y + height
23318
+ ]
23319
+ ];
23320
+ var left = Infinity;
23321
+ var top = Infinity;
23322
+ var right = -Infinity;
23323
+ var bottom = -Infinity;
23324
+ for(var _iterator = _create_for_of_iterator_helper_loose(corners), _step; !(_step = _iterator()).done;){
23325
+ var corner = _step.value;
23326
+ var transformedX = elements[0] * corner[0] + elements[3] * corner[1] + elements[6];
23327
+ var transformedY = elements[1] * corner[0] + elements[4] * corner[1] + elements[7];
23328
+ left = Math.min(left, transformedX);
23329
+ top = Math.min(top, transformedY);
23330
+ right = Math.max(right, transformedX);
23331
+ bottom = Math.max(bottom, transformedY);
23332
+ }
23333
+ var parent = this.clipStack[this.clipStack.length - 1];
23334
+ if (parent) {
23335
+ left = Math.max(left, parent.x);
23336
+ top = Math.max(top, parent.y);
23337
+ right = Math.min(right, parent.x + parent.width);
23338
+ bottom = Math.min(bottom, parent.y + parent.height);
23339
+ }
23340
+ var clip = {
23341
+ x: left,
23342
+ y: top,
23343
+ width: Math.max(0, right - left),
23344
+ height: Math.max(0, bottom - top)
23345
+ };
23346
+ var previous = parent;
23347
+ this.clipStack.push(clip);
23348
+ if (!this.clipRectsEqual(previous, clip)) {
23349
+ this.flushBatch();
23350
+ this.applyClipRect(clip);
23351
+ }
23352
+ };
23353
+ /** Restores the parent rectangular clip. */ _proto.popClipRect = function popClipRect() {
23354
+ var previous = this.clipStack.pop();
23355
+ if (!previous) {
23356
+ console.warn("Graphics: clip stack is empty.");
23357
+ return;
23358
+ }
23359
+ var clip = this.clipStack[this.clipStack.length - 1];
23360
+ if (!this.clipRectsEqual(previous, clip)) {
23361
+ this.flushBatch();
23362
+ if (clip) {
23363
+ this.applyClipRect(clip);
23364
+ } else {
23365
+ this.engine.setScissorTest(false);
23366
+ }
23367
+ }
23368
+ };
23150
23369
  /**
23151
23370
  * 刷新并渲染所有累积的绘制命令
23152
23371
  */ _proto.end = function end() {
23153
23372
  this.flushBatch();
23373
+ this.clipStack = [];
23374
+ this.engine.setScissorTest(false);
23154
23375
  };
23155
23376
  /**
23156
23377
  * 切换到指定批次类型/纹理。若与当前批次不一致,先 flush 已累积顶点
@@ -23163,6 +23384,24 @@ var Graphics = /*#__PURE__*/ function() {
23163
23384
  this.currentBatchType = type;
23164
23385
  this.currentBatchTexture = texture;
23165
23386
  };
23387
+ _proto.applyClipRect = function applyClipRect(clip) {
23388
+ var framebufferWidth = this.engine.canvas.width;
23389
+ var framebufferHeight = this.engine.canvas.height;
23390
+ var scaleX = framebufferWidth / this.logicalWidth;
23391
+ var scaleY = framebufferHeight / this.logicalHeight;
23392
+ var left = Math.max(0, Math.min(framebufferWidth, Math.floor(clip.x * scaleX)));
23393
+ var top = Math.max(0, Math.min(framebufferHeight, Math.floor(clip.y * scaleY)));
23394
+ var right = Math.max(left, Math.min(framebufferWidth, Math.ceil((clip.x + clip.width) * scaleX)));
23395
+ var bottom = Math.max(top, Math.min(framebufferHeight, Math.ceil((clip.y + clip.height) * scaleY)));
23396
+ this.engine.setScissorTest(true);
23397
+ this.engine.setScissor(left, framebufferHeight - bottom, right - left, bottom - top);
23398
+ };
23399
+ _proto.clipRectsEqual = function clipRectsEqual(left, right) {
23400
+ if (!left || !right) {
23401
+ return left === right;
23402
+ }
23403
+ return left.x === right.x && left.y === right.y && left.width === right.width && left.height === right.height;
23404
+ };
23166
23405
  /**
23167
23406
  * 提交当前累积的顶点到 renderer,清空缓冲(批次内部 flush 不重置 batchType)
23168
23407
  */ _proto.flushBatch = function flushBatch() {
@@ -23176,37 +23415,48 @@ var Graphics = /*#__PURE__*/ function() {
23176
23415
  var colorsArray = new Float32Array(this.colors);
23177
23416
  var uvsArray = new Float32Array(this.uvs);
23178
23417
  var indicesArray = new Uint16Array(this.indices);
23179
- this.updateAttributeData(VertexBuffer.PositionKind, verticesArray, 2);
23180
- this.updateAttributeData(VertexBuffer.ColorKind, colorsArray, 4);
23181
- this.updateAttributeData(VertexBuffer.UVKind, uvsArray, 2);
23182
- this.geometry.setIndexData(indicesArray);
23183
- this.geometry.setDrawCount(this.currentIndexCount);
23418
+ var geometry = this.currentBatchType === "ninePatch" ? this.ninePatchGeometry : this.geometry;
23419
+ this.updateAttributeData(geometry, VertexBuffer.PositionKind, verticesArray, 2);
23420
+ this.updateAttributeData(geometry, VertexBuffer.ColorKind, colorsArray, 4);
23421
+ this.updateAttributeData(geometry, VertexBuffer.UVKind, uvsArray, 2);
23422
+ if (this.currentBatchType === "ninePatch") {
23423
+ this.updateAttributeData(geometry, NINE_PATCH_DRAW_SOURCE_SIZE, new Float32Array(this.ninePatchDrawSourceSizes), 4);
23424
+ this.updateAttributeData(geometry, NINE_PATCH_SOURCE_RECT, new Float32Array(this.ninePatchSourceRects), 4);
23425
+ this.updateAttributeData(geometry, NINE_PATCH_MARGINS, new Float32Array(this.ninePatchMargins), 4);
23426
+ this.updateAttributeData(geometry, NINE_PATCH_OPTIONS, new Float32Array(this.ninePatchOptions), 4);
23427
+ }
23428
+ geometry.setIndexData(indicesArray);
23429
+ geometry.setDrawCount(this.currentIndexCount);
23184
23430
  var material;
23185
- if (this.currentBatchType === "textured" || this.currentBatchType === "text") {
23186
- material = this.currentBatchType === "text" ? this.textMaterial : this.texturedMaterial;
23431
+ if (this.currentBatchType === "textured" || this.currentBatchType === "text" || this.currentBatchType === "ninePatch") {
23432
+ material = this.currentBatchType === "text" ? this.textMaterial : this.currentBatchType === "ninePatch" ? this.ninePatchMaterial : this.texturedMaterial;
23187
23433
  var _this_currentBatchTexture;
23188
23434
  var tex = (_this_currentBatchTexture = this.currentBatchTexture) != null ? _this_currentBatchTexture : this.engine.whiteTexture;
23189
23435
  material.setTexture("uMainTexture", tex);
23190
23436
  } else {
23191
23437
  material = this.coloredMaterial;
23192
23438
  }
23193
- this.engine.renderer.drawGeometry(this.geometry, Matrix4.IDENTITY, material);
23439
+ this.engine.renderer.drawGeometry(geometry, Matrix4.IDENTITY, material);
23194
23440
  this.indices.length = 0;
23195
23441
  this.vertices.length = 0;
23196
23442
  this.colors.length = 0;
23197
23443
  this.uvs.length = 0;
23198
- };
23199
- _proto.updateAttributeData = function updateAttributeData(name, data, size) {
23200
- var _this_geometry_getVertexBuffer;
23201
- var dataBuffer = (_this_geometry_getVertexBuffer = this.geometry.getVertexBuffer(name)) == null ? void 0 : _this_geometry_getVertexBuffer.getBuffer();
23444
+ this.ninePatchDrawSourceSizes.length = 0;
23445
+ this.ninePatchSourceRects.length = 0;
23446
+ this.ninePatchMargins.length = 0;
23447
+ this.ninePatchOptions.length = 0;
23448
+ };
23449
+ _proto.updateAttributeData = function updateAttributeData(geometry, name, data, size) {
23450
+ var _geometry_getVertexBuffer;
23451
+ var dataBuffer = (_geometry_getVertexBuffer = geometry.getVertexBuffer(name)) == null ? void 0 : _geometry_getVertexBuffer.getBuffer();
23202
23452
  if (dataBuffer && data.byteLength > dataBuffer.capacity) {
23203
- this.geometry.setVerticesBuffer(new VertexBuffer(this.engine, data, name, {
23453
+ geometry.setVerticesBuffer(new VertexBuffer(this.engine, data, name, {
23204
23454
  updatable: true,
23205
23455
  size: size
23206
23456
  }));
23207
23457
  return;
23208
23458
  }
23209
- this.geometry.setAttributeData(name, data);
23459
+ geometry.setAttributeData(name, data);
23210
23460
  };
23211
23461
  /**
23212
23462
  * 线段顶点按顺序连接 (p0-p1, p1-p2, p2-p3, ...)
@@ -23375,10 +23625,37 @@ var Graphics = /*#__PURE__*/ function() {
23375
23625
  this.pushQuad(x, y, width, height, color, region);
23376
23626
  };
23377
23627
  /**
23628
+ * Draws a nine-patch as one quad. Stretching and repetition are resolved in the fragment shader,
23629
+ * so Tile and TileFit do not expand into CPU-side geometry.
23630
+ */ _proto.drawNinePatch = function drawNinePatch(x, y, width, height, texture, options, color) {
23631
+ if (color === void 0) color = Color.WHITE;
23632
+ if (width <= 0 || height <= 0 || options.sourceWidth <= 0 || options.sourceHeight <= 0) {
23633
+ return;
23634
+ }
23635
+ this.ensureBatch("ninePatch", texture);
23636
+ var sourceU = options.sourceX / texture.width;
23637
+ var sourceV = 1 - options.sourceY / texture.height;
23638
+ var sourceUSize = options.sourceWidth / texture.width;
23639
+ var sourceVSize = options.sourceHeight / texture.height;
23640
+ var _options_horizontalMode;
23641
+ var horizontalMode = (_options_horizontalMode = options.horizontalMode) != null ? _options_horizontalMode : 0;
23642
+ var _options_verticalMode;
23643
+ var verticalMode = (_options_verticalMode = options.verticalMode) != null ? _options_verticalMode : 0;
23644
+ var _options_drawCenter;
23645
+ var drawCenter = Number((_options_drawCenter = options.drawCenter) != null ? _options_drawCenter : true);
23646
+ this.pushQuad(x, y, width, height, color, FULL_REGION);
23647
+ for(var i = 0; i < 4; i++){
23648
+ this.ninePatchDrawSourceSizes.push(width, height, options.sourceWidth, options.sourceHeight);
23649
+ this.ninePatchSourceRects.push(sourceU, sourceV, sourceUSize, sourceVSize);
23650
+ this.ninePatchMargins.push(options.marginLeft, options.marginTop, options.marginRight, options.marginBottom);
23651
+ this.ninePatchOptions.push(horizontalMode, verticalMode, drawCenter, 0);
23652
+ }
23653
+ };
23654
+ /**
23378
23655
  * 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
23379
23656
  *
23380
23657
  * 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
23381
- * `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
23658
+ * `color` atlas 字形 RGBA 相乘,任意颜色都不会污染 atlas。
23382
23659
  *
23383
23660
  * 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
23384
23661
  * @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
@@ -23401,10 +23678,11 @@ var Graphics = /*#__PURE__*/ function() {
23401
23678
  this.ensureBatch("text", atlas.texture);
23402
23679
  var lineHeight = atlas.lineHeight;
23403
23680
  var cursorX = x;
23681
+ var characters = Array.from(text);
23404
23682
  // ensureChar 可能往 atlas canvas 写新字并打 dirty 标;实际 upload 推迟到
23405
23683
  // flushBatch 统一处理,这样一帧多次 drawText 共写同一 atlas 只 upload 一次
23406
- for(var i = 0; i < text.length; i++){
23407
- var info = atlas.ensureChar(text[i]);
23684
+ for(var i = 0; i < characters.length; i++){
23685
+ var info = atlas.ensureChar(characters[i]);
23408
23686
  if (!info) {
23409
23687
  continue;
23410
23688
  }
@@ -23426,11 +23704,35 @@ var Graphics = /*#__PURE__*/ function() {
23426
23704
  cursorX += info.advance;
23427
23705
  }
23428
23706
  };
23707
+ /** Measures text with the same glyph metrics used by {@link drawText}. */ _proto.measureText = function measureText(text, fontSize, fontFamily, fontWeight, fontStyle) {
23708
+ if (fontFamily === void 0) fontFamily = "sans-serif";
23709
+ if (fontWeight === void 0) fontWeight = "normal";
23710
+ if (fontStyle === void 0) fontStyle = "normal";
23711
+ var atlas = this.textCache.getAtlas(fontSize, fontFamily, fontWeight, fontStyle);
23712
+ var characters = Array.from(text);
23713
+ var advances = [];
23714
+ var width = 0;
23715
+ for(var _iterator = _create_for_of_iterator_helper_loose(characters), _step; !(_step = _iterator()).done;){
23716
+ var character = _step.value;
23717
+ var _atlas_ensureChar;
23718
+ var _atlas_ensureChar_advance;
23719
+ var advance = (_atlas_ensureChar_advance = (_atlas_ensureChar = atlas.ensureChar(character)) == null ? void 0 : _atlas_ensureChar.advance) != null ? _atlas_ensureChar_advance : 0;
23720
+ advances.push(advance);
23721
+ width += advance;
23722
+ }
23723
+ return {
23724
+ width: width,
23725
+ lineHeight: atlas.lineHeight,
23726
+ advances: advances
23727
+ };
23728
+ };
23429
23729
  _proto.dispose = function dispose() {
23430
23730
  this.geometry.dispose();
23731
+ this.ninePatchGeometry.dispose();
23431
23732
  this.coloredMaterial.dispose();
23432
23733
  this.texturedMaterial.dispose();
23433
23734
  this.textMaterial.dispose();
23735
+ this.ninePatchMaterial.dispose();
23434
23736
  this.textCache.dispose();
23435
23737
  };
23436
23738
  _proto.buildShape = function buildShape(shape, color) {
@@ -23438,7 +23740,7 @@ var Graphics = /*#__PURE__*/ function() {
23438
23740
  var indexOffset = this.indices.length;
23439
23741
  var vertexOffset = this.vertices.length / 2;
23440
23742
  buildPoints.length = 0;
23441
- shape.build(buildPoints);
23743
+ shape.build(buildPoints, this.getScreenScale());
23442
23744
  shape.triangulate(buildPoints, this.vertices, vertexOffset, this.indices, indexOffset);
23443
23745
  this.applyTransformAndColor(vertexOffset, this.vertices.length / 2 - vertexOffset, color);
23444
23746
  };
@@ -23448,11 +23750,19 @@ var Graphics = /*#__PURE__*/ function() {
23448
23750
  this.indices.length;
23449
23751
  var vertexOffset = this.vertices.length / 2;
23450
23752
  buildPoints.length = 0;
23451
- shape.build(buildPoints);
23753
+ shape.build(buildPoints, this.getScreenScale());
23452
23754
  this.lineStyle.width = thickness;
23453
23755
  buildLine(buildPoints, this.lineStyle, false, closed, this.vertices, 2, vertexOffset, this.indices);
23454
23756
  this.applyTransformAndColor(vertexOffset, this.vertices.length / 2 - vertexOffset, color);
23455
23757
  };
23758
+ _proto.getScreenScale = function getScreenScale() {
23759
+ var transform = this.currentTransform.elements;
23760
+ var transformScaleX = Math.hypot(transform[0], transform[1]);
23761
+ var transformScaleY = Math.hypot(transform[3], transform[4]);
23762
+ var framebufferScaleX = this.engine.canvas.width / this.logicalWidth;
23763
+ var framebufferScaleY = this.engine.canvas.height / this.logicalHeight;
23764
+ return Math.max(transformScaleX * framebufferScaleX, transformScaleY * framebufferScaleY, 1);
23765
+ };
23456
23766
  _proto.setTriangleShape = function setTriangleShape(x1, y1, x2, y2, x3, y3) {
23457
23767
  this.triangleShape.x = x1;
23458
23768
  this.triangleShape.y = y1;
@@ -24501,2107 +24811,6 @@ FrameComponent = __decorate([
24501
24811
  // 第四列 (位移) 乘 1,无需修改
24502
24812
  }
24503
24813
 
24504
- function _assert_this_initialized(self) {
24505
- if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
24506
- return self;
24507
- }
24508
-
24509
- var MouseFilter;
24510
- (function(MouseFilter) {
24511
- MouseFilter[MouseFilter["Stop"] = 0] = "Stop";
24512
- MouseFilter[MouseFilter["Pass"] = 1] = "Pass";
24513
- MouseFilter[MouseFilter["Ignore"] = 2] = "Ignore";
24514
- })(MouseFilter || (MouseFilter = {}));
24515
- var MouseBehaviorRecursive;
24516
- (function(MouseBehaviorRecursive) {
24517
- MouseBehaviorRecursive[MouseBehaviorRecursive["Inherited"] = 0] = "Inherited";
24518
- MouseBehaviorRecursive[MouseBehaviorRecursive["Disabled"] = 1] = "Disabled";
24519
- MouseBehaviorRecursive[MouseBehaviorRecursive["Enabled"] = 2] = "Enabled";
24520
- })(MouseBehaviorRecursive || (MouseBehaviorRecursive = {}));
24521
- var MouseButton;
24522
- (function(MouseButton) {
24523
- MouseButton[MouseButton["None"] = 0] = "None";
24524
- MouseButton[MouseButton["Left"] = 1] = "Left";
24525
- MouseButton[MouseButton["Right"] = 2] = "Right";
24526
- MouseButton[MouseButton["Middle"] = 3] = "Middle";
24527
- MouseButton[MouseButton["WheelUp"] = 4] = "WheelUp";
24528
- MouseButton[MouseButton["WheelDown"] = 5] = "WheelDown";
24529
- MouseButton[MouseButton["WheelLeft"] = 6] = "WheelLeft";
24530
- MouseButton[MouseButton["WheelRight"] = 7] = "WheelRight";
24531
- MouseButton[MouseButton["Xbutton1"] = 8] = "Xbutton1";
24532
- MouseButton[MouseButton["Xbutton2"] = 9] = "Xbutton2";
24533
- })(MouseButton || (MouseButton = {}));
24534
- var MouseButtonMask;
24535
- (function(MouseButtonMask) {
24536
- MouseButtonMask[MouseButtonMask["None"] = 0] = "None";
24537
- MouseButtonMask[MouseButtonMask["Left"] = 1] = "Left";
24538
- MouseButtonMask[MouseButtonMask["Right"] = 2] = "Right";
24539
- MouseButtonMask[MouseButtonMask["Middle"] = 4] = "Middle";
24540
- MouseButtonMask[MouseButtonMask["Xbutton1"] = 128] = "Xbutton1";
24541
- MouseButtonMask[MouseButtonMask["Xbutton2"] = 256] = "Xbutton2";
24542
- })(MouseButtonMask || (MouseButtonMask = {}));
24543
- var FocusMode;
24544
- (function(FocusMode) {
24545
- FocusMode[FocusMode["None"] = 0] = "None";
24546
- FocusMode[FocusMode["Click"] = 1] = "Click";
24547
- FocusMode[FocusMode["All"] = 2] = "All";
24548
- FocusMode[FocusMode["Accessibility"] = 3] = "Accessibility";
24549
- })(FocusMode || (FocusMode = {}));
24550
- var FocusBehaviorRecursive;
24551
- (function(FocusBehaviorRecursive) {
24552
- FocusBehaviorRecursive[FocusBehaviorRecursive["Inherited"] = 0] = "Inherited";
24553
- FocusBehaviorRecursive[FocusBehaviorRecursive["Disabled"] = 1] = "Disabled";
24554
- FocusBehaviorRecursive[FocusBehaviorRecursive["Enabled"] = 2] = "Enabled";
24555
- })(FocusBehaviorRecursive || (FocusBehaviorRecursive = {}));
24556
- var KeyLocation;
24557
- (function(KeyLocation) {
24558
- KeyLocation[KeyLocation["Unspecified"] = 0] = "Unspecified";
24559
- KeyLocation[KeyLocation["Left"] = 1] = "Left";
24560
- KeyLocation[KeyLocation["Right"] = 2] = "Right";
24561
- })(KeyLocation || (KeyLocation = {}));
24562
- var CursorShape;
24563
- (function(CursorShape) {
24564
- CursorShape[CursorShape["Arrow"] = 0] = "Arrow";
24565
- CursorShape[CursorShape["Ibeam"] = 1] = "Ibeam";
24566
- CursorShape[CursorShape["PointingHand"] = 2] = "PointingHand";
24567
- CursorShape[CursorShape["Cross"] = 3] = "Cross";
24568
- CursorShape[CursorShape["Wait"] = 4] = "Wait";
24569
- CursorShape[CursorShape["Busy"] = 5] = "Busy";
24570
- CursorShape[CursorShape["Drag"] = 6] = "Drag";
24571
- CursorShape[CursorShape["CanDrop"] = 7] = "CanDrop";
24572
- CursorShape[CursorShape["Forbidden"] = 8] = "Forbidden";
24573
- CursorShape[CursorShape["Vsize"] = 9] = "Vsize";
24574
- CursorShape[CursorShape["Hsize"] = 10] = "Hsize";
24575
- CursorShape[CursorShape["Bdiagsize"] = 11] = "Bdiagsize";
24576
- CursorShape[CursorShape["Fdiagsize"] = 12] = "Fdiagsize";
24577
- CursorShape[CursorShape["Move"] = 13] = "Move";
24578
- CursorShape[CursorShape["Vsplit"] = 14] = "Vsplit";
24579
- CursorShape[CursorShape["Hsplit"] = 15] = "Hsplit";
24580
- CursorShape[CursorShape["Help"] = 16] = "Help";
24581
- })(CursorShape || (CursorShape = {}));
24582
-
24583
- function _get_prototype_of(o) {
24584
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
24585
- return o.__proto__ || Object.getPrototypeOf(o);
24586
- };
24587
- return _get_prototype_of(o);
24588
- }
24589
-
24590
- function _is_native_function(fn) {
24591
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
24592
- }
24593
-
24594
- function _wrap_native_super(Class) {
24595
- var _cache = typeof Map === "function" ? new Map() : undefined;
24596
- _wrap_native_super = function _wrap_native_super(Class) {
24597
- if (Class === null || !_is_native_function(Class)) return Class;
24598
- if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
24599
- if (typeof _cache !== "undefined") {
24600
- if (_cache.has(Class)) return _cache.get(Class);
24601
- _cache.set(Class, Wrapper);
24602
- }
24603
- function Wrapper() {
24604
- return _construct(Class, arguments, _get_prototype_of(this).constructor);
24605
- }
24606
- Wrapper.prototype = Object.create(Class.prototype, {
24607
- constructor: {
24608
- value: Wrapper,
24609
- enumerable: false,
24610
- writable: true,
24611
- configurable: true
24612
- }
24613
- });
24614
- return _set_prototype_of(Wrapper, Class);
24615
- };
24616
- return _wrap_native_super(Class);
24617
- }
24618
-
24619
- function transformPoint(transform, value) {
24620
- var elements = transform.elements;
24621
- return new Vector2(elements[0] * value.x + elements[3] * value.y + elements[6], elements[1] * value.x + elements[4] * value.y + elements[7]);
24622
- }
24623
- function transformVector(transform, value) {
24624
- var elements = transform.elements;
24625
- return new Vector2(elements[0] * value.x + elements[3] * value.y, elements[1] * value.x + elements[4] * value.y);
24626
- }
24627
- var InputEvent = /*#__PURE__*/ function() {
24628
- function InputEvent() {
24629
- this.device = 0;
24630
- this.pressed = false;
24631
- this.canceled = false;
24632
- this._accepted = false;
24633
- }
24634
- var _proto = InputEvent.prototype;
24635
- _proto.accept = function accept() {
24636
- this._accepted = true;
24637
- };
24638
- _proto.clearAccepted = function clearAccepted() {
24639
- this._accepted = false;
24640
- };
24641
- _proto.isAccepted = function isAccepted() {
24642
- return this._accepted;
24643
- };
24644
- _proto.isPressed = function isPressed() {
24645
- return this.pressed && !this.canceled;
24646
- };
24647
- _proto.isReleased = function isReleased() {
24648
- return !this.pressed && !this.canceled;
24649
- };
24650
- _proto.isCanceled = function isCanceled() {
24651
- return this.canceled;
24652
- };
24653
- _proto.isEcho = function isEcho() {
24654
- return false;
24655
- };
24656
- _proto.xformedBy = function xformedBy(transform) {
24657
- return this;
24658
- };
24659
- return InputEvent;
24660
- }();
24661
- InputEvent.deviceIdEmulation = -1;
24662
- InputEvent.deviceIdInternal = -2;
24663
- InputEvent.deviceIdKeyboard = 16;
24664
- InputEvent.deviceIdMouse = 32;
24665
- var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
24666
- _inherits(InputEventWithModifiers, InputEvent);
24667
- function InputEventWithModifiers() {
24668
- var _this;
24669
- _this = InputEvent.apply(this, arguments) || this;
24670
- _this.commandOrControlAutoremap = false;
24671
- _this.shiftPressed = false;
24672
- _this.altPressed = false;
24673
- _this.metaPressed = false;
24674
- _this.ctrlPressed = false;
24675
- return _this;
24676
- }
24677
- var _proto = InputEventWithModifiers.prototype;
24678
- _proto.copyModifiersTo = function copyModifiersTo(event) {
24679
- event.device = this.device;
24680
- event.pressed = this.pressed;
24681
- event.canceled = this.canceled;
24682
- event.commandOrControlAutoremap = this.commandOrControlAutoremap;
24683
- event.shiftPressed = this.shiftPressed;
24684
- event.altPressed = this.altPressed;
24685
- event.metaPressed = this.metaPressed;
24686
- event.ctrlPressed = this.ctrlPressed;
24687
- };
24688
- return InputEventWithModifiers;
24689
- }(_wrap_native_super(InputEvent));
24690
- var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
24691
- _inherits(InputEventKey, InputEventWithModifiers);
24692
- function InputEventKey() {
24693
- var _this;
24694
- _this = InputEventWithModifiers.apply(this, arguments) || this;
24695
- _this.keycode = "";
24696
- _this.physicalKeycode = "";
24697
- _this.keyLabel = "";
24698
- _this.unicode = 0;
24699
- _this.location = KeyLocation.Unspecified;
24700
- _this.echo = false;
24701
- return _this;
24702
- }
24703
- var _proto = InputEventKey.prototype;
24704
- _proto.isEcho = function isEcho() {
24705
- return this.echo;
24706
- };
24707
- return InputEventKey;
24708
- }(InputEventWithModifiers);
24709
- var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
24710
- _inherits(InputEventMouse, InputEventWithModifiers);
24711
- function InputEventMouse() {
24712
- var _this;
24713
- _this = InputEventWithModifiers.apply(this, arguments) || this;
24714
- _this.buttonMask = MouseButtonMask.None;
24715
- _this.position = new Vector2();
24716
- _this.globalPosition = new Vector2();
24717
- return _this;
24718
- }
24719
- var _proto = InputEventMouse.prototype;
24720
- _proto.copyMouseTo = function copyMouseTo(event) {
24721
- this.copyModifiersTo(event);
24722
- event.buttonMask = this.buttonMask;
24723
- event.position.copyFrom(this.position);
24724
- event.globalPosition.copyFrom(this.globalPosition);
24725
- };
24726
- return InputEventMouse;
24727
- }(InputEventWithModifiers);
24728
- var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
24729
- _inherits(InputEventMouseButton, InputEventMouse);
24730
- function InputEventMouseButton() {
24731
- var _this;
24732
- _this = InputEventMouse.apply(this, arguments) || this;
24733
- _this.factor = 1;
24734
- _this.buttonIndex = MouseButton.None;
24735
- _this.doubleClick = false;
24736
- return _this;
24737
- }
24738
- var _proto = InputEventMouseButton.prototype;
24739
- _proto.xformedBy = function xformedBy(transform) {
24740
- var event = new InputEventMouseButton();
24741
- this.copyMouseTo(event);
24742
- event.position.copyFrom(transformPoint(transform, this.position));
24743
- event.factor = this.factor;
24744
- event.buttonIndex = this.buttonIndex;
24745
- event.doubleClick = this.doubleClick;
24746
- return event;
24747
- };
24748
- return InputEventMouseButton;
24749
- }(InputEventMouse);
24750
- var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
24751
- _inherits(InputEventMouseMotion, InputEventMouse);
24752
- function InputEventMouseMotion() {
24753
- var _this;
24754
- _this = InputEventMouse.apply(this, arguments) || this;
24755
- _this.tilt = new Vector2();
24756
- _this.pressure = 0;
24757
- _this.relative = new Vector2();
24758
- _this.screenRelative = new Vector2();
24759
- _this.velocity = new Vector2();
24760
- _this.screenVelocity = new Vector2();
24761
- _this.penInverted = false;
24762
- return _this;
24763
- }
24764
- var _proto = InputEventMouseMotion.prototype;
24765
- _proto.xformedBy = function xformedBy(transform) {
24766
- var event = new InputEventMouseMotion();
24767
- this.copyMouseTo(event);
24768
- event.position.copyFrom(transformPoint(transform, this.position));
24769
- event.tilt.copyFrom(this.tilt);
24770
- event.pressure = this.pressure;
24771
- event.relative.copyFrom(transformVector(transform, this.relative));
24772
- event.screenRelative.copyFrom(this.screenRelative);
24773
- event.velocity.copyFrom(transformVector(transform, this.velocity));
24774
- event.screenVelocity.copyFrom(this.screenVelocity);
24775
- event.penInverted = this.penInverted;
24776
- return event;
24777
- };
24778
- return InputEventMouseMotion;
24779
- }(InputEventMouse);
24780
- var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
24781
- _inherits(InputEventScreenTouch, InputEvent);
24782
- function InputEventScreenTouch() {
24783
- var _this;
24784
- _this = InputEvent.apply(this, arguments) || this;
24785
- _this.index = 0;
24786
- _this.position = new Vector2();
24787
- _this.doubleTap = false;
24788
- return _this;
24789
- }
24790
- var _proto = InputEventScreenTouch.prototype;
24791
- _proto.xformedBy = function xformedBy(transform) {
24792
- var event = new InputEventScreenTouch();
24793
- event.device = this.device;
24794
- event.pressed = this.pressed;
24795
- event.canceled = this.canceled;
24796
- event.index = this.index;
24797
- event.position.copyFrom(transformPoint(transform, this.position));
24798
- event.doubleTap = this.doubleTap;
24799
- return event;
24800
- };
24801
- return InputEventScreenTouch;
24802
- }(_wrap_native_super(InputEvent));
24803
- var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
24804
- _inherits(InputEventScreenDrag, InputEvent);
24805
- function InputEventScreenDrag() {
24806
- var _this;
24807
- _this = InputEvent.apply(this, arguments) || this;
24808
- _this.index = 0;
24809
- _this.position = new Vector2();
24810
- _this.relative = new Vector2();
24811
- _this.screenRelative = new Vector2();
24812
- _this.velocity = new Vector2();
24813
- _this.screenVelocity = new Vector2();
24814
- _this.pressure = 0;
24815
- _this.tilt = new Vector2();
24816
- _this.penInverted = false;
24817
- return _this;
24818
- }
24819
- var _proto = InputEventScreenDrag.prototype;
24820
- _proto.xformedBy = function xformedBy(transform) {
24821
- var event = new InputEventScreenDrag();
24822
- event.device = this.device;
24823
- event.pressed = this.pressed;
24824
- event.canceled = this.canceled;
24825
- event.index = this.index;
24826
- event.position.copyFrom(transformPoint(transform, this.position));
24827
- event.relative.copyFrom(transformVector(transform, this.relative));
24828
- event.screenRelative.copyFrom(this.screenRelative);
24829
- event.velocity.copyFrom(transformVector(transform, this.velocity));
24830
- event.screenVelocity.copyFrom(this.screenVelocity);
24831
- event.pressure = this.pressure;
24832
- event.tilt.copyFrom(this.tilt);
24833
- event.penInverted = this.penInverted;
24834
- return event;
24835
- };
24836
- return InputEventScreenDrag;
24837
- }(_wrap_native_super(InputEvent));
24838
-
24839
- var ANCHOR_PRESET_TABLE = {
24840
- topLeft: [
24841
- 0,
24842
- 0,
24843
- 0,
24844
- 0
24845
- ],
24846
- topRight: [
24847
- 1,
24848
- 0,
24849
- 1,
24850
- 0
24851
- ],
24852
- bottomLeft: [
24853
- 0,
24854
- 1,
24855
- 0,
24856
- 1
24857
- ],
24858
- bottomRight: [
24859
- 1,
24860
- 1,
24861
- 1,
24862
- 1
24863
- ],
24864
- centerLeft: [
24865
- 0,
24866
- 0.5,
24867
- 0,
24868
- 0.5
24869
- ],
24870
- centerTop: [
24871
- 0.5,
24872
- 0,
24873
- 0.5,
24874
- 0
24875
- ],
24876
- centerRight: [
24877
- 1,
24878
- 0.5,
24879
- 1,
24880
- 0.5
24881
- ],
24882
- centerBottom: [
24883
- 0.5,
24884
- 1,
24885
- 0.5,
24886
- 1
24887
- ],
24888
- center: [
24889
- 0.5,
24890
- 0.5,
24891
- 0.5,
24892
- 0.5
24893
- ],
24894
- leftWide: [
24895
- 0,
24896
- 0,
24897
- 0,
24898
- 1
24899
- ],
24900
- topWide: [
24901
- 0,
24902
- 0,
24903
- 1,
24904
- 0
24905
- ],
24906
- rightWide: [
24907
- 1,
24908
- 0,
24909
- 1,
24910
- 1
24911
- ],
24912
- bottomWide: [
24913
- 0,
24914
- 1,
24915
- 1,
24916
- 1
24917
- ],
24918
- vcenterWide: [
24919
- 0.5,
24920
- 0,
24921
- 0.5,
24922
- 1
24923
- ],
24924
- hcenterWide: [
24925
- 0,
24926
- 0.5,
24927
- 1,
24928
- 0.5
24929
- ],
24930
- fullRect: [
24931
- 0,
24932
- 0,
24933
- 1,
24934
- 1
24935
- ]
24936
- };
24937
- /**
24938
- * A drawable GUI object. Controls form a tree independent from the VFXItem
24939
- * scene tree. UIControl is the bridge between both trees.
24940
- */ var Control = /*#__PURE__*/ function() {
24941
- function Control(engine) {
24942
- this.engine = engine;
24943
- this._parent = null;
24944
- this._visible = true;
24945
- this._enabled = true;
24946
- this._mouseFilter = MouseFilter.Stop;
24947
- this._mouseBehaviorRecursive = MouseBehaviorRecursive.Inherited;
24948
- this._focusMode = FocusMode.None;
24949
- this._focusBehaviorRecursive = FocusBehaviorRecursive.Inherited;
24950
- this._defaultCursorShape = CursorShape.Arrow;
24951
- this._rotation = 0;
24952
- this.transformDirty = true;
24953
- this.cachedTransform = new Matrix3();
24954
- this.eventEmitter = new EventEmitter();
24955
- this.disposed = false;
24956
- this./** Scene-tree bridge that owns this GUI object, if any. */ owner = null;
24957
- this.position = new Vector2();
24958
- this.size = new Vector2(1, 1);
24959
- this.anchorMin = new Vector2();
24960
- this.anchorMax = new Vector2();
24961
- this.offsetMin = new Vector2();
24962
- this.offsetMax = new Vector2(1, 1);
24963
- this.pivot = new Vector2(0.5, 0.5);
24964
- this.scale = new Vector2(1, 1);
24965
- this.shear = new Vector2();
24966
- this.mouseForcePassScrollEvents = true;
24967
- this.clipContents = false;
24968
- }
24969
- var _proto = Control.prototype;
24970
- _proto.on = function on(eventName, listener, options) {
24971
- this.eventEmitter.on(eventName, listener, options);
24972
- };
24973
- _proto.off = function off(eventName, listener) {
24974
- this.eventEmitter.off(eventName, listener);
24975
- };
24976
- _proto.setPosition = function setPosition(x, y, keepOffsets) {
24977
- if (keepOffsets === void 0) keepOffsets = false;
24978
- if (this.position.x === x && this.position.y === y) {
24979
- return;
24980
- }
24981
- var rect = {
24982
- position: new Vector2(x, y),
24983
- size: this.size.clone()
24984
- };
24985
- if (keepOffsets && this.parent) {
24986
- this.computeAnchors(rect, this.getParentRect());
24987
- } else {
24988
- this.computeOffsets(rect, this.getParentRect());
24989
- }
24990
- this.updateLayout();
24991
- };
24992
- _proto.setSize = function setSize(width, height) {
24993
- if (this.size.x === width && this.size.y === height) {
24994
- return;
24995
- }
24996
- var rect = {
24997
- position: this.position.clone(),
24998
- size: new Vector2(width, height)
24999
- };
25000
- this.computeOffsets(rect, this.getParentRect());
25001
- this.updateLayout();
25002
- };
25003
- _proto.setScale = function setScale(x, y) {
25004
- if (this.scale.x !== x || this.scale.y !== y) {
25005
- this.scale.set(x, y);
25006
- this.markTransformDirty();
25007
- }
25008
- };
25009
- _proto.setRotation = function setRotation(degrees) {
25010
- if (this._rotation !== degrees) {
25011
- this._rotation = degrees;
25012
- this.markTransformDirty();
25013
- }
25014
- };
25015
- _proto.setShear = function setShear(x, y) {
25016
- if (this.shear.x !== x || this.shear.y !== y) {
25017
- this.shear.set(x, y);
25018
- this.markTransformDirty();
25019
- }
25020
- };
25021
- _proto.setPivot = function setPivot(x, y) {
25022
- if (this.pivot.x !== x || this.pivot.y !== y) {
25023
- this.pivot.set(x, y);
25024
- this.markTransformDirty();
25025
- }
25026
- };
25027
- _proto.setAnchorMin = function setAnchorMin(x, y) {
25028
- if (this.anchorMin.x !== x || this.anchorMin.y !== y) {
25029
- this.anchorMin.set(x, y);
25030
- this.updateLayout();
25031
- }
25032
- };
25033
- _proto.setAnchorMax = function setAnchorMax(x, y) {
25034
- if (this.anchorMax.x !== x || this.anchorMax.y !== y) {
25035
- this.anchorMax.set(x, y);
25036
- this.updateLayout();
25037
- }
25038
- };
25039
- _proto.setOffsetMin = function setOffsetMin(x, y) {
25040
- if (this.offsetMin.x !== x || this.offsetMin.y !== y) {
25041
- this.offsetMin.set(x, y);
25042
- this.updateLayout();
25043
- }
25044
- };
25045
- _proto.setOffsetMax = function setOffsetMax(x, y) {
25046
- if (this.offsetMax.x !== x || this.offsetMax.y !== y) {
25047
- this.offsetMax.set(x, y);
25048
- this.updateLayout();
25049
- }
25050
- };
25051
- _proto.getRect = function getRect() {
25052
- return {
25053
- position: this.position.clone(),
25054
- size: this.size.clone()
25055
- };
25056
- };
25057
- _proto.getTransform2D = function getTransform2D() {
25058
- if (this.transformDirty) {
25059
- var radians = this._rotation * Math.PI / 180;
25060
- var sin = Math.sin(radians);
25061
- var cos = Math.cos(radians);
25062
- var shearX = Math.tan(Math.max(-89, Math.min(89, this.shear.x)) * Math.PI / 180);
25063
- var shearY = Math.tan(Math.max(-89, Math.min(89, this.shear.y)) * Math.PI / 180);
25064
- var a = this.scale.x * (cos - sin * shearY);
25065
- var b = this.scale.x * (sin + cos * shearY);
25066
- var c = this.scale.y * (cos * shearX - sin);
25067
- var d = this.scale.y * (sin * shearX + cos);
25068
- var pivotX = this.pivot.x * this.size.x;
25069
- var pivotY = this.pivot.y * this.size.y;
25070
- var tx = this.position.x + pivotX - a * pivotX - c * pivotY;
25071
- var ty = this.position.y + pivotY - b * pivotX - d * pivotY;
25072
- this.cachedTransform.set(a, b, 0, c, d, 0, tx, ty, 1);
25073
- this.transformDirty = false;
25074
- }
25075
- return this.cachedTransform;
25076
- };
25077
- _proto.setAnchorsPreset = function setAnchorsPreset(preset, keepOffsets) {
25078
- if (keepOffsets === void 0) keepOffsets = true;
25079
- var _ANCHOR_PRESET_TABLE_preset = ANCHOR_PRESET_TABLE[preset], minX = _ANCHOR_PRESET_TABLE_preset[0], minY = _ANCHOR_PRESET_TABLE_preset[1], maxX = _ANCHOR_PRESET_TABLE_preset[2], maxY = _ANCHOR_PRESET_TABLE_preset[3];
25080
- if (keepOffsets) {
25081
- this.anchorMin.set(minX, minY);
25082
- this.anchorMax.set(maxX, maxY);
25083
- } else {
25084
- var rect = this.getRect();
25085
- this.anchorMin.set(minX, minY);
25086
- this.anchorMax.set(maxX, maxY);
25087
- this.computeOffsets(rect, this.getParentRect());
25088
- }
25089
- this.updateLayout();
25090
- };
25091
- _proto.setOffsetsPreset = function setOffsetsPreset(preset, margin) {
25092
- if (margin === void 0) margin = 0;
25093
- if (!this.parent) {
25094
- return;
25095
- }
25096
- var parentSize = this.parent.size;
25097
- var width = this.size.x;
25098
- var height = this.size.y;
25099
- var a = this.anchorMin;
25100
- var b = this.anchorMax;
25101
- var minX = 0, maxX = 0, minY = 0, maxY = 0;
25102
- // Left edge.
25103
- switch(preset){
25104
- case "topLeft":
25105
- case "bottomLeft":
25106
- case "centerLeft":
25107
- case "topWide":
25108
- case "bottomWide":
25109
- case "leftWide":
25110
- case "hcenterWide":
25111
- case "fullRect":
25112
- minX = margin - a.x * parentSize.x;
25113
- break;
25114
- case "centerTop":
25115
- case "centerBottom":
25116
- case "center":
25117
- case "vcenterWide":
25118
- minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
25119
- break;
25120
- default:
25121
- minX = parentSize.x - margin - width - a.x * parentSize.x;
25122
- break;
25123
- }
25124
- switch(preset){
25125
- case "topLeft":
25126
- case "bottomLeft":
25127
- case "centerLeft":
25128
- case "leftWide":
25129
- maxX = margin + width - b.x * parentSize.x;
25130
- break;
25131
- case "centerTop":
25132
- case "centerBottom":
25133
- case "center":
25134
- case "vcenterWide":
25135
- maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
25136
- break;
25137
- default:
25138
- maxX = parentSize.x - margin - b.x * parentSize.x;
25139
- break;
25140
- }
25141
- // Top edge.
25142
- switch(preset){
25143
- case "topLeft":
25144
- case "topRight":
25145
- case "centerTop":
25146
- case "leftWide":
25147
- case "rightWide":
25148
- case "topWide":
25149
- case "vcenterWide":
25150
- case "fullRect":
25151
- minY = margin - a.y * parentSize.y;
25152
- break;
25153
- case "centerLeft":
25154
- case "centerRight":
25155
- case "center":
25156
- case "hcenterWide":
25157
- minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
25158
- break;
25159
- default:
25160
- minY = parentSize.y - margin - height - a.y * parentSize.y;
25161
- break;
25162
- }
25163
- // Bottom edge.
25164
- switch(preset){
25165
- case "topLeft":
25166
- case "topRight":
25167
- case "centerTop":
25168
- case "topWide":
25169
- maxY = margin + height - b.y * parentSize.y;
25170
- break;
25171
- case "centerLeft":
25172
- case "centerRight":
25173
- case "center":
25174
- case "hcenterWide":
25175
- maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
25176
- break;
25177
- default:
25178
- maxY = parentSize.y - margin - b.y * parentSize.y;
25179
- break;
25180
- }
25181
- this.offsetMin.set(minX, minY);
25182
- this.offsetMax.set(maxX, maxY);
25183
- this.updateLayout();
25184
- };
25185
- _proto.setAnchorsAndOffsetsPreset = function setAnchorsAndOffsetsPreset(preset, margin) {
25186
- if (margin === void 0) margin = 0;
25187
- this.setAnchorsPreset(preset, false);
25188
- this.setOffsetsPreset(preset, margin);
25189
- };
25190
- _proto.getGlobalTransform2D = function getGlobalTransform2D() {
25191
- var local = this.getTransform2D();
25192
- return this.parent ? new Matrix3().multiplyMatrices(this.parent.getGlobalTransform2D(), local) : local.clone();
25193
- };
25194
- _proto.hasPoint = function hasPoint(point) {
25195
- return point.x >= 0 && point.y >= 0 && point.x <= this.size.x && point.y <= this.size.y;
25196
- };
25197
- _proto.getEffectiveMouseFilter = function getEffectiveMouseFilter() {
25198
- return this.enabledInHierarchy && this.isMouseRecursiveEnabled() ? this.mouseFilter : MouseFilter.Ignore;
25199
- };
25200
- _proto.getFocusModeWithOverride = function getFocusModeWithOverride() {
25201
- return this.enabledInHierarchy && this.isFocusRecursiveEnabled() ? this.focusMode : FocusMode.None;
25202
- };
25203
- _proto.getCursorShape = function getCursorShape(position) {
25204
- return this.defaultCursorShape;
25205
- };
25206
- _proto.focus = function focus() {
25207
- var _this_root;
25208
- (_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
25209
- };
25210
- _proto.grabFocus = function grabFocus() {
25211
- this.focus();
25212
- };
25213
- _proto.grabClickFocus = function grabClickFocus() {
25214
- var _this_root;
25215
- (_this_root = this.root) == null ? void 0 : _this_root.grabControlClickFocus(this);
25216
- };
25217
- _proto.releaseFocus = function releaseFocus() {
25218
- var _this_root;
25219
- (_this_root = this.root) == null ? void 0 : _this_root.releaseControlFocus(this);
25220
- };
25221
- _proto.warpMouse = function warpMouse(position) {
25222
- var _this_root;
25223
- var matrix = this.getGlobalTransform2D().elements;
25224
- (_this_root = this.root) == null ? void 0 : _this_root.warpControlMouse(new Vector2(matrix[0] * position.x + matrix[3] * position.y + matrix[6], matrix[1] * position.x + matrix[4] * position.y + matrix[7]));
25225
- };
25226
- /** Converts a window-space position into this control's local coordinates. */ _proto.makePositionLocal = function makePositionLocal(position) {
25227
- var transform = this.getGlobalTransform2D().clone();
25228
- if (Math.abs(transform.determinant()) < 1e-12) {
25229
- return new Vector2();
25230
- }
25231
- var elements = transform.invert().elements;
25232
- return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
25233
- };
25234
- /** Gets the current mouse position transformed into this control's coordinates. */ _proto.getLocalMousePosition = function getLocalMousePosition() {
25235
- var root = this.root;
25236
- return root ? this.makePositionLocal(root.getMousePosition()) : new Vector2();
25237
- };
25238
- _proto.update = function update(deltaTime) {};
25239
- _proto.draw = function draw() {
25240
- // OVERRIDE
25241
- };
25242
- _proto.onDestroy = function onDestroy() {};
25243
- /** @internal */ _proto.drawInternal = function drawInternal() {
25244
- if (!this.visibleInHierarchy || this.disposed) {
25245
- return;
25246
- }
25247
- var graphics = this.engine.graphics;
25248
- graphics.pushTransform(this.getTransform2D());
25249
- this.draw();
25250
- graphics.popTransform();
25251
- };
25252
- _proto.drawLine = function drawLine(x1, y1, x2, y2, color, thickness) {
25253
- this.engine.graphics.drawLine(x1, y1, x2, y2, color, thickness);
25254
- };
25255
- _proto.drawPolyline = function drawPolyline(points, color, thickness) {
25256
- this.engine.graphics.drawLines(points, color, thickness);
25257
- };
25258
- _proto.drawBezier = function drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness) {
25259
- this.engine.graphics.drawBezier(x1, y1, x2, y2, x3, y3, x4, y4, color, thickness);
25260
- };
25261
- _proto.drawTriangle = function drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness) {
25262
- this.engine.graphics.drawTriangle(x1, y1, x2, y2, x3, y3, color, thickness);
25263
- };
25264
- _proto.drawRect = function drawRect(x, y, width, height, color, thickness) {
25265
- this.engine.graphics.drawRectangle(x, y, width, height, color, thickness);
25266
- };
25267
- _proto.drawCircle = function drawCircle(cx, cy, radius, color, thickness) {
25268
- this.engine.graphics.drawCircle(cx, cy, radius, color, thickness);
25269
- };
25270
- _proto.fillTriangle = function fillTriangle(x1, y1, x2, y2, x3, y3, color) {
25271
- this.engine.graphics.fillTriangle(x1, y1, x2, y2, x3, y3, color);
25272
- };
25273
- _proto.fillRect = function fillRect(x, y, width, height, color) {
25274
- this.engine.graphics.fillRectangle(x, y, width, height, color);
25275
- };
25276
- _proto.fillCircle = function fillCircle(cx, cy, radius, color) {
25277
- this.engine.graphics.fillCircle(cx, cy, radius, color);
25278
- };
25279
- _proto.drawTexture = function drawTexture(x, y, width, height, texture, region, color) {
25280
- this.engine.graphics.drawTexture(x, y, width, height, texture, region, color);
25281
- };
25282
- _proto.drawText = function drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle) {
25283
- this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
25284
- };
25285
- _proto.onMouseEnter = function onMouseEnter(location) {};
25286
- _proto.onMouseMove = function onMouseMove(event) {};
25287
- _proto.onMouseLeave = function onMouseLeave() {};
25288
- _proto.onMouseWheel = function onMouseWheel(event) {};
25289
- _proto.onMouseDown = function onMouseDown(event) {};
25290
- _proto.onMouseUp = function onMouseUp(event) {};
25291
- _proto.onTouchDown = function onTouchDown(event) {};
25292
- _proto.onTouchMove = function onTouchMove(event) {};
25293
- _proto.onTouchUp = function onTouchUp(event) {};
25294
- _proto.onKeyDown = function onKeyDown(event) {};
25295
- _proto.onKeyUp = function onKeyUp(event) {};
25296
- _proto.onGotFocus = function onGotFocus() {};
25297
- _proto.onLostFocus = function onLostFocus() {};
25298
- /** @internal */ _proto.invokeGetDragData = function invokeGetDragData(position) {
25299
- return this.getDragData(position);
25300
- };
25301
- /** @internal */ _proto.invokeCanDropData = function invokeCanDropData(position, data) {
25302
- return this.canDropData(position, data);
25303
- };
25304
- /** @internal */ _proto.invokeDropData = function invokeDropData(position, data) {
25305
- this.dropData(position, data);
25306
- };
25307
- _proto.getDragData = function getDragData(position) {
25308
- return null;
25309
- };
25310
- _proto.canDropData = function canDropData(position, data) {
25311
- return false;
25312
- };
25313
- _proto.dropData = function dropData(position, data) {};
25314
- _proto.dispose = function dispose() {
25315
- if (this.disposed) {
25316
- return;
25317
- }
25318
- this.disposed = true;
25319
- this.onDestroy();
25320
- this.parent = null;
25321
- this.owner = null;
25322
- };
25323
- /** @internal */ _proto.updateLayout = function updateLayout() {
25324
- var _this_parent;
25325
- var _this_parent_size;
25326
- var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
25327
- var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
25328
- var top = this.offsetMin.y + this.anchorMin.y * parentSize.y;
25329
- var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
25330
- var bottom = this.offsetMax.y + this.anchorMax.y * parentSize.y;
25331
- this.applyBounds(left, top, right - left, bottom - top);
25332
- };
25333
- _proto.applyBounds = function applyBounds(x, y, width, height) {
25334
- var locationChanged = this.position.x !== x || this.position.y !== y;
25335
- var sizeChanged = this.size.x !== width || this.size.y !== height;
25336
- if (!locationChanged && !sizeChanged) {
25337
- return;
25338
- }
25339
- this.position.set(x, y);
25340
- this.size.set(width, height);
25341
- this.markTransformDirty();
25342
- if (locationChanged) {
25343
- this.eventEmitter.emit("locationChanged", this);
25344
- }
25345
- if (sizeChanged) {
25346
- this.eventEmitter.emit("sizeChanged", this);
25347
- if (_instanceof1(this, ContainerControl)) {
25348
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
25349
- var child = _step.value;
25350
- child.updateLayout();
25351
- }
25352
- }
25353
- }
25354
- };
25355
- _proto.markTransformDirty = function markTransformDirty() {
25356
- var _this_root;
25357
- this.transformDirty = true;
25358
- (_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
25359
- };
25360
- _proto.getParentRect = function getParentRect() {
25361
- var _this_parent;
25362
- var _this_parent_size_clone;
25363
- return {
25364
- position: new Vector2(),
25365
- size: (_this_parent_size_clone = (_this_parent = this.parent) == null ? void 0 : _this_parent.size.clone()) != null ? _this_parent_size_clone : new Vector2()
25366
- };
25367
- };
25368
- _proto.computeOffsets = function computeOffsets(rect, parentRect) {
25369
- this.offsetMin.set(rect.position.x - parentRect.position.x - this.anchorMin.x * parentRect.size.x, rect.position.y - parentRect.position.y - this.anchorMin.y * parentRect.size.y);
25370
- this.offsetMax.set(rect.position.x + rect.size.x - parentRect.position.x - this.anchorMax.x * parentRect.size.x, rect.position.y + rect.size.y - parentRect.position.y - this.anchorMax.y * parentRect.size.y);
25371
- };
25372
- _proto.computeAnchors = function computeAnchors(rect, parentRect) {
25373
- if (parentRect.size.x !== 0) {
25374
- this.anchorMin.x = (rect.position.x - parentRect.position.x - this.offsetMin.x) / parentRect.size.x;
25375
- this.anchorMax.x = (rect.position.x + rect.size.x - parentRect.position.x - this.offsetMax.x) / parentRect.size.x;
25376
- }
25377
- if (parentRect.size.y !== 0) {
25378
- this.anchorMin.y = (rect.position.y - parentRect.position.y - this.offsetMin.y) / parentRect.size.y;
25379
- this.anchorMax.y = (rect.position.y + rect.size.y - parentRect.position.y - this.offsetMax.y) / parentRect.size.y;
25380
- }
25381
- };
25382
- _proto.isMouseRecursiveEnabled = function isMouseRecursiveEnabled() {
25383
- if (this.mouseBehaviorRecursive === MouseBehaviorRecursive.Inherited) {
25384
- var _this_parent;
25385
- var _this_parent_isMouseRecursiveEnabled;
25386
- return (_this_parent_isMouseRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isMouseRecursiveEnabled()) != null ? _this_parent_isMouseRecursiveEnabled : true;
25387
- }
25388
- return this.mouseBehaviorRecursive === MouseBehaviorRecursive.Enabled;
25389
- };
25390
- _proto.isFocusRecursiveEnabled = function isFocusRecursiveEnabled() {
25391
- if (this.focusBehaviorRecursive === FocusBehaviorRecursive.Inherited) {
25392
- var _this_parent;
25393
- var _this_parent_isFocusRecursiveEnabled;
25394
- return (_this_parent_isFocusRecursiveEnabled = (_this_parent = this.parent) == null ? void 0 : _this_parent.isFocusRecursiveEnabled()) != null ? _this_parent_isFocusRecursiveEnabled : true;
25395
- }
25396
- return this.focusBehaviorRecursive === FocusBehaviorRecursive.Enabled;
25397
- };
25398
- _create_class(Control, [
25399
- {
25400
- key: "parent",
25401
- get: function get() {
25402
- return this._parent;
25403
- },
25404
- set: function set(value) {
25405
- var _this__parent;
25406
- if (value === this._parent) {
25407
- return;
25408
- }
25409
- var previousRoot = this.root;
25410
- (_this__parent = this._parent) == null ? void 0 : _this__parent.removeChildInternal(this);
25411
- this._parent = value;
25412
- value == null ? void 0 : value.addChildInternal(this);
25413
- this.updateLayout();
25414
- var nextRoot = this.root;
25415
- if (previousRoot && previousRoot !== nextRoot) {
25416
- previousRoot.controlRemoved(this);
25417
- }
25418
- nextRoot == null ? void 0 : nextRoot.controlTreeChanged();
25419
- this.eventEmitter.emit("parentChanged", this);
25420
- }
25421
- },
25422
- {
25423
- key: "item",
25424
- get: /** Scene item exposed through the optional UIControl bridge. */ function get() {
25425
- var _this_owner;
25426
- var _this_owner_item;
25427
- return (_this_owner_item = (_this_owner = this.owner) == null ? void 0 : _this_owner.item) != null ? _this_owner_item : null;
25428
- }
25429
- },
25430
- {
25431
- key: "indexInParent",
25432
- get: function get() {
25433
- var _this_parent;
25434
- var _this_parent_getChildIndex;
25435
- return (_this_parent_getChildIndex = (_this_parent = this.parent) == null ? void 0 : _this_parent.getChildIndex(this)) != null ? _this_parent_getChildIndex : -1;
25436
- },
25437
- set: function set(value) {
25438
- var _this_parent;
25439
- (_this_parent = this.parent) == null ? void 0 : _this_parent.changeChildIndex(this, value);
25440
- }
25441
- },
25442
- {
25443
- key: "visible",
25444
- get: function get() {
25445
- return this._visible;
25446
- },
25447
- set: function set(value) {
25448
- if (this._visible !== value) {
25449
- var _this_root;
25450
- this._visible = value;
25451
- (_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
25452
- }
25453
- }
25454
- },
25455
- {
25456
- key: "visibleInHierarchy",
25457
- get: function get() {
25458
- var _this_parent;
25459
- var _this_parent_visibleInHierarchy;
25460
- return this.visible && ((_this_parent_visibleInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.visibleInHierarchy) != null ? _this_parent_visibleInHierarchy : true);
25461
- }
25462
- },
25463
- {
25464
- key: "enabled",
25465
- get: function get() {
25466
- return this._enabled;
25467
- },
25468
- set: function set(value) {
25469
- if (this._enabled !== value) {
25470
- var _this_root;
25471
- this._enabled = value;
25472
- (_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
25473
- }
25474
- }
25475
- },
25476
- {
25477
- key: "enabledInHierarchy",
25478
- get: function get() {
25479
- var _this_parent;
25480
- var _this_parent_enabledInHierarchy;
25481
- return this.enabled && ((_this_parent_enabledInHierarchy = (_this_parent = this.parent) == null ? void 0 : _this_parent.enabledInHierarchy) != null ? _this_parent_enabledInHierarchy : true);
25482
- }
25483
- },
25484
- {
25485
- key: "mouseFilter",
25486
- get: function get() {
25487
- return this._mouseFilter;
25488
- },
25489
- set: function set(value) {
25490
- if (this._mouseFilter !== value) {
25491
- var _this_root;
25492
- this._mouseFilter = value;
25493
- (_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
25494
- }
25495
- }
25496
- },
25497
- {
25498
- key: "mouseBehaviorRecursive",
25499
- get: function get() {
25500
- return this._mouseBehaviorRecursive;
25501
- },
25502
- set: function set(value) {
25503
- if (this._mouseBehaviorRecursive !== value) {
25504
- var _this_root;
25505
- this._mouseBehaviorRecursive = value;
25506
- (_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
25507
- }
25508
- }
25509
- },
25510
- {
25511
- key: "focusMode",
25512
- get: function get() {
25513
- return this._focusMode;
25514
- },
25515
- set: function set(value) {
25516
- if (this._focusMode !== value) {
25517
- var _this_root;
25518
- this._focusMode = value;
25519
- (_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
25520
- }
25521
- }
25522
- },
25523
- {
25524
- key: "focusBehaviorRecursive",
25525
- get: function get() {
25526
- return this._focusBehaviorRecursive;
25527
- },
25528
- set: function set(value) {
25529
- if (this._focusBehaviorRecursive !== value) {
25530
- var _this_root;
25531
- this._focusBehaviorRecursive = value;
25532
- (_this_root = this.root) == null ? void 0 : _this_root.controlStateChanged(this);
25533
- }
25534
- }
25535
- },
25536
- {
25537
- key: "defaultCursorShape",
25538
- get: function get() {
25539
- return this._defaultCursorShape;
25540
- },
25541
- set: function set(value) {
25542
- var _this_root;
25543
- if (this._defaultCursorShape === value) {
25544
- return;
25545
- }
25546
- this._defaultCursorShape = value;
25547
- (_this_root = this.root) == null ? void 0 : _this_root.updateMouseCursorState();
25548
- }
25549
- },
25550
- {
25551
- key: "location",
25552
- get: function get() {
25553
- return this.position;
25554
- },
25555
- set: function set(value) {
25556
- this.setPosition(value.x, value.y);
25557
- }
25558
- },
25559
- {
25560
- key: "rotation",
25561
- get: function get() {
25562
- return this._rotation;
25563
- }
25564
- },
25565
- {
25566
- key: "x",
25567
- get: function get() {
25568
- return this.position.x;
25569
- },
25570
- set: function set(value) {
25571
- this.setPosition(value, this.position.y);
25572
- }
25573
- },
25574
- {
25575
- key: "y",
25576
- get: function get() {
25577
- return this.position.y;
25578
- },
25579
- set: function set(value) {
25580
- this.setPosition(this.position.x, value);
25581
- }
25582
- },
25583
- {
25584
- key: "width",
25585
- get: function get() {
25586
- return this.size.x;
25587
- },
25588
- set: function set(value) {
25589
- this.setSize(value, this.size.y);
25590
- }
25591
- },
25592
- {
25593
- key: "height",
25594
- get: function get() {
25595
- return this.size.y;
25596
- },
25597
- set: function set(value) {
25598
- this.setSize(this.size.x, value);
25599
- }
25600
- },
25601
- {
25602
- key: "root",
25603
- get: function get() {
25604
- var _this_parent;
25605
- var _this_parent_root;
25606
- return _instanceof1(this, RootControl) ? this : (_this_parent_root = (_this_parent = this.parent) == null ? void 0 : _this_parent.root) != null ? _this_parent_root : null;
25607
- }
25608
- },
25609
- {
25610
- key: "isDisposed",
25611
- get: function get() {
25612
- return this.disposed;
25613
- }
25614
- }
25615
- ]);
25616
- return Control;
25617
- }();
25618
- /** A Control that owns child Controls. */ var ContainerControl = /*#__PURE__*/ function(Control) {
25619
- _inherits(ContainerControl, Control);
25620
- function ContainerControl() {
25621
- var _this;
25622
- _this = Control.apply(this, arguments) || this;
25623
- _this.children = [];
25624
- return _this;
25625
- }
25626
- var _proto = ContainerControl.prototype;
25627
- _proto.addChild = function addChild(child) {
25628
- child.parent = this;
25629
- return child;
25630
- };
25631
- _proto.removeChild = function removeChild(child) {
25632
- if (child.parent === this) {
25633
- child.parent = null;
25634
- }
25635
- };
25636
- _proto.getChildIndex = function getChildIndex(child) {
25637
- return this.children.indexOf(child);
25638
- };
25639
- /** @internal */ _proto.changeChildIndex = function changeChildIndex(child, newIndex) {
25640
- var _this_root;
25641
- var oldIndex = this.children.indexOf(child);
25642
- if (oldIndex === newIndex || oldIndex === -1) {
25643
- return;
25644
- }
25645
- this.children.splice(oldIndex, 1);
25646
- if (newIndex < 0 || newIndex >= this.children.length) {
25647
- this.children.push(child);
25648
- } else {
25649
- this.children.splice(newIndex, 0, child);
25650
- }
25651
- (_this_root = this.root) == null ? void 0 : _this_root.controlTreeChanged();
25652
- };
25653
- /** @internal */ _proto.addChildInternal = function addChildInternal(child) {
25654
- if (!this.children.includes(child)) {
25655
- this.children.push(child);
25656
- }
25657
- };
25658
- /** @internal */ _proto.removeChildInternal = function removeChildInternal(child) {
25659
- var index = this.children.indexOf(child);
25660
- if (index !== -1) {
25661
- this.children.splice(index, 1);
25662
- }
25663
- };
25664
- _proto.drawSelf = function drawSelf() {
25665
- Control.prototype.draw.call(this);
25666
- };
25667
- _proto.draw = function draw() {
25668
- this.drawSelf();
25669
- this.drawChildren();
25670
- };
25671
- _proto.drawChildren = function drawChildren() {
25672
- var graphics = this.engine.graphics;
25673
- if (this.clipContents) ;
25674
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
25675
- var child = _step.value;
25676
- if (!child.visible || child.isDisposed) {
25677
- continue;
25678
- }
25679
- graphics.pushTransform(child.getTransform2D());
25680
- child.draw();
25681
- graphics.popTransform();
25682
- }
25683
- };
25684
- _proto.update = function update(deltaTime) {
25685
- Control.prototype.update.call(this, deltaTime);
25686
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
25687
- var child = _step.value;
25688
- if (child.enabled && !child.isDisposed) {
25689
- child.update(deltaTime);
25690
- }
25691
- }
25692
- };
25693
- _proto.dispose = function dispose() {
25694
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children.slice()), _step; !(_step = _iterator()).done;){
25695
- var child = _step.value;
25696
- child.dispose();
25697
- }
25698
- Control.prototype.dispose.call(this);
25699
- };
25700
- return ContainerControl;
25701
- }(Control);
25702
- /** Base class for GUI tree roots and input dispatchers. */ var RootControl = /*#__PURE__*/ function(ContainerControl) {
25703
- _inherits(RootControl, ContainerControl);
25704
- function RootControl() {
25705
- return ContainerControl.apply(this, arguments);
25706
- }
25707
- return RootControl;
25708
- }(ContainerControl);
25709
-
25710
- var _obj$3;
25711
- var cursorNames = (_obj$3 = {}, _obj$3[CursorShape.Arrow] = "default", _obj$3[CursorShape.Ibeam] = "text", _obj$3[CursorShape.PointingHand] = "pointer", _obj$3[CursorShape.Cross] = "crosshair", _obj$3[CursorShape.Wait] = "wait", _obj$3[CursorShape.Busy] = "progress", _obj$3[CursorShape.Drag] = "grab", _obj$3[CursorShape.CanDrop] = "copy", _obj$3[CursorShape.Forbidden] = "not-allowed", _obj$3[CursorShape.Vsize] = "ns-resize", _obj$3[CursorShape.Hsize] = "ew-resize", _obj$3[CursorShape.Bdiagsize] = "nesw-resize", _obj$3[CursorShape.Fdiagsize] = "nwse-resize", _obj$3[CursorShape.Move] = "move", _obj$3[CursorShape.Vsplit] = "row-resize", _obj$3[CursorShape.Hsplit] = "col-resize", _obj$3[CursorShape.Help] = "help", _obj$3);
25712
- function getButtonMask(button) {
25713
- switch(button){
25714
- case MouseButton.Left:
25715
- return MouseButtonMask.Left;
25716
- case MouseButton.Right:
25717
- return MouseButtonMask.Right;
25718
- case MouseButton.Middle:
25719
- return MouseButtonMask.Middle;
25720
- case MouseButton.Xbutton1:
25721
- return MouseButtonMask.Xbutton1;
25722
- case MouseButton.Xbutton2:
25723
- return MouseButtonMask.Xbutton2;
25724
- default:
25725
- return MouseButtonMask.None;
25726
- }
25727
- }
25728
- function isWheelButton(button) {
25729
- return button >= MouseButton.WheelUp && button <= MouseButton.WheelRight;
25730
- }
25731
- /** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
25732
- _inherits(CanvasRootControl, ContainerControl);
25733
- function CanvasRootControl(engine, canvas) {
25734
- var _this;
25735
- _this = ContainerControl.call(this, engine) || this;
25736
- _this.canvas = canvas;
25737
- _this.mouseFilter = MouseFilter.Ignore;
25738
- _this.setSize(engine.canvas.width, engine.canvas.height);
25739
- return _this;
25740
- }
25741
- _create_class(CanvasRootControl, [
25742
- {
25743
- key: "inputDisabled",
25744
- get: function get() {
25745
- var _this_canvas_item;
25746
- return !this.canvas.receivesEvents || !this.canvas.enabled || !((_this_canvas_item = this.canvas.item) == null ? void 0 : _this_canvas_item.isActive);
25747
- }
25748
- }
25749
- ]);
25750
- return CanvasRootControl;
25751
- }(ContainerControl);
25752
- /** Global ordered collection of UICanvas roots. */ var CanvasContainer = /*#__PURE__*/ function(ContainerControl) {
25753
- _inherits(CanvasContainer, ContainerControl);
25754
- function CanvasContainer(engine) {
25755
- var _this;
25756
- _this = ContainerControl.call(this, engine) || this;
25757
- _this.mouseFilter = MouseFilter.Ignore;
25758
- _this.setSize(engine.canvas.width, engine.canvas.height);
25759
- return _this;
25760
- }
25761
- var _proto = CanvasContainer.prototype;
25762
- _proto.sortCanvases = function sortCanvases() {
25763
- this.children.sort(function(left, right) {
25764
- return left.canvas.order - right.canvas.order;
25765
- });
25766
- };
25767
- _proto.addChildInternal = function addChildInternal(child) {
25768
- ContainerControl.prototype.addChildInternal.call(this, child);
25769
- this.sortCanvases();
25770
- };
25771
- _proto.draw = function draw() {
25772
- this.sortCanvases();
25773
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
25774
- var child = _step.value;
25775
- var root = child;
25776
- if (root.canvas.isVisible) {
25777
- root.draw();
25778
- }
25779
- }
25780
- };
25781
- return CanvasContainer;
25782
- }(ContainerControl);
25783
- /** Engine window GUI root. Routes events across all UICanvas roots. */ var WindowRootControl = /*#__PURE__*/ function(RootControl) {
25784
- _inherits(WindowRootControl, RootControl);
25785
- function WindowRootControl(engine) {
25786
- var _this;
25787
- _this = RootControl.call(this, engine) || this;
25788
- _this.dragThreshold = 10;
25789
- _this.lastInput = null;
25790
- _this.gui = {
25791
- mouseFocus: null,
25792
- mouseClickGrabber: null,
25793
- mouseFocusMask: MouseButtonMask.None,
25794
- mouseOver: null,
25795
- mouseOverHierarchy: [],
25796
- touchFocus: new Map(),
25797
- keyFocus: null,
25798
- dragAccum: new Vector2(),
25799
- dragAttempted: false,
25800
- dragging: false,
25801
- dragData: null,
25802
- dragMouseOver: null,
25803
- dragSuccessful: false,
25804
- lastMousePosition: new Vector2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY),
25805
- sendingMouseEnterExit: false,
25806
- mouseOverUpdatePending: false
25807
- };
25808
- _this.mouseFilter = MouseFilter.Ignore;
25809
- _this.setSize(engine.canvas.width, engine.canvas.height);
25810
- _this.canvases = new CanvasContainer(engine);
25811
- _this.canvases.parent = _assert_this_initialized(_this);
25812
- return _this;
25813
- }
25814
- var _proto = WindowRootControl.prototype;
25815
- _proto.pushInput = function pushInput(event) {
25816
- event.clearAccepted();
25817
- this.lastInput = event;
25818
- this.cleanupInternalState();
25819
- this.processGUIInput(event);
25820
- this.postGrabClickFocus();
25821
- };
25822
- _proto.isInputHandled = function isInputHandled() {
25823
- var _this_lastInput;
25824
- var _this_lastInput_isAccepted;
25825
- return (_this_lastInput_isAccepted = (_this_lastInput = this.lastInput) == null ? void 0 : _this_lastInput.isAccepted()) != null ? _this_lastInput_isAccepted : false;
25826
- };
25827
- _proto.getMousePosition = function getMousePosition() {
25828
- return this.gui.lastMousePosition.clone();
25829
- };
25830
- _proto.guiGetFocusOwner = function guiGetFocusOwner() {
25831
- return this.isFocusTargetUsable(this.gui.keyFocus) ? this.gui.keyFocus : null;
25832
- };
25833
- _proto.guiReleaseFocus = function guiReleaseFocus() {
25834
- this.releaseControlFocus();
25835
- };
25836
- _proto.guiIsDragging = function guiIsDragging() {
25837
- return this.gui.dragging;
25838
- };
25839
- _proto.guiGetDragData = function guiGetDragData() {
25840
- return this.gui.dragData;
25841
- };
25842
- _proto.guiIsDragSuccessful = function guiIsDragSuccessful() {
25843
- return this.gui.dragSuccessful;
25844
- };
25845
- _proto.guiCancelDrag = function guiCancelDrag() {
25846
- this.endDragging(false);
25847
- };
25848
- _proto.grabControlFocus = function grabControlFocus(control) {
25849
- if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
25850
- return;
25851
- }
25852
- var previous = this.gui.keyFocus;
25853
- this.gui.keyFocus = control;
25854
- if (previous && !previous.isDisposed) {
25855
- previous.onLostFocus();
25856
- }
25857
- control.onGotFocus();
25858
- };
25859
- _proto.grabControlClickFocus = function grabControlClickFocus(control) {
25860
- var _this = this;
25861
- if (this.isControlValid(control)) {
25862
- this.gui.mouseClickGrabber = control;
25863
- queueMicrotask(function() {
25864
- return _this.postGrabClickFocus();
25865
- });
25866
- }
25867
- };
25868
- _proto.releaseControlFocus = function releaseControlFocus(control) {
25869
- var previous = this.gui.keyFocus;
25870
- if (!previous || control && previous !== control) {
25871
- return;
25872
- }
25873
- this.gui.keyFocus = null;
25874
- if (!previous.isDisposed) {
25875
- previous.onLostFocus();
25876
- }
25877
- };
25878
- _proto.warpControlMouse = function warpControlMouse(position) {
25879
- this.gui.lastMousePosition.copyFrom(position);
25880
- this.updateMouseOver(position);
25881
- this.updateMouseCursorState();
25882
- };
25883
- _proto.updateMouseCursorState = function updateMouseCursorState() {
25884
- var position = this.gui.lastMousePosition;
25885
- var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.isControlUsable(this.gui.mouseOver) ? this.gui.mouseOver : null;
25886
- this.updateCursor(target, position);
25887
- };
25888
- _proto.controlStateChanged = function controlStateChanged(control) {
25889
- if (!this.isControlUsable(control)) {
25890
- this.dropControlState(control);
25891
- }
25892
- this.requestMouseOverUpdate();
25893
- };
25894
- _proto.controlRemoved = function controlRemoved(control) {
25895
- this.dropControlState(control);
25896
- this.cleanupInternalState();
25897
- this.requestMouseOverUpdate();
25898
- };
25899
- _proto.controlTreeChanged = function controlTreeChanged() {
25900
- this.requestMouseOverUpdate();
25901
- };
25902
- _proto.cancelPointerInput = function cancelPointerInput() {
25903
- this.dropMouseFocus();
25904
- this.dropMouseOver();
25905
- this.gui.touchFocus.clear();
25906
- this.endDragging(false);
25907
- this.releaseControlFocus();
25908
- };
25909
- _proto.resize = function resize(width, height) {
25910
- this.setSize(width, height);
25911
- this.canvases.setSize(width, height);
25912
- for(var _iterator = _create_for_of_iterator_helper_loose(this.canvases.children), _step; !(_step = _iterator()).done;){
25913
- var root = _step.value;
25914
- root.setSize(width, height);
25915
- }
25916
- };
25917
- _proto.render = function render() {
25918
- if (this.canvases.children.length === 0) {
25919
- return;
25920
- }
25921
- this.engine.graphics.begin();
25922
- this.draw();
25923
- this.engine.graphics.end();
25924
- };
25925
- _proto.update = function update(deltaTime) {
25926
- if (this.gui.mouseOverUpdatePending) {
25927
- this.gui.mouseOverUpdatePending = false;
25928
- this.updateMouseOver(this.gui.lastMousePosition);
25929
- }
25930
- RootControl.prototype.update.call(this, deltaTime);
25931
- };
25932
- _proto.dispose = function dispose() {
25933
- this.cancelPointerInput();
25934
- RootControl.prototype.dispose.call(this);
25935
- };
25936
- _proto.processGUIInput = function processGUIInput(event) {
25937
- if (_instanceof1(event, InputEventKey)) {
25938
- var target = this.guiGetFocusOwner();
25939
- if (target) {
25940
- this.callControlInput(target, event);
25941
- }
25942
- } else if (_instanceof1(event, InputEventMouse)) {
25943
- this.gui.lastMousePosition.copyFrom(event.globalPosition);
25944
- this.updateMouseOver(event.globalPosition);
25945
- if (_instanceof1(event, InputEventMouseButton)) {
25946
- this.processMouseButton(event);
25947
- } else if (_instanceof1(event, InputEventMouseMotion)) {
25948
- this.processMouseMotion(event);
25949
- }
25950
- } else if (_instanceof1(event, InputEventScreenTouch)) {
25951
- this.processScreenTouch(event);
25952
- } else if (_instanceof1(event, InputEventScreenDrag)) {
25953
- this.processScreenDrag(event);
25954
- }
25955
- };
25956
- _proto.processMouseButton = function processMouseButton(event) {
25957
- if (isWheelButton(event.buttonIndex)) {
25958
- var target = this.findInputControl(event.globalPosition);
25959
- if (target) {
25960
- this.callGUIInput(target, event);
25961
- }
25962
- return;
25963
- }
25964
- var mask = getButtonMask(event.buttonIndex);
25965
- if (event.isPressed()) {
25966
- var target1 = this.gui.mouseFocusMask !== 0 ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
25967
- this.gui.mouseFocus = target1;
25968
- if (!target1) {
25969
- return;
25970
- }
25971
- this.gui.mouseFocusMask |= mask;
25972
- if (event.buttonIndex === MouseButton.Left) {
25973
- this.gui.dragAccum.setZero();
25974
- this.gui.dragAttempted = false;
25975
- this.findClickFocus(target1);
25976
- }
25977
- this.callGUIInput(target1, event);
25978
- } else {
25979
- if (event.buttonIndex === MouseButton.Left && this.gui.dragging) {
25980
- this.finishDrop(event.globalPosition);
25981
- }
25982
- this.gui.mouseFocusMask &= ~mask;
25983
- var target2 = this.gui.mouseFocus;
25984
- if (this.gui.mouseFocusMask === 0) {
25985
- this.gui.mouseFocus = null;
25986
- }
25987
- if (this.isControlUsable(target2)) {
25988
- this.callGUIInput(target2, event);
25989
- }
25990
- }
25991
- };
25992
- _proto.processMouseMotion = function processMouseMotion(event) {
25993
- if (!this.gui.dragging && !this.gui.dragAttempted && this.gui.mouseFocus && (this.gui.mouseFocusMask & MouseButtonMask.Left) !== 0) {
25994
- this.gui.dragAccum.add(event.relative);
25995
- if (this.gui.dragAccum.length() > this.dragThreshold) {
25996
- var origin = event.globalPosition.clone().subtract(this.gui.dragAccum);
25997
- this.beginDragging(this.gui.mouseFocus, origin);
25998
- this.gui.dragAttempted = true;
25999
- }
26000
- }
26001
- var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.findInputControl(event.globalPosition);
26002
- if (target) {
26003
- this.callGUIInput(target, event);
26004
- }
26005
- if (this.gui.dragging) {
26006
- this.gui.dragMouseOver = this.findDropTarget(this.findInputControl(event.globalPosition), event.globalPosition);
26007
- }
26008
- this.updateCursor(target, event.globalPosition);
26009
- };
26010
- _proto.processScreenTouch = function processScreenTouch(event) {
26011
- var target;
26012
- if (event.isPressed()) {
26013
- target = this.findInputControl(event.position);
26014
- if (target) {
26015
- this.gui.touchFocus.set(event.index, target);
26016
- }
26017
- } else {
26018
- var _this_gui_touchFocus_get;
26019
- target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : null;
26020
- this.gui.touchFocus.delete(event.index);
26021
- }
26022
- if (this.isControlUsable(target)) {
26023
- this.callGUIInput(target, event);
26024
- }
26025
- };
26026
- _proto.processScreenDrag = function processScreenDrag(event) {
26027
- var _this_gui_touchFocus_get;
26028
- var target = (_this_gui_touchFocus_get = this.gui.touchFocus.get(event.index)) != null ? _this_gui_touchFocus_get : this.findInputControl(event.position);
26029
- if (this.isControlUsable(target)) {
26030
- this.callGUIInput(target, event);
26031
- }
26032
- };
26033
- _proto.callGUIInput = function callGUIInput(target, event) {
26034
- var current = target;
26035
- var pointerEvent = _instanceof1(event, InputEventMouse) || _instanceof1(event, InputEventScreenTouch) || _instanceof1(event, InputEventScreenDrag);
26036
- while(current && current !== this && this.isControlUsable(current)){
26037
- var filter = current.getEffectiveMouseFilter();
26038
- if (filter !== MouseFilter.Ignore) {
26039
- var localEvent = event.xformedBy(this.getGlobalInverse(current));
26040
- this.callControlInput(current, localEvent);
26041
- if (localEvent.isAccepted()) {
26042
- event.accept();
26043
- }
26044
- }
26045
- var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
26046
- if (event.isAccepted() || filter === MouseFilter.Stop && pointerEvent && !forcePassWheel) {
26047
- event.accept();
26048
- return;
26049
- }
26050
- current = current.parent;
26051
- }
26052
- };
26053
- _proto.callControlInput = function callControlInput(control, event) {
26054
- if (_instanceof1(event, InputEventMouseButton)) {
26055
- if (isWheelButton(event.buttonIndex)) {
26056
- control.onMouseWheel(event);
26057
- } else if (event.isPressed()) {
26058
- control.onMouseDown(event);
26059
- } else {
26060
- control.onMouseUp(event);
26061
- }
26062
- } else if (_instanceof1(event, InputEventMouseMotion)) {
26063
- control.onMouseMove(event);
26064
- } else if (_instanceof1(event, InputEventScreenTouch)) {
26065
- if (event.isPressed()) {
26066
- control.onTouchDown(event);
26067
- } else {
26068
- control.onTouchUp(event);
26069
- }
26070
- } else if (_instanceof1(event, InputEventScreenDrag)) {
26071
- control.onTouchMove(event);
26072
- } else if (_instanceof1(event, InputEventKey)) {
26073
- if (event.isPressed()) {
26074
- control.onKeyDown(event);
26075
- } else if (event.isReleased()) {
26076
- control.onKeyUp(event);
26077
- }
26078
- }
26079
- };
26080
- _proto.findInputControl = function findInputControl(position) {
26081
- this.canvases.sortCanvases();
26082
- for(var index = this.canvases.children.length - 1; index >= 0; index--){
26083
- var root = this.canvases.children[index];
26084
- if (!root.canvas.isVisible || root.inputDisabled) {
26085
- continue;
26086
- }
26087
- var target = this.findControlAtPosition(root, position, true);
26088
- if (target) {
26089
- return target;
26090
- }
26091
- }
26092
- return null;
26093
- };
26094
- _proto.findControlAtPosition = function findControlAtPosition(container, position, skipSelf) {
26095
- if (skipSelf === void 0) skipSelf = false;
26096
- if (!container.visibleInHierarchy || container.isDisposed) {
26097
- return null;
26098
- }
26099
- var localPosition = this.toLocal(container, position);
26100
- if (container.clipContents && !container.hasPoint(localPosition)) {
26101
- return null;
26102
- }
26103
- for(var index = container.children.length - 1; index >= 0; index--){
26104
- var child = container.children[index];
26105
- if (!child.visibleInHierarchy || child.isDisposed) {
26106
- continue;
26107
- }
26108
- if (_instanceof1(child, ContainerControl)) {
26109
- var found = this.findControlAtPosition(child, position);
26110
- if (found) {
26111
- return found;
26112
- }
26113
- } else if (child.getEffectiveMouseFilter() !== MouseFilter.Ignore && child.hasPoint(this.toLocal(child, position))) {
26114
- return child;
26115
- }
26116
- }
26117
- if (!skipSelf && container.getEffectiveMouseFilter() !== MouseFilter.Ignore && container.hasPoint(localPosition)) {
26118
- return container;
26119
- }
26120
- return null;
26121
- };
26122
- _proto.updateMouseOver = function updateMouseOver(position) {
26123
- if (this.gui.sendingMouseEnterExit) {
26124
- this.gui.mouseOverUpdatePending = true;
26125
- return;
26126
- }
26127
- this.gui.mouseOverUpdatePending = false;
26128
- var target = this.findInputControl(position);
26129
- var next = this.buildHoverHierarchy(target);
26130
- var previous = this.gui.mouseOverHierarchy;
26131
- var common = 0;
26132
- while(common < previous.length && common < next.length && previous[common] === next[common]){
26133
- common++;
26134
- }
26135
- this.gui.sendingMouseEnterExit = true;
26136
- for(var index = previous.length - 1; index >= common; index--){
26137
- if (!previous[index].isDisposed) {
26138
- previous[index].onMouseLeave();
26139
- }
26140
- }
26141
- for(var index1 = common; index1 < next.length; index1++){
26142
- next[index1].onMouseEnter(this.toLocal(next[index1], position));
26143
- }
26144
- this.gui.sendingMouseEnterExit = false;
26145
- this.gui.mouseOver = target;
26146
- this.gui.mouseOverHierarchy = next;
26147
- };
26148
- _proto.buildHoverHierarchy = function buildHoverHierarchy(target) {
26149
- var hierarchy = [];
26150
- var current = target;
26151
- while(current && current !== this){
26152
- if (current.getEffectiveMouseFilter() !== MouseFilter.Ignore) {
26153
- hierarchy.push(current);
26154
- }
26155
- if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
26156
- break;
26157
- }
26158
- current = current.parent;
26159
- }
26160
- hierarchy.reverse();
26161
- return hierarchy;
26162
- };
26163
- _proto.findClickFocus = function findClickFocus(target) {
26164
- var current = target;
26165
- while(current && current !== this){
26166
- var mode = current.getFocusModeWithOverride();
26167
- if (mode === FocusMode.Click || mode === FocusMode.All) {
26168
- this.grabControlFocus(current);
26169
- return;
26170
- }
26171
- if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
26172
- return;
26173
- }
26174
- current = current.parent;
26175
- }
26176
- };
26177
- _proto.beginDragging = function beginDragging(source, position) {
26178
- var current = source;
26179
- while(current && current !== this){
26180
- var data = current.invokeGetDragData(this.toLocal(current, position));
26181
- if (data !== null && data !== undefined) {
26182
- this.gui.dragging = true;
26183
- this.gui.dragData = data;
26184
- this.gui.mouseFocus = null;
26185
- this.gui.mouseFocusMask = MouseButtonMask.None;
26186
- return;
26187
- }
26188
- if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
26189
- return;
26190
- }
26191
- current = current.parent;
26192
- }
26193
- };
26194
- _proto.finishDrop = function finishDrop(position) {
26195
- var target = this.findDropTarget(this.findInputControl(position), position);
26196
- if (target) {
26197
- target.invokeDropData(this.toLocal(target, position), this.gui.dragData);
26198
- }
26199
- this.endDragging(!!target);
26200
- };
26201
- _proto.findDropTarget = function findDropTarget(target, position) {
26202
- var current = target;
26203
- while(current && current !== this){
26204
- if (current.invokeCanDropData(this.toLocal(current, position), this.gui.dragData)) {
26205
- return current;
26206
- }
26207
- if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
26208
- return null;
26209
- }
26210
- current = current.parent;
26211
- }
26212
- return null;
26213
- };
26214
- _proto.endDragging = function endDragging(successful) {
26215
- this.gui.dragSuccessful = successful;
26216
- this.gui.dragging = false;
26217
- this.gui.dragData = null;
26218
- this.gui.dragMouseOver = null;
26219
- };
26220
- _proto.updateCursor = function updateCursor(target, position) {
26221
- var current = target;
26222
- var cursor = CursorShape.Arrow;
26223
- while(current && current !== this){
26224
- var candidate = current.getCursorShape(this.toLocal(current, position));
26225
- if (candidate !== CursorShape.Arrow) {
26226
- cursor = candidate;
26227
- break;
26228
- }
26229
- if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
26230
- break;
26231
- }
26232
- current = current.parent;
26233
- }
26234
- this.engine.canvas.style.cursor = typeof cursor === "string" ? cursor : cursorNames[cursor];
26235
- };
26236
- _proto.postGrabClickFocus = function postGrabClickFocus() {
26237
- var target = this.gui.mouseClickGrabber;
26238
- this.gui.mouseClickGrabber = null;
26239
- if (this.isControlUsable(target)) {
26240
- this.gui.mouseFocus = target;
26241
- }
26242
- };
26243
- _proto.cleanupInternalState = function cleanupInternalState() {
26244
- if (!this.isControlUsable(this.gui.mouseFocus)) {
26245
- this.dropMouseFocus();
26246
- }
26247
- if (this.gui.keyFocus && !this.isFocusTargetUsable(this.gui.keyFocus)) {
26248
- this.releaseControlFocus(this.gui.keyFocus);
26249
- }
26250
- for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
26251
- var _step_value = _step.value, index = _step_value[0], control = _step_value[1];
26252
- if (!this.isControlUsable(control)) {
26253
- this.gui.touchFocus.delete(index);
26254
- }
26255
- }
26256
- };
26257
- _proto.dropMouseFocus = function dropMouseFocus() {
26258
- this.gui.mouseFocus = null;
26259
- this.gui.mouseFocusMask = MouseButtonMask.None;
26260
- };
26261
- _proto.dropMouseOver = function dropMouseOver() {
26262
- for(var index = this.gui.mouseOverHierarchy.length - 1; index >= 0; index--){
26263
- var control = this.gui.mouseOverHierarchy[index];
26264
- if (!control.isDisposed) {
26265
- control.onMouseLeave();
26266
- }
26267
- }
26268
- this.gui.mouseOver = null;
26269
- this.gui.mouseOverHierarchy = [];
26270
- };
26271
- _proto.dropControlState = function dropControlState(control) {
26272
- if (this.controlBelongsToSubtree(this.gui.mouseFocus, control)) {
26273
- this.dropMouseFocus();
26274
- }
26275
- if (this.controlBelongsToSubtree(this.gui.mouseClickGrabber, control)) {
26276
- this.gui.mouseClickGrabber = null;
26277
- }
26278
- if (this.controlBelongsToSubtree(this.gui.keyFocus, control)) {
26279
- var _this_gui_keyFocus;
26280
- this.releaseControlFocus((_this_gui_keyFocus = this.gui.keyFocus) != null ? _this_gui_keyFocus : undefined);
26281
- }
26282
- if (this.controlBelongsToSubtree(this.gui.mouseOver, control)) {
26283
- this.dropMouseOver();
26284
- }
26285
- if (this.controlBelongsToSubtree(this.gui.dragMouseOver, control)) {
26286
- this.gui.dragMouseOver = null;
26287
- }
26288
- for(var _iterator = _create_for_of_iterator_helper_loose(this.gui.touchFocus), _step; !(_step = _iterator()).done;){
26289
- var _step_value = _step.value, index = _step_value[0], target = _step_value[1];
26290
- if (this.controlBelongsToSubtree(target, control)) {
26291
- this.gui.touchFocus.delete(index);
26292
- }
26293
- }
26294
- };
26295
- _proto.requestMouseOverUpdate = function requestMouseOverUpdate() {
26296
- if (Number.isFinite(this.gui.lastMousePosition.x)) {
26297
- this.updateMouseOver(this.gui.lastMousePosition);
26298
- }
26299
- };
26300
- _proto.getGlobalInverse = function getGlobalInverse(control) {
26301
- var transform = control.getGlobalTransform2D().clone();
26302
- return Math.abs(transform.determinant()) < 1e-12 ? new Matrix3() : transform.invert();
26303
- };
26304
- _proto.toLocal = function toLocal(control, position) {
26305
- var elements = this.getGlobalInverse(control).elements;
26306
- return new Vector2(elements[0] * position.x + elements[3] * position.y + elements[6], elements[1] * position.x + elements[4] * position.y + elements[7]);
26307
- };
26308
- _proto.controlBelongsToSubtree = function controlBelongsToSubtree(control, subtree) {
26309
- var current = control;
26310
- while(current){
26311
- if (current === subtree) {
26312
- return true;
26313
- }
26314
- current = current.parent;
26315
- }
26316
- return false;
26317
- };
26318
- _proto.isControlValid = function isControlValid(control) {
26319
- return !!control && !control.isDisposed && control.root === this;
26320
- };
26321
- _proto.isControlUsable = function isControlUsable(control) {
26322
- if (!this.isControlValid(control) || !control.visibleInHierarchy || !control.enabledInHierarchy) {
26323
- return false;
26324
- }
26325
- var root = this.findCanvasRoot(control);
26326
- return !root || !root.inputDisabled;
26327
- };
26328
- _proto.findCanvasRoot = function findCanvasRoot(control) {
26329
- var current = control;
26330
- while(current && current !== this){
26331
- if (_instanceof1(current, CanvasRootControl)) {
26332
- return current;
26333
- }
26334
- current = current.parent;
26335
- }
26336
- return null;
26337
- };
26338
- _proto.isFocusTargetUsable = function isFocusTargetUsable(control) {
26339
- return this.isControlUsable(control) && control.getFocusModeWithOverride() !== FocusMode.None;
26340
- };
26341
- return WindowRootControl;
26342
- }(RootControl);
26343
-
26344
- var CanvasRenderMode;
26345
- (function(CanvasRenderMode) {
26346
- CanvasRenderMode[CanvasRenderMode["ScreenSpace"] = 0] = "ScreenSpace";
26347
- CanvasRenderMode[CanvasRenderMode["CameraSpace"] = 1] = "CameraSpace";
26348
- CanvasRenderMode[CanvasRenderMode["WorldSpace"] = 2] = "WorldSpace";
26349
- CanvasRenderMode[CanvasRenderMode["WorldSpaceFaceCamera"] = 3] = "WorldSpaceFaceCamera";
26350
- })(CanvasRenderMode || (CanvasRenderMode = {}));
26351
- /** Canvas-layer boundary attached to a VFXItem. Input state remains owned by the window root. */ var UICanvas = /*#__PURE__*/ function(Component) {
26352
- _inherits(UICanvas, Component);
26353
- function UICanvas(engine) {
26354
- var _this;
26355
- _this = Component.call(this, engine) || this;
26356
- _this.renderMode = 0;
26357
- _this.receivesEvents = true;
26358
- _this._order = 0;
26359
- _this.registered = false;
26360
- _this.rootControl = new CanvasRootControl(engine, _assert_this_initialized(_this));
26361
- return _this;
26362
- }
26363
- var _proto = UICanvas.prototype;
26364
- _proto.onEnable = function onEnable() {
26365
- this.register();
26366
- };
26367
- _proto.onDisable = function onDisable() {
26368
- this.unregister();
26369
- };
26370
- _proto.onDestroy = function onDestroy() {
26371
- this.destroyCanvas();
26372
- };
26373
- _proto.dispose = function dispose() {
26374
- this.destroyCanvas();
26375
- Component.prototype.dispose.call(this);
26376
- };
26377
- _proto.register = function register() {
26378
- if (!this.registered) {
26379
- this.rootControl.parent = this.engine.windowRoot.canvases;
26380
- this.registered = true;
26381
- }
26382
- };
26383
- _proto.unregister = function unregister() {
26384
- if (this.registered) {
26385
- this.rootControl.parent = null;
26386
- this.registered = false;
26387
- }
26388
- };
26389
- _proto.destroyCanvas = function destroyCanvas() {
26390
- this.unregister();
26391
- if (!this.rootControl.isDisposed) {
26392
- this.rootControl.dispose();
26393
- }
26394
- };
26395
- _create_class(UICanvas, [
26396
- {
26397
- key: "order",
26398
- get: function get() {
26399
- return this._order;
26400
- },
26401
- set: function set(value) {
26402
- if (this._order !== value) {
26403
- this._order = value;
26404
- this.engine.windowRoot.canvases.sortCanvases();
26405
- }
26406
- }
26407
- },
26408
- {
26409
- key: "isVisible",
26410
- get: function get() {
26411
- var _this_item;
26412
- return this.renderMode === 0 && this.enabled && !!((_this_item = this.item) == null ? void 0 : _this_item.isActive);
26413
- }
26414
- }
26415
- ]);
26416
- return UICanvas;
26417
- }(Component);
26418
-
26419
- /**
26420
- * Scene-tree bridge for a GUI Control. The VFXItem tree owns lifecycle and
26421
- * serialization while the Control tree owns layout, drawing and input.
26422
- */ var UIControl = /*#__PURE__*/ function(Component) {
26423
- _inherits(UIControl, Component);
26424
- function UIControl(engine) {
26425
- var _this;
26426
- _this = Component.call(this, engine) || this;
26427
- _this.controlNode = null;
26428
- _this.linkedItemTransform = null;
26429
- _this.linkedControl = null;
26430
- _this.syncingLocation = false;
26431
- _this.itemTransformChanged = function() {
26432
- return _this.syncItemLocationToControl();
26433
- };
26434
- _this.controlLocationChanged = function() {
26435
- return _this.syncControlLocationToItem();
26436
- };
26437
- return _this;
26438
- }
26439
- var _proto = UIControl.prototype;
26440
- _proto.onAwake = function onAwake() {
26441
- this.syncControl();
26442
- };
26443
- _proto.onEnable = function onEnable() {
26444
- if (this.controlNode) {
26445
- this.controlNode.visible = this.item.isActive;
26446
- this.controlNode.enabled = true;
26447
- }
26448
- };
26449
- _proto.onDisable = function onDisable() {
26450
- if (this.controlNode) {
26451
- this.controlNode.visible = this.item.isActive;
26452
- this.controlNode.enabled = false;
26453
- }
26454
- };
26455
- _proto.onParentChanged = function onParentChanged() {
26456
- this.syncControl();
26457
- };
26458
- _proto.onOrderInParentChanged = function onOrderInParentChanged() {
26459
- this.syncControlOrder();
26460
- };
26461
- _proto.onDestroy = function onDestroy() {
26462
- this.disposeControl();
26463
- };
26464
- _proto.dispose = function dispose() {
26465
- this.disposeControl();
26466
- Component.prototype.dispose.call(this);
26467
- };
26468
- /** Unlinks the GUI object without disposing or modifying it. */ _proto.unlinkControl = function unlinkControl() {
26469
- if (this.controlNode) {
26470
- this.unbindLocationSync();
26471
- this.controlNode = null;
26472
- }
26473
- };
26474
- _proto.disposeControl = function disposeControl() {
26475
- var control = this.controlNode;
26476
- if (control) {
26477
- this.unbindLocationSync();
26478
- this.controlNode = null;
26479
- control.dispose();
26480
- }
26481
- };
26482
- _proto.syncControl = function syncControl() {
26483
- var control = this.controlNode;
26484
- if (!control || !this.item) {
26485
- return;
26486
- }
26487
- this.syncingLocation = true;
26488
- try {
26489
- control.visible = this.item.isActive;
26490
- control.enabled = this.enabled;
26491
- control.parent = this.resolveParent();
26492
- this.syncControlOrder();
26493
- this.copyItemLocationToControl();
26494
- } finally{
26495
- this.syncingLocation = false;
26496
- }
26497
- this.bindLocationSync();
26498
- };
26499
- _proto.syncControlOrder = function syncControlOrder() {
26500
- if (this.controlNode && this.item) {
26501
- this.controlNode.indexInParent = this.item.orderInParent;
26502
- }
26503
- };
26504
- _proto.resolveParent = function resolveParent() {
26505
- var parentItem = this.item.parent;
26506
- if (!parentItem) {
26507
- var _UIControl_fallbackParentGetDelegate;
26508
- return (_UIControl_fallbackParentGetDelegate = UIControl.fallbackParentGetDelegate == null ? void 0 : UIControl.fallbackParentGetDelegate.call(UIControl, this)) != null ? _UIControl_fallbackParentGetDelegate : null;
26509
- }
26510
- var uiControl = parentItem.getComponent(UIControl);
26511
- if ((uiControl == null ? void 0 : uiControl.control) && "children" in uiControl.control) {
26512
- return uiControl.control;
26513
- }
26514
- var canvas = parentItem.getComponent(UICanvas);
26515
- var _canvas_rootControl, _ref;
26516
- return (_ref = (_canvas_rootControl = canvas == null ? void 0 : canvas.rootControl) != null ? _canvas_rootControl : UIControl.fallbackParentGetDelegate == null ? void 0 : UIControl.fallbackParentGetDelegate.call(UIControl, this)) != null ? _ref : null;
26517
- };
26518
- _proto.bindLocationSync = function bindLocationSync() {
26519
- var itemTransform = this.item.transform;
26520
- var control = this.controlNode;
26521
- if (this.linkedItemTransform === itemTransform && this.linkedControl === control) {
26522
- return;
26523
- }
26524
- this.unbindLocationSync();
26525
- if (control) {
26526
- this.linkedItemTransform = itemTransform;
26527
- this.linkedControl = control;
26528
- itemTransform.on("changed", this.itemTransformChanged);
26529
- control.on("locationChanged", this.controlLocationChanged);
26530
- }
26531
- };
26532
- _proto.unbindLocationSync = function unbindLocationSync() {
26533
- var _this_linkedItemTransform, _this_linkedControl;
26534
- (_this_linkedItemTransform = this.linkedItemTransform) == null ? void 0 : _this_linkedItemTransform.off("changed", this.itemTransformChanged);
26535
- (_this_linkedControl = this.linkedControl) == null ? void 0 : _this_linkedControl.off("locationChanged", this.controlLocationChanged);
26536
- this.linkedItemTransform = null;
26537
- this.linkedControl = null;
26538
- };
26539
- _proto.syncItemLocationToControl = function syncItemLocationToControl() {
26540
- if (!this.syncingLocation && this.controlNode) {
26541
- this.syncingLocation = true;
26542
- try {
26543
- this.copyItemLocationToControl();
26544
- } finally{
26545
- this.syncingLocation = false;
26546
- }
26547
- }
26548
- };
26549
- _proto.syncControlLocationToItem = function syncControlLocationToItem() {
26550
- var control = this.controlNode;
26551
- if (!this.syncingLocation && control) {
26552
- var source = control.location;
26553
- var target = this.item.transform.position;
26554
- if (source.x !== target.x || source.y !== target.y) {
26555
- this.syncingLocation = true;
26556
- try {
26557
- this.item.transform.setPosition(source.x, source.y, target.z);
26558
- } finally{
26559
- this.syncingLocation = false;
26560
- }
26561
- }
26562
- }
26563
- };
26564
- _proto.copyItemLocationToControl = function copyItemLocationToControl() {
26565
- var control = this.controlNode;
26566
- if (control) {
26567
- var source = this.item.transform.position;
26568
- var target = control.location;
26569
- if (source.x !== target.x || source.y !== target.y) {
26570
- control.setPosition(source.x, source.y);
26571
- }
26572
- }
26573
- };
26574
- _create_class(UIControl, [
26575
- {
26576
- key: "control",
26577
- get: function get() {
26578
- return this.controlNode;
26579
- },
26580
- set: function set(value) {
26581
- if (value === this.controlNode) {
26582
- return;
26583
- }
26584
- this.disposeControl();
26585
- if (value) {
26586
- if (value.owner && value.owner !== this && value.owner.control === value) {
26587
- throw new Error("A Control can only be owned by one UIControl.");
26588
- }
26589
- this.controlNode = value;
26590
- value.owner = this;
26591
- this.syncControl();
26592
- }
26593
- }
26594
- },
26595
- {
26596
- key: "hasControl",
26597
- get: function get() {
26598
- return this.controlNode !== null;
26599
- }
26600
- }
26601
- ]);
26602
- return UIControl;
26603
- }(Component);
26604
-
26605
24814
  var CameraController = /*#__PURE__*/ function(Component) {
26606
24815
  _inherits(CameraController, Component);
26607
24816
  function CameraController(engine, props) {
@@ -26636,6 +24845,42 @@ CameraController = __decorate([
26636
24845
  effectsClass(DataType.CameraController)
26637
24846
  ], CameraController);
26638
24847
 
24848
+ function _get_prototype_of(o) {
24849
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
24850
+ return o.__proto__ || Object.getPrototypeOf(o);
24851
+ };
24852
+ return _get_prototype_of(o);
24853
+ }
24854
+
24855
+ function _is_native_function(fn) {
24856
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
24857
+ }
24858
+
24859
+ function _wrap_native_super(Class) {
24860
+ var _cache = typeof Map === "function" ? new Map() : undefined;
24861
+ _wrap_native_super = function _wrap_native_super(Class) {
24862
+ if (Class === null || !_is_native_function(Class)) return Class;
24863
+ if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
24864
+ if (typeof _cache !== "undefined") {
24865
+ if (_cache.has(Class)) return _cache.get(Class);
24866
+ _cache.set(Class, Wrapper);
24867
+ }
24868
+ function Wrapper() {
24869
+ return _construct(Class, arguments, _get_prototype_of(this).constructor);
24870
+ }
24871
+ Wrapper.prototype = Object.create(Class.prototype, {
24872
+ constructor: {
24873
+ value: Wrapper,
24874
+ enumerable: false,
24875
+ writable: true,
24876
+ configurable: true
24877
+ }
24878
+ });
24879
+ return _set_prototype_of(Wrapper, Class);
24880
+ };
24881
+ return _wrap_native_super(Class);
24882
+ }
24883
+
26639
24884
  var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
26640
24885
  _inherits(CameraVFXItemLoader, Plugin);
26641
24886
  function CameraVFXItemLoader() {
@@ -26644,6 +24889,255 @@ var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
26644
24889
  return CameraVFXItemLoader;
26645
24890
  }(_wrap_native_super(Plugin));
26646
24891
 
24892
+ var MouseButton;
24893
+ (function(MouseButton) {
24894
+ MouseButton[MouseButton["None"] = 0] = "None";
24895
+ MouseButton[MouseButton["Left"] = 1] = "Left";
24896
+ MouseButton[MouseButton["Right"] = 2] = "Right";
24897
+ MouseButton[MouseButton["Middle"] = 3] = "Middle";
24898
+ MouseButton[MouseButton["WheelUp"] = 4] = "WheelUp";
24899
+ MouseButton[MouseButton["WheelDown"] = 5] = "WheelDown";
24900
+ MouseButton[MouseButton["WheelLeft"] = 6] = "WheelLeft";
24901
+ MouseButton[MouseButton["WheelRight"] = 7] = "WheelRight";
24902
+ MouseButton[MouseButton["Xbutton1"] = 8] = "Xbutton1";
24903
+ MouseButton[MouseButton["Xbutton2"] = 9] = "Xbutton2";
24904
+ })(MouseButton || (MouseButton = {}));
24905
+ var MouseButtonMask;
24906
+ (function(MouseButtonMask) {
24907
+ MouseButtonMask[MouseButtonMask["None"] = 0] = "None";
24908
+ MouseButtonMask[MouseButtonMask["Left"] = 1] = "Left";
24909
+ MouseButtonMask[MouseButtonMask["Right"] = 2] = "Right";
24910
+ MouseButtonMask[MouseButtonMask["Middle"] = 4] = "Middle";
24911
+ MouseButtonMask[MouseButtonMask["Xbutton1"] = 128] = "Xbutton1";
24912
+ MouseButtonMask[MouseButtonMask["Xbutton2"] = 256] = "Xbutton2";
24913
+ })(MouseButtonMask || (MouseButtonMask = {}));
24914
+ var KeyLocation;
24915
+ (function(KeyLocation) {
24916
+ KeyLocation[KeyLocation["Unspecified"] = 0] = "Unspecified";
24917
+ KeyLocation[KeyLocation["Left"] = 1] = "Left";
24918
+ KeyLocation[KeyLocation["Right"] = 2] = "Right";
24919
+ })(KeyLocation || (KeyLocation = {}));
24920
+
24921
+ function transformPoint(transform, value) {
24922
+ var elements = transform.elements;
24923
+ return new Vector2(elements[0] * value.x + elements[3] * value.y + elements[6], elements[1] * value.x + elements[4] * value.y + elements[7]);
24924
+ }
24925
+ function transformVector(transform, value) {
24926
+ var elements = transform.elements;
24927
+ return new Vector2(elements[0] * value.x + elements[3] * value.y, elements[1] * value.x + elements[4] * value.y);
24928
+ }
24929
+ var InputEvent = /*#__PURE__*/ function() {
24930
+ function InputEvent() {
24931
+ this.device = 0;
24932
+ this.pressed = false;
24933
+ this.canceled = false;
24934
+ this._accepted = false;
24935
+ }
24936
+ var _proto = InputEvent.prototype;
24937
+ _proto.accept = function accept() {
24938
+ this._accepted = true;
24939
+ };
24940
+ _proto.clearAccepted = function clearAccepted() {
24941
+ this._accepted = false;
24942
+ };
24943
+ _proto.isAccepted = function isAccepted() {
24944
+ return this._accepted;
24945
+ };
24946
+ _proto.isPressed = function isPressed() {
24947
+ return this.pressed && !this.canceled;
24948
+ };
24949
+ _proto.isReleased = function isReleased() {
24950
+ return !this.pressed && !this.canceled;
24951
+ };
24952
+ _proto.isCanceled = function isCanceled() {
24953
+ return this.canceled;
24954
+ };
24955
+ _proto.isEcho = function isEcho() {
24956
+ return false;
24957
+ };
24958
+ _proto.xformedBy = function xformedBy(transform) {
24959
+ return this;
24960
+ };
24961
+ return InputEvent;
24962
+ }();
24963
+ InputEvent.deviceIdEmulation = -1;
24964
+ InputEvent.deviceIdInternal = -2;
24965
+ InputEvent.deviceIdKeyboard = 16;
24966
+ InputEvent.deviceIdMouse = 32;
24967
+ var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
24968
+ _inherits(InputEventWithModifiers, InputEvent);
24969
+ function InputEventWithModifiers() {
24970
+ var _this;
24971
+ _this = InputEvent.apply(this, arguments) || this;
24972
+ _this.commandOrControlAutoremap = false;
24973
+ _this.shiftPressed = false;
24974
+ _this.altPressed = false;
24975
+ _this.metaPressed = false;
24976
+ _this.ctrlPressed = false;
24977
+ return _this;
24978
+ }
24979
+ var _proto = InputEventWithModifiers.prototype;
24980
+ _proto.copyModifiersTo = function copyModifiersTo(event) {
24981
+ event.device = this.device;
24982
+ event.pressed = this.pressed;
24983
+ event.canceled = this.canceled;
24984
+ event.commandOrControlAutoremap = this.commandOrControlAutoremap;
24985
+ event.shiftPressed = this.shiftPressed;
24986
+ event.altPressed = this.altPressed;
24987
+ event.metaPressed = this.metaPressed;
24988
+ event.ctrlPressed = this.ctrlPressed;
24989
+ };
24990
+ return InputEventWithModifiers;
24991
+ }(_wrap_native_super(InputEvent));
24992
+ var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
24993
+ _inherits(InputEventKey, InputEventWithModifiers);
24994
+ function InputEventKey() {
24995
+ var _this;
24996
+ _this = InputEventWithModifiers.apply(this, arguments) || this;
24997
+ _this.keycode = "";
24998
+ _this.physicalKeycode = "";
24999
+ _this.keyLabel = "";
25000
+ _this.unicode = 0;
25001
+ _this.location = KeyLocation.Unspecified;
25002
+ _this.echo = false;
25003
+ return _this;
25004
+ }
25005
+ var _proto = InputEventKey.prototype;
25006
+ _proto.isEcho = function isEcho() {
25007
+ return this.echo;
25008
+ };
25009
+ return InputEventKey;
25010
+ }(InputEventWithModifiers);
25011
+ var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
25012
+ _inherits(InputEventMouse, InputEventWithModifiers);
25013
+ function InputEventMouse() {
25014
+ var _this;
25015
+ _this = InputEventWithModifiers.apply(this, arguments) || this;
25016
+ _this.buttonMask = MouseButtonMask.None;
25017
+ _this.position = new Vector2();
25018
+ _this.globalPosition = new Vector2();
25019
+ return _this;
25020
+ }
25021
+ var _proto = InputEventMouse.prototype;
25022
+ _proto.copyMouseTo = function copyMouseTo(event) {
25023
+ this.copyModifiersTo(event);
25024
+ event.buttonMask = this.buttonMask;
25025
+ event.position.copyFrom(this.position);
25026
+ event.globalPosition.copyFrom(this.globalPosition);
25027
+ };
25028
+ return InputEventMouse;
25029
+ }(InputEventWithModifiers);
25030
+ var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
25031
+ _inherits(InputEventMouseButton, InputEventMouse);
25032
+ function InputEventMouseButton() {
25033
+ var _this;
25034
+ _this = InputEventMouse.apply(this, arguments) || this;
25035
+ _this.factor = 1;
25036
+ _this.buttonIndex = MouseButton.None;
25037
+ _this.doubleClick = false;
25038
+ return _this;
25039
+ }
25040
+ var _proto = InputEventMouseButton.prototype;
25041
+ _proto.xformedBy = function xformedBy(transform) {
25042
+ var event = new InputEventMouseButton();
25043
+ this.copyMouseTo(event);
25044
+ event.position.copyFrom(transformPoint(transform, this.position));
25045
+ event.factor = this.factor;
25046
+ event.buttonIndex = this.buttonIndex;
25047
+ event.doubleClick = this.doubleClick;
25048
+ return event;
25049
+ };
25050
+ return InputEventMouseButton;
25051
+ }(InputEventMouse);
25052
+ var InputEventMouseMotion = /*#__PURE__*/ function(InputEventMouse) {
25053
+ _inherits(InputEventMouseMotion, InputEventMouse);
25054
+ function InputEventMouseMotion() {
25055
+ var _this;
25056
+ _this = InputEventMouse.apply(this, arguments) || this;
25057
+ _this.tilt = new Vector2();
25058
+ _this.pressure = 0;
25059
+ _this.relative = new Vector2();
25060
+ _this.screenRelative = new Vector2();
25061
+ _this.velocity = new Vector2();
25062
+ _this.screenVelocity = new Vector2();
25063
+ _this.penInverted = false;
25064
+ return _this;
25065
+ }
25066
+ var _proto = InputEventMouseMotion.prototype;
25067
+ _proto.xformedBy = function xformedBy(transform) {
25068
+ var event = new InputEventMouseMotion();
25069
+ this.copyMouseTo(event);
25070
+ event.position.copyFrom(transformPoint(transform, this.position));
25071
+ event.tilt.copyFrom(this.tilt);
25072
+ event.pressure = this.pressure;
25073
+ event.relative.copyFrom(transformVector(transform, this.relative));
25074
+ event.screenRelative.copyFrom(this.screenRelative);
25075
+ event.velocity.copyFrom(transformVector(transform, this.velocity));
25076
+ event.screenVelocity.copyFrom(this.screenVelocity);
25077
+ event.penInverted = this.penInverted;
25078
+ return event;
25079
+ };
25080
+ return InputEventMouseMotion;
25081
+ }(InputEventMouse);
25082
+ var InputEventScreenTouch = /*#__PURE__*/ function(InputEvent) {
25083
+ _inherits(InputEventScreenTouch, InputEvent);
25084
+ function InputEventScreenTouch() {
25085
+ var _this;
25086
+ _this = InputEvent.apply(this, arguments) || this;
25087
+ _this.index = 0;
25088
+ _this.position = new Vector2();
25089
+ _this.doubleTap = false;
25090
+ return _this;
25091
+ }
25092
+ var _proto = InputEventScreenTouch.prototype;
25093
+ _proto.xformedBy = function xformedBy(transform) {
25094
+ var event = new InputEventScreenTouch();
25095
+ event.device = this.device;
25096
+ event.pressed = this.pressed;
25097
+ event.canceled = this.canceled;
25098
+ event.index = this.index;
25099
+ event.position.copyFrom(transformPoint(transform, this.position));
25100
+ event.doubleTap = this.doubleTap;
25101
+ return event;
25102
+ };
25103
+ return InputEventScreenTouch;
25104
+ }(_wrap_native_super(InputEvent));
25105
+ var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
25106
+ _inherits(InputEventScreenDrag, InputEvent);
25107
+ function InputEventScreenDrag() {
25108
+ var _this;
25109
+ _this = InputEvent.apply(this, arguments) || this;
25110
+ _this.index = 0;
25111
+ _this.position = new Vector2();
25112
+ _this.relative = new Vector2();
25113
+ _this.screenRelative = new Vector2();
25114
+ _this.velocity = new Vector2();
25115
+ _this.screenVelocity = new Vector2();
25116
+ _this.pressure = 0;
25117
+ _this.tilt = new Vector2();
25118
+ _this.penInverted = false;
25119
+ return _this;
25120
+ }
25121
+ var _proto = InputEventScreenDrag.prototype;
25122
+ _proto.xformedBy = function xformedBy(transform) {
25123
+ var event = new InputEventScreenDrag();
25124
+ event.device = this.device;
25125
+ event.pressed = this.pressed;
25126
+ event.canceled = this.canceled;
25127
+ event.index = this.index;
25128
+ event.position.copyFrom(transformPoint(transform, this.position));
25129
+ event.relative.copyFrom(transformVector(transform, this.relative));
25130
+ event.screenRelative.copyFrom(this.screenRelative);
25131
+ event.velocity.copyFrom(transformVector(transform, this.velocity));
25132
+ event.screenVelocity.copyFrom(this.screenVelocity);
25133
+ event.pressure = this.pressure;
25134
+ event.tilt.copyFrom(this.tilt);
25135
+ event.penInverted = this.penInverted;
25136
+ return event;
25137
+ };
25138
+ return InputEventScreenDrag;
25139
+ }(_wrap_native_super(InputEvent));
25140
+
26647
25141
  var EVENT_TYPE_CLICK = "click";
26648
25142
  var EVENT_TYPE_TOUCH_START = "touchstart";
26649
25143
  var EVENT_TYPE_TOUCH_MOVE = "touchmove";
@@ -26654,49 +25148,52 @@ var PointerEventType;
26654
25148
  PointerEventType[PointerEventType["PointerUp"] = 1] = "PointerUp";
26655
25149
  PointerEventType[PointerEventType["PointerMove"] = 2] = "PointerMove";
26656
25150
  })(PointerEventType || (PointerEventType = {}));
26657
- var EventSystem = /*#__PURE__*/ function() {
25151
+ var EventSystem = /*#__PURE__*/ function(EventEmitter) {
25152
+ _inherits(EventSystem, EventEmitter);
26658
25153
  function EventSystem(engine, allowPropagation) {
26659
- var _this = this;
26660
25154
  if (allowPropagation === void 0) allowPropagation = false;
26661
- this.engine = engine;
26662
- this.allowPropagation = allowPropagation;
26663
- this.skipPointerMovePicking = true;
26664
- this.emulateMouseFromTouch = true;
26665
- this.emulateTouchFromMouse = false;
26666
- this._enabled = true;
26667
- this.handlers = {};
26668
- this.nativeHandlers = [];
26669
- this.target = null;
26670
- this.mouseState = null;
26671
- this.touchStates = new Map();
26672
- this.mouseFromTouchIndex = null;
26673
- this.touchFromMousePressed = false;
26674
- this.addedTabIndex = false;
26675
- this.addedOutlineStyle = false;
26676
- this.onNativeWheel = function(event) {
25155
+ var _this;
25156
+ _this = EventEmitter.call(this) || this;
25157
+ _this.engine = engine;
25158
+ _this.allowPropagation = allowPropagation;
25159
+ _this.skipPointerMovePicking = true;
25160
+ _this.emulateMouseFromTouch = true;
25161
+ _this.emulateTouchFromMouse = false;
25162
+ _this._enabled = true;
25163
+ _this.handlers = {};
25164
+ _this.nativeHandlers = [];
25165
+ _this.target = null;
25166
+ _this.mouseState = null;
25167
+ _this.mouseButtonMask = MouseButtonMask.None;
25168
+ _this.touchStates = new Map();
25169
+ _this.mouseFromTouchIndex = null;
25170
+ _this.touchFromMousePressed = false;
25171
+ _this.addedTabIndex = false;
25172
+ _this.addedOutlineStyle = false;
25173
+ _this.onNativeWheel = function(event) {
26677
25174
  if (!_this.enabled || !_this.target) {
26678
25175
  return;
26679
25176
  }
26680
25177
  var position = _this.getCanvasPosition(event.clientX, event.clientY);
26681
25178
  var handled = false;
26682
25179
  if (event.deltaY !== 0) {
26683
- handled = _this.pushWheelButton(event.deltaY < 0 ? MouseButton.WheelUp : MouseButton.WheelDown, Math.abs(event.deltaY), position, event) || handled;
25180
+ handled = _this.pushWheelButton(event.deltaY < 0 ? MouseButton.WheelUp : MouseButton.WheelDown, normalizeWheelFactor(event.deltaY, event.deltaMode), position, event) || handled;
26684
25181
  }
26685
25182
  if (event.deltaX !== 0) {
26686
- handled = _this.pushWheelButton(event.deltaX < 0 ? MouseButton.WheelLeft : MouseButton.WheelRight, Math.abs(event.deltaX), position, event) || handled;
25183
+ handled = _this.pushWheelButton(event.deltaX < 0 ? MouseButton.WheelLeft : MouseButton.WheelRight, normalizeWheelFactor(event.deltaX, event.deltaMode), position, event) || handled;
26687
25184
  }
26688
25185
  _this.consumeNativeEvent(event, handled);
26689
25186
  };
26690
- this.onNativeKeyDown = function(event) {
25187
+ _this.onNativeKeyDown = function(event) {
26691
25188
  _this.handleNativeKey(event, true);
26692
25189
  };
26693
- this.onNativeKeyUp = function(event) {
25190
+ _this.onNativeKeyUp = function(event) {
26694
25191
  _this.handleNativeKey(event, false);
26695
25192
  };
26696
- this.onNativeMouseDown = function(event) {
25193
+ _this.onNativeMouseDown = function(event) {
26697
25194
  _this.handleNativeMouseDown(event);
26698
25195
  };
26699
- this.onNativeMouseMove = function(event) {
25196
+ _this.onNativeMouseMove = function(event) {
26700
25197
  var _state;
26701
25198
  if (!_this.enabled || !_this.target) {
26702
25199
  return;
@@ -26708,18 +25205,22 @@ var EventSystem = /*#__PURE__*/ function() {
26708
25205
  var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
26709
25206
  var velocity = _this.getVelocity(state, position);
26710
25207
  var handled = _this.pushNativeMouseMotion(event, position, relative, velocity);
26711
- (_state = state).controlHandled || (_state.controlHandled = handled);
26712
- if (!handled && (!state.pressed || !state.controlHandled)) {
25208
+ (_state = state).inputHandled || (_state.inputHandled = handled);
25209
+ if (!handled && (!state.pressed || !state.inputHandled)) {
26713
25210
  var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
26714
25211
  _this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
26715
25212
  }
26716
25213
  _this.updatePointerState(state, position);
26717
25214
  _this.consumeNativeEvent(event, handled);
26718
25215
  };
26719
- this.onNativeMouseUp = function(event) {
25216
+ _this.onNativeMouseUp = function(event) {
26720
25217
  if (!_this.enabled || !_this.target) {
26721
25218
  return;
26722
25219
  }
25220
+ // Keep the canonical mask in sync even when mouseState already ended on a
25221
+ // previous button release. The target and Window listeners may see the
25222
+ // same mouseup, but clearing a bit twice is intentionally idempotent.
25223
+ _this.setMouseButtonPressed(event.button, false);
26723
25224
  var position = _this.getCanvasPosition(event.clientX, event.clientY);
26724
25225
  var existingState = _this.mouseState;
26725
25226
  if (!(existingState == null ? void 0 : existingState.pressed)) {
@@ -26728,16 +25229,16 @@ var EventSystem = /*#__PURE__*/ function() {
26728
25229
  var state = existingState;
26729
25230
  var handled = _this.pushNativeMouseButton(event, position, false);
26730
25231
  var pointerEvent = _this.createPointerEvent(event, position, state);
26731
- if (!state.controlHandled && !handled && _this.isClick(state, position)) {
25232
+ if (!state.inputHandled && !handled && _this.isClick(state, position)) {
26732
25233
  _this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
26733
25234
  }
26734
- if (!handled && !state.controlHandled) {
25235
+ if (!handled && !state.inputHandled) {
26735
25236
  _this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
26736
25237
  }
26737
25238
  _this.mouseState = null;
26738
- _this.consumeNativeEvent(event, handled || state.controlHandled || !_this.allowPropagation);
25239
+ _this.consumeNativeEvent(event, handled || state.inputHandled || !_this.allowPropagation);
26739
25240
  };
26740
- this.onNativeTouchStart = function(event) {
25241
+ _this.onNativeTouchStart = function(event) {
26741
25242
  if (!_this.enabled) {
26742
25243
  return;
26743
25244
  }
@@ -26749,7 +25250,7 @@ var EventSystem = /*#__PURE__*/ function() {
26749
25250
  _this.touchStates.set(touch.identifier, state);
26750
25251
  state.pressed = true;
26751
25252
  var handled = _this.pushNativeScreenTouch(touch.identifier, position, true, false, false);
26752
- state.controlHandled = handled;
25253
+ state.inputHandled = handled;
26753
25254
  if (!handled) {
26754
25255
  var pointerEvent = _this.createPointerEvent(event, position, state);
26755
25256
  _this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
@@ -26758,7 +25259,7 @@ var EventSystem = /*#__PURE__*/ function() {
26758
25259
  }
26759
25260
  _this.preventTouchDefaults(event);
26760
25261
  };
26761
- this.onNativeTouchMove = function(event) {
25262
+ _this.onNativeTouchMove = function(event) {
26762
25263
  if (!_this.enabled) {
26763
25264
  return;
26764
25265
  }
@@ -26772,8 +25273,8 @@ var EventSystem = /*#__PURE__*/ function() {
26772
25273
  var relative = new Vector2(position.x - state.last.x, position.y - state.last.y);
26773
25274
  var velocity = _this.getVelocity(state, position);
26774
25275
  var handled = _this.pushNativeScreenDrag(touch.identifier, position, relative, velocity);
26775
- (_state = state).controlHandled || (_state.controlHandled = handled);
26776
- if (!handled && !state.controlHandled) {
25276
+ (_state = state).inputHandled || (_state.inputHandled = handled);
25277
+ if (!handled && !state.inputHandled) {
26777
25278
  var pointerEvent = _this.createPointerEvent(event, position, state, velocity);
26778
25279
  _this.dispatchEvent(EVENT_TYPE_TOUCH_MOVE, pointerEvent);
26779
25280
  }
@@ -26782,24 +25283,26 @@ var EventSystem = /*#__PURE__*/ function() {
26782
25283
  }
26783
25284
  _this.preventTouchDefaults(event);
26784
25285
  };
26785
- this.onNativeTouchEnd = function(event) {
25286
+ _this.onNativeTouchEnd = function(event) {
26786
25287
  _this.handleNativeTouchEnd(event, false);
26787
25288
  };
26788
- this.onNativeTouchCancel = function(event) {
25289
+ _this.onNativeTouchCancel = function(event) {
26789
25290
  _this.handleNativeTouchEnd(event, true);
26790
25291
  };
26791
- this.onWindowBlur = function() {
26792
- if (_this.enabled) {
26793
- _this.mouseState = null;
26794
- _this.touchStates.clear();
26795
- _this.mouseFromTouchIndex = null;
26796
- _this.touchFromMousePressed = false;
26797
- _this.engine.windowRoot.cancelPointerInput();
26798
- }
25292
+ _this.onCanvasFocus = function() {
25293
+ _this.emit("canvasFocus");
26799
25294
  };
25295
+ _this.onCanvasBlur = function() {
25296
+ _this.emit("canvasBlur");
25297
+ };
25298
+ return _this;
26800
25299
  }
26801
25300
  var _proto = EventSystem.prototype;
26802
- _proto.bindListeners = function bindListeners(target) {
25301
+ /**
25302
+ * Rebinds native input listeners to a canvas.
25303
+ *
25304
+ * Rebind or unbind only while there are no active key, mouse, touch, or drag sessions.
25305
+ */ _proto.bindListeners = function bindListeners(target) {
26803
25306
  this.unbindListeners();
26804
25307
  this.target = target;
26805
25308
  if (!target || typeof window === "undefined") {
@@ -26836,7 +25339,8 @@ var EventSystem = /*#__PURE__*/ function() {
26836
25339
  });
26837
25340
  this.addNativeHandler(target, "keydown", this.onNativeKeyDown);
26838
25341
  this.addNativeHandler(target, "keyup", this.onNativeKeyUp);
26839
- this.addNativeHandler(window, "blur", this.onWindowBlur);
25342
+ this.addNativeHandler(target, "focus", this.onCanvasFocus);
25343
+ this.addNativeHandler(target, "blur", this.onCanvasBlur);
26840
25344
  };
26841
25345
  _proto.dispatchEvent = function dispatchEvent(type, event) {
26842
25346
  var handlers = this.handlers[type];
@@ -26870,11 +25374,7 @@ var EventSystem = /*#__PURE__*/ function() {
26870
25374
  }
26871
25375
  };
26872
25376
  _proto.dispose = function dispose() {
26873
- this.engine.windowRoot.cancelPointerInput();
26874
- this.mouseState = null;
26875
- this.touchStates.clear();
26876
- this.mouseFromTouchIndex = null;
26877
- this.touchFromMousePressed = false;
25377
+ this.resetInputState();
26878
25378
  this.handlers = {};
26879
25379
  this.unbindListeners();
26880
25380
  this.target = null;
@@ -26883,13 +25383,14 @@ var EventSystem = /*#__PURE__*/ function() {
26883
25383
  if (!this.enabled || !this.target) {
26884
25384
  return;
26885
25385
  }
25386
+ this.setMouseButtonPressed(event.button, true);
26886
25387
  var position = this.getCanvasPosition(event.clientX, event.clientY);
26887
25388
  this.focusTarget();
26888
25389
  var state = this.createPointerState(position);
26889
25390
  this.mouseState = state;
26890
25391
  state.pressed = true;
26891
25392
  var handled = this.pushNativeMouseButton(event, position, true);
26892
- state.controlHandled = handled;
25393
+ state.inputHandled = handled;
26893
25394
  if (!handled) {
26894
25395
  var pointerEvent = this.createPointerEvent(event, position, state);
26895
25396
  this.dispatchEvent(EVENT_TYPE_TOUCH_START, pointerEvent);
@@ -26913,8 +25414,7 @@ var EventSystem = /*#__PURE__*/ function() {
26913
25414
  input.altPressed = event.altKey;
26914
25415
  input.metaPressed = event.metaKey;
26915
25416
  input.ctrlPressed = event.ctrlKey;
26916
- this.engine.windowRoot.pushInput(input);
26917
- this.consumeNativeEvent(event, this.engine.windowRoot.isInputHandled());
25417
+ this.consumeNativeEvent(event, this.pushInput(input));
26918
25418
  };
26919
25419
  _proto.handleNativeTouchEnd = function handleNativeTouchEnd(event, canceled) {
26920
25420
  if (!this.enabled) {
@@ -26929,14 +25429,14 @@ var EventSystem = /*#__PURE__*/ function() {
26929
25429
  }
26930
25430
  var handled = this.pushNativeScreenTouch(touch.identifier, position, false, canceled, false);
26931
25431
  var pointerEvent = this.createPointerEvent(event, position, state);
26932
- if (!canceled && !state.controlHandled && !handled && this.isClick(state, position)) {
25432
+ if (!canceled && !state.inputHandled && !handled && this.isClick(state, position)) {
26933
25433
  this.dispatchEvent(EVENT_TYPE_CLICK, pointerEvent);
26934
25434
  }
26935
- if (!handled && !canceled && !state.controlHandled) {
25435
+ if (!handled && !canceled && !state.inputHandled) {
26936
25436
  this.dispatchEvent(EVENT_TYPE_TOUCH_END, pointerEvent);
26937
25437
  }
26938
25438
  this.touchStates.delete(touch.identifier);
26939
- this.consumeNativeEvent(event, handled || state.controlHandled || !this.allowPropagation);
25439
+ this.consumeNativeEvent(event, handled || state.inputHandled || !this.allowPropagation);
26940
25440
  }
26941
25441
  this.preventTouchDefaults(event);
26942
25442
  };
@@ -26956,7 +25456,7 @@ var EventSystem = /*#__PURE__*/ function() {
26956
25456
  };
26957
25457
  _proto.pushNativeMouseMotion = function pushNativeMouseMotion(event, position, relative, velocity) {
26958
25458
  var handled = false;
26959
- if (this.touchFromMousePressed && (event.buttons & 1) !== 0) {
25459
+ if (this.touchFromMousePressed && (this.mouseButtonMask & MouseButtonMask.Left) !== 0) {
26960
25460
  handled = this.pushScreenDrag(0, position, relative, velocity, InputEvent.deviceIdEmulation);
26961
25461
  }
26962
25462
  return this.pushMouseMotion(event, position, relative, velocity) || handled;
@@ -26993,8 +25493,7 @@ var EventSystem = /*#__PURE__*/ function() {
26993
25493
  input.pressed = pressed;
26994
25494
  input.canceled = canceled;
26995
25495
  input.doubleClick = doubleClick;
26996
- this.engine.windowRoot.pushInput(input);
26997
- return this.engine.windowRoot.isInputHandled();
25496
+ return this.pushInput(input);
26998
25497
  };
26999
25498
  _proto.pushEmulatedMouseMotion = function pushEmulatedMouseMotion(position, relative, velocity) {
27000
25499
  var input = new InputEventMouseMotion();
@@ -27007,42 +25506,42 @@ var EventSystem = /*#__PURE__*/ function() {
27007
25506
  input.screenRelative.copyFrom(relative);
27008
25507
  input.velocity.copyFrom(velocity);
27009
25508
  input.screenVelocity.copyFrom(velocity);
27010
- this.engine.windowRoot.pushInput(input);
27011
- return this.engine.windowRoot.isInputHandled();
25509
+ return this.pushInput(input);
27012
25510
  };
27013
25511
  _proto.pushMouseButton = function pushMouseButton(event, position, pressed) {
27014
25512
  var input = new InputEventMouseButton();
27015
25513
  this.copyMouseFields(input, event, position);
27016
25514
  input.device = InputEvent.deviceIdMouse;
27017
25515
  input.buttonIndex = getMouseButton(event.button);
27018
- input.buttonMask = getMouseButtonMask(event.buttons);
25516
+ input.buttonMask = this.mouseButtonMask;
25517
+ input.pressed = pressed;
25518
+ input.doubleClick = event.detail > 1;
25519
+ return this.pushInput(input);
25520
+ };
25521
+ _proto.setMouseButtonPressed = function setMouseButtonPressed(button, pressed) {
25522
+ var buttonBit = getMouseButtonBit(getMouseButton(button));
27019
25523
  if (pressed) {
27020
- input.buttonMask |= getMouseButtonBit(input.buttonIndex);
25524
+ this.mouseButtonMask |= buttonBit;
27021
25525
  } else {
27022
- input.buttonMask &= ~getMouseButtonBit(input.buttonIndex);
25526
+ this.mouseButtonMask &= ~buttonBit;
27023
25527
  }
27024
- input.pressed = pressed;
27025
- input.doubleClick = event.detail > 1;
27026
- this.engine.windowRoot.pushInput(input);
27027
- return this.engine.windowRoot.isInputHandled();
27028
25528
  };
27029
25529
  _proto.pushWheelButton = function pushWheelButton(button, factor, position, event) {
27030
25530
  var input = new InputEventMouseButton();
27031
25531
  this.copyMouseFields(input, event, position);
27032
25532
  input.device = InputEvent.deviceIdMouse;
27033
25533
  input.buttonIndex = button;
27034
- input.buttonMask = getMouseButtonMask(event.buttons);
25534
+ input.buttonMask = this.mouseButtonMask;
27035
25535
  input.factor = factor;
27036
25536
  input.pressed = true;
27037
- this.engine.windowRoot.pushInput(input);
27038
- return this.engine.windowRoot.isInputHandled();
25537
+ return this.pushInput(input);
27039
25538
  };
27040
25539
  _proto.pushMouseMotion = function pushMouseMotion(event, position, relative, velocity) {
27041
25540
  var input = new InputEventMouseMotion();
27042
25541
  this.copyMouseFields(input, event, position);
27043
25542
  input.device = InputEvent.deviceIdMouse;
27044
- input.buttonMask = getMouseButtonMask(event.buttons);
27045
- input.pressed = event.buttons !== 0;
25543
+ input.buttonMask = this.mouseButtonMask;
25544
+ input.pressed = this.mouseButtonMask !== MouseButtonMask.None;
27046
25545
  input.relative.copyFrom(relative);
27047
25546
  input.screenRelative.copyFrom(relative);
27048
25547
  input.velocity.copyFrom(velocity);
@@ -27051,8 +25550,7 @@ var EventSystem = /*#__PURE__*/ function() {
27051
25550
  input.pressure = event.pressure;
27052
25551
  input.tilt.set(event.tiltX, event.tiltY);
27053
25552
  }
27054
- this.engine.windowRoot.pushInput(input);
27055
- return this.engine.windowRoot.isInputHandled();
25553
+ return this.pushInput(input);
27056
25554
  };
27057
25555
  _proto.pushScreenTouch = function pushScreenTouch(index, position, pressed, canceled, doubleTap, device) {
27058
25556
  var input = new InputEventScreenTouch();
@@ -27062,8 +25560,7 @@ var EventSystem = /*#__PURE__*/ function() {
27062
25560
  input.pressed = pressed;
27063
25561
  input.canceled = canceled;
27064
25562
  input.doubleTap = doubleTap;
27065
- this.engine.windowRoot.pushInput(input);
27066
- return this.engine.windowRoot.isInputHandled();
25563
+ return this.pushInput(input);
27067
25564
  };
27068
25565
  _proto.pushScreenDrag = function pushScreenDrag(index, position, relative, velocity, device) {
27069
25566
  var input = new InputEventScreenDrag();
@@ -27075,8 +25572,7 @@ var EventSystem = /*#__PURE__*/ function() {
27075
25572
  input.velocity.copyFrom(velocity);
27076
25573
  input.screenVelocity.copyFrom(velocity);
27077
25574
  input.pressed = true;
27078
- this.engine.windowRoot.pushInput(input);
27079
- return this.engine.windowRoot.isInputHandled();
25575
+ return this.pushInput(input);
27080
25576
  };
27081
25577
  _proto.copyMouseFields = function copyMouseFields(input, event, position) {
27082
25578
  input.position.copyFrom(position);
@@ -27151,7 +25647,7 @@ var EventSystem = /*#__PURE__*/ function() {
27151
25647
  start: position.clone(),
27152
25648
  last: position.clone(),
27153
25649
  lastTime: performance.now(),
27154
- controlHandled: false,
25650
+ inputHandled: false,
27155
25651
  pressed: false
27156
25652
  };
27157
25653
  return state;
@@ -27176,8 +25672,8 @@ var EventSystem = /*#__PURE__*/ function() {
27176
25672
  var _target_width, _target_height;
27177
25673
  return {
27178
25674
  x: position.x / cssWidth * 2 - 1,
27179
- // Legacy composition picking uses bottom-left, Y-up NDC even though GUI
27180
- // input follows the DOM convention of top-left, Y-down pixels.
25675
+ // Legacy composition picking uses bottom-left, Y-up NDC even though
25676
+ // standardized input follows the DOM convention of top-left, Y-down pixels.
27181
25677
  y: 1 - position.y / cssHeight * 2,
27182
25678
  vx: velocity.x / cssWidth * 2,
27183
25679
  vy: -velocity.y / cssHeight * 2,
@@ -27205,6 +25701,11 @@ var EventSystem = /*#__PURE__*/ function() {
27205
25701
  event.stopPropagation();
27206
25702
  }
27207
25703
  };
25704
+ _proto.pushInput = function pushInput(input) {
25705
+ input.clearAccepted();
25706
+ this.emit("input", input);
25707
+ return input.isAccepted();
25708
+ };
27208
25709
  _proto.preventTouchDefaults = function preventTouchDefaults(event) {
27209
25710
  if (event.cancelable) {
27210
25711
  event.preventDefault();
@@ -27214,6 +25715,13 @@ var EventSystem = /*#__PURE__*/ function() {
27214
25715
  var _this_target;
27215
25716
  (_this_target = this.target) == null ? void 0 : _this_target.focus();
27216
25717
  };
25718
+ _proto.resetInputState = function resetInputState() {
25719
+ this.mouseState = null;
25720
+ this.mouseButtonMask = MouseButtonMask.None;
25721
+ this.touchStates.clear();
25722
+ this.mouseFromTouchIndex = null;
25723
+ this.touchFromMousePressed = false;
25724
+ };
27217
25725
  _proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
27218
25726
  target.addEventListener(name, handler, options);
27219
25727
  this.nativeHandlers.push({
@@ -27244,23 +25752,20 @@ var EventSystem = /*#__PURE__*/ function() {
27244
25752
  get: function get() {
27245
25753
  return this._enabled;
27246
25754
  },
27247
- set: function set(value) {
25755
+ set: /**
25756
+ * Enables native input processing.
25757
+ *
25758
+ * Change this only while there are no active key, mouse, touch, or drag sessions.
25759
+ */ function set(value) {
27248
25760
  if (this._enabled === value) {
27249
25761
  return;
27250
25762
  }
27251
25763
  this._enabled = value;
27252
- if (!value) {
27253
- this.mouseState = null;
27254
- this.touchStates.clear();
27255
- this.mouseFromTouchIndex = null;
27256
- this.touchFromMousePressed = false;
27257
- this.engine.windowRoot.cancelPointerInput();
27258
- }
27259
25764
  }
27260
25765
  }
27261
25766
  ]);
27262
25767
  return EventSystem;
27263
- }();
25768
+ }(EventEmitter);
27264
25769
  function getKeyLocation(location) {
27265
25770
  if (location === 1) {
27266
25771
  return KeyLocation.Left;
@@ -27291,25 +25796,6 @@ function getMouseButton(button) {
27291
25796
  return MouseButton.None;
27292
25797
  }
27293
25798
  }
27294
- function getMouseButtonMask(buttons) {
27295
- var mask = MouseButtonMask.None;
27296
- if ((buttons & 1) !== 0) {
27297
- mask |= MouseButtonMask.Left;
27298
- }
27299
- if ((buttons & 2) !== 0) {
27300
- mask |= MouseButtonMask.Right;
27301
- }
27302
- if ((buttons & 4) !== 0) {
27303
- mask |= MouseButtonMask.Middle;
27304
- }
27305
- if ((buttons & 8) !== 0) {
27306
- mask |= MouseButtonMask.Xbutton1;
27307
- }
27308
- if ((buttons & 16) !== 0) {
27309
- mask |= MouseButtonMask.Xbutton2;
27310
- }
27311
- return mask;
27312
- }
27313
25799
  function getMouseButtonBit(button) {
27314
25800
  switch(button){
27315
25801
  case MouseButton.Left:
@@ -27326,6 +25812,16 @@ function getMouseButtonBit(button) {
27326
25812
  return MouseButtonMask.None;
27327
25813
  }
27328
25814
  }
25815
+ function normalizeWheelFactor(delta, mode) {
25816
+ var magnitude = Math.abs(delta);
25817
+ if (mode === 1) {
25818
+ return magnitude / 3;
25819
+ }
25820
+ if (mode === 2) {
25821
+ return magnitude;
25822
+ }
25823
+ return magnitude / 100;
25824
+ }
27329
25825
 
27330
25826
  var InteractLoader = /*#__PURE__*/ function(Plugin) {
27331
25827
  _inherits(InteractLoader, Plugin);
@@ -29345,6 +27841,11 @@ SpritePropertyTrack = __decorate([
29345
27841
  effectsClass("SpritePropertyTrack")
29346
27842
  ], SpritePropertyTrack);
29347
27843
 
27844
+ function _assert_this_initialized(self) {
27845
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
27846
+ return self;
27847
+ }
27848
+
29348
27849
  var Cone = /*#__PURE__*/ function() {
29349
27850
  function Cone(props) {
29350
27851
  var _this = this;
@@ -39349,7 +37850,7 @@ function getStandardSpriteContent(sprite, transform) {
39349
37850
  return ret;
39350
37851
  }
39351
37852
 
39352
- var version$1 = "2.10.0-alpha.4";
37853
+ var version$1 = "2.10.0";
39353
37854
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
39354
37855
  var standardVersion = /^(\d+)\.(\d+)$/;
39355
37856
  var reverseParticle = false;
@@ -41345,9 +39846,11 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
41345
39846
  // Instantiate composition rootItem
41346
39847
  _this.sceneRoot = new VFXItem(_this.engine);
41347
39848
  _this.sceneRoot.setParent(_this.root);
41348
- _this.uiCanvas = _this.sceneRoot.addComponent(UICanvas);
41349
39849
  if (sourceContent) {
41350
39850
  _this.sceneRoot.setInstanceId(sourceContent.id);
39851
+ }
39852
+ PluginSystem.notifyCompositionCreating(_assert_this_initialized(_this), scene);
39853
+ if (sourceContent) {
41351
39854
  _this.sceneRoot.instantiatePreComposition(sourceContent, false);
41352
39855
  }
41353
39856
  // 在 instantiatePreComposition 后设置 rootItem 的 name,避免 name 被覆盖
@@ -41916,9 +40419,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
41916
40419
  },
41917
40420
  set: function set(value) {
41918
40421
  this._renderOrder = value;
41919
- if (this.uiCanvas) {
41920
- this.uiCanvas.order = value;
41921
- }
41922
40422
  }
41923
40423
  },
41924
40424
  {
@@ -41931,9 +40431,6 @@ var PreRenderTickData = /*#__PURE__*/ function(TickData) {
41931
40431
  },
41932
40432
  set: function set(value) {
41933
40433
  this._interactive = !!value;
41934
- if (this.uiCanvas) {
41935
- this.uiCanvas.receivesEvents = this._interactive;
41936
- }
41937
40434
  }
41938
40435
  },
41939
40436
  {
@@ -43761,7 +42258,6 @@ var DEFAULT_FPS = 60;
43761
42258
  _this.objectInstance = {};
43762
42259
  _this.root = new VFXItem(_assert_this_initialized(_this));
43763
42260
  _this.root.name = "root";
43764
- _this.windowRoot = new WindowRootControl(_assert_this_initialized(_this));
43765
42261
  _this.whiteTexture = generateWhiteTexture(_assert_this_initialized(_this));
43766
42262
  _this.transparentTexture = generateEmptyTexture(_assert_this_initialized(_this));
43767
42263
  if (!(options == null ? void 0 : options.manualRender)) {
@@ -43914,7 +42410,7 @@ var DEFAULT_FPS = 60;
43914
42410
  (_this_ticker1 = this.ticker) == null ? void 0 : _this_ticker1.pause();
43915
42411
  return;
43916
42412
  }
43917
- this.windowRoot.update(dt);
42413
+ this.emit("update", dt);
43918
42414
  // Tick compositions onPreRender
43919
42415
  //-------------------------------------------------------------------------
43920
42416
  for(var _iterator1 = _create_for_of_iterator_helper_loose(compositions), _step1; !(_step1 = _iterator1()).done;){
@@ -43929,7 +42425,7 @@ var DEFAULT_FPS = 60;
43929
42425
  var composition2 = _step2.value;
43930
42426
  composition2.renderContent();
43931
42427
  }
43932
- this.windowRoot.render();
42428
+ this.emit("postrender");
43933
42429
  this.renderTargetPool.flush();
43934
42430
  };
43935
42431
  /**
@@ -43971,7 +42467,6 @@ var DEFAULT_FPS = 60;
43971
42467
  this.canvas.style.height = containerHeight + "px";
43972
42468
  logger.info("Resize engine " + this.name + " [" + canvasWidth + "," + canvasHeight + "," + containerWidth + "," + containerHeight + "].");
43973
42469
  this.setSize(canvasWidth, canvasHeight);
43974
- this.windowRoot.resize(canvasWidth, canvasHeight);
43975
42470
  }
43976
42471
  };
43977
42472
  _proto.setSize = function setSize(width, height) {
@@ -44177,6 +42672,12 @@ var DEFAULT_FPS = 60;
44177
42672
  _proto.setStencilTest = function setStencilTest(enable) {
44178
42673
  // OVERRIDE
44179
42674
  };
42675
+ _proto.setScissorTest = function setScissorTest(enable) {
42676
+ // OVERRIDE
42677
+ };
42678
+ _proto.setScissor = function setScissor(x, y, width, height) {
42679
+ // OVERRIDE
42680
+ };
44180
42681
  _proto.setCulling = function setCulling(enable) {
44181
42682
  // OVERRIDE
44182
42683
  };
@@ -44254,7 +42755,6 @@ var DEFAULT_FPS = 60;
44254
42755
  composition.dispose();
44255
42756
  }
44256
42757
  this.root.dispose();
44257
- this.windowRoot.dispose();
44258
42758
  (_this_assetService = this.assetService) == null ? void 0 : _this_assetService.dispose();
44259
42759
  (_this__graphics = this._graphics) == null ? void 0 : _this__graphics.dispose();
44260
42760
  this.renderPasses.forEach(function(pass) {
@@ -44579,8 +43079,8 @@ registerPlugin("text", TextLoader);
44579
43079
  registerPlugin("sprite", SpriteLoader);
44580
43080
  registerPlugin("particle", ParticleLoader);
44581
43081
  registerPlugin("interact", InteractLoader);
44582
- var version = "2.10.0-alpha.4";
43082
+ var version = "2.10.0";
44583
43083
  logger.info("Core version: " + version + ".");
44584
43084
 
44585
- export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader, CanvasContainer, CanvasRenderMode, CanvasRootControl, Circle$1 as Circle, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ContainerControl, Control, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, CursorShape, DEFAULT_FONTS, DEFAULT_FPS, DataBuffer, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, FocusBehaviorRecursive, FocusMode, FrameComponent, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GlyphAtlas, GradientValue, GraphInstance, GraphNode, GraphNodeData, Graphics, GreaterNodeData, HELP_LINK, HitTestType, InputEvent, InputEventKey, InputEventMouse, InputEventMouseButton, InputEventMouseMotion, InputEventScreenDrag, InputEventScreenTouch, InputEventWithModifiers, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, KeyLocation, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialState, MaterialTrack, Mesh, MouseBehaviorRecursive, MouseButton, MouseButtonMask, MouseFilter, NodeTransform, NotNode, NotNodeData, NotifyEvent, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, Plugin, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, Precomposition, PrecompositionManager, PropertyClipPlayable, PropertyTrack, REFERENCE_CURVE, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, Rectangle$1 as Rectangle, ReferenceCurve, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RootControl, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SourceType, Sprite, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, SpritePropertyMixerPlayable, SpritePropertyPlayableAsset, SpritePropertyTrack, SpriteRotation, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TangentMode, TextCache, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, Triangle, TrimPath, TrimPathMode, UICanvas, UIControl, UpdateModes, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, VertexBuffer, WeightedMode, WindowRootControl, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, breakOpportunityAfter, buildBezierData, buildEasingCurve, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createTypedArray, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, extractMinAndMax, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTexture, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateWhiteTexture, getBackgroundImage, getBytesPerElement, getClass, getColorFromGradientStops, getConfig, getControlPoints, getDataByteLength, getDataType, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isBreakChar, isCJKLike, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSafeFontFamily, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, toBufferView, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
43085
+ export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader, Circle$1 as Circle, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, DataBuffer, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, FrameComponent, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GlyphAtlas, GradientValue, GraphInstance, GraphNode, GraphNodeData, Graphics, GreaterNodeData, HELP_LINK, HitTestType, InputEvent, InputEventKey, InputEventMouse, InputEventMouseButton, InputEventMouseMotion, InputEventScreenDrag, InputEventScreenTouch, InputEventWithModifiers, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, KeyLocation, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialState, MaterialTrack, Mesh, MouseButton, MouseButtonMask, NodeTransform, NotNode, NotNodeData, NotifyEvent, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, Plugin, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, Precomposition, PrecompositionManager, PropertyClipPlayable, PropertyTrack, REFERENCE_CURVE, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, Rectangle$1 as Rectangle, ReferenceCurve, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SourceType, Sprite, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, SpritePropertyMixerPlayable, SpritePropertyPlayableAsset, SpritePropertyTrack, SpriteRotation, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TangentMode, TextCache, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, Triangle, TrimPath, TrimPathMode, UpdateModes, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, VertexBuffer, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, breakOpportunityAfter, buildBezierData, buildEasingCurve, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createTypedArray, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, extractMinAndMax, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTexture, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateWhiteTexture, getBackgroundImage, getBytesPerElement, getClass, getColorFromGradientStops, getConfig, getControlPoints, getDataByteLength, getDataType, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isBreakChar, isCJKLike, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSafeFontFamily, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, toBufferView, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
44586
43086
  //# sourceMappingURL=index.mjs.map