@galacean/effects-core 2.0.0-alpha.20 → 2.0.0-alpha.21

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/camera.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import { Euler, Matrix4, Quaternion, Vector3 } from '@galacean/effects-math/es/core/index';
1
2
  import * as spec from '@galacean/effects-specification';
2
- import { Matrix4, Vector3, Euler, Quaternion } from '@galacean/effects-math/es/core/index';
3
3
  interface CameraOptionsBase {
4
4
  /**
5
5
  * 相机近平面
@@ -58,6 +58,10 @@ export interface CameraOptionsEx extends CameraOptionsBase {
58
58
  */
59
59
  export declare class Camera {
60
60
  name: string;
61
+ /**
62
+ * 编辑器用于缩放画布
63
+ */
64
+ fovScaleRatio: number;
61
65
  private options;
62
66
  private viewMatrix;
63
67
  private projectionMatrix;
@@ -1,5 +1,6 @@
1
- import type { Ray } from '@galacean/effects-math/es/core/index';
2
1
  import * as spec from '@galacean/effects-specification';
2
+ import type { Ray } from '@galacean/effects-math/es/core/ray';
3
+ import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
3
4
  import { Camera } from './camera';
4
5
  import { CompositionComponent } from './comp-vfx-item';
5
6
  import { CompositionSourceManager } from './composition-source-manager';
@@ -16,6 +17,7 @@ export interface CompositionStatistic {
16
17
  loadTime: number;
17
18
  loadStart: number;
18
19
  firstFrameTime: number;
20
+ precompileTime: number;
19
21
  }
20
22
  export interface MessageItem {
21
23
  id: string;
@@ -23,6 +25,12 @@ export interface MessageItem {
23
25
  phrase: number;
24
26
  compositionId: string;
25
27
  }
28
+ export interface CompItemClickedData {
29
+ name: string;
30
+ id: string;
31
+ hitPositions: Vector3[];
32
+ position: Vector3;
33
+ }
26
34
  /**
27
35
  *
28
36
  */
@@ -36,6 +44,7 @@ export interface CompositionProps {
36
44
  baseRenderOrder?: number;
37
45
  renderer: Renderer;
38
46
  onPlayerPause?: (item: VFXItem) => void;
47
+ onItemClicked?: (item: VFXItem) => void;
39
48
  onMessageItem?: (item: MessageItem) => void;
40
49
  onEnd?: (composition: Composition) => void;
41
50
  event?: EventSystem;
@@ -76,6 +85,11 @@ export declare class Composition implements Disposable, LostHandler {
76
85
  */
77
86
  keepResource: boolean;
78
87
  extraCamera: VFXItem;
88
+ /**
89
+ * 合成内的元素否允许点击、拖拽交互
90
+ * @since 1.6.0
91
+ */
92
+ interactive: boolean;
79
93
  /**
80
94
  * 合成结束行为是 spec.END_BEHAVIOR_PAUSE 或 spec.END_BEHAVIOR_PAUSE_AND_DESTROY 时执行的回调
81
95
  * @internal
@@ -89,6 +103,14 @@ export declare class Composition implements Disposable, LostHandler {
89
103
  * 合成中消息元素创建/销毁时触发的回调
90
104
  */
91
105
  onMessageItem?: (item: MessageItem) => void;
106
+ /**
107
+ * 合成中元素点击时触发的回调
108
+ * 注意:此接口随时可能下线,请务使用!
109
+ * @since 1.6.0
110
+ * @ignore
111
+ * @deprecated
112
+ */
113
+ onItemClicked?: (data: CompItemClickedData) => void;
92
114
  /**
93
115
  * 合成id
94
116
  */
@@ -149,7 +171,6 @@ export declare class Composition implements Disposable, LostHandler {
149
171
  * 合成全局时间
150
172
  */
151
173
  globalTime: number;
152
- editorScaleRatio: number;
153
174
  protected rendererOptions: MeshRendererOptions | null;
154
175
  protected assigned: boolean;
155
176
  /**
@@ -204,6 +225,8 @@ export declare class Composition implements Disposable, LostHandler {
204
225
  * 获取销毁状态
205
226
  */
206
227
  get isDestroyed(): boolean;
228
+ set editorScaleRatio(value: number);
229
+ get editorScaleRatio(): number;
207
230
  /**
208
231
  * 获取合成的时长
209
232
  */
package/dist/index.js 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.0.0-alpha.20
6
+ * Version: v2.0.0-alpha.21
7
7
  */
8
8
 
9
9
  'use strict';
@@ -4917,10 +4917,25 @@ var EventSystem = /*#__PURE__*/ function() {
4917
4917
  var getTouchEventValue = function(event, x, y, dx, dy) {
4918
4918
  if (dx === void 0) dx = 0;
4919
4919
  if (dy === void 0) dy = 0;
4920
- var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
4921
- var ts = performance.now();
4922
4920
  var vx = 0;
4923
4921
  var vy = 0;
4922
+ var ts = performance.now();
4923
+ if (!_this.target) {
4924
+ logger.error("Trigger TouchEvent after EventSystem is disposed.");
4925
+ return {
4926
+ x: x,
4927
+ y: y,
4928
+ vx: 0,
4929
+ vy: vy,
4930
+ dx: dx,
4931
+ dy: dy,
4932
+ ts: ts,
4933
+ width: 0,
4934
+ height: 0,
4935
+ origin: event
4936
+ };
4937
+ }
4938
+ var _this_target = _this.target, width = _this_target.width, height = _this_target.height;
4924
4939
  if (lastTouch) {
4925
4940
  var dt = ts - lastTouch.ts;
4926
4941
  vx = (dx - lastTouch.dx) / dt || 0;
@@ -13045,6 +13060,16 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13045
13060
  function InteractComponent() {
13046
13061
  var _this;
13047
13062
  _this = RendererComponent.apply(this, arguments) || this;
13063
+ /**
13064
+ * 拖拽的惯性衰减系数,范围[0, 1], 越大惯性越强
13065
+ */ _this.downgrade = 0.95;
13066
+ /**
13067
+ * 拖拽的距离映射系数,越大越容易拖动
13068
+ */ _this.dragRatio = [
13069
+ 1,
13070
+ 1
13071
+ ];
13072
+ /** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
13048
13073
  _this.getHitTestParams = function(force) {
13049
13074
  if (!_this.clickable) {
13050
13075
  return;
@@ -13096,9 +13121,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13096
13121
  if (!this.dragEvent || !this.bouncingArg) {
13097
13122
  return;
13098
13123
  }
13099
- var downgrade = 0.95;
13100
- this.bouncingArg.vx *= downgrade;
13101
- this.bouncingArg.vy *= downgrade;
13124
+ this.bouncingArg.vx *= this.downgrade;
13125
+ this.bouncingArg.vy *= this.downgrade;
13102
13126
  this.bouncingArg.dy += this.bouncingArg.vy;
13103
13127
  this.bouncingArg.dx += this.bouncingArg.vx;
13104
13128
  if (shouldIgnoreBouncing(this.bouncingArg)) {
@@ -13126,7 +13150,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13126
13150
  // OVERRIDE
13127
13151
  };
13128
13152
  _proto.handleDragMove = function handleDragMove(evt, event) {
13129
- if (!(evt && evt.cameraParam) || !this.item.composition) {
13153
+ if (!(evt == null ? void 0 : evt.cameraParam) || !this.canInteract() || !this.item.composition) {
13130
13154
  return;
13131
13155
  }
13132
13156
  var options = this.item.props.content.options;
@@ -13137,8 +13161,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13137
13161
  var sp = Math.tan(fov * Math.PI / 180 / 2) * Math.abs(depth);
13138
13162
  var height = dy * sp;
13139
13163
  var width = dx * sp;
13140
- var nx = position[0] - width;
13141
- var ny = position[1] - height;
13164
+ var nx = position[0] - this.dragRatio[0] * width;
13165
+ var ny = position[1] - this.dragRatio[1] * height;
13142
13166
  if (options.dxRange) {
13143
13167
  var _options_dxRange = options.dxRange, min = _options_dxRange[0], max = _options_dxRange[1];
13144
13168
  nx = clamp$1(nx, min, max);
@@ -13166,6 +13190,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13166
13190
  var handlerMap = {
13167
13191
  touchstart: function(event) {
13168
13192
  var _this_item_composition;
13193
+ if (!_this.canInteract()) {
13194
+ return;
13195
+ }
13169
13196
  _this.dragEvent = null;
13170
13197
  _this.bouncingArg = null;
13171
13198
  var camera = (_this_item_composition = _this.item.composition) == null ? void 0 : _this_item_composition.camera;
@@ -13187,6 +13214,9 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13187
13214
  _this.bouncingArg = event;
13188
13215
  },
13189
13216
  touchend: function(event) {
13217
+ if (!_this.canInteract()) {
13218
+ return;
13219
+ }
13190
13220
  var bouncingArg = _this.bouncingArg;
13191
13221
  if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
13192
13222
  var speed = 5;
@@ -13229,6 +13259,25 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13229
13259
  RendererComponent.prototype.fromData.call(this, data);
13230
13260
  this.interactData = data;
13231
13261
  };
13262
+ _proto.canInteract = function canInteract() {
13263
+ var _this_item_composition;
13264
+ return Boolean((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.interactive) && this._interactive;
13265
+ };
13266
+ _create_class(InteractComponent, [
13267
+ {
13268
+ key: "interactive",
13269
+ get: function get() {
13270
+ return this._interactive;
13271
+ },
13272
+ set: function set(enable) {
13273
+ this._interactive = enable;
13274
+ if (!enable) {
13275
+ // 立刻停止惯性滑动
13276
+ this.bouncingArg = null;
13277
+ }
13278
+ }
13279
+ }
13280
+ ]);
13232
13281
  return InteractComponent;
13233
13282
  }(RendererComponent);
13234
13283
  exports.InteractComponent = __decorate([
@@ -16745,17 +16794,12 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16745
16794
  _proto.onEnd = function onEnd(particle) {};
16746
16795
  _proto.onIterate = function onIterate(particle) {};
16747
16796
  _proto.initPoint = function initPoint(data) {
16748
- var _this_item_composition, _this_item_composition1;
16749
16797
  var options = this.options;
16750
16798
  var lifetime = this.lifetime;
16751
16799
  var shape = this.shape;
16752
16800
  var speed = options.startSpeed.getValue(lifetime);
16753
16801
  var matrix4 = options.particleFollowParent ? this.transform.getMatrix() : this.transform.getWorldMatrix();
16754
16802
  var pointPosition = data.position;
16755
- if (((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
16756
- pointPosition.x /= this.item.composition.editorScaleRatio;
16757
- pointPosition.y /= this.item.composition.editorScaleRatio;
16758
- }
16759
16803
  // 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
16760
16804
  var position = matrix4.transformPoint(pointPosition, new Vector3());
16761
16805
  var transform = new Transform({
@@ -16836,10 +16880,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16836
16880
  size.x *= tempScale.x;
16837
16881
  size.y *= tempScale.y;
16838
16882
  }
16839
- if (((_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.renderer.env) === PLAYER_OPTIONS_ENV_EDITOR) {
16840
- size.x /= this.item.composition.editorScaleRatio;
16841
- size.y /= this.item.composition.editorScaleRatio;
16842
- }
16843
16883
  transform.setScale(size.x, size.y, 1);
16844
16884
  return {
16845
16885
  size: size,
@@ -19395,21 +19435,33 @@ var TextLayout = /*#__PURE__*/ function() {
19395
19435
  this.lineHeight = lineHeight;
19396
19436
  }
19397
19437
  var _proto = TextLayout.prototype;
19398
- _proto.getOffsetY = function getOffsetY(style) {
19399
- var offsetY = 0;
19400
- var offset = (style.fontSize + style.outlineWidth) * style.fontScale;
19438
+ /**
19439
+ * 获取初始的行高偏移值
19440
+ * @param style - 字体基础数据
19441
+ * @param lineCount - 渲染行数
19442
+ * @param lineHeight - 渲染时的字体行高
19443
+ * @param fontSize - 渲染时的字体大小
19444
+ * @returns - 行高偏移值
19445
+ */ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize) {
19446
+ var outlineWidth = style.outlineWidth, fontScale = style.fontScale;
19447
+ // /3 计算Y轴偏移量,以匹配编辑器行为
19448
+ var offsetY = (lineHeight - fontSize) / 3;
19449
+ // 计算基础偏移量
19450
+ var baseOffset = fontSize + outlineWidth * fontScale;
19451
+ var commonCalculation = lineHeight * (lineCount - 1);
19452
+ var offsetResult = 0;
19401
19453
  switch(this.textBaseline){
19402
19454
  case TextBaseline.top:
19403
- offsetY = offset;
19455
+ offsetResult = baseOffset + offsetY;
19404
19456
  break;
19405
19457
  case TextBaseline.middle:
19406
- offsetY = (this.height + offset) / 2; // fonSize;
19458
+ offsetResult = (this.height * fontScale - commonCalculation + baseOffset) / 2;
19407
19459
  break;
19408
19460
  case TextBaseline.bottom:
19409
- offsetY = this.height - offset / 2;
19461
+ offsetResult = this.height * fontScale - commonCalculation - offsetY;
19410
19462
  break;
19411
19463
  }
19412
- return offsetY;
19464
+ return offsetResult;
19413
19465
  };
19414
19466
  _proto.getOffsetX = function getOffsetX(style, maxWidth) {
19415
19467
  var offsetX = 0;
@@ -19567,6 +19619,9 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19567
19619
  var _this;
19568
19620
  _this = SpriteComponent.call(this, engine, props) || this;
19569
19621
  _this.isDirty = true;
19622
+ /**
19623
+ * 文本行数
19624
+ */ _this.lineCount = 0;
19570
19625
  _this.canvas = canvasPool.getCanvas();
19571
19626
  canvasPool.saveCanvas(_this.canvas);
19572
19627
  _this.context = _this.canvas.getContext("2d", {
@@ -19610,6 +19665,31 @@ var TextComponentBase = /*#__PURE__*/ function() {
19610
19665
  this.textStyle = new TextStyle(options);
19611
19666
  this.textLayout = new TextLayout(options);
19612
19667
  this.text = options.text;
19668
+ this.lineCount = this.getLineCount(options.text, true);
19669
+ };
19670
+ _proto.getLineCount = function getLineCount(text, init) {
19671
+ var context = this.context;
19672
+ var letterSpace = this.textLayout.letterSpace;
19673
+ var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
19674
+ var width = this.textLayout.width + this.textStyle.fontOffset;
19675
+ var lineCount = 1;
19676
+ var x = 0;
19677
+ for(var i = 0; i < text.length; i++){
19678
+ var _context_measureText;
19679
+ var str = text[i];
19680
+ var _context_measureText_width;
19681
+ 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;
19682
+ // 和浏览器行为保持一致
19683
+ x += letterSpace;
19684
+ if (x + textMetrics > width && i > 0 || str === "\n") {
19685
+ lineCount++;
19686
+ x = 0;
19687
+ }
19688
+ if (str !== "\n") {
19689
+ x += textMetrics;
19690
+ }
19691
+ }
19692
+ return lineCount;
19613
19693
  };
19614
19694
  /**
19615
19695
  * 设置字号大小
@@ -19656,6 +19736,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
19656
19736
  return;
19657
19737
  }
19658
19738
  this.text = value;
19739
+ this.lineCount = this.getLineCount(value, false);
19659
19740
  this.isDirty = true;
19660
19741
  };
19661
19742
  /**
@@ -19818,10 +19899,8 @@ var TextComponentBase = /*#__PURE__*/ function() {
19818
19899
  // 文本颜色
19819
19900
  context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
19820
19901
  var charsInfo = [];
19821
- // /3 是为了和编辑器行为保持一致
19822
- var offsetY = (lineHeight - fontSize) / 3;
19823
19902
  var x = 0;
19824
- var y = layout.getOffsetY(style) + offsetY;
19903
+ var y = layout.getOffsetY(style, this.lineCount, lineHeight, fontSize);
19825
19904
  var charsArray = [];
19826
19905
  var charOffsetX = [];
19827
19906
  for(var i = 0; i < this.char.length; i++){
@@ -22384,10 +22463,6 @@ function getStandardCameraContent(model) {
22384
22463
  ]
22385
22464
  });
22386
22465
  }
22387
- // gizmo 的 target id 转换为新的 item guid
22388
- if (item.content.options.target) {
22389
- item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
22390
- }
22391
22466
  // 修正老 json 的 item.pluginName
22392
22467
  if (item.pn !== undefined) {
22393
22468
  var pn = item.pn;
@@ -22405,6 +22480,10 @@ function getStandardCameraContent(model) {
22405
22480
  //@ts-expect-error
22406
22481
  item.type = "orientation-transformer";
22407
22482
  }
22483
+ // gizmo 的 target id 转换为新的 item guid
22484
+ if (item.content.options.target && item.pluginName === "editor-gizmo") {
22485
+ item.content.options.target = itemOldIdToGuidMap[item.content.options.target];
22486
+ }
22408
22487
  // Spine 元素转为 guid 索引
22409
22488
  if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
22410
22489
  convertSpineData(json.spines[item.content.options.spine], item.content, result);
@@ -23211,26 +23290,27 @@ var seed = 1;
23211
23290
  */ _proto.loadScene = function loadScene(url, renderer, options) {
23212
23291
  var _this = this;
23213
23292
  return _async_to_generator(function() {
23214
- var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfos, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
23293
+ var _gpuInstance_detail, rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_asyncShaderCompile, asyncShaderCompile, _gpuInstance_detail_compressedTexture, compressedTexture, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
23215
23294
  return __generator(this, function(_state) {
23216
23295
  assetUrl = isString(url) ? url : _this.id;
23217
23296
  startTime = performance.now();
23218
- timeInfos = [];
23297
+ timeInfoMessages = [];
23219
23298
  gpuInstance = renderer == null ? void 0 : renderer.engine.gpuCapability;
23220
23299
  asyncShaderCompile = (_gpuInstance_detail_asyncShaderCompile = gpuInstance == null ? void 0 : (_gpuInstance_detail = gpuInstance.detail) == null ? void 0 : _gpuInstance_detail.asyncShaderCompile) != null ? _gpuInstance_detail_asyncShaderCompile : false;
23221
23300
  compressedTexture = (_gpuInstance_detail_compressedTexture = gpuInstance == null ? void 0 : gpuInstance.detail.compressedTexture) != null ? _gpuInstance_detail_compressedTexture : exports.COMPRESSED_TEXTURE.NONE;
23301
+ timeInfos = {};
23222
23302
  cancelLoading = false;
23223
23303
  waitPromise = new Promise(function(resolve, reject) {
23224
23304
  loadTimer = window.setTimeout(function() {
23225
23305
  cancelLoading = true;
23226
23306
  _this.removeTimer(loadTimer);
23227
23307
  var totalTime = performance.now() - startTime;
23228
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23308
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + "."));
23229
23309
  }, _this.timeout * 1000);
23230
23310
  _this.timers.push(loadTimer);
23231
23311
  });
23232
23312
  hookTimeInfo = /*#__PURE__*/ _async_to_generator(function(label, func) {
23233
- var st, result, e;
23313
+ var st, result, time, e;
23234
23314
  return __generator(this, function(_state) {
23235
23315
  switch(_state.label){
23236
23316
  case 0:
@@ -23253,7 +23333,9 @@ var seed = 1;
23253
23333
  ];
23254
23334
  case 2:
23255
23335
  result = _state.sent();
23256
- timeInfos.push("[" + label + ": " + (performance.now() - st).toFixed(2) + "]");
23336
+ time = performance.now() - st;
23337
+ timeInfoMessages.push("[" + label + ": " + time.toFixed(2) + "]");
23338
+ timeInfos[label] = time;
23257
23339
  return [
23258
23340
  2,
23259
23341
  result
@@ -23352,7 +23434,7 @@ var seed = 1;
23352
23434
  hookTimeInfo("processImages", function() {
23353
23435
  return _this.processImages(images1, compressedTexture);
23354
23436
  }),
23355
- hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + " compile", function() {
23437
+ hookTimeInfo("" + (asyncShaderCompile ? "async" : "sync") + "Compile", function() {
23356
23438
  return _this.precompile(compositions, pluginSystem, renderer, options);
23357
23439
  })
23358
23440
  ])
@@ -23385,6 +23467,7 @@ var seed = 1;
23385
23467
  loadedTextures = _state.sent();
23386
23468
  _this.updateSceneData(jsonScene.items);
23387
23469
  scene = {
23470
+ timeInfos: timeInfos,
23388
23471
  url: url,
23389
23472
  renderLevel: _this.options.renderLevel,
23390
23473
  storage: {},
@@ -23407,11 +23490,13 @@ var seed = 1;
23407
23490
  _state.label = 12;
23408
23491
  case 12:
23409
23492
  totalTime = performance.now() - startTime;
23410
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23493
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
23411
23494
  window.clearTimeout(loadTimer);
23412
23495
  _this.removeTimer(loadTimer);
23413
23496
  scene.totalTime = totalTime;
23414
23497
  scene.startTime = startTime;
23498
+ // 各部分分段时长
23499
+ scene.timeInfos = timeInfos;
23415
23500
  return [
23416
23501
  2,
23417
23502
  scene
@@ -23950,6 +24035,9 @@ var tmpScale = new Vector3(1, 1, 1);
23950
24035
  function Camera(name, options) {
23951
24036
  if (options === void 0) options = {};
23952
24037
  this.name = name;
24038
+ this./**
24039
+ * 编辑器用于缩放画布
24040
+ */ fovScaleRatio = 1.0;
23953
24041
  this.viewMatrix = Matrix4.fromIdentity();
23954
24042
  this.projectionMatrix = Matrix4.fromIdentity();
23955
24043
  this.viewProjectionMatrix = Matrix4.fromIdentity();
@@ -24097,7 +24185,7 @@ var tmpScale = new Vector3(1, 1, 1);
24097
24185
  */ _proto.updateMatrix = function updateMatrix() {
24098
24186
  if (this.dirty) {
24099
24187
  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;
24100
- this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
24188
+ this.projectionMatrix.perspective(fov * DEG2RAD * this.fovScaleRatio, aspect, near, far, clipMode === CameraClipMode.portrait);
24101
24189
  this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
24102
24190
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
24103
24191
  this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
@@ -24404,7 +24492,6 @@ var listOrder = 0;
24404
24492
  /**
24405
24493
  * 预合成的合成属性,在 content 中会被其元素属性覆盖
24406
24494
  */ this.refCompositionProps = new Map();
24407
- this.editorScaleRatio = 1.0;
24408
24495
  // TODO: 待优化
24409
24496
  this.assigned = false;
24410
24497
  /**
@@ -24441,11 +24528,12 @@ var listOrder = 0;
24441
24528
  this.renderer = renderer;
24442
24529
  this.texInfo = imageUsage != null ? imageUsage : {};
24443
24530
  this.event = event;
24444
- var _scene_startTime;
24531
+ var _scene_startTime, _scene_timeInfos_asyncCompile;
24445
24532
  this.statistic = {
24446
24533
  loadTime: totalTime != null ? totalTime : 0,
24447
24534
  loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
24448
- firstFrameTime: 0
24535
+ firstFrameTime: 0,
24536
+ precompileTime: (_scene_timeInfos_asyncCompile = scene.timeInfos["asyncCompile"]) != null ? _scene_timeInfos_asyncCompile : scene.timeInfos["syncCompile"]
24449
24537
  };
24450
24538
  this.reusable = reusable;
24451
24539
  this.speed = speed;
@@ -24459,6 +24547,7 @@ var listOrder = 0;
24459
24547
  this.url = scene.url;
24460
24548
  this.assigned = true;
24461
24549
  this.globalTime = 0;
24550
+ this.interactive = true;
24462
24551
  this.onPlayerPause = onPlayerPause;
24463
24552
  this.onMessageItem = onMessageItem;
24464
24553
  this.onEnd = onEnd;
@@ -24888,7 +24977,7 @@ var listOrder = 0;
24888
24977
  * @param options - 最大求交数和求交时的回调
24889
24978
  */ _proto.hitTest = function hitTest(x, y, force, options) {
24890
24979
  var _this_rootItem_getComponent;
24891
- if (this.isDestroyed) {
24980
+ if (this.isDestroyed || !this.interactive) {
24892
24981
  return [];
24893
24982
  }
24894
24983
  var regions = [];
@@ -25209,6 +25298,15 @@ var listOrder = 0;
25209
25298
  */ function get() {
25210
25299
  return this.destroyed;
25211
25300
  }
25301
+ },
25302
+ {
25303
+ key: "editorScaleRatio",
25304
+ get: function get() {
25305
+ return this.camera.fovScaleRatio;
25306
+ },
25307
+ set: function set(value) {
25308
+ this.camera.fovScaleRatio = value;
25309
+ }
25212
25310
  }
25213
25311
  ]);
25214
25312
  return Composition;
@@ -25606,7 +25704,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
25606
25704
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
25607
25705
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
25608
25706
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
25609
- var version = "2.0.0-alpha.20";
25707
+ var version = "2.0.0-alpha.21";
25610
25708
  logger.info("Core version: " + version + ".");
25611
25709
 
25612
25710
  exports.AbstractPlugin = AbstractPlugin;