@vvfx/sdk 0.2.2-beta.12 → 0.2.2-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: TODO
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 赤芍,何即,不择,意绮
6
- * Version: v0.2.2-beta.12
6
+ * Version: v0.2.2-beta.16
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
@@ -60414,6 +60414,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
60414
60414
  }
60415
60415
  }
60416
60416
  var isLocked = (_this_getSDKItem = this.getSDKItem(playerItem.getInstanceId())) == null ? void 0 : _this_getSDKItem.isLocked;
60417
+ // 优先通过 ID 查找现有 SDKItem,获取其 SDKItemType
60418
+ var existingSDKItem = this.getSDKItem(playerItem.getInstanceId());
60417
60419
  // 创建基础选项
60418
60420
  var baseOptions = {
60419
60421
  id: playerItem.getInstanceId(),
@@ -60425,12 +60427,11 @@ var PageDataUtils = /*#__PURE__*/ function() {
60425
60427
  endBehavior: playerItem.endBehavior,
60426
60428
  visible: isVisible,
60427
60429
  isLocked: isLocked,
60428
- isCoreEditable: isCoreEditable
60430
+ isCoreEditable: isCoreEditable,
60431
+ extension: existingSDKItem == null ? void 0 : existingSDKItem.extension
60429
60432
  };
60430
60433
  // 根据类型创建对应的 SDKItem 类实例
60431
60434
  var sdkItem;
60432
- // 优先通过 ID 查找现有 SDKItem,获取其 SDKItemType
60433
- var existingSDKItem = this.getSDKItem(playerItem.getInstanceId());
60434
60435
  // 如果找到了现有 SDKItem,根据 SDKItemType 创建
60435
60436
  // 将类型转换为 string 进行比较
60436
60437
  if ((existingSDKItem == null ? void 0 : existingSDKItem.type) === SDKItemType.GENERATOR) {
@@ -94004,18 +94005,22 @@ var SDK = /*#__PURE__*/ function() {
94004
94005
  _proto.initPlayer = function initPlayer(mode) {
94005
94006
  var _this = this;
94006
94007
  var playerContainer = document.createElement('div');
94007
- var _ref = mode === 'editor' ? [
94008
- this._container.clientWidth,
94009
- this._container.clientHeight
94010
- ] : [
94008
+ var _ref = mode === 'template' ? [
94011
94009
  this._container.offsetWidth,
94012
94010
  this._container.offsetHeight
94011
+ ] : [
94012
+ document.documentElement.clientWidth,
94013
+ document.documentElement.clientHeight
94013
94014
  ], width = _ref[0], height = _ref[1];
94014
94015
  this._playerContainer = playerContainer;
94015
94016
  this._playerContainer.id = 'player-container';
94016
94017
  this._playerContainer.style.position = 'absolute';
94017
94018
  this._playerContainer.style.width = "" + width + "px";
94018
94019
  this._playerContainer.style.height = "" + height + "px";
94020
+ if (mode === 'editor') {
94021
+ this._playerContainer.style.left = '0px';
94022
+ this._playerContainer.style.top = '0px';
94023
+ }
94019
94024
  this._container.appendChild(playerContainer);
94020
94025
  this.player = new Player({
94021
94026
  container: this._playerContainer,
@@ -94074,6 +94079,7 @@ var SDK = /*#__PURE__*/ function() {
94074
94079
  _this._gestureHandler.dispose();
94075
94080
  setTimeout(function() {
94076
94081
  return _async_to_generator(function() {
94082
+ var _this_pageData, _this_pageData1, itemExtension;
94077
94083
  return _ts_generator(this, function(_state) {
94078
94084
  switch(_state.label){
94079
94085
  case 0:
@@ -94081,12 +94087,22 @@ var SDK = /*#__PURE__*/ function() {
94081
94087
  this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
94082
94088
  this._gestureHandler = new GestureHandler(this._container);
94083
94089
  this.syncCanvasLayerOrder();
94090
+ itemExtension = {};
94091
+ (_this_pageData = this.pageData) == null ? void 0 : _this_pageData.items.forEach(function(item) {
94092
+ itemExtension[item.id] = item.getAllExtension();
94093
+ });
94084
94094
  return [
94085
94095
  4,
94086
94096
  this.runByPageData(this.pageData)
94087
94097
  ];
94088
94098
  case 1:
94089
94099
  _state.sent();
94100
+ (_this_pageData1 = this.pageData) == null ? void 0 : _this_pageData1.items.forEach(function(item) {
94101
+ var extension = itemExtension[item.id];
94102
+ if (extension) {
94103
+ item.setExtensions(extension);
94104
+ }
94105
+ });
94090
94106
  this._eventEmitter.emit('viewRebuildFinish');
94091
94107
  return [
94092
94108
  2