@galacean/effects-threejs 2.0.0-alpha.20 → 2.0.0-alpha.22

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.d.ts CHANGED
@@ -5,4 +5,5 @@ export * from './three-display-object';
5
5
  export * from './three-engine';
6
6
  export * from './three-texture';
7
7
  export * from './three-sprite-component';
8
+ export * from './three-text-component';
8
9
  export declare const version: string;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.20
6
+ * Version: v2.0.0-alpha.22
7
7
  */
8
8
 
9
9
  'use strict';
@@ -4346,11 +4346,19 @@ var DataType;
4346
4346
  DataType["Texture"] = "Texture";
4347
4347
  DataType["AnimationClip"] = "AnimationClip";
4348
4348
  DataType["TextComponent"] = "TextComponent";
4349
+ DataType["BinaryAsset"] = "BinaryAsset";
4350
+ // Timeline
4349
4351
  DataType["TrackAsset"] = "TrackAsset";
4350
4352
  DataType["TimelineAsset"] = "TimelineAsset";
4353
+ DataType["ObjectBindingTrack"] = "ObjectBindingTrack";
4354
+ DataType["TransformTrack"] = "TransformTrack";
4355
+ DataType["SpriteColorTrack"] = "SpriteColorTrack";
4356
+ DataType["ActivationTrack"] = "ActivationTrack";
4357
+ DataType["SubCompositionTrack"] = "SubCompositionTrack";
4351
4358
  DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
4352
4359
  DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
4353
- DataType["BinaryAsset"] = "BinaryAsset";
4360
+ DataType["ActivationPlayableAsset"] = "ActivationPlayableAsset";
4361
+ DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
4354
4362
  // FIXME: 先完成ECS的场景转换,后面移到spec中
4355
4363
  DataType["MeshComponent"] = "MeshComponent";
4356
4364
  DataType["SkyboxComponent"] = "SkyboxComponent";
