@vvfx/sdk 0.2.2-beta.9 → 0.2.3
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/config.d.ts +1 -24
- package/dist/gesture-handler/gizmo/mask-gizmo.d.ts +15 -3
- package/dist/gesture-handler/gizmo/type.d.ts +5 -1
- package/dist/gesture-handler/src/gesture-handler.d.ts +1 -1
- package/dist/html-overlay/auto-height-runtime.d.ts +0 -5
- package/dist/html-overlay/manager.d.ts +0 -53
- package/dist/html-overlay/overlay-transform.d.ts +1 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +563 -1060
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +563 -1060
- package/dist/index.mjs.map +1 -1
- package/dist/sdk-item/card-item.d.ts +6 -1
- package/dist/sdk-item/text-item.d.ts +2 -0
- package/dist/sdk.d.ts +4 -24
- package/dist/types.d.ts +22 -17
- package/dist/utils/page-data-utils.d.ts +9 -4
- package/package.json +2 -2
- package/dist/layer-order.d.ts +0 -7
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: TODO
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 赤芍,何即,不择,意绮
|
|
6
|
-
* Version: v0.2.
|
|
6
|
+
* Version: v0.2.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -24032,9 +24032,21 @@ function getUniqueName(name, names) {
|
|
|
24032
24032
|
};
|
|
24033
24033
|
_create_class(TextItem, [
|
|
24034
24034
|
{
|
|
24035
|
-
key: "
|
|
24035
|
+
key: "pixelWidth",
|
|
24036
24036
|
get: // ==================== 便捷访问器 ====================
|
|
24037
|
-
|
|
24037
|
+
function get() {
|
|
24038
|
+
return this.width;
|
|
24039
|
+
}
|
|
24040
|
+
},
|
|
24041
|
+
{
|
|
24042
|
+
key: "pixelHeight",
|
|
24043
|
+
get: function get() {
|
|
24044
|
+
return this.height;
|
|
24045
|
+
}
|
|
24046
|
+
},
|
|
24047
|
+
{
|
|
24048
|
+
key: "text",
|
|
24049
|
+
get: /**
|
|
24038
24050
|
* @description 文本内容
|
|
24039
24051
|
*/ function get() {
|
|
24040
24052
|
return this.property.text;
|
|
@@ -25172,150 +25184,6 @@ var ItemOrderAction = /*#__PURE__*/ function(ItemOrderAction) {
|
|
|
25172
25184
|
return _instanceof(obj, FrameItem);
|
|
25173
25185
|
}
|
|
25174
25186
|
|
|
25175
|
-
/**
|
|
25176
|
-
* @description 卡片元素 SDKItem 类
|
|
25177
|
-
* @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
|
|
25178
|
-
* @description 支持设置卡片类型(cardType)
|
|
25179
|
-
*/ var CardItem = /*#__PURE__*/ function(BaseItem) {
|
|
25180
|
-
_inherits(CardItem, BaseItem);
|
|
25181
|
-
function CardItem(options) {
|
|
25182
|
-
var _this;
|
|
25183
|
-
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
|
25184
|
-
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5;
|
|
25185
|
-
_this = BaseItem.call(this, options) || this, /**
|
|
25186
|
-
* @description 元素类型
|
|
25187
|
-
*/ _this.type = SDKItemType.CARD;
|
|
25188
|
-
// 初始化属性(包含 cardType)
|
|
25189
|
-
_this.property = {
|
|
25190
|
-
position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
|
|
25191
|
-
0,
|
|
25192
|
-
0
|
|
25193
|
-
],
|
|
25194
|
-
rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
|
|
25195
|
-
0,
|
|
25196
|
-
0,
|
|
25197
|
-
0
|
|
25198
|
-
],
|
|
25199
|
-
width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
|
|
25200
|
-
height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
|
|
25201
|
-
scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
|
|
25202
|
-
1,
|
|
25203
|
-
1
|
|
25204
|
-
],
|
|
25205
|
-
cardType: (_ref5 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref5 : 'unknown'
|
|
25206
|
-
};
|
|
25207
|
-
return _this;
|
|
25208
|
-
}
|
|
25209
|
-
var _proto = CardItem.prototype;
|
|
25210
|
-
// ==================== 实现抽象方法 ====================
|
|
25211
|
-
/**
|
|
25212
|
-
* @description 转换为 CardCreateInfo
|
|
25213
|
-
* @param withParent 是否包含父节点ID
|
|
25214
|
-
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
25215
|
-
var extension = this.getAllExtension();
|
|
25216
|
-
return {
|
|
25217
|
-
type: SDKItemType.CARD,
|
|
25218
|
-
id: this.id,
|
|
25219
|
-
name: this.name,
|
|
25220
|
-
parentId: withParent ? this.parentId : undefined,
|
|
25221
|
-
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
25222
|
-
property: deepClone(this.property)
|
|
25223
|
-
};
|
|
25224
|
-
};
|
|
25225
|
-
/**
|
|
25226
|
-
* @description 克隆 SDKItem
|
|
25227
|
-
*/ _proto.clone = function clone() {
|
|
25228
|
-
return new CardItem({
|
|
25229
|
-
id: EFFECTS.generateGUID(),
|
|
25230
|
-
name: this.name,
|
|
25231
|
-
parentId: this.parentId,
|
|
25232
|
-
duration: this.duration,
|
|
25233
|
-
delay: this.delay,
|
|
25234
|
-
endBehavior: this.endBehavior,
|
|
25235
|
-
isLocked: this.isLocked,
|
|
25236
|
-
isCoreEditable: this.isCoreEditable,
|
|
25237
|
-
property: deepClone(this.property),
|
|
25238
|
-
extension: this.getAllExtension()
|
|
25239
|
-
});
|
|
25240
|
-
};
|
|
25241
|
-
_create_class(CardItem, [
|
|
25242
|
-
{
|
|
25243
|
-
key: "cardType",
|
|
25244
|
-
get: // ==================== cardType 访问器 ====================
|
|
25245
|
-
/**
|
|
25246
|
-
* @description 卡片类型
|
|
25247
|
-
*/ function get() {
|
|
25248
|
-
return this.property.cardType;
|
|
25249
|
-
},
|
|
25250
|
-
set: function set(value) {
|
|
25251
|
-
this.property.cardType = value;
|
|
25252
|
-
}
|
|
25253
|
-
},
|
|
25254
|
-
{
|
|
25255
|
-
key: "position",
|
|
25256
|
-
get: // ==================== 便捷访问器 ====================
|
|
25257
|
-
/**
|
|
25258
|
-
* @description 位置
|
|
25259
|
-
*/ function get() {
|
|
25260
|
-
return this.property.position;
|
|
25261
|
-
},
|
|
25262
|
-
set: function set(value) {
|
|
25263
|
-
this.property.position = value;
|
|
25264
|
-
}
|
|
25265
|
-
},
|
|
25266
|
-
{
|
|
25267
|
-
key: "width",
|
|
25268
|
-
get: /**
|
|
25269
|
-
* @description 宽度
|
|
25270
|
-
*/ function get() {
|
|
25271
|
-
return this.property.width;
|
|
25272
|
-
},
|
|
25273
|
-
set: function set(value) {
|
|
25274
|
-
this.property.width = value;
|
|
25275
|
-
}
|
|
25276
|
-
},
|
|
25277
|
-
{
|
|
25278
|
-
key: "height",
|
|
25279
|
-
get: /**
|
|
25280
|
-
* @description 高度
|
|
25281
|
-
*/ function get() {
|
|
25282
|
-
return this.property.height;
|
|
25283
|
-
},
|
|
25284
|
-
set: function set(value) {
|
|
25285
|
-
this.property.height = value;
|
|
25286
|
-
}
|
|
25287
|
-
},
|
|
25288
|
-
{
|
|
25289
|
-
key: "rotation",
|
|
25290
|
-
get: /**
|
|
25291
|
-
* @description 旋转(二维旋转角度)
|
|
25292
|
-
*/ function get() {
|
|
25293
|
-
return this.property.rotation[2];
|
|
25294
|
-
},
|
|
25295
|
-
set: function set(value) {
|
|
25296
|
-
this.property.rotation[2] = value;
|
|
25297
|
-
}
|
|
25298
|
-
},
|
|
25299
|
-
{
|
|
25300
|
-
key: "fullRotation",
|
|
25301
|
-
get: /**
|
|
25302
|
-
* @description 完整旋转(包含 x, y, z)
|
|
25303
|
-
*/ function get() {
|
|
25304
|
-
return this.property.rotation;
|
|
25305
|
-
},
|
|
25306
|
-
set: function set(value) {
|
|
25307
|
-
this.property.rotation = value;
|
|
25308
|
-
}
|
|
25309
|
-
}
|
|
25310
|
-
]);
|
|
25311
|
-
return CardItem;
|
|
25312
|
-
}(BaseItem);
|
|
25313
|
-
/**
|
|
25314
|
-
* @description 类型守卫:检查是否是 CardItem
|
|
25315
|
-
*/ function isCardItem(obj) {
|
|
25316
|
-
return _instanceof(obj, CardItem);
|
|
25317
|
-
}
|
|
25318
|
-
|
|
25319
25187
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
25320
25188
|
try {
|
|
25321
25189
|
var info = gen[key](arg);
|
|
@@ -47317,7 +47185,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
47317
47185
|
var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
|
|
47318
47186
|
var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
|
|
47319
47187
|
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, regionBoxColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionBoxColor, regionBoxAlpha = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionBoxAlpha, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, regionWireframeWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeWidth, regionWireframeColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeColor, regionWireframeAlpha = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeAlpha;
|
|
47320
|
-
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())
|
|
47188
|
+
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
|
|
47321
47189
|
this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
|
|
47322
47190
|
this.graphics.drawBox(preSelectedItemBox);
|
|
47323
47191
|
}
|
|
@@ -55577,16 +55445,6 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55577
55445
|
newWidth,
|
|
55578
55446
|
newHeight
|
|
55579
55447
|
], translation1);
|
|
55580
|
-
} else if (selectedItem && selectedItems.length === 1 && isCardItem(selectedItem)) {
|
|
55581
|
-
void this._pageDataUtils.setItemProperty({
|
|
55582
|
-
itemId: selectedItem.id,
|
|
55583
|
-
type: SDKItemType.CARD,
|
|
55584
|
-
property: {
|
|
55585
|
-
width: selectedItem.width * resultScalar1.x,
|
|
55586
|
-
height: selectedItem.height * resultScalar1.y
|
|
55587
|
-
}
|
|
55588
|
-
});
|
|
55589
|
-
this._pageDataUtils.moveItem(selectedItem.id, translation1);
|
|
55590
55448
|
} else {
|
|
55591
55449
|
// 普通元素的缩放逻辑
|
|
55592
55450
|
selectedItems.forEach(function(item) {
|
|
@@ -55911,7 +55769,6 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55911
55769
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55912
55770
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55913
55771
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55914
|
-
var isSingleCardItem = isCardItem(selectedItem);
|
|
55915
55772
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55916
55773
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55917
55774
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55951,11 +55808,9 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55951
55808
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55952
55809
|
// 根据box获取边缘线
|
|
55953
55810
|
var corners = this.wireframe.box.corners;
|
|
55954
|
-
|
|
55955
|
-
|
|
55956
|
-
|
|
55957
|
-
});
|
|
55958
|
-
}
|
|
55811
|
+
corners.forEach(function(corner, i) {
|
|
55812
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55813
|
+
});
|
|
55959
55814
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55960
55815
|
// 成组暂不支持缩放
|
|
55961
55816
|
if (selectedItems.length === 1) {
|
|
@@ -56748,6 +56603,10 @@ var cursorMap = {
|
|
|
56748
56603
|
type: 'preset',
|
|
56749
56604
|
content: 'crosshair'
|
|
56750
56605
|
},
|
|
56606
|
+
'box-select': {
|
|
56607
|
+
type: 'preset',
|
|
56608
|
+
content: 'crosshair'
|
|
56609
|
+
},
|
|
56751
56610
|
'text-rotation': {
|
|
56752
56611
|
type: 'svg',
|
|
56753
56612
|
content: 'default',
|
|
@@ -59806,6 +59665,12 @@ var MAX_ITEM_DISTANCE_THRESHOLD = 100000;
|
|
|
59806
59665
|
/**
|
|
59807
59666
|
* @description SDKItem position 属性的数字精度(保留小数位数)
|
|
59808
59667
|
*/ var POSITION_PRECISION = 4;
|
|
59668
|
+
function isCardHTMLContentValue(value) {
|
|
59669
|
+
return (value == null ? void 0 : value.kind) === 'inline' || (value == null ? void 0 : value.kind) === 'dom' || (value == null ? void 0 : value.kind) === 'document';
|
|
59670
|
+
}
|
|
59671
|
+
function isCardHTMLValue(value) {
|
|
59672
|
+
return isCardHTMLContentValue(value == null ? void 0 : value.content);
|
|
59673
|
+
}
|
|
59809
59674
|
var PageDataUtils = /*#__PURE__*/ function() {
|
|
59810
59675
|
function PageDataUtils(player, container, emitter, sdk) {
|
|
59811
59676
|
this.player = player;
|
|
@@ -60623,10 +60488,11 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60623
60488
|
property: property
|
|
60624
60489
|
}));
|
|
60625
60490
|
} else if ((existingSDKItem == null ? void 0 : existingSDKItem.type) == SDKItemType.CARD) {
|
|
60626
|
-
var cardType = existingSDKItem.cardType;
|
|
60491
|
+
var cardType = existingSDKItem.cardType, html = existingSDKItem.html;
|
|
60627
60492
|
sdkItem = new CardItem(_extends({}, baseOptions, {
|
|
60628
60493
|
property: _extends({}, property, {
|
|
60629
|
-
cardType: cardType
|
|
60494
|
+
cardType: cardType,
|
|
60495
|
+
html: html
|
|
60630
60496
|
})
|
|
60631
60497
|
}));
|
|
60632
60498
|
} else {
|
|
@@ -60853,19 +60719,6 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60853
60719
|
}).call(this);
|
|
60854
60720
|
};
|
|
60855
60721
|
/**
|
|
60856
|
-
* @description 设置元素extension字段
|
|
60857
|
-
*/ _proto.setItemExtension = function setItemExtension(itemId, extension) {
|
|
60858
|
-
var item = this.getSDKItem(itemId);
|
|
60859
|
-
if (!item) {
|
|
60860
|
-
console.warn('setItemExtension: item not found');
|
|
60861
|
-
return;
|
|
60862
|
-
}
|
|
60863
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.entries(extension)), _step; !(_step = _iterator()).done;){
|
|
60864
|
-
var _step_value = _step.value, key = _step_value[0], value = _step_value[1];
|
|
60865
|
-
item.extension.set(key, value);
|
|
60866
|
-
}
|
|
60867
|
-
};
|
|
60868
|
-
/**
|
|
60869
60722
|
* @description 场景 1: 设置单个元素的单个属性
|
|
60870
60723
|
*/ _proto.setSingleItemSingleProperty = function setSingleItemSingleProperty(param) {
|
|
60871
60724
|
return _async_to_generator(function() {
|
|
@@ -61122,7 +60975,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61122
60975
|
* @description 更新 PlayerItem 的 Property 属性
|
|
61123
60976
|
*/ _proto.updatePlayerItemPropertyAttribute = function updatePlayerItemPropertyAttribute(playerItem, targetItem, propertyName, propertyValue) {
|
|
61124
60977
|
return _async_to_generator(function() {
|
|
61125
|
-
var _this, _playerItem_getComponent, _playerItem_getComponent1, color, _array_, array, family, textComponent, textComponent1, lineCount, textHeight, _playerItem_getComponent2, textComponent2, textHeight1, textComponent3, outlineColor, textComponent4, textComponent5, textComponent6, originFontSize, lineCount1, textHeight2, textComponent7, textHeight3, viewSize, worldSizeX, originSize, originChildBoxes, originBox, worldScaleX, originScale, originWidth, currentWidth, ratio, originScale1, textComponent8, originChildBoxes1, originBox1, worldScaleY, originScale2, originHeight, currentHeight, ratio1, originScale3, viewSize1, worldSizeY, originSize1, textComponent9, textHeight4, _playerItem_getComponent3, _, _playerItem_getComponent4, _1, _propertyValue_compositions_find, _ref, subCompositionItem, compositionId, mainComposition, effectsSize, viewSize2, worldSize, compositionItem, component, videoComponent, videoComponent1, videoComponent2, pixelTranslation, viewTranslation, translation, rotation, currentScale, scaleRatio, frameComponent, _SDK_config_itemConfig_frameConfig, freeLayoutBackgroundColor, autoLayoutBackgroundColor, color1, childrenItem, time;
|
|
60978
|
+
var _this, _playerItem_getComponent, _playerItem_getComponent1, color, _array_, array, family, textComponent, textComponent1, lineCount, textHeight, _playerItem_getComponent2, textComponent2, textHeight1, textComponent3, outlineColor, textComponent4, textComponent5, textComponent6, originFontSize, lineCount1, textHeight2, textComponent7, textHeight3, viewSize, worldSizeX, originSize, originChildBoxes, originBox, worldScaleX, originScale, originWidth, currentWidth, ratio, originScale1, textComponent8, originChildBoxes1, originBox1, worldScaleY, originScale2, originHeight, currentHeight, ratio1, originScale3, viewSize1, worldSizeY, originSize1, textComponent9, textHeight4, _playerItem_getComponent3, _, _playerItem_getComponent4, _1, _propertyValue_compositions_find, _ref, subCompositionItem, compositionId, mainComposition, effectsSize, viewSize2, worldSize, compositionItem, component, videoPlayStates, videoComponent, videoComponent1, videoComponent2, pixelTranslation, viewTranslation, translation, rotation, currentScale, scaleRatio, frameComponent, _SDK_config_itemConfig_frameConfig, freeLayoutBackgroundColor, autoLayoutBackgroundColor, color1, childrenItem, time, videoPlayStates1;
|
|
61126
60979
|
return _ts_generator(this, function(_state) {
|
|
61127
60980
|
switch(_state.label){
|
|
61128
60981
|
case 0:
|
|
@@ -61223,35 +61076,40 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61223
61076
|
3,
|
|
61224
61077
|
31
|
|
61225
61078
|
];
|
|
61226
|
-
case '
|
|
61079
|
+
case 'html':
|
|
61227
61080
|
return [
|
|
61228
61081
|
3,
|
|
61229
61082
|
32
|
|
61230
61083
|
];
|
|
61231
|
-
case '
|
|
61084
|
+
case 'position':
|
|
61232
61085
|
return [
|
|
61233
61086
|
3,
|
|
61234
61087
|
33
|
|
61235
61088
|
];
|
|
61236
|
-
case '
|
|
61089
|
+
case 'rotation':
|
|
61237
61090
|
return [
|
|
61238
61091
|
3,
|
|
61239
61092
|
34
|
|
61240
61093
|
];
|
|
61241
|
-
case '
|
|
61094
|
+
case 'scale':
|
|
61242
61095
|
return [
|
|
61243
61096
|
3,
|
|
61244
61097
|
35
|
|
61245
61098
|
];
|
|
61246
|
-
case '
|
|
61099
|
+
case 'layoutMode':
|
|
61247
61100
|
return [
|
|
61248
61101
|
3,
|
|
61249
61102
|
36
|
|
61250
61103
|
];
|
|
61104
|
+
case 'visible':
|
|
61105
|
+
return [
|
|
61106
|
+
3,
|
|
61107
|
+
37
|
|
61108
|
+
];
|
|
61251
61109
|
}
|
|
61252
61110
|
return [
|
|
61253
61111
|
3,
|
|
61254
|
-
|
|
61112
|
+
38
|
|
61255
61113
|
];
|
|
61256
61114
|
case 1:
|
|
61257
61115
|
{
|
|
@@ -61264,7 +61122,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61264
61122
|
}
|
|
61265
61123
|
return [
|
|
61266
61124
|
3,
|
|
61267
|
-
|
|
61125
|
+
39
|
|
61268
61126
|
];
|
|
61269
61127
|
}
|
|
61270
61128
|
case 2:
|
|
@@ -61275,7 +61133,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61275
61133
|
}
|
|
61276
61134
|
return [
|
|
61277
61135
|
3,
|
|
61278
|
-
|
|
61136
|
+
39
|
|
61279
61137
|
];
|
|
61280
61138
|
}
|
|
61281
61139
|
case 3:
|
|
@@ -61307,7 +61165,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61307
61165
|
case 5:
|
|
61308
61166
|
return [
|
|
61309
61167
|
3,
|
|
61310
|
-
|
|
61168
|
+
39
|
|
61311
61169
|
];
|
|
61312
61170
|
case 6:
|
|
61313
61171
|
{
|
|
@@ -61324,7 +61182,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61324
61182
|
}
|
|
61325
61183
|
return [
|
|
61326
61184
|
3,
|
|
61327
|
-
|
|
61185
|
+
39
|
|
61328
61186
|
];
|
|
61329
61187
|
}
|
|
61330
61188
|
case 7:
|
|
@@ -61338,7 +61196,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61338
61196
|
}
|
|
61339
61197
|
return [
|
|
61340
61198
|
3,
|
|
61341
|
-
|
|
61199
|
+
39
|
|
61342
61200
|
];
|
|
61343
61201
|
}
|
|
61344
61202
|
case 8:
|
|
@@ -61351,7 +61209,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61351
61209
|
}
|
|
61352
61210
|
return [
|
|
61353
61211
|
3,
|
|
61354
|
-
|
|
61212
|
+
39
|
|
61355
61213
|
];
|
|
61356
61214
|
}
|
|
61357
61215
|
case 9:
|
|
@@ -61365,7 +61223,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61365
61223
|
}
|
|
61366
61224
|
return [
|
|
61367
61225
|
3,
|
|
61368
|
-
|
|
61226
|
+
39
|
|
61369
61227
|
];
|
|
61370
61228
|
}
|
|
61371
61229
|
case 10:
|
|
@@ -61378,7 +61236,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61378
61236
|
}
|
|
61379
61237
|
return [
|
|
61380
61238
|
3,
|
|
61381
|
-
|
|
61239
|
+
39
|
|
61382
61240
|
];
|
|
61383
61241
|
}
|
|
61384
61242
|
case 11:
|
|
@@ -61391,7 +61249,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61391
61249
|
}
|
|
61392
61250
|
return [
|
|
61393
61251
|
3,
|
|
61394
|
-
|
|
61252
|
+
39
|
|
61395
61253
|
];
|
|
61396
61254
|
}
|
|
61397
61255
|
case 12:
|
|
@@ -61411,7 +61269,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61411
61269
|
}
|
|
61412
61270
|
return [
|
|
61413
61271
|
3,
|
|
61414
|
-
|
|
61272
|
+
39
|
|
61415
61273
|
];
|
|
61416
61274
|
}
|
|
61417
61275
|
case 13:
|
|
@@ -61453,7 +61311,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61453
61311
|
}
|
|
61454
61312
|
return [
|
|
61455
61313
|
3,
|
|
61456
|
-
|
|
61314
|
+
39
|
|
61457
61315
|
];
|
|
61458
61316
|
}
|
|
61459
61317
|
case 14:
|
|
@@ -61488,7 +61346,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61488
61346
|
}
|
|
61489
61347
|
return [
|
|
61490
61348
|
3,
|
|
61491
|
-
|
|
61349
|
+
39
|
|
61492
61350
|
];
|
|
61493
61351
|
}
|
|
61494
61352
|
case 15:
|
|
@@ -61502,7 +61360,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61502
61360
|
}
|
|
61503
61361
|
return [
|
|
61504
61362
|
3,
|
|
61505
|
-
|
|
61363
|
+
39
|
|
61506
61364
|
];
|
|
61507
61365
|
}
|
|
61508
61366
|
case 16:
|
|
@@ -61534,7 +61392,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61534
61392
|
case 20:
|
|
61535
61393
|
return [
|
|
61536
61394
|
3,
|
|
61537
|
-
|
|
61395
|
+
39
|
|
61538
61396
|
];
|
|
61539
61397
|
case 21:
|
|
61540
61398
|
if (!(typeof propertyValue === 'string' && playerItem.type === EFFECTS.spec.ItemType.video)) return [
|
|
@@ -61565,7 +61423,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61565
61423
|
case 25:
|
|
61566
61424
|
return [
|
|
61567
61425
|
3,
|
|
61568
|
-
|
|
61426
|
+
39
|
|
61569
61427
|
];
|
|
61570
61428
|
case 26:
|
|
61571
61429
|
if (!(playerItem.type === EFFECTS.spec.ItemType.null)) return [
|
|
@@ -61605,12 +61463,15 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61605
61463
|
compositionItem.parentId = playerItem.getInstanceId();
|
|
61606
61464
|
component = compositionItem.components[0];
|
|
61607
61465
|
component == null ? void 0 : component.pause();
|
|
61466
|
+
// 刷新前快照视频播放态,刷新后恢复,避免更换特效导致全量视频被自动播放
|
|
61467
|
+
videoPlayStates = this.snapshotVideoPlayStates();
|
|
61608
61468
|
this.sdk.player.gotoAndPlay(0);
|
|
61469
|
+
this.restoreVideoPlayStates(videoPlayStates);
|
|
61609
61470
|
_state.label = 28;
|
|
61610
61471
|
case 28:
|
|
61611
61472
|
return [
|
|
61612
61473
|
3,
|
|
61613
|
-
|
|
61474
|
+
39
|
|
61614
61475
|
];
|
|
61615
61476
|
case 29:
|
|
61616
61477
|
{
|
|
@@ -61622,7 +61483,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61622
61483
|
}
|
|
61623
61484
|
return [
|
|
61624
61485
|
3,
|
|
61625
|
-
|
|
61486
|
+
39
|
|
61626
61487
|
];
|
|
61627
61488
|
}
|
|
61628
61489
|
case 30:
|
|
@@ -61635,7 +61496,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61635
61496
|
}
|
|
61636
61497
|
return [
|
|
61637
61498
|
3,
|
|
61638
|
-
|
|
61499
|
+
39
|
|
61639
61500
|
];
|
|
61640
61501
|
}
|
|
61641
61502
|
case 31:
|
|
@@ -61648,10 +61509,20 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61648
61509
|
}
|
|
61649
61510
|
return [
|
|
61650
61511
|
3,
|
|
61651
|
-
|
|
61512
|
+
39
|
|
61652
61513
|
];
|
|
61653
61514
|
}
|
|
61654
61515
|
case 32:
|
|
61516
|
+
{
|
|
61517
|
+
if (isCardItem(targetItem)) {
|
|
61518
|
+
targetItem.html = isCardHTMLValue(propertyValue) ? propertyValue : undefined;
|
|
61519
|
+
}
|
|
61520
|
+
return [
|
|
61521
|
+
3,
|
|
61522
|
+
39
|
|
61523
|
+
];
|
|
61524
|
+
}
|
|
61525
|
+
case 33:
|
|
61655
61526
|
{
|
|
61656
61527
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61657
61528
|
pixelTranslation = propertyValue.map(function(v, i) {
|
|
@@ -61664,10 +61535,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61664
61535
|
}
|
|
61665
61536
|
return [
|
|
61666
61537
|
3,
|
|
61667
|
-
|
|
61538
|
+
39
|
|
61668
61539
|
];
|
|
61669
61540
|
}
|
|
61670
|
-
case
|
|
61541
|
+
case 34:
|
|
61671
61542
|
{
|
|
61672
61543
|
if (Array.isArray(propertyValue) && propertyValue.length === 3) {
|
|
61673
61544
|
rotation = propertyValue.map(function(v, i) {
|
|
@@ -61678,10 +61549,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61678
61549
|
}
|
|
61679
61550
|
return [
|
|
61680
61551
|
3,
|
|
61681
|
-
|
|
61552
|
+
39
|
|
61682
61553
|
];
|
|
61683
61554
|
}
|
|
61684
|
-
case
|
|
61555
|
+
case 35:
|
|
61685
61556
|
{
|
|
61686
61557
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61687
61558
|
currentScale = targetItem.property.scale;
|
|
@@ -61695,10 +61566,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61695
61566
|
}
|
|
61696
61567
|
return [
|
|
61697
61568
|
3,
|
|
61698
|
-
|
|
61569
|
+
39
|
|
61699
61570
|
];
|
|
61700
61571
|
}
|
|
61701
|
-
case
|
|
61572
|
+
case 36:
|
|
61702
61573
|
{
|
|
61703
61574
|
if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
|
|
61704
61575
|
frameComponent = playerItem.getComponent(EFFECTS.FrameComponent);
|
|
@@ -61708,10 +61579,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61708
61579
|
}
|
|
61709
61580
|
return [
|
|
61710
61581
|
3,
|
|
61711
|
-
|
|
61582
|
+
39
|
|
61712
61583
|
];
|
|
61713
61584
|
}
|
|
61714
|
-
case
|
|
61585
|
+
case 37:
|
|
61715
61586
|
{
|
|
61716
61587
|
if (typeof propertyValue === 'boolean') {
|
|
61717
61588
|
playerItem.setVisible(propertyValue);
|
|
@@ -61724,10 +61595,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61724
61595
|
}
|
|
61725
61596
|
return [
|
|
61726
61597
|
3,
|
|
61727
|
-
|
|
61598
|
+
39
|
|
61728
61599
|
];
|
|
61729
61600
|
}
|
|
61730
|
-
case
|
|
61601
|
+
case 38:
|
|
61731
61602
|
{
|
|
61732
61603
|
console.log('ignore property name ', propertyName);
|
|
61733
61604
|
// 对于未明确处理的属性,尝试直接设置到 property 对象
|
|
@@ -61735,8 +61606,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61735
61606
|
targetItem.property[propertyName] = propertyValue;
|
|
61736
61607
|
}
|
|
61737
61608
|
}
|
|
61738
|
-
_state.label =
|
|
61739
|
-
case
|
|
61609
|
+
_state.label = 39;
|
|
61610
|
+
case 39:
|
|
61740
61611
|
// 非位置属性需要刷新播放器
|
|
61741
61612
|
// template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
|
|
61742
61613
|
if (![
|
|
@@ -61745,11 +61616,14 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61745
61616
|
'size'
|
|
61746
61617
|
].includes(propertyName)) {
|
|
61747
61618
|
time = this.sdk.pageData.time;
|
|
61619
|
+
// 刷新前快照视频播放态,刷新后恢复,避免设置属性导致全量视频被自动播放
|
|
61620
|
+
videoPlayStates1 = this.snapshotVideoPlayStates();
|
|
61748
61621
|
if (SDK.config.mode === 'editor') {
|
|
61749
61622
|
this.player.gotoAndPlay(time);
|
|
61750
61623
|
} else {
|
|
61751
61624
|
this.player.gotoAndStop(time);
|
|
61752
61625
|
}
|
|
61626
|
+
this.restoreVideoPlayStates(videoPlayStates1);
|
|
61753
61627
|
}
|
|
61754
61628
|
return [
|
|
61755
61629
|
2
|
|
@@ -62616,10 +62490,6 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
62616
62490
|
}
|
|
62617
62491
|
break;
|
|
62618
62492
|
}
|
|
62619
|
-
case 'cardType':
|
|
62620
|
-
{
|
|
62621
|
-
break;
|
|
62622
|
-
}
|
|
62623
62493
|
default:
|
|
62624
62494
|
{
|
|
62625
62495
|
console.warn("Target property " + propertyName + " can not be changed.");
|
|
@@ -63212,15 +63082,12 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63212
63082
|
var _cardInfo_name = cardInfo.name, name = _cardInfo_name === void 0 ? '卡片' : _cardInfo_name, _cardInfo_property = cardInfo.property, width = _cardInfo_property.width, height = _cardInfo_property.height, _cardInfo_property_scale = _cardInfo_property.scale, scale = _cardInfo_property_scale === void 0 ? [
|
|
63213
63083
|
1,
|
|
63214
63084
|
1
|
|
63215
|
-
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position, parentId = cardInfo.parentId, _cardInfo_id = cardInfo.id, id = _cardInfo_id === void 0 ? EFFECTS.generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63085
|
+
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position, autoHeight = _cardInfo_property.autoHeight, html = _cardInfo_property.html, parentId = cardInfo.parentId, _cardInfo_id = cardInfo.id, id = _cardInfo_id === void 0 ? EFFECTS.generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63216
63086
|
// 校验 cardType 是否已在配置中注册
|
|
63217
|
-
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63218
|
-
return t.type === cardType;
|
|
63219
|
-
});
|
|
63220
63087
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63221
63088
|
return t.type;
|
|
63222
63089
|
});
|
|
63223
|
-
if (!
|
|
63090
|
+
if (!registeredTypes.includes(cardType)) {
|
|
63224
63091
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63225
63092
|
return;
|
|
63226
63093
|
}
|
|
@@ -63264,7 +63131,9 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63264
63131
|
width: width,
|
|
63265
63132
|
height: height,
|
|
63266
63133
|
scale: [].concat(scale),
|
|
63267
|
-
cardType: cardType
|
|
63134
|
+
cardType: cardType,
|
|
63135
|
+
autoHeight: autoHeight,
|
|
63136
|
+
html: html
|
|
63268
63137
|
},
|
|
63269
63138
|
extension: extension
|
|
63270
63139
|
});
|
|
@@ -64646,7 +64515,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64646
64515
|
scalar.y
|
|
64647
64516
|
],
|
|
64648
64517
|
rotation: [].concat(rotation),
|
|
64649
|
-
position: [].concat(resultPosition)
|
|
64518
|
+
position: [].concat(resultPosition),
|
|
64519
|
+
html: sdkItem.html
|
|
64650
64520
|
},
|
|
64651
64521
|
extension: extension
|
|
64652
64522
|
};
|
|
@@ -64731,7 +64601,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64731
64601
|
};
|
|
64732
64602
|
addTextItemIntoNewScene = function addTextItemIntoNewScene(textCreateInfo, sceneSize, itemViewPosition) {
|
|
64733
64603
|
var _scene_fonts;
|
|
64734
|
-
var _textCreateInfo_id = textCreateInfo.id, id = _textCreateInfo_id === void 0 ? EFFECTS.generateGUID() : _textCreateInfo_id, _textCreateInfo_name = textCreateInfo.name, name = _textCreateInfo_name === void 0 ? '文本' : _textCreateInfo_name, _textCreateInfo_property = textCreateInfo.property, lineHeight = _textCreateInfo_property.lineHeight, textWidth = _textCreateInfo_property.width, tmp = _textCreateInfo_property.height, textHeight = tmp === void 0 ? lineHeight : tmp, fontFamily = _textCreateInfo_property.fontFamily, fontSize = _textCreateInfo_property.fontSize, _textCreateInfo_property_fontWeight = _textCreateInfo_property.fontWeight, fontWeight = _textCreateInfo_property_fontWeight === void 0 ? EFFECTS.spec.TextWeight.normal : _textCreateInfo_property_fontWeight, _textCreateInfo_property_fontStyle = _textCreateInfo_property.fontStyle, fontStyle = _textCreateInfo_property_fontStyle === void 0 ? EFFECTS.spec.FontStyle.normal : _textCreateInfo_property_fontStyle, _textCreateInfo_property_textAlign = _textCreateInfo_property.textAlign, textAlign = _textCreateInfo_property_textAlign === void 0 ? EFFECTS.spec.TextAlignment.left : _textCreateInfo_property_textAlign, text = _textCreateInfo_property.text, textColor = _textCreateInfo_property.color, tmp1 = _textCreateInfo_property.rotation, sourceRotation = tmp1 === void 0 ? 0 : tmp1, url = _textCreateInfo_property.fontUrl, outlineColor = _textCreateInfo_property.outlineColor, outlineWidth = _textCreateInfo_property.outlineWidth, outlineEnabled = _textCreateInfo_property.outlineEnabled;
|
|
64604
|
+
var _textCreateInfo_id = textCreateInfo.id, id = _textCreateInfo_id === void 0 ? EFFECTS.generateGUID() : _textCreateInfo_id, _textCreateInfo_name = textCreateInfo.name, name = _textCreateInfo_name === void 0 ? '文本' : _textCreateInfo_name, _textCreateInfo_property = textCreateInfo.property, lineHeight = _textCreateInfo_property.lineHeight, textWidth = _textCreateInfo_property.width, tmp = _textCreateInfo_property.height, textHeight = tmp === void 0 ? lineHeight : tmp, fontFamily = _textCreateInfo_property.fontFamily, fontSize = _textCreateInfo_property.fontSize, _textCreateInfo_property_fontWeight = _textCreateInfo_property.fontWeight, fontWeight = _textCreateInfo_property_fontWeight === void 0 ? EFFECTS.spec.TextWeight.normal : _textCreateInfo_property_fontWeight, _textCreateInfo_property_fontStyle = _textCreateInfo_property.fontStyle, fontStyle = _textCreateInfo_property_fontStyle === void 0 ? EFFECTS.spec.FontStyle.normal : _textCreateInfo_property_fontStyle, _textCreateInfo_property_textAlign = _textCreateInfo_property.textAlign, textAlign = _textCreateInfo_property_textAlign === void 0 ? EFFECTS.spec.TextAlignment.left : _textCreateInfo_property_textAlign, text = _textCreateInfo_property.text, textColor = _textCreateInfo_property.color, tmp1 = _textCreateInfo_property.rotation, sourceRotation = tmp1 === void 0 ? 0 : tmp1, url = _textCreateInfo_property.fontUrl, outlineColor = _textCreateInfo_property.outlineColor, outlineWidth = _textCreateInfo_property.outlineWidth, outlineEnabled = _textCreateInfo_property.outlineEnabled, letterSpacing = _textCreateInfo_property.letterSpacing;
|
|
64735
64605
|
var rotation = Array.isArray(sourceRotation) ? [].concat(sourceRotation) : [
|
|
64736
64606
|
0,
|
|
64737
64607
|
0,
|
|
@@ -64761,7 +64631,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64761
64631
|
fontSize: fontSize,
|
|
64762
64632
|
textColor: resutlTextColor,
|
|
64763
64633
|
fontWeight: fontWeight,
|
|
64764
|
-
letterSpace:
|
|
64634
|
+
letterSpace: letterSpacing,
|
|
64765
64635
|
textAlign: textAlign,
|
|
64766
64636
|
fontStyle: fontStyle,
|
|
64767
64637
|
textWidth: textWidth,
|
|
@@ -65692,7 +65562,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65692
65562
|
_this = this;
|
|
65693
65563
|
changeProeprty = function changeProeprty(targetCreateInfo) {
|
|
65694
65564
|
return _async_to_generator(function() {
|
|
65695
|
-
var currentCreateInfo
|
|
65565
|
+
var currentCreateInfo;
|
|
65696
65566
|
return _ts_generator(this, function(_state) {
|
|
65697
65567
|
switch(_state.label){
|
|
65698
65568
|
case 0:
|
|
@@ -65703,20 +65573,16 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65703
65573
|
2
|
|
65704
65574
|
];
|
|
65705
65575
|
}
|
|
65706
|
-
itemId = targetCreateInfo.id;
|
|
65707
65576
|
return [
|
|
65708
65577
|
4,
|
|
65709
65578
|
this.setItemProperty({
|
|
65710
|
-
itemId:
|
|
65579
|
+
itemId: currentCreateInfo.id,
|
|
65711
65580
|
type: currentCreateInfo.type,
|
|
65712
65581
|
property: targetCreateInfo.property
|
|
65713
65582
|
})
|
|
65714
65583
|
];
|
|
65715
65584
|
case 1:
|
|
65716
65585
|
_state.sent();
|
|
65717
|
-
if (targetCreateInfo.extension) {
|
|
65718
|
-
this.setItemExtension(itemId, targetCreateInfo.extension);
|
|
65719
|
-
}
|
|
65720
65586
|
return [
|
|
65721
65587
|
2
|
|
65722
65588
|
];
|
|
@@ -65772,6 +65638,51 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65772
65638
|
var result = box.clone().scale(scale, center).translate(translation);
|
|
65773
65639
|
return result;
|
|
65774
65640
|
};
|
|
65641
|
+
/**
|
|
65642
|
+
* @description 快照当前所有视频元素的播放状态(播放/暂停 + 当前播放进度),用于属性刷新后恢复,
|
|
65643
|
+
* 避免设置属性导致全量视频被自动播放或进度被重置回 0s
|
|
65644
|
+
*/ _proto.snapshotVideoPlayStates = function snapshotVideoPlayStates() {
|
|
65645
|
+
var states = new Map();
|
|
65646
|
+
var composition = this.getCurrentComposition();
|
|
65647
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(composition.items), _step; !(_step = _iterator()).done;){
|
|
65648
|
+
var item = _step.value;
|
|
65649
|
+
if (item.type === EFFECTS.spec.ItemType.video) {
|
|
65650
|
+
var videoComponent = item.getComponent(VideoComponent);
|
|
65651
|
+
if (!videoComponent) {
|
|
65652
|
+
continue;
|
|
65653
|
+
}
|
|
65654
|
+
//@ts-expect-error @赤芍 played 字段未在类型中声明,参见 rebuildCompositionItems 处用法
|
|
65655
|
+
var played = !!videoComponent.played;
|
|
65656
|
+
var time = videoComponent.getCurrentTime();
|
|
65657
|
+
states.set(item.getInstanceId(), {
|
|
65658
|
+
played: played,
|
|
65659
|
+
time: time
|
|
65660
|
+
});
|
|
65661
|
+
}
|
|
65662
|
+
}
|
|
65663
|
+
return states;
|
|
65664
|
+
};
|
|
65665
|
+
/**
|
|
65666
|
+
* @description 按快照恢复视频元素的播放状态(先 pause 再 seek,最后按原状态 play/pause,避免进度抖动)
|
|
65667
|
+
*/ _proto.restoreVideoPlayStates = function restoreVideoPlayStates(states) {
|
|
65668
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(states), _step; !(_step = _iterator()).done;){
|
|
65669
|
+
var _step_value = _step.value, id = _step_value[0], _step_value_ = _step_value[1], played = _step_value_.played, time = _step_value_.time;
|
|
65670
|
+
var playerItem = this.getPlayerItemById(id);
|
|
65671
|
+
if ((playerItem == null ? void 0 : playerItem.type) !== EFFECTS.spec.ItemType.video) {
|
|
65672
|
+
continue;
|
|
65673
|
+
}
|
|
65674
|
+
var videoComponent = playerItem.getComponent(VideoComponent);
|
|
65675
|
+
if (!videoComponent) {
|
|
65676
|
+
continue;
|
|
65677
|
+
}
|
|
65678
|
+
// 先暂停再 seek,避免播放状态下 seek 导致画面抖动
|
|
65679
|
+
videoComponent.pauseVideo();
|
|
65680
|
+
videoComponent.setCurrentTime(time);
|
|
65681
|
+
if (played) {
|
|
65682
|
+
videoComponent.playVideo();
|
|
65683
|
+
}
|
|
65684
|
+
}
|
|
65685
|
+
};
|
|
65775
65686
|
_proto.playVideoItem = function playVideoItem(id) {
|
|
65776
65687
|
var playerItem = this.getPlayerItemById(id);
|
|
65777
65688
|
if ((playerItem == null ? void 0 : playerItem.type) !== EFFECTS.spec.ItemType.video) {
|
|
@@ -66034,56 +65945,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
66034
65945
|
};
|
|
66035
65946
|
_proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
|
|
66036
65947
|
return _async_to_generator(function() {
|
|
66037
|
-
var
|
|
65948
|
+
var _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, createInfo, id, type, url, textureId, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
|
|
66038
65949
|
return _ts_generator(this, function(_state) {
|
|
66039
65950
|
switch(_state.label){
|
|
66040
65951
|
case 0:
|
|
66041
|
-
|
|
66042
|
-
|
|
66043
|
-
|
|
66044
|
-
|
|
66045
|
-
|
|
66046
|
-
|
|
66047
|
-
|
|
66048
|
-
|
|
66049
|
-
|
|
66050
|
-
|
|
66051
|
-
|
|
66052
|
-
|
|
66053
|
-
|
|
66054
|
-
|
|
66055
|
-
|
|
66056
|
-
|
|
66057
|
-
};
|
|
66058
|
-
}
|
|
66059
|
-
default:
|
|
66060
|
-
{
|
|
66061
|
-
return {};
|
|
66062
|
-
}
|
|
66063
|
-
}
|
|
66064
|
-
}(), url = _ref.url, type = _ref.type;
|
|
66065
|
-
if (url && type) {
|
|
66066
|
-
var textureId = EFFECTS.generateGUID();
|
|
66067
|
-
itemToTextureInfo.set(createInfo.id, {
|
|
65952
|
+
_this = this;
|
|
65953
|
+
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
65954
|
+
return Object.assign({}, createInfo, createInfo.id ? {} : {
|
|
65955
|
+
id: EFFECTS.generateGUID()
|
|
65956
|
+
});
|
|
65957
|
+
});
|
|
65958
|
+
itemToTextureInfo = new Map();
|
|
65959
|
+
// 预处理所有 createInfo,分配 textureId
|
|
65960
|
+
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;){
|
|
65961
|
+
createInfo = _step.value;
|
|
65962
|
+
id = createInfo.id;
|
|
65963
|
+
type = createInfo.type;
|
|
65964
|
+
url = type === SDKItemType.SPRITE ? createInfo.property.image : type === SDKItemType.VIDEO ? createInfo.property.video : undefined;
|
|
65965
|
+
if ((type === SDKItemType.SPRITE || type === SDKItemType.VIDEO) && url) {
|
|
65966
|
+
textureId = EFFECTS.generateGUID();
|
|
65967
|
+
itemToTextureInfo.set(id, {
|
|
66068
65968
|
id: textureId,
|
|
66069
65969
|
url: url,
|
|
66070
|
-
type: type
|
|
65970
|
+
type: type === SDKItemType.SPRITE ? 'image' : 'video'
|
|
66071
65971
|
});
|
|
66072
65972
|
Object.assign(createInfo, {
|
|
66073
65973
|
textureId: textureId
|
|
66074
65974
|
});
|
|
66075
65975
|
}
|
|
66076
|
-
}
|
|
66077
|
-
_this = this;
|
|
66078
|
-
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
66079
|
-
var _createInfo_id;
|
|
66080
|
-
return Object.assign({}, createInfo, {
|
|
66081
|
-
id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : EFFECTS.generateGUID()
|
|
66082
|
-
});
|
|
66083
|
-
});
|
|
66084
|
-
itemToTextureInfo = new Map();
|
|
66085
|
-
// 预处理所有 createInfo,分配 textureId
|
|
66086
|
-
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
|
|
65976
|
+
}
|
|
66087
65977
|
// 并行创建所有 item
|
|
66088
65978
|
toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
|
|
66089
65979
|
return ![
|
|
@@ -67358,7 +67248,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67358
67248
|
};
|
|
67359
67249
|
_proto.autoLayoutPage = function autoLayoutPage() {
|
|
67360
67250
|
return _async_to_generator(function(param) {
|
|
67361
|
-
var _this, pageData, _param_mode, mode, ids, _param_focus, focus, _param_gap, gap, isPartialLayout, targetItems, layoutElements, moveInfos, anchor, _iterator, _step, moveInfo, sdkItem;
|
|
67251
|
+
var _this, pageData, _param_mode, mode, ids, _param_focus, focus, _param_gap, gap, shift, isPartialLayout, targetItems, layoutElements, moveInfos, anchor, _iterator, _step, moveInfo, sdkItem;
|
|
67362
67252
|
return _ts_generator(this, function(_state) {
|
|
67363
67253
|
switch(_state.label){
|
|
67364
67254
|
case 0:
|
|
@@ -67373,7 +67263,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67373
67263
|
2
|
|
67374
67264
|
];
|
|
67375
67265
|
}
|
|
67376
|
-
_param_mode = param.mode, mode = _param_mode === void 0 ? SDK.config.pageConfig.autoLayoutDefaultMode : _param_mode, ids = param.ids, _param_focus = param.focus, focus = _param_focus === void 0 ? true : _param_focus, _param_gap = param.gap, gap = _param_gap === void 0 ? SDK.config.pageConfig.autoLayoutDefaultGap : _param_gap;
|
|
67266
|
+
_param_mode = param.mode, mode = _param_mode === void 0 ? SDK.config.pageConfig.autoLayoutDefaultMode : _param_mode, ids = param.ids, _param_focus = param.focus, focus = _param_focus === void 0 ? true : _param_focus, _param_gap = param.gap, gap = _param_gap === void 0 ? SDK.config.pageConfig.autoLayoutDefaultGap : _param_gap, shift = param.shift;
|
|
67377
67267
|
isPartialLayout = !!(ids == null ? void 0 : ids.length);
|
|
67378
67268
|
// 1. 确定参与排布的顶层元素(过滤子元素)
|
|
67379
67269
|
targetItems = pageData.items.filter(function(item) {
|
|
@@ -67402,7 +67292,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67402
67292
|
// 4. 计算锚点偏移
|
|
67403
67293
|
// - 选中元素排布:以原始包围盒左上角为锚点
|
|
67404
67294
|
// - 全量排布:以视口中心为锚点
|
|
67405
|
-
anchor = isPartialLayout ? this.getPartialLayoutAnchor(layoutElements, moveInfos.boundingBox) : this.getGlobalLayoutAnchor(moveInfos.boundingBox);
|
|
67295
|
+
anchor = isPartialLayout ? this.getPartialLayoutAnchor(layoutElements, moveInfos.boundingBox) : this.getGlobalLayoutAnchor(moveInfos.boundingBox, shift);
|
|
67406
67296
|
_iterator = _create_for_of_iterator_helper_loose(moveInfos.items);
|
|
67407
67297
|
_state.label = 1;
|
|
67408
67298
|
case 1:
|
|
@@ -67445,7 +67335,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67445
67335
|
if (focus) {
|
|
67446
67336
|
this.setPageZoom(1, undefined, true);
|
|
67447
67337
|
this.setPageMove(new Vector2());
|
|
67448
|
-
this.viewportFit(
|
|
67338
|
+
this.viewportFit(shift, moveInfos.boundingBox.translate(anchor));
|
|
67449
67339
|
}
|
|
67450
67340
|
return [
|
|
67451
67341
|
2
|
|
@@ -67469,8 +67359,9 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67469
67359
|
/**
|
|
67470
67360
|
* @description 计算全量排布的锚点偏移:以视口中心为锚点
|
|
67471
67361
|
* @param layoutBoundingBox 排布算法输出的包围盒
|
|
67472
|
-
*/ _proto.getGlobalLayoutAnchor = function getGlobalLayoutAnchor(layoutBoundingBox) {
|
|
67473
|
-
var
|
|
67362
|
+
*/ _proto.getGlobalLayoutAnchor = function getGlobalLayoutAnchor(layoutBoundingBox, shift) {
|
|
67363
|
+
var _ref = shift != null ? shift : {}, _ref_top = _ref.top, top = _ref_top === void 0 ? 0 : _ref_top, _ref_bottom = _ref.bottom, bottom = _ref_bottom === void 0 ? 0 : _ref_bottom, _ref_left = _ref.left, left = _ref_left === void 0 ? 0 : _ref_left, _ref_right = _ref.right, right = _ref_right === void 0 ? 0 : _ref_right;
|
|
67364
|
+
var viewCenter = new Vector2(this.sdk._container.offsetWidth / 2 + left - right, this.sdk._container.offsetHeight / 2 + top - bottom);
|
|
67474
67365
|
var boundCenter = layoutBoundingBox.getCenter();
|
|
67475
67366
|
return new Vector2(viewCenter.x - boundCenter.x, viewCenter.y - boundCenter.y);
|
|
67476
67367
|
};
|
|
@@ -69072,6 +68963,8 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69072
68963
|
*/ _this.maskSprite = null, _this._config = {}, _this.boxGraphics = new Graphics(), _this.type = 'mask', _this.mode = 'paint', /**
|
|
69073
68964
|
* 蒙版工具独立的撤销重做实例
|
|
69074
68965
|
*/ _this._undoRedo = new GizmoUndoRedo(), /**
|
|
68966
|
+
* 框选擦除进行中标记(按下到松开之间),用于实时选框描边的显示控制
|
|
68967
|
+
*/ _this._isBoxErasing = false, /**
|
|
69075
68968
|
* 鼠标状态绘制结果
|
|
69076
68969
|
*/ _this.cursorResult = {
|
|
69077
68970
|
type: 'normal',
|
|
@@ -69088,10 +68981,22 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69088
68981
|
var _proto = MaskGizmo.prototype;
|
|
69089
68982
|
/**
|
|
69090
68983
|
* 设置模式
|
|
69091
|
-
* @param mode 模式类型:'paint'
|
|
68984
|
+
* @param mode 模式类型:'paint' 笔刷涂抹、'erase' 笔刷逐笔擦除、'box-erase' 框选擦除、'box-paint' 框选涂抹
|
|
69092
68985
|
*/ _proto.setMode = function setMode(mode) {
|
|
69093
68986
|
this.mode = mode;
|
|
69094
68987
|
};
|
|
68988
|
+
/**
|
|
68989
|
+
* @description 判断点是否在包围盒内
|
|
68990
|
+
*/ _proto._isPointInBox = function _isPointInBox(p, box) {
|
|
68991
|
+
return p.x >= box.min.x && p.x <= box.max.x && p.y >= box.min.y && p.y <= box.max.y;
|
|
68992
|
+
};
|
|
68993
|
+
/**
|
|
68994
|
+
* @description 将屏幕坐标转换为包围盒内的归一化坐标 [0,1](钳制在范围内)
|
|
68995
|
+
*/ _proto._toNormalized = function _toNormalized(p, box) {
|
|
68996
|
+
var x = Math.max(0, Math.min(1, (p.x - box.min.x) / (box.max.x - box.min.x)));
|
|
68997
|
+
var y = Math.max(0, Math.min(1, (p.y - box.min.y) / (box.max.y - box.min.y)));
|
|
68998
|
+
return new Vector2(x, y);
|
|
68999
|
+
};
|
|
69095
69000
|
_proto.initialize = function initialize() {};
|
|
69096
69001
|
_proto.preparationAction = function preparationAction(event) {
|
|
69097
69002
|
if (!this.interactive) {
|
|
@@ -69110,6 +69015,26 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69110
69015
|
};
|
|
69111
69016
|
// 更新鼠标位置
|
|
69112
69017
|
this.result.point = new Vector2(event.offsetX, event.offsetY);
|
|
69018
|
+
// 框选模式(框选擦除 / 框选涂抹):仅在元素包围盒内按下才触发
|
|
69019
|
+
if (this.mode === 'box-erase' || this.mode === 'box-paint') {
|
|
69020
|
+
var box = this.result.box;
|
|
69021
|
+
if (!box || !this._isPointInBox(this.result.point, box)) {
|
|
69022
|
+
// 包围盒外按下:不触发框选,交由其它 gizmo
|
|
69023
|
+
return undefined;
|
|
69024
|
+
}
|
|
69025
|
+
var start = this._toNormalized(this.result.point, box);
|
|
69026
|
+
this.result.lines.push({
|
|
69027
|
+
type: this.mode === 'box-paint' ? 'paint' : 'erase',
|
|
69028
|
+
shape: 'rect',
|
|
69029
|
+
brushSize: 0,
|
|
69030
|
+
points: [
|
|
69031
|
+
start,
|
|
69032
|
+
start.clone()
|
|
69033
|
+
]
|
|
69034
|
+
});
|
|
69035
|
+
this._isBoxErasing = true;
|
|
69036
|
+
return this.type;
|
|
69037
|
+
}
|
|
69113
69038
|
// 开启新画笔
|
|
69114
69039
|
this.result.lines.push({
|
|
69115
69040
|
type: this.mode,
|
|
@@ -69119,32 +69044,61 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69119
69044
|
return this.type;
|
|
69120
69045
|
};
|
|
69121
69046
|
_proto.action = function action(event) {
|
|
69122
|
-
var // 记录鼠标划线位置
|
|
69123
|
-
_this_result_lines_;
|
|
69124
69047
|
if (!this.interactive || this.result.status === 'init') {
|
|
69125
69048
|
return;
|
|
69126
69049
|
}
|
|
69127
69050
|
// 更新鼠标位置
|
|
69128
69051
|
var box = this.result.box;
|
|
69129
|
-
var point = new Vector2(
|
|
69130
|
-
|
|
69052
|
+
var point = new Vector2(event.offsetX, event.offsetY);
|
|
69053
|
+
this.result.point = point;
|
|
69054
|
+
var lastLine = this.result.lines[this.result.lines.length - 1];
|
|
69055
|
+
// 框选擦除:更新框选终点(钳制到包围盒内)
|
|
69056
|
+
if ((lastLine == null ? void 0 : lastLine.shape) === 'rect') {
|
|
69057
|
+
lastLine.points[1] = this._toNormalized(point, box);
|
|
69058
|
+
return;
|
|
69059
|
+
}
|
|
69060
|
+
// 记录鼠标划线位置(笔刷模式)
|
|
69061
|
+
var np = new Vector2((event.offsetX - box.min.x) / (box.max.x - box.min.x), (event.offsetY - box.min.y) / (box.max.y - box.min.y));
|
|
69062
|
+
lastLine == null ? void 0 : lastLine.points.push(np);
|
|
69131
69063
|
};
|
|
69132
69064
|
_proto.endAction = function endAction() {
|
|
69133
69065
|
if (!this.interactive) {
|
|
69134
69066
|
return undefined;
|
|
69135
69067
|
}
|
|
69136
|
-
// 记录操作到 undoRedo(仅当画线有实际点时才记录)
|
|
69137
69068
|
var lastLine = this.result.lines[this.result.lines.length - 1];
|
|
69069
|
+
// 框选擦除:起点==终点视为空框选,移除;否则提交 undoRedo
|
|
69070
|
+
if ((lastLine == null ? void 0 : lastLine.shape) === 'rect') {
|
|
69071
|
+
this._isBoxErasing = false;
|
|
69072
|
+
var _lastLine_points = lastLine.points, a = _lastLine_points[0], b = _lastLine_points[1];
|
|
69073
|
+
var isEmpty = !!a && !!b && a.x === b.x && a.y === b.y;
|
|
69074
|
+
if (this._oldLines && !isEmpty) {
|
|
69075
|
+
var operation = {
|
|
69076
|
+
type: 'update',
|
|
69077
|
+
oldData: this._oldLines,
|
|
69078
|
+
newData: {
|
|
69079
|
+
lines: JSON.parse(JSON.stringify(this.result.lines))
|
|
69080
|
+
}
|
|
69081
|
+
};
|
|
69082
|
+
this._undoRedo.push(operation);
|
|
69083
|
+
this._eventEmitter.emit('maskGizmoUndoRedoChange', operation);
|
|
69084
|
+
} else {
|
|
69085
|
+
// 空框选移除
|
|
69086
|
+
this.result.lines.pop();
|
|
69087
|
+
}
|
|
69088
|
+
this._oldLines = undefined;
|
|
69089
|
+
return this.type;
|
|
69090
|
+
}
|
|
69091
|
+
// 记录操作到 undoRedo(仅当画线有实际点时才记录)
|
|
69138
69092
|
if (this._oldLines && lastLine && lastLine.points.length > 0) {
|
|
69139
|
-
var
|
|
69093
|
+
var operation1 = {
|
|
69140
69094
|
type: 'update',
|
|
69141
69095
|
oldData: this._oldLines,
|
|
69142
69096
|
newData: {
|
|
69143
69097
|
lines: JSON.parse(JSON.stringify(this.result.lines))
|
|
69144
69098
|
}
|
|
69145
69099
|
};
|
|
69146
|
-
this._undoRedo.push(
|
|
69147
|
-
this._eventEmitter.emit('maskGizmoUndoRedoChange',
|
|
69100
|
+
this._undoRedo.push(operation1);
|
|
69101
|
+
this._eventEmitter.emit('maskGizmoUndoRedoChange', operation1);
|
|
69148
69102
|
} else if ((lastLine == null ? void 0 : lastLine.points.length) === 0) {
|
|
69149
69103
|
// 如果没有实际绘制点,移除空的线条
|
|
69150
69104
|
this.result.lines.pop();
|
|
@@ -69269,6 +69223,17 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69269
69223
|
this.boxGraphics.lineStyle(boxLineWidth, boxLineColor, boxLineAlpha);
|
|
69270
69224
|
this.boxGraphics.drawBox(box);
|
|
69271
69225
|
this.boxGraphics.endFill();
|
|
69226
|
+
// 框选擦除进行中:叠加当前拖动矩形的可视描边
|
|
69227
|
+
var lastLine = this.result.lines[this.result.lines.length - 1];
|
|
69228
|
+
if (this._isBoxErasing && (lastLine == null ? void 0 : lastLine.shape) === 'rect' && lastLine.points.length >= 2) {
|
|
69229
|
+
var _lastLine_points = lastLine.points, a = _lastLine_points[0], b = _lastLine_points[1];
|
|
69230
|
+
if (a && b) {
|
|
69231
|
+
var selBox = new Box2(new Vector2(box.min.x + Math.min(a.x, b.x) * (box.max.x - box.min.x), box.min.y + Math.min(a.y, b.y) * (box.max.y - box.min.y)), new Vector2(box.min.x + Math.max(a.x, b.x) * (box.max.x - box.min.x), box.min.y + Math.max(a.y, b.y) * (box.max.y - box.min.y)));
|
|
69232
|
+
this.boxGraphics.lineStyle(boxLineWidth, boxLineColor, boxLineAlpha);
|
|
69233
|
+
this.boxGraphics.drawBox(selBox);
|
|
69234
|
+
this.boxGraphics.endFill();
|
|
69235
|
+
}
|
|
69236
|
+
}
|
|
69272
69237
|
// 1. 画线形(只用于遮罩,不直接显示
|
|
69273
69238
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.result.lines), _step; !(_step = _iterator()).done;){
|
|
69274
69239
|
var line = _step.value;
|
|
@@ -69276,6 +69241,32 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69276
69241
|
continue;
|
|
69277
69242
|
}
|
|
69278
69243
|
var lineGraphics = new Graphics();
|
|
69244
|
+
// 矩形框选:填充矩形,paint 用 NORMAL 叠加,erase 用 DST_OUT 抠除
|
|
69245
|
+
if (line.shape === 'rect') {
|
|
69246
|
+
var a1 = line.points[0];
|
|
69247
|
+
var b1 = line.points[1];
|
|
69248
|
+
if (a1 && b1) {
|
|
69249
|
+
var w = box.max.x - box.min.x;
|
|
69250
|
+
var h = box.max.y - box.min.y;
|
|
69251
|
+
var x0 = Math.min(a1.x, b1.x) * w;
|
|
69252
|
+
var y0 = Math.min(a1.y, b1.y) * h;
|
|
69253
|
+
var x1 = Math.max(a1.x, b1.x) * w;
|
|
69254
|
+
var y1 = Math.max(a1.y, b1.y) * h;
|
|
69255
|
+
// 太小(纯点击)不渲染,避免 1px 擦除/涂抹点
|
|
69256
|
+
if (x1 - x0 > 0.5 || y1 - y0 > 0.5) {
|
|
69257
|
+
lineGraphics.beginFill(brushColor);
|
|
69258
|
+
lineGraphics.drawRect(x0, y0, x1 - x0, y1 - y0);
|
|
69259
|
+
lineGraphics.endFill();
|
|
69260
|
+
lineGraphics.blendMode = line.type === 'paint' ? BLEND_MODES.NORMAL : BLEND_MODES.DST_OUT;
|
|
69261
|
+
this._app.renderer.render(lineGraphics, {
|
|
69262
|
+
renderTexture: this.maskRenderTexture,
|
|
69263
|
+
clear: false
|
|
69264
|
+
});
|
|
69265
|
+
}
|
|
69266
|
+
}
|
|
69267
|
+
lineGraphics.destroy();
|
|
69268
|
+
continue;
|
|
69269
|
+
}
|
|
69279
69270
|
lineGraphics.blendMode = line.type === 'paint' ? BLEND_MODES.NORMAL : BLEND_MODES.DST_OUT;
|
|
69280
69271
|
lineGraphics.lineStyle({
|
|
69281
69272
|
width: line.brushSize * viewportParam.scale,
|
|
@@ -69319,14 +69310,24 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69319
69310
|
if (!point || !box) {
|
|
69320
69311
|
return;
|
|
69321
69312
|
}
|
|
69322
|
-
|
|
69323
|
-
|
|
69313
|
+
var inside = point.x >= box.min.x && point.x <= box.max.x && point.y >= box.min.y && point.y <= box.max.y;
|
|
69314
|
+
if (!inside) {
|
|
69315
|
+
return;
|
|
69316
|
+
}
|
|
69317
|
+
// 框选模式(框选擦除 / 框选涂抹):crosshair
|
|
69318
|
+
if (this.mode === 'box-erase' || this.mode === 'box-paint') {
|
|
69324
69319
|
this.cursorResult = {
|
|
69325
|
-
type: '
|
|
69326
|
-
angle: 0
|
|
69327
|
-
radius: this.config.brushSize * viewportParam.scale / 2
|
|
69320
|
+
type: 'box-select',
|
|
69321
|
+
angle: 0
|
|
69328
69322
|
};
|
|
69323
|
+
return;
|
|
69329
69324
|
}
|
|
69325
|
+
var viewportParam = this._pageDataUtils.interactionUtils.viewportParam;
|
|
69326
|
+
this.cursorResult = {
|
|
69327
|
+
type: 'circle',
|
|
69328
|
+
angle: 0,
|
|
69329
|
+
radius: this.config.brushSize * viewportParam.scale / 2
|
|
69330
|
+
};
|
|
69330
69331
|
};
|
|
69331
69332
|
_proto.close = function close() {
|
|
69332
69333
|
this._config.maskImage = undefined;
|
|
@@ -69474,6 +69475,21 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69474
69475
|
if (!line || line.points.length === 0) {
|
|
69475
69476
|
continue;
|
|
69476
69477
|
}
|
|
69478
|
+
// 矩形框选:填充矩形
|
|
69479
|
+
if (line.shape === 'rect') {
|
|
69480
|
+
var _line_points = line.points, a = _line_points[0], b1 = _line_points[1];
|
|
69481
|
+
if (!a || !b1) {
|
|
69482
|
+
continue;
|
|
69483
|
+
}
|
|
69484
|
+
var x0 = Math.min(a.x, b1.x) * width;
|
|
69485
|
+
var y0 = Math.min(a.y, b1.y) * height;
|
|
69486
|
+
var x1 = Math.max(a.x, b1.x) * width;
|
|
69487
|
+
var y1 = Math.max(a.y, b1.y) * height;
|
|
69488
|
+
ctx.globalCompositeOperation = 'source-over';
|
|
69489
|
+
ctx.fillStyle = line.type === 'paint' ? maskHexColor : maskBackgroundHexColor;
|
|
69490
|
+
ctx.fillRect(x0, y0, Math.max(1, x1 - x0), Math.max(1, y1 - y0));
|
|
69491
|
+
continue;
|
|
69492
|
+
}
|
|
69477
69493
|
ctx.lineWidth = line.brushSize * scale;
|
|
69478
69494
|
ctx.lineCap = 'round';
|
|
69479
69495
|
ctx.lineJoin = 'round';
|
|
@@ -71479,7 +71495,8 @@ var GestureHandler = /*#__PURE__*/ function() {
|
|
|
71479
71495
|
'active-hand',
|
|
71480
71496
|
'pointer',
|
|
71481
71497
|
'text-create',
|
|
71482
|
-
'frame-create'
|
|
71498
|
+
'frame-create',
|
|
71499
|
+
'box-select'
|
|
71483
71500
|
].includes(result.type)) {
|
|
71484
71501
|
var cursor = cursorMap[result.type];
|
|
71485
71502
|
if (cursor.type === 'svg') {
|
|
@@ -71651,6 +71668,7 @@ var GestureHandler = /*#__PURE__*/ function() {
|
|
|
71651
71668
|
return;
|
|
71652
71669
|
}
|
|
71653
71670
|
this.maskGizmo.setMode(mode);
|
|
71671
|
+
this.render();
|
|
71654
71672
|
};
|
|
71655
71673
|
_proto.openLoadingGizmo = function openLoadingGizmo(id, options) {
|
|
71656
71674
|
var _this__emitter;
|
|
@@ -83256,12 +83274,43 @@ var BaseConfig = {
|
|
|
83256
83274
|
},
|
|
83257
83275
|
cardConfig: {
|
|
83258
83276
|
backgroundColor: [
|
|
83259
|
-
|
|
83260
|
-
|
|
83261
|
-
|
|
83262
|
-
0
|
|
83277
|
+
0.6,
|
|
83278
|
+
0.6,
|
|
83279
|
+
0.6,
|
|
83280
|
+
0.12
|
|
83263
83281
|
],
|
|
83264
|
-
cardTypes: [
|
|
83282
|
+
cardTypes: [
|
|
83283
|
+
{
|
|
83284
|
+
type: 'character',
|
|
83285
|
+
label: '角色图',
|
|
83286
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83287
|
+
},
|
|
83288
|
+
{
|
|
83289
|
+
type: 'environment',
|
|
83290
|
+
label: '环境图',
|
|
83291
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83292
|
+
},
|
|
83293
|
+
{
|
|
83294
|
+
type: 'storyboard',
|
|
83295
|
+
label: '分镜图',
|
|
83296
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83297
|
+
},
|
|
83298
|
+
{
|
|
83299
|
+
type: 'scene-clip',
|
|
83300
|
+
label: '场景剪辑',
|
|
83301
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83302
|
+
},
|
|
83303
|
+
{
|
|
83304
|
+
type: 'video-compose',
|
|
83305
|
+
label: '视频合成',
|
|
83306
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83307
|
+
},
|
|
83308
|
+
{
|
|
83309
|
+
type: 'video-generate',
|
|
83310
|
+
label: '生成视频',
|
|
83311
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83312
|
+
}
|
|
83313
|
+
]
|
|
83265
83314
|
}
|
|
83266
83315
|
}
|
|
83267
83316
|
};
|
|
@@ -91590,18 +91639,11 @@ function isCardHTMLAutoHeightMessage(data, id) {
|
|
|
91590
91639
|
var message = data;
|
|
91591
91640
|
return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
|
|
91592
91641
|
}
|
|
91593
|
-
function requestCardHTMLAutoHeight(iframe, id) {
|
|
91594
|
-
var _iframe_contentWindow;
|
|
91595
|
-
(_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
|
|
91596
|
-
source: 'vvfx-card-html-auto-height-request',
|
|
91597
|
-
id: id
|
|
91598
|
-
}, '*');
|
|
91599
|
-
}
|
|
91600
91642
|
function withCardHTMLAutoHeightBridge(html, id) {
|
|
91601
91643
|
if (!id) {
|
|
91602
91644
|
return html;
|
|
91603
91645
|
}
|
|
91604
|
-
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const
|
|
91646
|
+
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const getChildrenHeight = (element) => {\n if (!element) return 0;\n return Array.from(element.children).reduce((height, child) => {\n const rect = child.getBoundingClientRect();\n return Math.max(height, rect.bottom + window.scrollY);\n }, 0);\n };\n const getHeight = () => {\n const body = document.body;\n const root = document.documentElement;\n const childHeight = getChildrenHeight(body);\n const scrollHeight = Math.max(root.scrollHeight, body ? body.scrollHeight : 0);\n return Math.ceil(Math.max(childHeight, scrollHeight));\n };\n const postHeight = () => {\n frame = 0;\n window.parent.postMessage({\n source: 'vvfx-card-html-auto-height',\n id,\n height: getHeight(),\n }, '*');\n };\n const schedule = () => {\n if (frame) return;\n frame = requestAnimationFrame(postHeight);\n };\n window.addEventListener('load', schedule);\n window.addEventListener('resize', schedule);\n new ResizeObserver(schedule).observe(document.documentElement);\n if (document.body) {\n new ResizeObserver(schedule).observe(document.body);\n new MutationObserver(schedule).observe(document.body, {\n attributes: true,\n childList: true,\n subtree: true,\n characterData: true,\n });\n }\n schedule();\n})();\n</script>";
|
|
91605
91647
|
if (/<\/body>/i.test(html)) {
|
|
91606
91648
|
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91607
91649
|
}
|
|
@@ -91874,38 +91916,30 @@ function syncElementStackOrder(_container, elements) {
|
|
|
91874
91916
|
});
|
|
91875
91917
|
}
|
|
91876
91918
|
|
|
91877
|
-
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY
|
|
91919
|
+
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
|
|
91878
91920
|
if (offsetX === void 0) offsetX = 0;
|
|
91879
91921
|
if (offsetY === void 0) offsetY = 0;
|
|
91880
91922
|
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
91881
91923
|
var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
|
|
91882
|
-
var
|
|
91883
|
-
var
|
|
91884
|
-
var
|
|
91885
|
-
var
|
|
91886
|
-
var c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
91887
|
-
var d = (leftBottom.y - leftTop.y) / contentHeight;
|
|
91924
|
+
var a = (rightTop.x - leftTop.x) / width;
|
|
91925
|
+
var b = (rightTop.y - leftTop.y) / width;
|
|
91926
|
+
var c = (leftBottom.x - leftTop.x) / height;
|
|
91927
|
+
var d = (leftBottom.y - leftTop.y) / height;
|
|
91888
91928
|
var e = leftTop.x - offsetX;
|
|
91889
91929
|
var f = leftTop.y - offsetY;
|
|
91890
91930
|
return {
|
|
91891
91931
|
left: '0px',
|
|
91892
91932
|
top: '0px',
|
|
91893
|
-
width: "" +
|
|
91894
|
-
height: "" +
|
|
91895
|
-
contentWidth: contentWidth,
|
|
91896
|
-
contentHeight: contentHeight,
|
|
91933
|
+
width: "" + width + "px",
|
|
91934
|
+
height: "" + height + "px",
|
|
91897
91935
|
transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
|
|
91898
91936
|
};
|
|
91899
91937
|
}
|
|
91900
|
-
var contentWidth1 = box.max.x - box.min.x;
|
|
91901
|
-
var contentHeight1 = box.max.y - box.min.y;
|
|
91902
91938
|
return {
|
|
91903
91939
|
left: "" + (box.min.x - offsetX) + "px",
|
|
91904
91940
|
top: "" + (box.min.y - offsetY) + "px",
|
|
91905
|
-
width: "" +
|
|
91906
|
-
height: "" +
|
|
91907
|
-
contentWidth: contentWidth1,
|
|
91908
|
-
contentHeight: contentHeight1,
|
|
91941
|
+
width: "" + (box.max.x - box.min.x) + "px",
|
|
91942
|
+
height: "" + (box.max.y - box.min.y) + "px",
|
|
91909
91943
|
transform: ''
|
|
91910
91944
|
};
|
|
91911
91945
|
}
|
|
@@ -91928,10 +91962,6 @@ function formatMatrixNumber(value) {
|
|
|
91928
91962
|
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91929
91963
|
return Number(normalized.toFixed(6)).toString();
|
|
91930
91964
|
}
|
|
91931
|
-
function formatPixelNumber(value) {
|
|
91932
|
-
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91933
|
-
return Number(normalized.toFixed(6)).toString();
|
|
91934
|
-
}
|
|
91935
91965
|
|
|
91936
91966
|
function mountHTMLShell(container, content, shell) {
|
|
91937
91967
|
if (!shell) {
|
|
@@ -91952,26 +91982,6 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91952
91982
|
|
|
91953
91983
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91954
91984
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
91955
|
-
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
91956
|
-
'[data-vvfx-html-interaction-zone="self"]',
|
|
91957
|
-
'[data-vvfx-html-interaction-zone="subtree"]',
|
|
91958
|
-
'a[href]',
|
|
91959
|
-
'button:not([disabled])',
|
|
91960
|
-
'input:not([disabled])',
|
|
91961
|
-
'textarea:not([disabled])',
|
|
91962
|
-
'select:not([disabled])',
|
|
91963
|
-
'summary',
|
|
91964
|
-
'video[controls]',
|
|
91965
|
-
'audio[controls]',
|
|
91966
|
-
'[contenteditable]:not([contenteditable="false"])',
|
|
91967
|
-
'[role="button"]',
|
|
91968
|
-
'[role="link"]',
|
|
91969
|
-
'[role="textbox"]',
|
|
91970
|
-
'[tabindex]:not([tabindex="-1"])'
|
|
91971
|
-
].join(', ');
|
|
91972
|
-
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
91973
|
-
'[data-vvfx-html-interaction-zone="none"]'
|
|
91974
|
-
].join(', ');
|
|
91975
91985
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91976
91986
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91977
91987
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
@@ -91981,20 +91991,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91981
91991
|
var _this = this;
|
|
91982
91992
|
this.options = options;
|
|
91983
91993
|
this.eventCleanups = [];
|
|
91984
|
-
this.htmlRootConfigCleanups = new WeakMap();
|
|
91985
91994
|
this.state = {
|
|
91986
91995
|
frameElements: new Map(),
|
|
91987
91996
|
elements: new Map(),
|
|
91988
|
-
selectionElements: new Map(),
|
|
91989
91997
|
contentScaleElements: new Map(),
|
|
91990
91998
|
contentElements: new Map(),
|
|
91991
91999
|
contentMountElements: new Map(),
|
|
91992
|
-
contentInteractionZones: new Map(),
|
|
91993
|
-
contentInteractionZoneCleanups: new Map(),
|
|
91994
|
-
contentInteractionResizeCleanups: new Map(),
|
|
91995
92000
|
contents: new Map(),
|
|
91996
92001
|
cleanups: new Map(),
|
|
91997
|
-
autoHeightModes: new Map(),
|
|
91998
92002
|
autoHeightCleanups: new Map(),
|
|
91999
92003
|
autoHeightFrames: new Map()
|
|
92000
92004
|
};
|
|
@@ -92011,9 +92015,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92011
92015
|
}
|
|
92012
92016
|
return;
|
|
92013
92017
|
}
|
|
92014
|
-
if (!_this.isEditableCard(targetId)) {
|
|
92015
|
-
return;
|
|
92016
|
-
}
|
|
92017
92018
|
event.preventDefault();
|
|
92018
92019
|
event.stopPropagation();
|
|
92019
92020
|
_this.enterEditing(targetId);
|
|
@@ -92029,7 +92030,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92029
92030
|
_this.exitEditing();
|
|
92030
92031
|
};
|
|
92031
92032
|
this.handleContainerMouseMove = function(event) {
|
|
92032
|
-
_this.scheduleActiveContentInteractionSync(event);
|
|
92033
92033
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
92034
92034
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
92035
92035
|
return;
|
|
@@ -92043,16 +92043,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92043
92043
|
_this.syncContentInteraction(hoverShellInteractiveId);
|
|
92044
92044
|
}
|
|
92045
92045
|
};
|
|
92046
|
-
this.handleContainerMouseLeave = function(
|
|
92047
|
-
if (_this.isMouseLeaveWithinContainer(event)) {
|
|
92048
|
-
return;
|
|
92049
|
-
}
|
|
92050
|
-
if (_this.contentInteractionFrame !== undefined) {
|
|
92051
|
-
cancelAnimationFrame(_this.contentInteractionFrame);
|
|
92052
|
-
_this.contentInteractionFrame = undefined;
|
|
92053
|
-
}
|
|
92054
|
-
_this.pendingContentInteractionEvent = undefined;
|
|
92055
|
-
_this.setActiveContentInteraction(undefined);
|
|
92046
|
+
this.handleContainerMouseLeave = function() {
|
|
92056
92047
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
92057
92048
|
if (!previousId) {
|
|
92058
92049
|
return;
|
|
@@ -92060,33 +92051,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92060
92051
|
_this.state.hoverShellInteractiveId = undefined;
|
|
92061
92052
|
_this.syncContentInteraction(previousId);
|
|
92062
92053
|
};
|
|
92063
|
-
this.handleContainerContextMenu = function(event) {
|
|
92064
|
-
var activeInteraction = _this.state.activeContentInteraction;
|
|
92065
|
-
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92066
|
-
return;
|
|
92067
|
-
}
|
|
92068
|
-
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92069
|
-
if (!canvas) {
|
|
92070
|
-
return;
|
|
92071
|
-
}
|
|
92072
|
-
event.preventDefault();
|
|
92073
|
-
event.stopPropagation();
|
|
92074
|
-
_this.setActiveContentInteraction(undefined);
|
|
92075
|
-
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92076
|
-
bubbles: true,
|
|
92077
|
-
cancelable: true,
|
|
92078
|
-
clientX: event.clientX,
|
|
92079
|
-
clientY: event.clientY,
|
|
92080
|
-
screenX: event.screenX,
|
|
92081
|
-
screenY: event.screenY,
|
|
92082
|
-
button: event.button,
|
|
92083
|
-
buttons: event.buttons,
|
|
92084
|
-
ctrlKey: event.ctrlKey,
|
|
92085
|
-
shiftKey: event.shiftKey,
|
|
92086
|
-
altKey: event.altKey,
|
|
92087
|
-
metaKey: event.metaKey
|
|
92088
|
-
}));
|
|
92089
|
-
};
|
|
92090
92054
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
92091
92055
|
}
|
|
92092
92056
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -92100,6 +92064,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92100
92064
|
layer.style.position = 'absolute';
|
|
92101
92065
|
layer.style.inset = '0';
|
|
92102
92066
|
layer.style.pointerEvents = 'none';
|
|
92067
|
+
layer.style.zIndex = '1';
|
|
92103
92068
|
container.appendChild(layer);
|
|
92104
92069
|
this.state.layer = layer;
|
|
92105
92070
|
this.initDOMEvents();
|
|
@@ -92112,32 +92077,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92112
92077
|
cancelAnimationFrame(this.state.updateFrame);
|
|
92113
92078
|
this.state.updateFrame = undefined;
|
|
92114
92079
|
}
|
|
92115
|
-
if (this.contentInteractionFrame !== undefined) {
|
|
92116
|
-
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92117
|
-
this.contentInteractionFrame = undefined;
|
|
92118
|
-
}
|
|
92119
|
-
this.pendingContentInteractionEvent = undefined;
|
|
92120
92080
|
this.state.cleanups.forEach(function(cleanup) {
|
|
92121
92081
|
cleanup();
|
|
92122
92082
|
});
|
|
92123
92083
|
this.state.frameElements.clear();
|
|
92124
92084
|
this.state.elements.clear();
|
|
92125
|
-
this.state.selectionElements.clear();
|
|
92126
92085
|
this.state.contentScaleElements.clear();
|
|
92127
92086
|
this.state.contentElements.clear();
|
|
92128
92087
|
this.state.contentMountElements.clear();
|
|
92129
|
-
this.state.contentInteractionZones.clear();
|
|
92130
|
-
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92131
|
-
cleanup();
|
|
92132
|
-
});
|
|
92133
|
-
this.state.contentInteractionZoneCleanups.clear();
|
|
92134
|
-
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92135
|
-
cleanup();
|
|
92136
|
-
});
|
|
92137
|
-
this.state.contentInteractionResizeCleanups.clear();
|
|
92138
92088
|
this.state.contents.clear();
|
|
92139
92089
|
this.state.cleanups.clear();
|
|
92140
|
-
this.state.autoHeightModes.clear();
|
|
92141
92090
|
this.state.autoHeightCleanups.forEach(function(cleanup) {
|
|
92142
92091
|
cleanup();
|
|
92143
92092
|
});
|
|
@@ -92152,12 +92101,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92152
92101
|
this.eventCleanups = [];
|
|
92153
92102
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92154
92103
|
this.state.layer = undefined;
|
|
92155
|
-
this.state.selectionLayer = undefined;
|
|
92156
92104
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92157
92105
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92158
92106
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92159
92107
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92160
|
-
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92161
92108
|
};
|
|
92162
92109
|
_proto.scheduleRender = function scheduleRender() {
|
|
92163
92110
|
var _this = this;
|
|
@@ -92169,10 +92116,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92169
92116
|
_this.render();
|
|
92170
92117
|
});
|
|
92171
92118
|
};
|
|
92172
|
-
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92173
|
-
this.cleanupOverlayContent(id);
|
|
92174
|
-
this.invalidateContentInteractionZones(id);
|
|
92175
|
-
};
|
|
92176
92119
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92177
92120
|
return _async_to_generator(function() {
|
|
92178
92121
|
var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
|
|
@@ -92265,7 +92208,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92265
92208
|
var events = [
|
|
92266
92209
|
'pageDataChange',
|
|
92267
92210
|
'selectedItemChange',
|
|
92268
|
-
'preSelectedItemChange',
|
|
92269
92211
|
'itemPropertyChange',
|
|
92270
92212
|
'viewportTransform',
|
|
92271
92213
|
'viewRebuildFinish'
|
|
@@ -92275,7 +92217,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92275
92217
|
if (event === 'viewportTransform') {
|
|
92276
92218
|
_this.handleViewportTransform();
|
|
92277
92219
|
}
|
|
92278
|
-
_this.invalidateContentInteractionZones();
|
|
92279
92220
|
_this.scheduleRender();
|
|
92280
92221
|
});
|
|
92281
92222
|
});
|
|
@@ -92285,24 +92226,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92285
92226
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92286
92227
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92287
92228
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92288
|
-
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92289
|
-
};
|
|
92290
|
-
_proto.isMouseLeaveWithinContainer = function isMouseLeaveWithinContainer(event) {
|
|
92291
|
-
var relatedTarget = event.relatedTarget;
|
|
92292
|
-
if (!relatedTarget) {
|
|
92293
|
-
return false;
|
|
92294
|
-
}
|
|
92295
|
-
try {
|
|
92296
|
-
return this.options.container.contains(relatedTarget);
|
|
92297
|
-
} catch (unused) {
|
|
92298
|
-
return false;
|
|
92299
|
-
}
|
|
92300
|
-
};
|
|
92301
|
-
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92302
|
-
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92303
|
-
return false;
|
|
92304
|
-
}
|
|
92305
|
-
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92306
92229
|
};
|
|
92307
92230
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92308
92231
|
var editing = this.state.editing;
|
|
@@ -92322,16 +92245,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92322
92245
|
}
|
|
92323
92246
|
var items = this.options.getItems();
|
|
92324
92247
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92325
|
-
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92326
92248
|
var visibleCardIds = new Set();
|
|
92327
92249
|
var editingVisible = false;
|
|
92328
92250
|
items.forEach(function(item) {
|
|
92329
92251
|
var _this_state_editing;
|
|
92330
|
-
if (!isCardItem(item) || !item.visible) {
|
|
92331
|
-
return;
|
|
92332
|
-
}
|
|
92333
|
-
var html = _this.options.resolveCardHTML(item);
|
|
92334
|
-
if (html === undefined) {
|
|
92252
|
+
if (!isCardItem(item) || !item.visible || item.html === undefined) {
|
|
92335
92253
|
return;
|
|
92336
92254
|
}
|
|
92337
92255
|
var itemBox = _this.options.getViewBoxById(item.id);
|
|
@@ -92346,31 +92264,21 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92346
92264
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92347
92265
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92348
92266
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92349
|
-
var
|
|
92350
|
-
if (
|
|
92267
|
+
var html = item.html;
|
|
92268
|
+
if (html && _this.state.contents.get(item.id) !== html) {
|
|
92351
92269
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92352
92270
|
}
|
|
92353
|
-
_this.applyHTMLRootConfig(overlay, html);
|
|
92354
92271
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92355
92272
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92356
|
-
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY
|
|
92273
|
+
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY);
|
|
92357
92274
|
overlay.style.left = boxStyle.left;
|
|
92358
92275
|
overlay.style.top = boxStyle.top;
|
|
92359
92276
|
overlay.style.width = boxStyle.width;
|
|
92360
92277
|
overlay.style.height = boxStyle.height;
|
|
92361
92278
|
overlay.style.transform = boxStyle.transform;
|
|
92362
92279
|
overlay.style.transformOrigin = '0 0';
|
|
92363
|
-
|
|
92364
|
-
|
|
92365
|
-
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92366
|
-
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92367
|
-
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92368
|
-
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92369
|
-
selectionOverlay.style.transformOrigin = '0 0';
|
|
92370
|
-
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92371
|
-
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92372
|
-
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92373
|
-
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92280
|
+
_this.syncContentScale(item.id, item.property.width, item.property.height);
|
|
92281
|
+
_this.syncAutoHeight(item.id, item.property.autoHeight === true);
|
|
92374
92282
|
_this.syncContentInteraction(item.id);
|
|
92375
92283
|
});
|
|
92376
92284
|
elements.forEach(function(_overlay, id) {
|
|
@@ -92409,9 +92317,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92409
92317
|
}
|
|
92410
92318
|
}
|
|
92411
92319
|
syncElementStackOrder(layer, rootElements);
|
|
92412
|
-
if (this.state.selectionLayer) {
|
|
92413
|
-
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92414
|
-
}
|
|
92415
92320
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92416
92321
|
var frameElements = [];
|
|
92417
92322
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92427,28 +92332,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92427
92332
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92428
92333
|
});
|
|
92429
92334
|
};
|
|
92430
|
-
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92431
|
-
var _layer_ownerDocument;
|
|
92432
|
-
if (this.state.selectionLayer) {
|
|
92433
|
-
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92434
|
-
layer.appendChild(this.state.selectionLayer);
|
|
92435
|
-
}
|
|
92436
|
-
return this.state.selectionLayer;
|
|
92437
|
-
}
|
|
92438
|
-
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92439
|
-
if (!ownerDocument) {
|
|
92440
|
-
return layer;
|
|
92441
|
-
}
|
|
92442
|
-
var selectionLayer = ownerDocument.createElement('div');
|
|
92443
|
-
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92444
|
-
selectionLayer.style.position = 'absolute';
|
|
92445
|
-
selectionLayer.style.inset = '0';
|
|
92446
|
-
selectionLayer.style.pointerEvents = 'none';
|
|
92447
|
-
selectionLayer.style.zIndex = '1';
|
|
92448
|
-
layer.appendChild(selectionLayer);
|
|
92449
|
-
this.state.selectionLayer = selectionLayer;
|
|
92450
|
-
return selectionLayer;
|
|
92451
|
-
};
|
|
92452
92335
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92453
92336
|
var _this = this;
|
|
92454
92337
|
var visibleFrameIds = new Set();
|
|
@@ -92513,41 +92396,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92513
92396
|
elements.set(id, overlay);
|
|
92514
92397
|
return overlay;
|
|
92515
92398
|
};
|
|
92516
|
-
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92517
|
-
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92518
|
-
if (selectionOverlay) {
|
|
92519
|
-
if (selectionOverlay.parentElement !== parent) {
|
|
92520
|
-
parent.appendChild(selectionOverlay);
|
|
92521
|
-
}
|
|
92522
|
-
return selectionOverlay;
|
|
92523
|
-
}
|
|
92524
|
-
selectionOverlay = document.createElement('div');
|
|
92525
|
-
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92526
|
-
selectionOverlay.dataset.itemId = id;
|
|
92527
|
-
selectionOverlay.style.position = 'absolute';
|
|
92528
|
-
selectionOverlay.style.pointerEvents = 'none';
|
|
92529
|
-
selectionOverlay.style.zIndex = '1';
|
|
92530
|
-
parent.appendChild(selectionOverlay);
|
|
92531
|
-
this.state.selectionElements.set(id, selectionOverlay);
|
|
92532
|
-
return selectionOverlay;
|
|
92533
|
-
};
|
|
92534
|
-
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92535
|
-
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92536
|
-
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92537
|
-
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92538
|
-
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92539
|
-
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92540
|
-
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92541
|
-
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92542
|
-
};
|
|
92543
|
-
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92544
|
-
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92545
|
-
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92546
|
-
};
|
|
92547
|
-
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92548
|
-
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92549
|
-
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92550
|
-
};
|
|
92551
92399
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92552
92400
|
var layer = this.state.layer;
|
|
92553
92401
|
if (!layer) {
|
|
@@ -92557,7 +92405,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92557
92405
|
var items = this.options.getItems();
|
|
92558
92406
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92559
92407
|
var item = items[i];
|
|
92560
|
-
if (!isCardItem(item) || !item.visible ||
|
|
92408
|
+
if (!isCardItem(item) || !item.visible || item.html === undefined) {
|
|
92561
92409
|
continue;
|
|
92562
92410
|
}
|
|
92563
92411
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -92576,7 +92424,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92576
92424
|
var items = this.options.getItems();
|
|
92577
92425
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92578
92426
|
var item = items[i];
|
|
92579
|
-
if (!isCardItem(item) || !item.visible ||
|
|
92427
|
+
if (!isCardItem(item) || !item.visible || item.html === undefined) {
|
|
92580
92428
|
continue;
|
|
92581
92429
|
}
|
|
92582
92430
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -92586,206 +92434,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92586
92434
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92587
92435
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92588
92436
|
var isHoveringShellInteractive = interactiveElements.some(function(element) {
|
|
92589
|
-
|
|
92437
|
+
var rect = element.getBoundingClientRect();
|
|
92438
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
92590
92439
|
});
|
|
92591
92440
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92592
92441
|
}
|
|
92593
92442
|
return undefined;
|
|
92594
92443
|
};
|
|
92595
|
-
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92596
|
-
var decision = this.resolveHTMLInteractionTarget(event);
|
|
92597
|
-
if (decision.kind === 'canvas' && this.shouldKeepActiveContentInteractionForFocusedElement()) {
|
|
92598
|
-
return;
|
|
92599
|
-
}
|
|
92600
|
-
this.setActiveContentInteraction(decision.kind === 'html' ? decision.interaction : undefined);
|
|
92601
|
-
};
|
|
92602
|
-
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92603
|
-
var _this = this;
|
|
92604
|
-
if (typeof requestAnimationFrame !== 'function') {
|
|
92605
|
-
this.syncActiveContentInteraction(event);
|
|
92606
|
-
return;
|
|
92607
|
-
}
|
|
92608
|
-
this.pendingContentInteractionEvent = event;
|
|
92609
|
-
if (this.contentInteractionFrame !== undefined) {
|
|
92610
|
-
return;
|
|
92611
|
-
}
|
|
92612
|
-
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92613
|
-
_this.contentInteractionFrame = undefined;
|
|
92614
|
-
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92615
|
-
_this.pendingContentInteractionEvent = undefined;
|
|
92616
|
-
if (pendingEvent) {
|
|
92617
|
-
_this.syncActiveContentInteraction(pendingEvent);
|
|
92618
|
-
}
|
|
92619
|
-
});
|
|
92620
|
-
};
|
|
92621
|
-
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92622
|
-
var _this = this;
|
|
92623
|
-
var previous = this.state.activeContentInteraction;
|
|
92624
|
-
if ((previous == null ? void 0 : previous.id) === (zone == null ? void 0 : zone.id) && (previous == null ? void 0 : previous.element) === (zone == null ? void 0 : zone.element) && (previous == null ? void 0 : previous.zone) === (zone == null ? void 0 : zone.zone)) {
|
|
92625
|
-
return;
|
|
92626
|
-
}
|
|
92627
|
-
this.state.activeContentInteraction = zone;
|
|
92628
|
-
var changedIds = new Set();
|
|
92629
|
-
if (previous) {
|
|
92630
|
-
changedIds.add(previous.id);
|
|
92631
|
-
}
|
|
92632
|
-
if (zone) {
|
|
92633
|
-
changedIds.add(zone.id);
|
|
92634
|
-
}
|
|
92635
|
-
changedIds.forEach(function(id) {
|
|
92636
|
-
_this.syncContentInteraction(id);
|
|
92637
|
-
});
|
|
92638
|
-
};
|
|
92639
|
-
_proto.shouldKeepActiveContentInteractionForFocusedElement = function shouldKeepActiveContentInteractionForFocusedElement() {
|
|
92640
|
-
var activeInteraction = this.state.activeContentInteraction;
|
|
92641
|
-
if (!activeInteraction || typeof document === 'undefined') {
|
|
92642
|
-
return false;
|
|
92643
|
-
}
|
|
92644
|
-
var activeElement = document.activeElement;
|
|
92645
|
-
if (!activeElement || activeElement === document.body) {
|
|
92646
|
-
return false;
|
|
92647
|
-
}
|
|
92648
|
-
var interactionElement = activeInteraction.element;
|
|
92649
|
-
return interactionElement === activeElement || typeof interactionElement.contains === 'function' && interactionElement.contains(activeElement);
|
|
92650
|
-
};
|
|
92651
|
-
_proto.resolveHTMLInteractionTarget = function resolveHTMLInteractionTarget(event) {
|
|
92652
|
-
var id = this.getHTMLCardIdByEvent(event);
|
|
92653
|
-
if (!id || this.isEditableCard(id)) {
|
|
92654
|
-
return {
|
|
92655
|
-
kind: 'canvas',
|
|
92656
|
-
id: id
|
|
92657
|
-
};
|
|
92658
|
-
}
|
|
92659
|
-
var contentOverlay = this.state.contentElements.get(id);
|
|
92660
|
-
if (!contentOverlay) {
|
|
92661
|
-
return {
|
|
92662
|
-
kind: 'canvas',
|
|
92663
|
-
id: id
|
|
92664
|
-
};
|
|
92665
|
-
}
|
|
92666
|
-
var activeSubtree = this.getActiveSubtreeInteractionAtEvent(id, event);
|
|
92667
|
-
if (activeSubtree) {
|
|
92668
|
-
return {
|
|
92669
|
-
kind: 'html',
|
|
92670
|
-
interaction: activeSubtree
|
|
92671
|
-
};
|
|
92672
|
-
}
|
|
92673
|
-
var matchedZones = this.getContentInteractionZones(id, contentOverlay).filter(function(zone) {
|
|
92674
|
-
return isMouseEventInsideRect(event, zone.rect);
|
|
92675
|
-
});
|
|
92676
|
-
var zone = this.resolveContentInteractionZone(matchedZones);
|
|
92677
|
-
if (zone) {
|
|
92678
|
-
return {
|
|
92679
|
-
kind: 'html',
|
|
92680
|
-
interaction: {
|
|
92681
|
-
id: id,
|
|
92682
|
-
element: zone.element,
|
|
92683
|
-
zone: zone.zone
|
|
92684
|
-
}
|
|
92685
|
-
};
|
|
92686
|
-
}
|
|
92687
|
-
return {
|
|
92688
|
-
kind: 'canvas',
|
|
92689
|
-
id: id
|
|
92690
|
-
};
|
|
92691
|
-
};
|
|
92692
|
-
_proto.getActiveSubtreeInteractionAtEvent = function getActiveSubtreeInteractionAtEvent(id, event) {
|
|
92693
|
-
var activeInteraction = this.state.activeContentInteraction;
|
|
92694
|
-
if ((activeInteraction == null ? void 0 : activeInteraction.id) !== id || activeInteraction.zone !== 'subtree') {
|
|
92695
|
-
return undefined;
|
|
92696
|
-
}
|
|
92697
|
-
var rect = activeInteraction.element.getBoundingClientRect();
|
|
92698
|
-
return isMouseEventInsideRect(event, rect) ? activeInteraction : undefined;
|
|
92699
|
-
};
|
|
92700
|
-
_proto.resolveContentInteractionZone = function resolveContentInteractionZone(zones) {
|
|
92701
|
-
if (zones.length <= 1) {
|
|
92702
|
-
return zones[0];
|
|
92703
|
-
}
|
|
92704
|
-
var subtreeRoot = zones.find(function(candidate) {
|
|
92705
|
-
return candidate.zone === 'subtree' && typeof candidate.element.contains === 'function' && zones.some(function(zone) {
|
|
92706
|
-
return zone.element !== candidate.element && candidate.element.contains(zone.element);
|
|
92707
|
-
});
|
|
92708
|
-
});
|
|
92709
|
-
return subtreeRoot != null ? subtreeRoot : zones[0];
|
|
92710
|
-
};
|
|
92711
|
-
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92712
|
-
var _this = this;
|
|
92713
|
-
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92714
|
-
if (cachedZones) {
|
|
92715
|
-
return cachedZones;
|
|
92716
|
-
}
|
|
92717
|
-
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92718
|
-
return !_this.isContentInteractionDisabled(element);
|
|
92719
|
-
}).map(function(element) {
|
|
92720
|
-
return {
|
|
92721
|
-
element: element,
|
|
92722
|
-
rect: element.getBoundingClientRect(),
|
|
92723
|
-
zone: _this.getContentInteractionZoneMode(element)
|
|
92724
|
-
};
|
|
92725
|
-
});
|
|
92726
|
-
this.state.contentInteractionZones.set(id, zones);
|
|
92727
|
-
this.observeContentInteractionZoneResizes(id, zones);
|
|
92728
|
-
return zones;
|
|
92729
|
-
};
|
|
92730
|
-
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92731
|
-
var _ref;
|
|
92732
|
-
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92733
|
-
var item = this.options.getItems().find(function(item) {
|
|
92734
|
-
return item.id === id;
|
|
92735
|
-
});
|
|
92736
|
-
if (!item) {
|
|
92737
|
-
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92738
|
-
}
|
|
92739
|
-
var selectors = (_ref = (_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : (_this_options_resolveCardTypeConfig_htmlInteractionSelectors = _this_options_resolveCardTypeConfig.htmlInteractionSelectors) == null ? void 0 : _this_options_resolveCardTypeConfig_htmlInteractionSelectors.filter(Boolean)) != null ? _ref : [];
|
|
92740
|
-
if (selectors.length === 0) {
|
|
92741
|
-
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92742
|
-
}
|
|
92743
|
-
return [].concat([
|
|
92744
|
-
CONTENT_INTERACTIVE_SELECTOR
|
|
92745
|
-
], selectors).join(', ');
|
|
92746
|
-
};
|
|
92747
|
-
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92748
|
-
if (typeof element.closest !== 'function') {
|
|
92749
|
-
return false;
|
|
92750
|
-
}
|
|
92751
|
-
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92752
|
-
};
|
|
92753
|
-
_proto.getContentInteractionZoneMode = function getContentInteractionZoneMode(element) {
|
|
92754
|
-
var zone = element.dataset.vvfxHtmlInteractionZone;
|
|
92755
|
-
return zone === 'subtree' ? 'subtree' : 'self';
|
|
92756
|
-
};
|
|
92757
|
-
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92758
|
-
if (id) {
|
|
92759
|
-
var _this_state_contentInteractionResizeCleanups_get;
|
|
92760
|
-
this.state.contentInteractionZones.delete(id);
|
|
92761
|
-
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92762
|
-
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92763
|
-
return;
|
|
92764
|
-
}
|
|
92765
|
-
this.state.contentInteractionZones.clear();
|
|
92766
|
-
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92767
|
-
cleanup();
|
|
92768
|
-
});
|
|
92769
|
-
this.state.contentInteractionResizeCleanups.clear();
|
|
92770
|
-
};
|
|
92771
|
-
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92772
|
-
var _this = this;
|
|
92773
|
-
var _this_state_contentInteractionResizeCleanups_get;
|
|
92774
|
-
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92775
|
-
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92776
|
-
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92777
|
-
return;
|
|
92778
|
-
}
|
|
92779
|
-
var observer = new ResizeObserver(function() {
|
|
92780
|
-
_this.invalidateContentInteractionZones(id);
|
|
92781
|
-
});
|
|
92782
|
-
zones.forEach(function(zone) {
|
|
92783
|
-
observer.observe(zone.element);
|
|
92784
|
-
});
|
|
92785
|
-
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92786
|
-
observer.disconnect();
|
|
92787
|
-
});
|
|
92788
|
-
};
|
|
92789
92444
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92790
92445
|
var rect = this.options.container.getBoundingClientRect();
|
|
92791
92446
|
return {
|
|
@@ -92842,35 +92497,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92842
92497
|
if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
|
|
92843
92498
|
return;
|
|
92844
92499
|
}
|
|
92845
|
-
|
|
92846
|
-
|
|
92847
|
-
var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
|
|
92848
|
-
scaleOverlay.style.width = nextWidth;
|
|
92849
|
-
scaleOverlay.style.height = nextHeight;
|
|
92500
|
+
scaleOverlay.style.width = "" + width + "px";
|
|
92501
|
+
scaleOverlay.style.height = "" + height + "px";
|
|
92850
92502
|
scaleOverlay.style.transform = 'none';
|
|
92851
|
-
contentOverlay.style.width =
|
|
92852
|
-
contentOverlay.style.height =
|
|
92853
|
-
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92854
|
-
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92855
|
-
}
|
|
92856
|
-
if (sizeChanged) {
|
|
92857
|
-
this.invalidateContentInteractionZones(id);
|
|
92858
|
-
}
|
|
92859
|
-
};
|
|
92860
|
-
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92861
|
-
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92862
|
-
requestCardHTMLAutoHeight(iframe, id);
|
|
92863
|
-
});
|
|
92503
|
+
contentOverlay.style.width = "" + width + "px";
|
|
92504
|
+
contentOverlay.style.height = "" + height + "px";
|
|
92864
92505
|
};
|
|
92865
92506
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92866
|
-
var _this_state_editing
|
|
92507
|
+
var _this_state_editing;
|
|
92867
92508
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
92868
|
-
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92869
92509
|
var overlay = this.state.elements.get(id);
|
|
92870
92510
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92871
92511
|
var contentOverlay = this.state.contentElements.get(id);
|
|
92872
92512
|
var contentMount = this.state.contentMountElements.get(id);
|
|
92873
|
-
var isInteractive = isEditing || !!activeInteraction;
|
|
92874
92513
|
if (overlay) {
|
|
92875
92514
|
overlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92876
92515
|
overlay.style.pointerEvents = 'none';
|
|
@@ -92881,62 +92520,34 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92881
92520
|
}
|
|
92882
92521
|
if (contentOverlay) {
|
|
92883
92522
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92884
|
-
contentOverlay.style.pointerEvents =
|
|
92523
|
+
contentOverlay.style.pointerEvents = 'none';
|
|
92885
92524
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92886
|
-
|
|
92887
|
-
iframe.
|
|
92888
|
-
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92525
|
+
iframe.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92526
|
+
iframe.tabIndex = isEditing ? 0 : -1;
|
|
92889
92527
|
});
|
|
92890
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
92891
|
-
this.syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive);
|
|
92528
|
+
this.syncShellInteraction(id, contentOverlay, isEditing);
|
|
92892
92529
|
}
|
|
92893
92530
|
if (contentMount) {
|
|
92894
92531
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92895
|
-
contentMount.style.pointerEvents =
|
|
92896
|
-
contentMount.inert = !
|
|
92897
|
-
if (
|
|
92532
|
+
contentMount.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92533
|
+
contentMount.inert = !isEditing;
|
|
92534
|
+
if (isEditing) {
|
|
92898
92535
|
contentMount.removeAttribute('aria-hidden');
|
|
92899
92536
|
} else {
|
|
92900
92537
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92901
92538
|
}
|
|
92902
92539
|
}
|
|
92903
92540
|
};
|
|
92904
|
-
_proto.
|
|
92905
|
-
var _this = this;
|
|
92906
|
-
var activeElement = activeInteraction == null ? void 0 : activeInteraction.element;
|
|
92907
|
-
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
92908
|
-
if ((activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && activeElement && element !== activeElement && typeof activeElement.contains === 'function' && activeElement.contains(element)) {
|
|
92909
|
-
_this.clearContentInteractionState(element);
|
|
92910
|
-
return;
|
|
92911
|
-
}
|
|
92912
|
-
if (!isInteractive) {
|
|
92913
|
-
_this.clearContentInteractionState(element);
|
|
92914
|
-
return;
|
|
92915
|
-
}
|
|
92916
|
-
if (_this.isContentInteractionDisabled(element)) {
|
|
92917
|
-
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
92918
|
-
element.style.pointerEvents = 'none';
|
|
92919
|
-
return;
|
|
92920
|
-
}
|
|
92921
|
-
var isElementInteractive = isEditing || activeElement === element || (activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && typeof (activeElement == null ? void 0 : activeElement.contains) === 'function' && activeElement.contains(element);
|
|
92922
|
-
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
92923
|
-
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
92924
|
-
});
|
|
92925
|
-
};
|
|
92926
|
-
_proto.clearContentInteractionState = function clearContentInteractionState(element) {
|
|
92927
|
-
delete element.dataset.vvfxHtmlInteractionActive;
|
|
92928
|
-
element.style.pointerEvents = '';
|
|
92929
|
-
};
|
|
92930
|
-
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92541
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isEditing) {
|
|
92931
92542
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92932
|
-
var isShellInteractiveActive =
|
|
92543
|
+
var isShellInteractiveActive = isEditing || isHoveringShellInteractive;
|
|
92933
92544
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92934
92545
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92935
92546
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92936
92547
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92937
92548
|
});
|
|
92938
92549
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92939
|
-
element.style.pointerEvents =
|
|
92550
|
+
element.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92940
92551
|
});
|
|
92941
92552
|
};
|
|
92942
92553
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92944,9 +92555,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92944
92555
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92945
92556
|
return;
|
|
92946
92557
|
}
|
|
92947
|
-
if (!this.isEditableCard(id)) {
|
|
92948
|
-
return;
|
|
92949
|
-
}
|
|
92950
92558
|
var box = this.options.getViewBoxById(id);
|
|
92951
92559
|
if (box.isEmpty()) {
|
|
92952
92560
|
return;
|
|
@@ -92990,13 +92598,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92990
92598
|
this.options.setViewport(editing.restoreViewport);
|
|
92991
92599
|
this.scheduleRender();
|
|
92992
92600
|
};
|
|
92993
|
-
_proto.isEditableCard = function isEditableCard(id) {
|
|
92994
|
-
var _this_options_resolveCardTypeConfig;
|
|
92995
|
-
var item = this.options.getItems().find(function(item) {
|
|
92996
|
-
return item.id === id;
|
|
92997
|
-
});
|
|
92998
|
-
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
92999
|
-
};
|
|
93000
92601
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
93001
92602
|
var viewportElement = this.options.container.parentElement;
|
|
93002
92603
|
if (!viewportElement) {
|
|
@@ -93021,7 +92622,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93021
92622
|
};
|
|
93022
92623
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
93023
92624
|
this.cleanupOverlayContent(id);
|
|
93024
|
-
this.invalidateContentInteractionZones(id);
|
|
93025
92625
|
overlay.innerHTML = '';
|
|
93026
92626
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
93027
92627
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -93031,81 +92631,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93031
92631
|
});
|
|
93032
92632
|
var contentCleanup = this.renderOverlayContent(shell.contentContainer, html.content, {
|
|
93033
92633
|
id: id,
|
|
93034
|
-
autoHeight:
|
|
92634
|
+
autoHeight: isCardItem(item) && item.property.autoHeight === true
|
|
93035
92635
|
});
|
|
93036
|
-
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
93037
92636
|
this.state.cleanups.set(id, function() {
|
|
93038
92637
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
93039
92638
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
93040
92639
|
});
|
|
93041
92640
|
this.state.contents.set(id, html);
|
|
93042
92641
|
};
|
|
93043
|
-
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
93044
|
-
var _this = this;
|
|
93045
|
-
var _this_state_contentInteractionZoneCleanups_get;
|
|
93046
|
-
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93047
|
-
this.state.contentInteractionZoneCleanups.delete(id);
|
|
93048
|
-
if (typeof MutationObserver !== 'function') {
|
|
93049
|
-
return;
|
|
93050
|
-
}
|
|
93051
|
-
var observer = new MutationObserver(function() {
|
|
93052
|
-
_this.invalidateContentInteractionZones(id);
|
|
93053
|
-
});
|
|
93054
|
-
observer.observe(contentContainer, {
|
|
93055
|
-
attributes: true,
|
|
93056
|
-
childList: true,
|
|
93057
|
-
subtree: true
|
|
93058
|
-
});
|
|
93059
|
-
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
93060
|
-
observer.disconnect();
|
|
93061
|
-
});
|
|
93062
|
-
};
|
|
93063
|
-
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
93064
|
-
var _ref, _config_style;
|
|
93065
|
-
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
93066
|
-
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
93067
|
-
this.htmlRootConfigCleanups.delete(root);
|
|
93068
|
-
var config = html.root;
|
|
93069
|
-
if (!config) {
|
|
93070
|
-
return;
|
|
93071
|
-
}
|
|
93072
|
-
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
93073
|
-
var styleProperties = [];
|
|
93074
|
-
classNames.forEach(function(className) {
|
|
93075
|
-
root.classList.add(className);
|
|
93076
|
-
});
|
|
93077
|
-
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
93078
|
-
var property = param[0], value = param[1];
|
|
93079
|
-
if (value === undefined) {
|
|
93080
|
-
return;
|
|
93081
|
-
}
|
|
93082
|
-
styleProperties.push(property);
|
|
93083
|
-
if (property.startsWith('--') || property.includes('-')) {
|
|
93084
|
-
root.style.setProperty(property, String(value));
|
|
93085
|
-
return;
|
|
93086
|
-
}
|
|
93087
|
-
root.style[property] = String(value);
|
|
93088
|
-
});
|
|
93089
|
-
this.htmlRootConfigCleanups.set(root, function() {
|
|
93090
|
-
classNames.forEach(function(className) {
|
|
93091
|
-
root.classList.remove(className);
|
|
93092
|
-
});
|
|
93093
|
-
styleProperties.forEach(function(property) {
|
|
93094
|
-
if (property.startsWith('--') || property.includes('-')) {
|
|
93095
|
-
root.style.removeProperty(property);
|
|
93096
|
-
return;
|
|
93097
|
-
}
|
|
93098
|
-
root.style[property] = '';
|
|
93099
|
-
});
|
|
93100
|
-
});
|
|
93101
|
-
};
|
|
93102
92642
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
93103
92643
|
var _this = this;
|
|
93104
92644
|
switch(content.kind){
|
|
93105
92645
|
case 'inline':
|
|
93106
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93107
|
-
this.state.autoHeightModes.set(options.id, 'message');
|
|
93108
|
-
}
|
|
93109
92646
|
return this.chainCleanups(function() {
|
|
93110
92647
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
93111
92648
|
}, renderDocumentContent(overlay, {
|
|
@@ -93122,9 +92659,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93122
92659
|
}));
|
|
93123
92660
|
case 'dom':
|
|
93124
92661
|
{
|
|
93125
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93126
|
-
this.state.autoHeightModes.set(options.id, 'measure');
|
|
93127
|
-
}
|
|
93128
92662
|
if (content.target === 'iframe') {
|
|
93129
92663
|
return renderDOMContentInIframe(overlay, content.render, content.cleanup);
|
|
93130
92664
|
}
|
|
@@ -93134,9 +92668,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93134
92668
|
} : undefined;
|
|
93135
92669
|
}
|
|
93136
92670
|
case 'document':
|
|
93137
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93138
|
-
this.state.autoHeightModes.set(options.id, 'message');
|
|
93139
|
-
}
|
|
93140
92671
|
return this.chainCleanups(function() {
|
|
93141
92672
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
93142
92673
|
}, renderDocumentContent(overlay, content, {
|
|
@@ -93164,7 +92695,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93164
92695
|
};
|
|
93165
92696
|
};
|
|
93166
92697
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93167
|
-
var _this_state_contentInteractionZoneCleanups_get;
|
|
93168
92698
|
var cleanup = this.state.cleanups.get(id);
|
|
93169
92699
|
if (cleanup) {
|
|
93170
92700
|
cleanup();
|
|
@@ -93172,19 +92702,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93172
92702
|
}
|
|
93173
92703
|
this.state.contents.delete(id);
|
|
93174
92704
|
this.state.contentMountElements.delete(id);
|
|
93175
|
-
this.state.autoHeightModes.delete(id);
|
|
93176
|
-
this.invalidateContentInteractionZones(id);
|
|
93177
|
-
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93178
|
-
this.state.contentInteractionZoneCleanups.delete(id);
|
|
93179
92705
|
this.cleanupAutoHeight(id);
|
|
93180
92706
|
};
|
|
93181
92707
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
93182
|
-
var _this_state_elements_get
|
|
92708
|
+
var _this_state_elements_get;
|
|
93183
92709
|
this.cleanupOverlayContent(id);
|
|
93184
92710
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93185
|
-
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
93186
92711
|
this.state.elements.delete(id);
|
|
93187
|
-
this.state.selectionElements.delete(id);
|
|
93188
92712
|
this.state.contentScaleElements.delete(id);
|
|
93189
92713
|
this.state.contentElements.delete(id);
|
|
93190
92714
|
};
|
|
@@ -93193,27 +92717,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93193
92717
|
this.cleanupAutoHeight(id);
|
|
93194
92718
|
return;
|
|
93195
92719
|
}
|
|
93196
|
-
this.ensureAutoHeightMode(id);
|
|
93197
|
-
if (this.state.autoHeightModes.get(id) === 'message') {
|
|
93198
|
-
this.cleanupAutoHeight(id);
|
|
93199
|
-
return;
|
|
93200
|
-
}
|
|
93201
92720
|
if (!this.state.autoHeightCleanups.has(id)) {
|
|
93202
92721
|
this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
|
|
93203
92722
|
}
|
|
93204
92723
|
this.scheduleAutoHeightMeasure(id);
|
|
93205
92724
|
};
|
|
93206
|
-
_proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
|
|
93207
|
-
var _this_state_contents_get;
|
|
93208
|
-
if (this.state.autoHeightModes.has(id)) {
|
|
93209
|
-
return;
|
|
93210
|
-
}
|
|
93211
|
-
var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
|
|
93212
|
-
if (!content) {
|
|
93213
|
-
return;
|
|
93214
|
-
}
|
|
93215
|
-
this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
|
|
93216
|
-
};
|
|
93217
92725
|
_proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
|
|
93218
92726
|
var _this = this;
|
|
93219
92727
|
var cleanupFns = [];
|
|
@@ -93301,7 +92809,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93301
92809
|
var item = this.options.getItems().find(function(candidate) {
|
|
93302
92810
|
return candidate.id === id;
|
|
93303
92811
|
});
|
|
93304
|
-
if (!
|
|
92812
|
+
if (!isCardItem(item) || item.property.autoHeight !== true) {
|
|
93305
92813
|
this.cleanupAutoHeight(id);
|
|
93306
92814
|
return;
|
|
93307
92815
|
}
|
|
@@ -93320,9 +92828,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93320
92828
|
}).filter(function(height) {
|
|
93321
92829
|
return typeof height === 'number' && Number.isFinite(height) && height > 0;
|
|
93322
92830
|
});
|
|
93323
|
-
var childHeight = this.getChildrenNaturalHeight(element
|
|
93324
|
-
includeIframes: iframeHeights.length === 0
|
|
93325
|
-
});
|
|
92831
|
+
var childHeight = this.getChildrenNaturalHeight(element);
|
|
93326
92832
|
var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
|
|
93327
92833
|
childHeight
|
|
93328
92834
|
], iframeHeights));
|
|
@@ -93342,29 +92848,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93342
92848
|
}
|
|
93343
92849
|
return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
|
|
93344
92850
|
};
|
|
93345
|
-
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element
|
|
93346
|
-
|
|
93347
|
-
|
|
93348
|
-
|
|
93349
|
-
var _child_textContent;
|
|
93350
|
-
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
93351
|
-
var childElement = child;
|
|
93352
|
-
if (!includeIframes && childElement.tagName === 'IFRAME') {
|
|
93353
|
-
return height;
|
|
93354
|
-
}
|
|
93355
|
-
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
93356
|
-
}
|
|
93357
|
-
if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
|
|
93358
|
-
var range = element.ownerDocument.createRange();
|
|
93359
|
-
range.selectNodeContents(child);
|
|
93360
|
-
var rects = Array.from(range.getClientRects());
|
|
93361
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
93362
|
-
range.detach();
|
|
93363
|
-
return rects.reduce(function(textHeight, rect) {
|
|
93364
|
-
return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
|
|
93365
|
-
}, height);
|
|
93366
|
-
}
|
|
93367
|
-
return height;
|
|
92851
|
+
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element) {
|
|
92852
|
+
return Array.from(element.children).reduce(function(height, child) {
|
|
92853
|
+
var childElement = child;
|
|
92854
|
+
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
93368
92855
|
}, 0);
|
|
93369
92856
|
};
|
|
93370
92857
|
_proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
|
|
@@ -93383,48 +92870,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93383
92870
|
var item = this.options.getItems().find(function(candidate) {
|
|
93384
92871
|
return candidate.id === id;
|
|
93385
92872
|
});
|
|
93386
|
-
if (!isCardItem(item) ||
|
|
92873
|
+
if (!isCardItem(item) || item.property.autoHeight !== true) {
|
|
93387
92874
|
return;
|
|
93388
92875
|
}
|
|
93389
|
-
if (!Number.isFinite(height) || height <= 0) {
|
|
92876
|
+
if (!Number.isFinite(height) || height <= 0 || Math.abs(height - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
93390
92877
|
return;
|
|
93391
92878
|
}
|
|
93392
|
-
|
|
93393
|
-
if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
93394
|
-
return;
|
|
93395
|
-
}
|
|
93396
|
-
this.options.setCardItemHeight(id, nextHeight);
|
|
93397
|
-
};
|
|
93398
|
-
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
93399
|
-
if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
|
|
93400
|
-
return contentHeight;
|
|
93401
|
-
}
|
|
93402
|
-
var scaleOverlay = this.state.contentScaleElements.get(item.id);
|
|
93403
|
-
var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
|
|
93404
|
-
if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
|
|
93405
|
-
return contentHeight;
|
|
93406
|
-
}
|
|
93407
|
-
return contentHeight / displayedHeight * item.property.height;
|
|
93408
|
-
};
|
|
93409
|
-
_proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
|
|
93410
|
-
var _this_options_resolveCardTypeConfig;
|
|
93411
|
-
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
|
|
92879
|
+
this.options.setCardItemHeight(id, Math.ceil(height));
|
|
93412
92880
|
};
|
|
93413
|
-
_proto.isAutoScaleEnabled = function isAutoScaleEnabled(item) {
|
|
93414
|
-
var _this_options_resolveCardTypeConfig;
|
|
93415
|
-
if (!isCardItem(item)) {
|
|
93416
|
-
return true;
|
|
93417
|
-
}
|
|
93418
|
-
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
93419
|
-
};
|
|
93420
|
-
_create_class(HTMLOverlayManager, [
|
|
93421
|
-
{
|
|
93422
|
-
key: "layerElement",
|
|
93423
|
-
get: function get() {
|
|
93424
|
-
return this.state.layer;
|
|
93425
|
-
}
|
|
93426
|
-
}
|
|
93427
|
-
]);
|
|
93428
92881
|
return HTMLOverlayManager;
|
|
93429
92882
|
}();
|
|
93430
92883
|
function waitForCardCaptureReady(root) {
|
|
@@ -93466,17 +92919,6 @@ function waitForCardCaptureReady(root) {
|
|
|
93466
92919
|
});
|
|
93467
92920
|
})();
|
|
93468
92921
|
}
|
|
93469
|
-
function formatCssColor(color, alpha) {
|
|
93470
|
-
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93471
|
-
var red = normalizedColor >> 16 & 0xFF;
|
|
93472
|
-
var green = normalizedColor >> 8 & 0xFF;
|
|
93473
|
-
var blue = normalizedColor & 0xFF;
|
|
93474
|
-
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93475
|
-
}
|
|
93476
|
-
function formatCssNumber(value) {
|
|
93477
|
-
var normalized = Number.isFinite(value) ? value : 0;
|
|
93478
|
-
return Number(normalized.toFixed(6)).toString();
|
|
93479
|
-
}
|
|
93480
92922
|
function nextAnimationFrame() {
|
|
93481
92923
|
return new Promise(function(resolve) {
|
|
93482
92924
|
requestAnimationFrame(function() {
|
|
@@ -93895,9 +93337,6 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93895
93337
|
});
|
|
93896
93338
|
return replacement;
|
|
93897
93339
|
}
|
|
93898
|
-
function isMouseEventInsideRect(event, rect) {
|
|
93899
|
-
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
93900
|
-
}
|
|
93901
93340
|
function createFlattenedIframeContent(iframe) {
|
|
93902
93341
|
var doc = iframe.contentDocument;
|
|
93903
93342
|
if (!doc) {
|
|
@@ -93937,19 +93376,6 @@ function withTimeout(promise, timeout) {
|
|
|
93937
93376
|
});
|
|
93938
93377
|
}
|
|
93939
93378
|
|
|
93940
|
-
function orderSDKCanvasLayers(param) {
|
|
93941
|
-
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
93942
|
-
[
|
|
93943
|
-
playerContainer,
|
|
93944
|
-
htmlOverlayLayer,
|
|
93945
|
-
gestureCanvas
|
|
93946
|
-
].forEach(function(layer) {
|
|
93947
|
-
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
93948
|
-
container.appendChild(layer);
|
|
93949
|
-
}
|
|
93950
|
-
});
|
|
93951
|
-
}
|
|
93952
|
-
|
|
93953
93379
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93954
93380
|
var SDK = /*#__PURE__*/ function() {
|
|
93955
93381
|
function SDK(container, mode) {
|
|
@@ -94055,45 +93481,9 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94055
93481
|
propertyName: 'height',
|
|
94056
93482
|
propertyValue: height
|
|
94057
93483
|
});
|
|
94058
|
-
},
|
|
94059
|
-
getSelectedItemIds: function getSelectedItemIds() {
|
|
94060
|
-
var _ref;
|
|
94061
|
-
var _this__pageData;
|
|
94062
|
-
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
94063
|
-
},
|
|
94064
|
-
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
94065
|
-
var _this__pageData;
|
|
94066
|
-
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
94067
|
-
},
|
|
94068
|
-
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
94069
|
-
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, wireframeColor = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeColor, wireframeAlpha = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeAlpha, wireframeWidth = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeWidth;
|
|
94070
|
-
return {
|
|
94071
|
-
color: wireframeColor,
|
|
94072
|
-
alpha: wireframeAlpha,
|
|
94073
|
-
width: wireframeWidth
|
|
94074
|
-
};
|
|
94075
|
-
},
|
|
94076
|
-
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
94077
|
-
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
94078
|
-
return {
|
|
94079
|
-
color: preSelectedColor,
|
|
94080
|
-
alpha: 1,
|
|
94081
|
-
width: preSelectedWidth
|
|
94082
|
-
};
|
|
94083
|
-
},
|
|
94084
|
-
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
94085
|
-
var _this__gestureHandler;
|
|
94086
|
-
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
94087
|
-
},
|
|
94088
|
-
resolveCardHTML: function resolveCardHTML(item) {
|
|
94089
|
-
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
94090
|
-
},
|
|
94091
|
-
resolveCardTypeConfig: function resolveCardTypeConfig(item) {
|
|
94092
|
-
return isCardItem(item) ? _this.resolveCardTypeConfig(item) : undefined;
|
|
94093
93484
|
}
|
|
94094
93485
|
});
|
|
94095
93486
|
this._htmlOverlayManager.attach();
|
|
94096
|
-
this.syncCanvasLayerOrder();
|
|
94097
93487
|
}
|
|
94098
93488
|
var _proto = SDK.prototype;
|
|
94099
93489
|
_proto.dispose = function dispose() {
|
|
@@ -94189,7 +93579,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94189
93579
|
this.initPlayer(SDK.config.mode);
|
|
94190
93580
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
94191
93581
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94192
|
-
this.syncCanvasLayerOrder();
|
|
94193
93582
|
return [
|
|
94194
93583
|
4,
|
|
94195
93584
|
this.runByPageData(this.pageData)
|
|
@@ -94239,16 +93628,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94239
93628
|
env: 'editor'
|
|
94240
93629
|
});
|
|
94241
93630
|
this.player.resize();
|
|
94242
|
-
this.syncCanvasLayerOrder();
|
|
94243
|
-
};
|
|
94244
|
-
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94245
|
-
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94246
|
-
orderSDKCanvasLayers({
|
|
94247
|
-
container: this._container,
|
|
94248
|
-
playerContainer: this._playerContainer,
|
|
94249
|
-
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94250
|
-
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94251
|
-
});
|
|
94252
93631
|
};
|
|
94253
93632
|
_proto.getInitParam = function getInitParam(param) {
|
|
94254
93633
|
return _async_to_generator(function() {
|
|
@@ -95343,7 +94722,8 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95343
94722
|
* @param ignoreClamp 是否忽视约束
|
|
95344
94723
|
*/ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
|
|
95345
94724
|
EFFECTS.assertExist(this._pageData);
|
|
95346
|
-
this.
|
|
94725
|
+
this._pageData.property.zoom = zoom;
|
|
94726
|
+
this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
|
|
95347
94727
|
this._gestureHandler.render();
|
|
95348
94728
|
};
|
|
95349
94729
|
/**
|
|
@@ -95583,7 +94963,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95583
94963
|
};
|
|
95584
94964
|
/**
|
|
95585
94965
|
* @description 设置蒙版工具模式
|
|
95586
|
-
* @param mode 模式类型:'paint'
|
|
94966
|
+
* @param mode 模式类型:'paint' 笔刷涂抹、'erase' 笔刷逐笔擦除、'box-erase' 框选擦除、'box-paint' 框选涂抹
|
|
95587
94967
|
*/ _proto.setMaskGizmoMode = function setMaskGizmoMode(mode) {
|
|
95588
94968
|
this._gestureHandler.setMaskGizmoMode(mode);
|
|
95589
94969
|
};
|
|
@@ -96239,44 +95619,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
96239
95619
|
});
|
|
96240
95620
|
};
|
|
96241
95621
|
/**
|
|
96242
|
-
* @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
|
|
96243
|
-
* @param item 卡片元素
|
|
96244
|
-
* @returns HTML 渲染配置
|
|
96245
|
-
*/ _proto.resolveCardHTML = function resolveCardHTML(item) {
|
|
96246
|
-
var _cardTypeConfig_html;
|
|
96247
|
-
var cardTypeConfig = this.resolveCardTypeConfig(item);
|
|
96248
|
-
return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
|
|
96249
|
-
};
|
|
96250
|
-
/**
|
|
96251
|
-
* @description 按 cardType 从注册表解析卡片类型配置。
|
|
96252
|
-
* @param item 卡片元素
|
|
96253
|
-
* @returns 卡片类型配置
|
|
96254
|
-
*/ _proto.resolveCardTypeConfig = function resolveCardTypeConfig(item) {
|
|
96255
|
-
return SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
96256
|
-
return t.type === item.cardType;
|
|
96257
|
-
});
|
|
96258
|
-
};
|
|
96259
|
-
/**
|
|
96260
|
-
* @description 重新解析并挂载指定卡片的 HTML 内容。
|
|
96261
|
-
* @description 当 inline/document 内容依赖 extension 或外部状态变化时,可调用此方法刷新 DOM。
|
|
96262
|
-
* @param id 卡片元素 ID
|
|
96263
|
-
* @returns 是否成功触发刷新
|
|
96264
|
-
*/ _proto.refreshCardHTML = function refreshCardHTML(id) {
|
|
96265
|
-
var _this__htmlOverlayManager, _this__htmlOverlayManager1;
|
|
96266
|
-
var item = this.getSDKItem(id);
|
|
96267
|
-
if (!isCardItem(item)) {
|
|
96268
|
-
console.warn('CardItem "' + id + '" not found.');
|
|
96269
|
-
return false;
|
|
96270
|
-
}
|
|
96271
|
-
if (!this.resolveCardHTML(item)) {
|
|
96272
|
-
console.warn('CardItem "' + id + '" has no registered HTML renderer.');
|
|
96273
|
-
return false;
|
|
96274
|
-
}
|
|
96275
|
-
(_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.invalidateCardHTML(id);
|
|
96276
|
-
(_this__htmlOverlayManager1 = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager1.scheduleRender();
|
|
96277
|
-
return true;
|
|
96278
|
-
};
|
|
96279
|
-
/**
|
|
96280
95622
|
* @description 创建卡片元素
|
|
96281
95623
|
* @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
|
|
96282
95624
|
* @param createInfo 卡片创建信息
|
|
@@ -96563,6 +95905,167 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
96563
95905
|
}();
|
|
96564
95906
|
SDK.config = BaseConfig;
|
|
96565
95907
|
|
|
95908
|
+
/**
|
|
95909
|
+
* @description 卡片元素 SDKItem 类
|
|
95910
|
+
* @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
|
|
95911
|
+
* @description 支持设置卡片类型(cardType)
|
|
95912
|
+
*/ var CardItem = /*#__PURE__*/ function(BaseItem) {
|
|
95913
|
+
_inherits(CardItem, BaseItem);
|
|
95914
|
+
function CardItem(options) {
|
|
95915
|
+
var _this;
|
|
95916
|
+
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
|
|
95917
|
+
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5, _SDK_config_itemConfig_cardConfig_cardTypes_, _options_property6, _options_property7;
|
|
95918
|
+
_this = BaseItem.call(this, options) || this, /**
|
|
95919
|
+
* @description 元素类型
|
|
95920
|
+
*/ _this.type = SDKItemType.CARD;
|
|
95921
|
+
// 初始化属性(包含 cardType)
|
|
95922
|
+
_this.property = {
|
|
95923
|
+
position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
|
|
95924
|
+
0,
|
|
95925
|
+
0
|
|
95926
|
+
],
|
|
95927
|
+
rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
|
|
95928
|
+
0,
|
|
95929
|
+
0,
|
|
95930
|
+
0
|
|
95931
|
+
],
|
|
95932
|
+
width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
|
|
95933
|
+
height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
|
|
95934
|
+
scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
|
|
95935
|
+
1,
|
|
95936
|
+
1
|
|
95937
|
+
],
|
|
95938
|
+
cardType: (_ref5 = (_ref6 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref6 : (_SDK_config_itemConfig_cardConfig_cardTypes_ = SDK.config.itemConfig.cardConfig.cardTypes[0]) == null ? void 0 : _SDK_config_itemConfig_cardConfig_cardTypes_.type) != null ? _ref5 : '',
|
|
95939
|
+
autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
|
|
95940
|
+
html: (_options_property7 = options.property) == null ? void 0 : _options_property7.html
|
|
95941
|
+
};
|
|
95942
|
+
return _this;
|
|
95943
|
+
}
|
|
95944
|
+
var _proto = CardItem.prototype;
|
|
95945
|
+
// ==================== 实现抽象方法 ====================
|
|
95946
|
+
/**
|
|
95947
|
+
* @description 转换为 CardCreateInfo
|
|
95948
|
+
* @param withParent 是否包含父节点ID
|
|
95949
|
+
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
95950
|
+
var extension = this.getAllExtension();
|
|
95951
|
+
var property = deepClone(this.property);
|
|
95952
|
+
property.html = this.html;
|
|
95953
|
+
return {
|
|
95954
|
+
type: SDKItemType.CARD,
|
|
95955
|
+
id: this.id,
|
|
95956
|
+
name: this.name,
|
|
95957
|
+
parentId: withParent ? this.parentId : undefined,
|
|
95958
|
+
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
95959
|
+
property: property
|
|
95960
|
+
};
|
|
95961
|
+
};
|
|
95962
|
+
/**
|
|
95963
|
+
* @description 克隆 SDKItem
|
|
95964
|
+
*/ _proto.clone = function clone() {
|
|
95965
|
+
var property = deepClone(this.property);
|
|
95966
|
+
property.html = this.html;
|
|
95967
|
+
return new CardItem({
|
|
95968
|
+
id: EFFECTS.generateGUID(),
|
|
95969
|
+
name: this.name,
|
|
95970
|
+
parentId: this.parentId,
|
|
95971
|
+
duration: this.duration,
|
|
95972
|
+
delay: this.delay,
|
|
95973
|
+
endBehavior: this.endBehavior,
|
|
95974
|
+
isLocked: this.isLocked,
|
|
95975
|
+
isCoreEditable: this.isCoreEditable,
|
|
95976
|
+
property: property,
|
|
95977
|
+
extension: this.getAllExtension()
|
|
95978
|
+
});
|
|
95979
|
+
};
|
|
95980
|
+
_create_class(CardItem, [
|
|
95981
|
+
{
|
|
95982
|
+
key: "cardType",
|
|
95983
|
+
get: // ==================== cardType 访问器 ====================
|
|
95984
|
+
/**
|
|
95985
|
+
* @description 卡片类型
|
|
95986
|
+
*/ function get() {
|
|
95987
|
+
return this.property.cardType;
|
|
95988
|
+
},
|
|
95989
|
+
set: function set(value) {
|
|
95990
|
+
this.property.cardType = value;
|
|
95991
|
+
}
|
|
95992
|
+
},
|
|
95993
|
+
{
|
|
95994
|
+
key: "html",
|
|
95995
|
+
get: /**
|
|
95996
|
+
* @description HTML 覆盖层配置
|
|
95997
|
+
*/ function get() {
|
|
95998
|
+
return this.property.html;
|
|
95999
|
+
},
|
|
96000
|
+
set: function set(value) {
|
|
96001
|
+
this.property.html = value;
|
|
96002
|
+
}
|
|
96003
|
+
},
|
|
96004
|
+
{
|
|
96005
|
+
key: "position",
|
|
96006
|
+
get: // ==================== 便捷访问器 ====================
|
|
96007
|
+
/**
|
|
96008
|
+
* @description 位置
|
|
96009
|
+
*/ function get() {
|
|
96010
|
+
return this.property.position;
|
|
96011
|
+
},
|
|
96012
|
+
set: function set(value) {
|
|
96013
|
+
this.property.position = value;
|
|
96014
|
+
}
|
|
96015
|
+
},
|
|
96016
|
+
{
|
|
96017
|
+
key: "width",
|
|
96018
|
+
get: /**
|
|
96019
|
+
* @description 宽度
|
|
96020
|
+
*/ function get() {
|
|
96021
|
+
return this.property.width;
|
|
96022
|
+
},
|
|
96023
|
+
set: function set(value) {
|
|
96024
|
+
this.property.width = value;
|
|
96025
|
+
}
|
|
96026
|
+
},
|
|
96027
|
+
{
|
|
96028
|
+
key: "height",
|
|
96029
|
+
get: /**
|
|
96030
|
+
* @description 高度
|
|
96031
|
+
*/ function get() {
|
|
96032
|
+
return this.property.height;
|
|
96033
|
+
},
|
|
96034
|
+
set: function set(value) {
|
|
96035
|
+
this.property.height = value;
|
|
96036
|
+
}
|
|
96037
|
+
},
|
|
96038
|
+
{
|
|
96039
|
+
key: "rotation",
|
|
96040
|
+
get: /**
|
|
96041
|
+
* @description 旋转(二维旋转角度)
|
|
96042
|
+
*/ function get() {
|
|
96043
|
+
return this.property.rotation[2];
|
|
96044
|
+
},
|
|
96045
|
+
set: function set(value) {
|
|
96046
|
+
this.property.rotation[2] = value;
|
|
96047
|
+
}
|
|
96048
|
+
},
|
|
96049
|
+
{
|
|
96050
|
+
key: "fullRotation",
|
|
96051
|
+
get: /**
|
|
96052
|
+
* @description 完整旋转(包含 x, y, z)
|
|
96053
|
+
*/ function get() {
|
|
96054
|
+
return this.property.rotation;
|
|
96055
|
+
},
|
|
96056
|
+
set: function set(value) {
|
|
96057
|
+
this.property.rotation = value;
|
|
96058
|
+
}
|
|
96059
|
+
}
|
|
96060
|
+
]);
|
|
96061
|
+
return CardItem;
|
|
96062
|
+
}(BaseItem);
|
|
96063
|
+
/**
|
|
96064
|
+
* @description 类型守卫:检查是否是 CardItem
|
|
96065
|
+
*/ function isCardItem(obj) {
|
|
96066
|
+
return _instanceof(obj, CardItem);
|
|
96067
|
+
}
|
|
96068
|
+
|
|
96566
96069
|
Object.defineProperty(exports, "generateGUID", {
|
|
96567
96070
|
enumerable: true,
|
|
96568
96071
|
get: function () { return EFFECTS.generateGUID; }
|