@@ -4939,10 +4947,25 @@ var EventSystem = /*#__PURE__*/ function() {
4939
4947
  var getTouchEventValue = function(event, x, y, dx, dy) {
4940
4948
  if (dx === void 0) dx = 0;
4941
4949
  if (dy === void 0) dy = 0;
4942
- var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
4943
- var ts = performance.now();
4944
4950
  var vx = 0;
4945
4951
  var vy = 0;
4952
+ var ts = performance.now();
4953
+ if (!_this.target) {
4954
+ logger.error("Trigger TouchEvent after EventSystem is disposed.");
4955
+ return {
4956
+ x: x,
4957
+ y: y,
4958
+ vx: 0,
4959
+ vy: vy,
4960
+ dx: dx,
4961
+ dy: dy,
4962
+ ts: ts,
4963
+ width: 0,
4964
+ height: 0,
4965
+ origin: event
4966
+ };
4967
+ }
4968
+ var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
4946
4969
  if (lastTouch) {
4947
4970
  var dt = ts - lastTouch.ts;
4948
4971
  vx = (dx - lastTouch.dx) / dt || 0;
@@ -13067,6 +13090,16 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13067
13090
  function InteractComponent() {
13068
13091
  var _this;
13069
13092
  _this = RendererComponent.apply(this, arguments) || this;
13093
+ /**
13094
+ * 拖拽的惯性衰减系数,范围[0, 1], 越大惯性越强
13095
+ */ _this.downgrade = 0.95;
13096
+ /**
13097
+ * 拖拽的距离映射系数,越大越容易拖动
13098
+ */ _this.dragRatio = [
13099
+ 1,
13100
+ 1
13101
+ ];
13102
+ /** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
13070
13103
  _this.getHitTestParams = function(force) {
13071
13104
  if (!_this.clickable) {
13072
13105
  return;
@@ -13118,9 +13151,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13118
13151
  if (!this.dragEvent || !this.bouncingArg) {
13119
13152
  return;
13120
13153
  }
13121
- var downgrade = 0.95;
13122
- this.bouncingArg.vx *= downgrade;
13123
- this.bouncingArg.vy *= downgrade;
13154
+ this.bouncingArg.vx *= this.downgrade;
13155
+ this.bouncingArg.vy *= this.downgrade;
13124
13156
  this.bouncingArg.dy += this.bouncingArg.vy;
13125
13157
  this.bouncingArg.dx += this.bouncingArg.vx;
13126
13158
  if (shouldIgnoreBouncing(this.bouncingArg)) {
@@ -13148,7 +13180,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13148
13180
  // OVERRIDE
13149
13181
  };
13150
13182
  _proto.handleDragMove = function handleDragMove(evt, event) {
13151
- if (!(evt && evt.cameraParam) || !this.item.composition) {
13183
+ if (!(evt == null ? void 0 : evt.cameraParam) || !this.canInteract() || !this.item.composition) {
13152
13184
  return;
13153
13185
  }
13154
13186
  var options = this.item.props.content.options;
@@ -13159,8 +13191,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13159
13191
  var sp = Math.tan(fov * Math.PI / 180 / 2) * Math.abs(depth);
13160
13192
  var height = dy * sp;
13161
13193
  var width = dx * sp;
13162
- var nx = position[0] - width;
13163
- var ny = position[1] - height;
13194
+ var nx = position[0] - this.dragRatio[0] * width;
13195
+ var ny = position[1] - this.dragRatio[1] * height;
13164
13196
  if (options.dxRange) {
13165
13197
  var _options_dxRange = options.dxRange, min = _options_dxRange[0], max = _options_dxRange[1];
13166
13198
  nx = clamp$1(nx, min, max);
@@ -13188,6 +13220,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13188
13220
  var handlerMap = {
13189
13221
  touchstart: function(event) {
13190
13222
  var _this_item_composition;
13223
+ if (!_this.canInteract()) {
13224
+ return;
13225
+ }
13191
13226
  _this.dragEvent = null;
13192
13227
  _this.bouncingArg = null;
13193
13228
  var camera = (_this_item_composition = _this.item.composition) == null ? void 0 : _this_item_composition.camera;
@@ -13209,6 +13244,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13209
13244
  _this.bouncingArg = event;
13210
13245
  },
13211
13246
  touchend: function(event) {
13247
+ if (!_this.canInteract()) {
13248
+ return;
13249
+ }
13212
13250
  var bouncingArg = _this.bouncingArg;
13213
13251
  if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
13214
13252
  var speed = 5;
@@ -13251,6 +13289,25 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13251
13289
  RendererComponent.prototype.fromData.call(this, data);
13252
13290
  this.interactData = data;
13253
13291
  };
13292
+ _proto.canInteract = function canInteract() {
13293
+ var _this_item_composition;
13294
+ return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
13295
+ };
13296
+ _create_class(InteractComponent, [
13297
+ {
13298
+ key: "interactive",
13299
+ get: function get() {
13300
+ return this._interactive;
13301
+ },
13302
+ set: function set(enable) {
13303
+ this._interactive = enable;
13304
+ if (!enable) {
13305
+ // 立刻停止惯性滑动
13306
+ this.bouncingArg = null;
13307
+ }
13308
+ }
13309
+ }
13310
+ ]);
13254
13311
  return InteractComponent;
13255
13312
  }(RendererComponent);
13256
13313
  exports.InteractComponent = __decorate([
@@ -16767,17 +16824,12 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16767
16824
  _proto.onEnd = function onEnd(particle) {};
16768
16825
  _proto.onIterate = function onIterate(particle) {};
16769
16826
  _proto.initPoint = function initPoint(data) {
16770
- var _this_item_composition, _this_item_composition1;
16771
16827
  var options = this.options;
16772
16828
  var lifetime = this.lifetime;
16773
16829
  var shape = this.shape;
16774
16830
  var speed = options.startSpeed.getValue(lifetime);
16775
16831
  var matrix4 = options.particleFollowParent ? this.transform.getMatrix() : this.transform.getWorldMatrix();
16776
16832
  var pointPosition = data.position;
16777
- if (((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
16778
- pointPosition.x /= this.item.composition.editorScaleRatio;
16779
- pointPosition.y /= this.item.composition.editorScaleRatio;
16780
- }
16781
16833
  // 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
16782
16834
  var position = matrix4.transformPoint(pointPosition, new Vector3());
16783
16835
  var transform = new Transform({
@@ -16858,10 +16910,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16858
16910
  size.x *= tempScale.x;
16859
16911
  size.y *= tempScale.y;
16860
16912
  }
16861
- if (((_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
16862
- size.x /= this.item.composition.editorScaleRatio;
16863
- size.y /= this.item.composition.editorScaleRatio;
16864
- }
16865
16913
  transform.setScale(size.x, size.y, 1);
16866
16914
  return {
16867
16915
  size: size,
@@ -19417,21 +19465,33 @@ var TextLayout = /*#__PURE__*/ function() {
19417
19465
  this.lineHeight = lineHeight;
19418
19466
  }
19419
19467
  var _proto = TextLayout.prototype;
19420
- _proto.getOffsetY = function getOffsetY(style) {
19421
- var offsetY = 0;
19422
- var offset = (style.fontSize + style.outlineWidth) * style.fontScale;
19468
+ /**
19469
+ * 获取初始的行高偏移值
19470
+ * @param style - 字体基础数据
19471
+ * @param lineCount - 渲染行数
19472
+ * @param lineHeight - 渲染时的字体行高
19473
+ * @param fontSize - 渲染时的字体大小
19474
+ * @returns - 行高偏移值
19475
+ */ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize) {
19476
+ var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
19477
+ // /3 计算Y轴偏移量,以匹配编辑器行为
19478
+ var offsetY = (lineHeight - fontSize) / 3;
19479
+ // 计算基础偏移量
19480
+ var baseOffset = fontSize + outlineWidth * fontScale;
19481
+ var commonCalculation = lineHeight * (lineCount - 1);
19482
+ var offsetResult = 0;
19423
19483
  switch(this.textBaseline){
19424
19484
  case TextBaseline.top:
19425
- offsetY = offset;
19485
+ offsetResult = baseOffset + offsetY;
19426
19486
  break;
19427
19487
  case TextBaseline.middle:
19428
- offsetY = (this.height + offset) / 2; // fonSize;
19488
+ offsetResult = (this.height * fontScale - commonCalculation + baseOffset) / 2;
19429
19489
  break;
19430
19490
  case TextBaseline.bottom:
19431
- offsetY = this.height - offset / 2;
19491
+ offsetResult = this.height * fontScale - commonCalculation - offsetY;
19432
19492
  break;
19433
19493
  }
19434
- return offsetY;
19494
+ return offsetResult;
19435
19495
  };
19436
19496
  _proto.getOffsetX = function getOffsetX(style, maxWidth) {
19437
19497
  var offsetX = 0;
@@ -19589,6 +19649,9 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19589
19649
  var _this;
19590
19650
  _this = SpriteComponent.call(this, engine, props) || this;
19591
19651
  _this.isDirty = true;
19652
+ /**
19653
+ * 文本行数
19654
+ */ _this.lineCount = 0;
19592
19655
  _this.canvas = canvasPool.getCanvas();
19593
19656
  canvasPool.saveCanvas(_this.canvas);
19594
19657
  _this.context = _this.canvas.getContext("2d", {
@@ -19632,6 +19695,31 @@ var TextComponentBase = /*#__PURE__*/ function() {
19632
19695
  this.textStyle = new TextStyle(options);
19633
19696
  this.textLayout = new TextLayout(options);
19634
19697
  this.text = options.text;
19698
+ this.lineCount = this.getLineCount(options.text, true);
19699
+ };
19700
+ _proto.getLineCount = function getLineCount(text, init) {
19701
+ var context = this.context;
19702
+ var letterSpace = this.textLayout.letterSpace;
19703
+ var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
19704
+ var width = this.textLayout.width + this.textStyle.fontOffset;
19705
+ var lineCount = 1;
19706
+ var x = 0;
19707
+ for(var i = 0; i < text.length; i++){
19708
+ var _context_measureText;
19709
+ var str = text[i];
19710
+ var _context_measureText_width;
19711
+ var textMetrics = ((_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0) * fontScale;
19712
+ // 和浏览器行为保持一致
19713
+ x += letterSpace;
19714
+ if (x + textMetrics > width && i > 0 || str === "\n") {
19715
+ lineCount++;
19716
+ x = 0;
19717
+ }
19718
+ if (str !== "\n") {
19719
+ x += textMetrics;
19720
+ }
19721
+ }
19722
+ return lineCount;
19635
19723
  };
19636
19724
  /**
19637
19725
  * 设置字号大小
@@ -19678,6 +19766,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
19678
19766
  return;
19679
19767
  }
19680
19768
  this.text = value;
19769
+ this.lineCount = this.getLineCount(value, false);
19681
19770
  this.isDirty = true;
19682
19771
  };
19683
19772
  /**
@@ -19840,10 +19929,8 @@ var TextComponentBase = /*#__PURE__*/ function() {
19840
19929
  // 文本颜色
19841
19930
  context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
19842
19931
  var charsInfo = [];
19843
- // /3 是为了和编辑器行为保持一致
19844
- var offsetY = (lineHeight - fontSize) / 3;
19845
19932
  var x = 0;
19846
- var y = layout.getOffsetY(style) + offsetY;
19933
+ var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
19847
19934
  var charsArray = [];
19848
19935
  var charOffsetX = [];
19849
19936
  for(var i = 0; i < this.char.length; i++){
@@ -22406,10 +22493,6 @@ function getStandardCameraContent(model) {
22406
22493
  ]
22407
22494
  });
22408
22495
  }
22409
- // gizmo 的 target id 转换为新的 item guid
22410
- if (item.content.options.target) {
22411
- item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
22412
- }
22413
22496
  // 修正老 json 的 item.pluginName
22414
22497
  if (item.pn !== undefined) {
22415
22498
  var pn = item.pn;
@@ -22427,6 +22510,10 @@ function getStandardCameraContent(model) {
22427
22510
  //@ts-expect-error
22428
22511
  item.type = "orientation-transformer";
22429
22512
  }
22513
+ // gizmo 的 target id 转换为新的 item guid
22514
+ if (item.content.options.target && item.pluginName === "editor-gizmo") {
22515
+ item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
22516
+ }
22430
22517
  // Spine 元素转为 guid 索引
22431
22518
  if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
22432
22519
  convertSpineData(json.spines[item.content.options.spine], item.content, result);
@@ -23233,26 +23320,27 @@ var seed$1 = 1;
23233
23320
  */ _proto.loadScene = function loadScene(url, renderer, options) {
23234
23321
  var _this = this;
23235
23322
  return _async_to_generator(function() {
23236
- var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfos, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
23323
+ var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
23237
23324
  return __generator(this, function(_state) {
23238
23325
  assetUrl = isString(url) ? url : _this.id;
23239
23326
  startTime = performance.now();
23240
- timeInfos = [];
23327
+ timeInfoMessages = [];
23241
23328
  gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
23242
23329
  asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
23243
23330
  compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : exports.COMPRESSED_TEXTURE.NONE;
23331
+ timeInfos = {};
23244
23332
  cancelLoading = false;
23245
23333
  waitPromise = new Promise(function(resolve, reject) {
23246
23334
  loadTimer = window.setTimeout(function() {
23247
23335
  cancelLoading = true;
23248
23336
  _this.removeTimer(loadTimer);
23249
23337
  var totalTime = performance.now() - startTime;
23250
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23338
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + "."));
23251
23339
  }, _this.timeout * 1000);
23252
23340
  _this.timers.push(loadTimer);
23253
23341
  });
23254
23342
  hookTimeInfo = /*#__PURE__*/ _async_to_generator(function(label, func) {
23255
- var st, result, e;
23343
+ var st, result, time, e;
23256
23344
  return __generator(this, function(_state) {
23257
23345
  switch(_state.label){
23258
23346
  case 0:
@@ -23275,7 +23363,9 @@ var seed$1 = 1;
23275
23363
  ];
23276
23364
  case 2:
23277
23365
  result = _state.sent();
23278
- timeInfos.push("[" + label + ": " + (performance.now() - st).toFixed(2) + "]");
23366
+ time = performance.now() - st;
23367
+ timeInfoMessages.push("[" + label + ": " + time.toFixed(2) + "]");
23368
+ timeInfos[label] = time;
23279
23369
  return [
23280
23370
  2,
23281
23371
  result
@@ -23374,7 +23464,7 @@ var seed$1 = 1;
23374
23464
  hookTimeInfo("processImages", function() {
23375
23465
  return _this.processImages(images1, compressedTexture);
23376
23466
  }),
23377
- hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + " compile", function() {
23467
+ hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
23378
23468
  return _this.precompile(compositions, pluginSystem, renderer, options);
23379
23469
  })
23380
23470
  ])
@@ -23407,6 +23497,7 @@ var seed$1 = 1;
23407
23497
  loadedTextures = _state.sent();
23408
23498
  _this.updateSceneData(jsonScene.items);
23409
23499
  scene = {
23500
+ timeInfos: timeInfos,
23410
23501
  url: url,
23411
23502
  renderLevel: _this.options.renderLevel,
23412
23503
  storage: {},
@@ -23429,11 +23520,13 @@ var seed$1 = 1;
23429
23520
  _state.label = 12;
23430
23521
  case 12:
23431
23522
  totalTime = performance.now() - startTime;
23432
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23523
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
23433
23524
  window.clearTimeout(loadTimer);
23434
23525
  _this.removeTimer(loadTimer);
23435
23526
  scene.totalTime = totalTime;
23436
23527
  scene.startTime = startTime;
23528
+ // 各部分分段时长
23529
+ scene.timeInfos = timeInfos;
23437
23530
  return [
23438
23531
  2,
23439
23532
  scene
@@ -23972,6 +24065,7 @@ var tmpScale = new Vector3(1, 1, 1);
23972
24065
  function Camera(name, options) {
23973
24066
  if (options === void 0) options = {};
23974
24067
  this.name = name;
24068
+ this.fovScaleRatio = 1.0;
23975
24069
  this.viewMatrix = Matrix4.fromIdentity();
23976
24070
  this.projectionMatrix = Matrix4.fromIdentity();
23977
24071
  this.viewProjectionMatrix = Matrix4.fromIdentity();
@@ -23999,6 +24093,13 @@ var tmpScale = new Vector3(1, 1, 1);
23999
24093
  this.updateMatrix();
24000
24094
  }
24001
24095
  var _proto = Camera.prototype;
24096
+ _proto.setFovScaleRatio = function setFovScaleRatio(value) {
24097
+ this.fovScaleRatio = value;
24098
+ this.dirty = true;
24099
+ };
24100
+ _proto.getFovScaleRatio = function getFovScaleRatio() {
24101
+ return this.fovScaleRatio;
24102
+ };
24002
24103
  /**
24003
24104
  * 获取相机的视图变换矩阵
24004
24105
  * @return
@@ -24119,7 +24220,7 @@ var tmpScale = new Vector3(1, 1, 1);
24119
24220
  */ _proto.updateMatrix = function updateMatrix() {
24120
24221
  if (this.dirty) {
24121
24222
  var _this_options = this.options, fov = _this_options.fov, aspect = _this_options.aspect, near = _this_options.near, far = _this_options.far, clipMode = _this_options.clipMode, position = _this_options.position;
24122
- this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
24223
+ this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
24123
24224
  this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
24124
24225
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
24125
24226
  this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
@@ -24426,7 +24527,6 @@ var listOrder = 0;
24426
24527
  /**
24427
24528
  * 预合成的合成属性,在 content 中会被其元素属性覆盖
24428
24529
  */ this.refCompositionProps = new Map();
24429
- this.editorScaleRatio = 1.0;
24430
24530
  // TODO: 待优化
24431
24531
  this.assigned = false;
24432
24532
  /**
@@ -24463,11 +24563,12 @@ var listOrder = 0;
24463
24563
  this.renderer = renderer;
24464
24564
  this.texInfo = imageUsage != null ? imageUsage : {};
24465
24565
  this.event = event;
24466
- var _scene_startTime;
24566
+ var _scene_startTime, _scene_timeInfos_asyncCompile;
24467
24567
  this.statistic = {
24468
24568
  loadTime: totalTime != null ? totalTime : 0,
24469
24569
  loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
24470
- firstFrameTime: 0
24570
+ firstFrameTime: 0,
24571
+ precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
24471
24572
  };
24472
24573
  this.reusable = reusable;
24473
24574
  this.speed = speed;
@@ -24481,6 +24582,7 @@ var listOrder = 0;
24481
24582
  this.url = scene.url;
24482
24583
  this.assigned = true;
24483
24584
  this.globalTime = 0;
24585
+ this.interactive = true;
24484
24586
  this.onPlayerPause = onPlayerPause;
24485
24587
  this.onMessageItem = onMessageItem;
24486
24588
  this.onEnd = onEnd;
@@ -24910,7 +25012,7 @@ var listOrder = 0;
24910
25012
  * @param options - 最大求交数和求交时的回调
24911
25013
  */ _proto.hitTest = function hitTest(x, y, force, options) {
24912
25014
  var _this_rootItem_getComponent;
24913
- if (this.isDestroyed) {
25015
+ if (this.isDestroyed || !this.interactive) {
24914
25016
  return [];
24915
25017
  }
24916
25018
  var regions = [];
@@ -25231,6 +25333,15 @@ var listOrder = 0;
25231
25333
  */ function get() {
25232
25334
  return this.destroyed;
25233
25335
  }
25336
+ },
25337
+ {
25338
+ key: "editorScaleRatio",
25339
+ get: function get() {
25340
+ return this.camera.getFovScaleRatio();
25341
+ },
25342
+ set: function set(value) {
25343
+ this.camera.setFovScaleRatio(value);
25344
+ }
25234
25345
  }
25235
25346
  ]);
25236
25347
  return Composition;
@@ -25628,7 +25739,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
25628
25739
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
25629
25740
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
25630
25741
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
25631
- var version$1 = "2.0.0-alpha.20";
25742
+ var version$1 = "2.0.0-alpha.22";
25632
25743
  logger.info("Core version: " + version$1 + ".");
25633
25744
 
25634
25745
  var _obj;
@@ -26672,11 +26783,10 @@ var seed = 1;
26672
26783
  }
26673
26784
  }
26674
26785
  // @ts-expect-error
26675
- return _extends({
26786
+ return _extends({}, options, {
26676
26787
  target: target,
26677
26788
  format: THREE__namespace.RGBAFormat,
26678
- type: THREE__namespace.UnsignedByteType
26679
- }, options, {
26789
+ type: THREE__namespace.UnsignedByteType,
26680
26790
  minFilter: ThreeTexture.toThreeJsTextureFilter(options.minFilter),
26681
26791
  magFilter: ThreeTexture.toThreeJsTextureFilter(options.magFilter),
26682
26792
  wrapS: ThreeTexture.toThreeJsTextureWrap(options.wrapS),
@@ -27174,6 +27284,52 @@ exports.ThreeSpriteComponent = __decorate([
27174
27284
  effectsClass(DataType.SpriteComponent)
27175
27285
  ], exports.ThreeSpriteComponent);
27176
27286
 
27287
+ exports.ThreeTextComponent = /*#__PURE__*/ function(ThreeSpriteComponent) {
27288
+ _inherits(ThreeTextComponent, ThreeSpriteComponent);
27289
+ function ThreeTextComponent(engine, props) {
27290
+ var _this;
27291
+ _this = ThreeSpriteComponent.call(this, engine, props) || this;
27292
+ _this.isDirty = true;
27293
+ _this.canvas = canvasPool.getCanvas();
27294
+ canvasPool.saveCanvas(_this.canvas);
27295
+ _this.context = _this.canvas.getContext("2d", {
27296
+ willReadFrequently: true
27297
+ });
27298
+ if (!props) {
27299
+ return _possible_constructor_return(_this);
27300
+ }
27301
+ var options = props.options;
27302
+ _this.updateWithOptions(options);
27303
+ _this.updateTexture(false);
27304
+ return _this;
27305
+ }
27306
+ var _proto = ThreeTextComponent.prototype;
27307
+ _proto.update = function update(dt) {
27308
+ ThreeSpriteComponent.prototype.update.call(this, dt);
27309
+ this.updateTexture(false);
27310
+ };
27311
+ _proto.fromData = function fromData(data) {
27312
+ ThreeSpriteComponent.prototype.fromData.call(this, data);
27313
+ var options = data.options;
27314
+ this.updateWithOptions(options);
27315
+ // Text
27316
+ this.updateTexture(false);
27317
+ };
27318
+ _proto.updateWithOptions = function updateWithOptions(options) {
27319
+ // OVERRIDE by mixins
27320
+ };
27321
+ _proto.updateTexture = function updateTexture(flipY) {
27322
+ // OVERRIDE by mixins
27323
+ };
27324
+ return ThreeTextComponent;
27325
+ }(exports.ThreeSpriteComponent);
27326
+ exports.ThreeTextComponent = __decorate([
27327
+ effectsClass(DataType.TextComponent)
27328
+ ], exports.ThreeTextComponent);
27329
+ applyMixins(exports.ThreeTextComponent, [
27330
+ TextComponentBase
27331
+ ]);
27332
+
27177
27333
  setMaxSpriteMeshItemCount(8);
27178
27334
  /**
27179
27335
  * 图片的创建方法
@@ -27216,7 +27372,7 @@ setMaxSpriteMeshItemCount(8);
27216
27372
  */ Mesh.create = function(engine, props) {
27217
27373
  return new ThreeMesh(engine, props);
27218
27374
  };
27219
- var version = "2.0.0-alpha.20";
27375
+ var version = "2.0.0-alpha.22";
27220
27376
  logger.info("THREEJS plugin version: " + version + ".");
27221
27377
 
27222
27378
  exports.AbstractPlugin = AbstractPlugin;