@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.js
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
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -24013,9 +24013,21 @@ function getUniqueName(name, names) {
|
|
|
24013
24013
|
};
|
|
24014
24014
|
_create_class(TextItem, [
|
|
24015
24015
|
{
|
|
24016
|
-
key: "
|
|
24016
|
+
key: "pixelWidth",
|
|
24017
24017
|
get: // ==================== 便捷访问器 ====================
|
|
24018
|
-
|
|
24018
|
+
function get() {
|
|
24019
|
+
return this.width;
|
|
24020
|
+
}
|
|
24021
|
+
},
|
|
24022
|
+
{
|
|
24023
|
+
key: "pixelHeight",
|
|
24024
|
+
get: function get() {
|
|
24025
|
+
return this.height;
|
|
24026
|
+
}
|
|
24027
|
+
},
|
|
24028
|
+
{
|
|
24029
|
+
key: "text",
|
|
24030
|
+
get: /**
|
|
24019
24031
|
* @description 文本内容
|
|
24020
24032
|
*/ function get() {
|
|
24021
24033
|
return this.property.text;
|
|
@@ -25153,150 +25165,6 @@ var ItemOrderAction = /*#__PURE__*/ function(ItemOrderAction) {
|
|
|
25153
25165
|
return _instanceof(obj, FrameItem);
|
|
25154
25166
|
}
|
|
25155
25167
|
|
|
25156
|
-
/**
|
|
25157
|
-
* @description 卡片元素 SDKItem 类
|
|
25158
|
-
* @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
|
|
25159
|
-
* @description 支持设置卡片类型(cardType)
|
|
25160
|
-
*/ var CardItem = /*#__PURE__*/ function(BaseItem) {
|
|
25161
|
-
_inherits(CardItem, BaseItem);
|
|
25162
|
-
function CardItem(options) {
|
|
25163
|
-
var _this;
|
|
25164
|
-
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
|
25165
|
-
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5;
|
|
25166
|
-
_this = BaseItem.call(this, options) || this, /**
|
|
25167
|
-
* @description 元素类型
|
|
25168
|
-
*/ _this.type = SDKItemType.CARD;
|
|
25169
|
-
// 初始化属性(包含 cardType)
|
|
25170
|
-
_this.property = {
|
|
25171
|
-
position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
|
|
25172
|
-
0,
|
|
25173
|
-
0
|
|
25174
|
-
],
|
|
25175
|
-
rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
|
|
25176
|
-
0,
|
|
25177
|
-
0,
|
|
25178
|
-
0
|
|
25179
|
-
],
|
|
25180
|
-
width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
|
|
25181
|
-
height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
|
|
25182
|
-
scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
|
|
25183
|
-
1,
|
|
25184
|
-
1
|
|
25185
|
-
],
|
|
25186
|
-
cardType: (_ref5 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref5 : 'unknown'
|
|
25187
|
-
};
|
|
25188
|
-
return _this;
|
|
25189
|
-
}
|
|
25190
|
-
var _proto = CardItem.prototype;
|
|
25191
|
-
// ==================== 实现抽象方法 ====================
|
|
25192
|
-
/**
|
|
25193
|
-
* @description 转换为 CardCreateInfo
|
|
25194
|
-
* @param withParent 是否包含父节点ID
|
|
25195
|
-
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
25196
|
-
var extension = this.getAllExtension();
|
|
25197
|
-
return {
|
|
25198
|
-
type: SDKItemType.CARD,
|
|
25199
|
-
id: this.id,
|
|
25200
|
-
name: this.name,
|
|
25201
|
-
parentId: withParent ? this.parentId : undefined,
|
|
25202
|
-
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
25203
|
-
property: deepClone(this.property)
|
|
25204
|
-
};
|
|
25205
|
-
};
|
|
25206
|
-
/**
|
|
25207
|
-
* @description 克隆 SDKItem
|
|
25208
|
-
*/ _proto.clone = function clone() {
|
|
25209
|
-
return new CardItem({
|
|
25210
|
-
id: generateGUID(),
|
|
25211
|
-
name: this.name,
|
|
25212
|
-
parentId: this.parentId,
|
|
25213
|
-
duration: this.duration,
|
|
25214
|
-
delay: this.delay,
|
|
25215
|
-
endBehavior: this.endBehavior,
|
|
25216
|
-
isLocked: this.isLocked,
|
|
25217
|
-
isCoreEditable: this.isCoreEditable,
|
|
25218
|
-
property: deepClone(this.property),
|
|
25219
|
-
extension: this.getAllExtension()
|
|
25220
|
-
});
|
|
25221
|
-
};
|
|
25222
|
-
_create_class(CardItem, [
|
|
25223
|
-
{
|
|
25224
|
-
key: "cardType",
|
|
25225
|
-
get: // ==================== cardType 访问器 ====================
|
|
25226
|
-
/**
|
|
25227
|
-
* @description 卡片类型
|
|
25228
|
-
*/ function get() {
|
|
25229
|
-
return this.property.cardType;
|
|
25230
|
-
},
|
|
25231
|
-
set: function set(value) {
|
|
25232
|
-
this.property.cardType = value;
|
|
25233
|
-
}
|
|
25234
|
-
},
|
|
25235
|
-
{
|
|
25236
|
-
key: "position",
|
|
25237
|
-
get: // ==================== 便捷访问器 ====================
|
|
25238
|
-
/**
|
|
25239
|
-
* @description 位置
|
|
25240
|
-
*/ function get() {
|
|
25241
|
-
return this.property.position;
|
|
25242
|
-
},
|
|
25243
|
-
set: function set(value) {
|
|
25244
|
-
this.property.position = value;
|
|
25245
|
-
}
|
|
25246
|
-
},
|
|
25247
|
-
{
|
|
25248
|
-
key: "width",
|
|
25249
|
-
get: /**
|
|
25250
|
-
* @description 宽度
|
|
25251
|
-
*/ function get() {
|
|
25252
|
-
return this.property.width;
|
|
25253
|
-
},
|
|
25254
|
-
set: function set(value) {
|
|
25255
|
-
this.property.width = value;
|
|
25256
|
-
}
|
|
25257
|
-
},
|
|
25258
|
-
{
|
|
25259
|
-
key: "height",
|
|
25260
|
-
get: /**
|
|
25261
|
-
* @description 高度
|
|
25262
|
-
*/ function get() {
|
|
25263
|
-
return this.property.height;
|
|
25264
|
-
},
|
|
25265
|
-
set: function set(value) {
|
|
25266
|
-
this.property.height = value;
|
|
25267
|
-
}
|
|
25268
|
-
},
|
|
25269
|
-
{
|
|
25270
|
-
key: "rotation",
|
|
25271
|
-
get: /**
|
|
25272
|
-
* @description 旋转(二维旋转角度)
|
|
25273
|
-
*/ function get() {
|
|
25274
|
-
return this.property.rotation[2];
|
|
25275
|
-
},
|
|
25276
|
-
set: function set(value) {
|
|
25277
|
-
this.property.rotation[2] = value;
|
|
25278
|
-
}
|
|
25279
|
-
},
|
|
25280
|
-
{
|
|
25281
|
-
key: "fullRotation",
|
|
25282
|
-
get: /**
|
|
25283
|
-
* @description 完整旋转(包含 x, y, z)
|
|
25284
|
-
*/ function get() {
|
|
25285
|
-
return this.property.rotation;
|
|
25286
|
-
},
|
|
25287
|
-
set: function set(value) {
|
|
25288
|
-
this.property.rotation = value;
|
|
25289
|
-
}
|
|
25290
|
-
}
|
|
25291
|
-
]);
|
|
25292
|
-
return CardItem;
|
|
25293
|
-
}(BaseItem);
|
|
25294
|
-
/**
|
|
25295
|
-
* @description 类型守卫:检查是否是 CardItem
|
|
25296
|
-
*/ function isCardItem(obj) {
|
|
25297
|
-
return _instanceof(obj, CardItem);
|
|
25298
|
-
}
|
|
25299
|
-
|
|
25300
25168
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
25301
25169
|
try {
|
|
25302
25170
|
var info = gen[key](arg);
|
|
@@ -47298,7 +47166,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
47298
47166
|
var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
|
|
47299
47167
|
var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
|
|
47300
47168
|
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;
|
|
47301
|
-
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())
|
|
47169
|
+
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
|
|
47302
47170
|
this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
|
|
47303
47171
|
this.graphics.drawBox(preSelectedItemBox);
|
|
47304
47172
|
}
|
|
@@ -55558,16 +55426,6 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55558
55426
|
newWidth,
|
|
55559
55427
|
newHeight
|
|
55560
55428
|
], translation1);
|
|
55561
|
-
} else if (selectedItem && selectedItems.length === 1 && isCardItem(selectedItem)) {
|
|
55562
|
-
void this._pageDataUtils.setItemProperty({
|
|
55563
|
-
itemId: selectedItem.id,
|
|
55564
|
-
type: SDKItemType.CARD,
|
|
55565
|
-
property: {
|
|
55566
|
-
width: selectedItem.width * resultScalar1.x,
|
|
55567
|
-
height: selectedItem.height * resultScalar1.y
|
|
55568
|
-
}
|
|
55569
|
-
});
|
|
55570
|
-
this._pageDataUtils.moveItem(selectedItem.id, translation1);
|
|
55571
55429
|
} else {
|
|
55572
55430
|
// 普通元素的缩放逻辑
|
|
55573
55431
|
selectedItems.forEach(function(item) {
|
|
@@ -55892,7 +55750,6 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55892
55750
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55893
55751
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55894
55752
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55895
|
-
var isSingleCardItem = isCardItem(selectedItem);
|
|
55896
55753
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55897
55754
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55898
55755
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55932,11 +55789,9 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55932
55789
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55933
55790
|
// 根据box获取边缘线
|
|
55934
55791
|
var corners = this.wireframe.box.corners;
|
|
55935
|
-
|
|
55936
|
-
|
|
55937
|
-
|
|
55938
|
-
});
|
|
55939
|
-
}
|
|
55792
|
+
corners.forEach(function(corner, i) {
|
|
55793
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55794
|
+
});
|
|
55940
55795
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55941
55796
|
// 成组暂不支持缩放
|
|
55942
55797
|
if (selectedItems.length === 1) {
|
|
@@ -56729,6 +56584,10 @@ var cursorMap = {
|
|
|
56729
56584
|
type: 'preset',
|
|
56730
56585
|
content: 'crosshair'
|
|
56731
56586
|
},
|
|
56587
|
+
'box-select': {
|
|
56588
|
+
type: 'preset',
|
|
56589
|
+
content: 'crosshair'
|
|
56590
|
+
},
|
|
56732
56591
|
'text-rotation': {
|
|
56733
56592
|
type: 'svg',
|
|
56734
56593
|
content: 'default',
|
|
@@ -59787,6 +59646,12 @@ var MAX_ITEM_DISTANCE_THRESHOLD = 100000;
|
|
|
59787
59646
|
/**
|
|
59788
59647
|
* @description SDKItem position 属性的数字精度(保留小数位数)
|
|
59789
59648
|
*/ var POSITION_PRECISION = 4;
|
|
59649
|
+
function isCardHTMLContentValue(value) {
|
|
59650
|
+
return (value == null ? void 0 : value.kind) === 'inline' || (value == null ? void 0 : value.kind) === 'dom' || (value == null ? void 0 : value.kind) === 'document';
|
|
59651
|
+
}
|
|
59652
|
+
function isCardHTMLValue(value) {
|
|
59653
|
+
return isCardHTMLContentValue(value == null ? void 0 : value.content);
|
|
59654
|
+
}
|
|
59790
59655
|
var PageDataUtils = /*#__PURE__*/ function() {
|
|
59791
59656
|
function PageDataUtils(player, container, emitter, sdk) {
|
|
59792
59657
|
this.player = player;
|
|
@@ -60604,10 +60469,11 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60604
60469
|
property: property
|
|
60605
60470
|
}));
|
|
60606
60471
|
} else if ((existingSDKItem == null ? void 0 : existingSDKItem.type) == SDKItemType.CARD) {
|
|
60607
|
-
var cardType = existingSDKItem.cardType;
|
|
60472
|
+
var cardType = existingSDKItem.cardType, html = existingSDKItem.html;
|
|
60608
60473
|
sdkItem = new CardItem(_extends({}, baseOptions, {
|
|
60609
60474
|
property: _extends({}, property, {
|
|
60610
|
-
cardType: cardType
|
|
60475
|
+
cardType: cardType,
|
|
60476
|
+
html: html
|
|
60611
60477
|
})
|
|
60612
60478
|
}));
|
|
60613
60479
|
} else {
|
|
@@ -60834,19 +60700,6 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60834
60700
|
}).call(this);
|
|
60835
60701
|
};
|
|
60836
60702
|
/**
|
|
60837
|
-
* @description 设置元素extension字段
|
|
60838
|
-
*/ _proto.setItemExtension = function setItemExtension(itemId, extension) {
|
|
60839
|
-
var item = this.getSDKItem(itemId);
|
|
60840
|
-
if (!item) {
|
|
60841
|
-
console.warn('setItemExtension: item not found');
|
|
60842
|
-
return;
|
|
60843
|
-
}
|
|
60844
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.entries(extension)), _step; !(_step = _iterator()).done;){
|
|
60845
|
-
var _step_value = _step.value, key = _step_value[0], value = _step_value[1];
|
|
60846
|
-
item.extension.set(key, value);
|
|
60847
|
-
}
|
|
60848
|
-
};
|
|
60849
|
-
/**
|
|
60850
60703
|
* @description 场景 1: 设置单个元素的单个属性
|
|
60851
60704
|
*/ _proto.setSingleItemSingleProperty = function setSingleItemSingleProperty(param) {
|
|
60852
60705
|
return _async_to_generator(function() {
|
|
@@ -61103,7 +60956,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61103
60956
|
* @description 更新 PlayerItem 的 Property 属性
|
|
61104
60957
|
*/ _proto.updatePlayerItemPropertyAttribute = function updatePlayerItemPropertyAttribute(playerItem, targetItem, propertyName, propertyValue) {
|
|
61105
60958
|
return _async_to_generator(function() {
|
|
61106
|
-
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;
|
|
60959
|
+
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;
|
|
61107
60960
|
return _ts_generator(this, function(_state) {
|
|
61108
60961
|
switch(_state.label){
|
|
61109
60962
|
case 0:
|
|
@@ -61204,35 +61057,40 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61204
61057
|
3,
|
|
61205
61058
|
31
|
|
61206
61059
|
];
|
|
61207
|
-
case '
|
|
61060
|
+
case 'html':
|
|
61208
61061
|
return [
|
|
61209
61062
|
3,
|
|
61210
61063
|
32
|
|
61211
61064
|
];
|
|
61212
|
-
case '
|
|
61065
|
+
case 'position':
|
|
61213
61066
|
return [
|
|
61214
61067
|
3,
|
|
61215
61068
|
33
|
|
61216
61069
|
];
|
|
61217
|
-
case '
|
|
61070
|
+
case 'rotation':
|
|
61218
61071
|
return [
|
|
61219
61072
|
3,
|
|
61220
61073
|
34
|
|
61221
61074
|
];
|
|
61222
|
-
case '
|
|
61075
|
+
case 'scale':
|
|
61223
61076
|
return [
|
|
61224
61077
|
3,
|
|
61225
61078
|
35
|
|
61226
61079
|
];
|
|
61227
|
-
case '
|
|
61080
|
+
case 'layoutMode':
|
|
61228
61081
|
return [
|
|
61229
61082
|
3,
|
|
61230
61083
|
36
|
|
61231
61084
|
];
|
|
61085
|
+
case 'visible':
|
|
61086
|
+
return [
|
|
61087
|
+
3,
|
|
61088
|
+
37
|
|
61089
|
+
];
|
|
61232
61090
|
}
|
|
61233
61091
|
return [
|
|
61234
61092
|
3,
|
|
61235
|
-
|
|
61093
|
+
38
|
|
61236
61094
|
];
|
|
61237
61095
|
case 1:
|
|
61238
61096
|
{
|
|
@@ -61245,7 +61103,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61245
61103
|
}
|
|
61246
61104
|
return [
|
|
61247
61105
|
3,
|
|
61248
|
-
|
|
61106
|
+
39
|
|
61249
61107
|
];
|
|
61250
61108
|
}
|
|
61251
61109
|
case 2:
|
|
@@ -61256,7 +61114,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61256
61114
|
}
|
|
61257
61115
|
return [
|
|
61258
61116
|
3,
|
|
61259
|
-
|
|
61117
|
+
39
|
|
61260
61118
|
];
|
|
61261
61119
|
}
|
|
61262
61120
|
case 3:
|
|
@@ -61288,7 +61146,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61288
61146
|
case 5:
|
|
61289
61147
|
return [
|
|
61290
61148
|
3,
|
|
61291
|
-
|
|
61149
|
+
39
|
|
61292
61150
|
];
|
|
61293
61151
|
case 6:
|
|
61294
61152
|
{
|
|
@@ -61305,7 +61163,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61305
61163
|
}
|
|
61306
61164
|
return [
|
|
61307
61165
|
3,
|
|
61308
|
-
|
|
61166
|
+
39
|
|
61309
61167
|
];
|
|
61310
61168
|
}
|
|
61311
61169
|
case 7:
|
|
@@ -61319,7 +61177,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61319
61177
|
}
|
|
61320
61178
|
return [
|
|
61321
61179
|
3,
|
|
61322
|
-
|
|
61180
|
+
39
|
|
61323
61181
|
];
|
|
61324
61182
|
}
|
|
61325
61183
|
case 8:
|
|
@@ -61332,7 +61190,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61332
61190
|
}
|
|
61333
61191
|
return [
|
|
61334
61192
|
3,
|
|
61335
|
-
|
|
61193
|
+
39
|
|
61336
61194
|
];
|
|
61337
61195
|
}
|
|
61338
61196
|
case 9:
|
|
@@ -61346,7 +61204,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61346
61204
|
}
|
|
61347
61205
|
return [
|
|
61348
61206
|
3,
|
|
61349
|
-
|
|
61207
|
+
39
|
|
61350
61208
|
];
|
|
61351
61209
|
}
|
|
61352
61210
|
case 10:
|
|
@@ -61359,7 +61217,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61359
61217
|
}
|
|
61360
61218
|
return [
|
|
61361
61219
|
3,
|
|
61362
|
-
|
|
61220
|
+
39
|
|
61363
61221
|
];
|
|
61364
61222
|
}
|
|
61365
61223
|
case 11:
|
|
@@ -61372,7 +61230,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61372
61230
|
}
|
|
61373
61231
|
return [
|
|
61374
61232
|
3,
|
|
61375
|
-
|
|
61233
|
+
39
|
|
61376
61234
|
];
|
|
61377
61235
|
}
|
|
61378
61236
|
case 12:
|
|
@@ -61392,7 +61250,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61392
61250
|
}
|
|
61393
61251
|
return [
|
|
61394
61252
|
3,
|
|
61395
|
-
|
|
61253
|
+
39
|
|
61396
61254
|
];
|
|
61397
61255
|
}
|
|
61398
61256
|
case 13:
|
|
@@ -61434,7 +61292,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61434
61292
|
}
|
|
61435
61293
|
return [
|
|
61436
61294
|
3,
|
|
61437
|
-
|
|
61295
|
+
39
|
|
61438
61296
|
];
|
|
61439
61297
|
}
|
|
61440
61298
|
case 14:
|
|
@@ -61469,7 +61327,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61469
61327
|
}
|
|
61470
61328
|
return [
|
|
61471
61329
|
3,
|
|
61472
|
-
|
|
61330
|
+
39
|
|
61473
61331
|
];
|
|
61474
61332
|
}
|
|
61475
61333
|
case 15:
|
|
@@ -61483,7 +61341,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61483
61341
|
}
|
|
61484
61342
|
return [
|
|
61485
61343
|
3,
|
|
61486
|
-
|
|
61344
|
+
39
|
|
61487
61345
|
];
|
|
61488
61346
|
}
|
|
61489
61347
|
case 16:
|
|
@@ -61515,7 +61373,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61515
61373
|
case 20:
|
|
61516
61374
|
return [
|
|
61517
61375
|
3,
|
|
61518
|
-
|
|
61376
|
+
39
|
|
61519
61377
|
];
|
|
61520
61378
|
case 21:
|
|
61521
61379
|
if (!(typeof propertyValue === 'string' && playerItem.type === spec.ItemType.video)) return [
|
|
@@ -61546,7 +61404,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61546
61404
|
case 25:
|
|
61547
61405
|
return [
|
|
61548
61406
|
3,
|
|
61549
|
-
|
|
61407
|
+
39
|
|
61550
61408
|
];
|
|
61551
61409
|
case 26:
|
|
61552
61410
|
if (!(playerItem.type === spec.ItemType.null)) return [
|
|
@@ -61586,12 +61444,15 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61586
61444
|
compositionItem.parentId = playerItem.getInstanceId();
|
|
61587
61445
|
component = compositionItem.components[0];
|
|
61588
61446
|
component == null ? void 0 : component.pause();
|
|
61447
|
+
// 刷新前快照视频播放态,刷新后恢复,避免更换特效导致全量视频被自动播放
|
|
61448
|
+
videoPlayStates = this.snapshotVideoPlayStates();
|
|
61589
61449
|
this.sdk.player.gotoAndPlay(0);
|
|
61450
|
+
this.restoreVideoPlayStates(videoPlayStates);
|
|
61590
61451
|
_state.label = 28;
|
|
61591
61452
|
case 28:
|
|
61592
61453
|
return [
|
|
61593
61454
|
3,
|
|
61594
|
-
|
|
61455
|
+
39
|
|
61595
61456
|
];
|
|
61596
61457
|
case 29:
|
|
61597
61458
|
{
|
|
@@ -61603,7 +61464,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61603
61464
|
}
|
|
61604
61465
|
return [
|
|
61605
61466
|
3,
|
|
61606
|
-
|
|
61467
|
+
39
|
|
61607
61468
|
];
|
|
61608
61469
|
}
|
|
61609
61470
|
case 30:
|
|
@@ -61616,7 +61477,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61616
61477
|
}
|
|
61617
61478
|
return [
|
|
61618
61479
|
3,
|
|
61619
|
-
|
|
61480
|
+
39
|
|
61620
61481
|
];
|
|
61621
61482
|
}
|
|
61622
61483
|
case 31:
|
|
@@ -61629,10 +61490,20 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61629
61490
|
}
|
|
61630
61491
|
return [
|
|
61631
61492
|
3,
|
|
61632
|
-
|
|
61493
|
+
39
|
|
61633
61494
|
];
|
|
61634
61495
|
}
|
|
61635
61496
|
case 32:
|
|
61497
|
+
{
|
|
61498
|
+
if (isCardItem(targetItem)) {
|
|
61499
|
+
targetItem.html = isCardHTMLValue(propertyValue) ? propertyValue : undefined;
|
|
61500
|
+
}
|
|
61501
|
+
return [
|
|
61502
|
+
3,
|
|
61503
|
+
39
|
|
61504
|
+
];
|
|
61505
|
+
}
|
|
61506
|
+
case 33:
|
|
61636
61507
|
{
|
|
61637
61508
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61638
61509
|
pixelTranslation = propertyValue.map(function(v, i) {
|
|
@@ -61645,10 +61516,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61645
61516
|
}
|
|
61646
61517
|
return [
|
|
61647
61518
|
3,
|
|
61648
|
-
|
|
61519
|
+
39
|
|
61649
61520
|
];
|
|
61650
61521
|
}
|
|
61651
|
-
case
|
|
61522
|
+
case 34:
|
|
61652
61523
|
{
|
|
61653
61524
|
if (Array.isArray(propertyValue) && propertyValue.length === 3) {
|
|
61654
61525
|
rotation = propertyValue.map(function(v, i) {
|
|
@@ -61659,10 +61530,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61659
61530
|
}
|
|
61660
61531
|
return [
|
|
61661
61532
|
3,
|
|
61662
|
-
|
|
61533
|
+
39
|
|
61663
61534
|
];
|
|
61664
61535
|
}
|
|
61665
|
-
case
|
|
61536
|
+
case 35:
|
|
61666
61537
|
{
|
|
61667
61538
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61668
61539
|
currentScale = targetItem.property.scale;
|
|
@@ -61676,10 +61547,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61676
61547
|
}
|
|
61677
61548
|
return [
|
|
61678
61549
|
3,
|
|
61679
|
-
|
|
61550
|
+
39
|
|
61680
61551
|
];
|
|
61681
61552
|
}
|
|
61682
|
-
case
|
|
61553
|
+
case 36:
|
|
61683
61554
|
{
|
|
61684
61555
|
if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
|
|
61685
61556
|
frameComponent = playerItem.getComponent(FrameComponent);
|
|
@@ -61689,10 +61560,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61689
61560
|
}
|
|
61690
61561
|
return [
|
|
61691
61562
|
3,
|
|
61692
|
-
|
|
61563
|
+
39
|
|
61693
61564
|
];
|
|
61694
61565
|
}
|
|
61695
|
-
case
|
|
61566
|
+
case 37:
|
|
61696
61567
|
{
|
|
61697
61568
|
if (typeof propertyValue === 'boolean') {
|
|
61698
61569
|
playerItem.setVisible(propertyValue);
|
|
@@ -61705,10 +61576,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61705
61576
|
}
|
|
61706
61577
|
return [
|
|
61707
61578
|
3,
|
|
61708
|
-
|
|
61579
|
+
39
|
|
61709
61580
|
];
|
|
61710
61581
|
}
|
|
61711
|
-
case
|
|
61582
|
+
case 38:
|
|
61712
61583
|
{
|
|
61713
61584
|
console.log('ignore property name ', propertyName);
|
|
61714
61585
|
// 对于未明确处理的属性,尝试直接设置到 property 对象
|
|
@@ -61716,8 +61587,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61716
61587
|
targetItem.property[propertyName] = propertyValue;
|
|
61717
61588
|
}
|
|
61718
61589
|
}
|
|
61719
|
-
_state.label =
|
|
61720
|
-
case
|
|
61590
|
+
_state.label = 39;
|
|
61591
|
+
case 39:
|
|
61721
61592
|
// 非位置属性需要刷新播放器
|
|
61722
61593
|
// template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
|
|
61723
61594
|
if (![
|
|
@@ -61726,11 +61597,14 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61726
61597
|
'size'
|
|
61727
61598
|
].includes(propertyName)) {
|
|
61728
61599
|
time = this.sdk.pageData.time;
|
|
61600
|
+
// 刷新前快照视频播放态,刷新后恢复,避免设置属性导致全量视频被自动播放
|
|
61601
|
+
videoPlayStates1 = this.snapshotVideoPlayStates();
|
|
61729
61602
|
if (SDK.config.mode === 'editor') {
|
|
61730
61603
|
this.player.gotoAndPlay(time);
|
|
61731
61604
|
} else {
|
|
61732
61605
|
this.player.gotoAndStop(time);
|
|
61733
61606
|
}
|
|
61607
|
+
this.restoreVideoPlayStates(videoPlayStates1);
|
|
61734
61608
|
}
|
|
61735
61609
|
return [
|
|
61736
61610
|
2
|
|
@@ -62597,10 +62471,6 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
62597
62471
|
}
|
|
62598
62472
|
break;
|
|
62599
62473
|
}
|
|
62600
|
-
case 'cardType':
|
|
62601
|
-
{
|
|
62602
|
-
break;
|
|
62603
|
-
}
|
|
62604
62474
|
default:
|
|
62605
62475
|
{
|
|
62606
62476
|
console.warn("Target property " + propertyName + " can not be changed.");
|
|
@@ -63193,15 +63063,12 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63193
63063
|
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 ? [
|
|
63194
63064
|
1,
|
|
63195
63065
|
1
|
|
63196
|
-
] : _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 ? generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63066
|
+
] : _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 ? generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63197
63067
|
// 校验 cardType 是否已在配置中注册
|
|
63198
|
-
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63199
|
-
return t.type === cardType;
|
|
63200
|
-
});
|
|
63201
63068
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63202
63069
|
return t.type;
|
|
63203
63070
|
});
|
|
63204
|
-
if (!
|
|
63071
|
+
if (!registeredTypes.includes(cardType)) {
|
|
63205
63072
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63206
63073
|
return;
|
|
63207
63074
|
}
|
|
@@ -63245,7 +63112,9 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63245
63112
|
width: width,
|
|
63246
63113
|
height: height,
|
|
63247
63114
|
scale: [].concat(scale),
|
|
63248
|
-
cardType: cardType
|
|
63115
|
+
cardType: cardType,
|
|
63116
|
+
autoHeight: autoHeight,
|
|
63117
|
+
html: html
|
|
63249
63118
|
},
|
|
63250
63119
|
extension: extension
|
|
63251
63120
|
});
|
|
@@ -64627,7 +64496,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64627
64496
|
scalar.y
|
|
64628
64497
|
],
|
|
64629
64498
|
rotation: [].concat(rotation),
|
|
64630
|
-
position: [].concat(resultPosition)
|
|
64499
|
+
position: [].concat(resultPosition),
|
|
64500
|
+
html: sdkItem.html
|
|
64631
64501
|
},
|
|
64632
64502
|
extension: extension
|
|
64633
64503
|
};
|
|
@@ -64712,7 +64582,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64712
64582
|
};
|
|
64713
64583
|
addTextItemIntoNewScene = function addTextItemIntoNewScene(textCreateInfo, sceneSize, itemViewPosition) {
|
|
64714
64584
|
var _scene_fonts;
|
|
64715
|
-
var _textCreateInfo_id = textCreateInfo.id, id = _textCreateInfo_id === void 0 ? 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 ? spec.TextWeight.normal : _textCreateInfo_property_fontWeight, _textCreateInfo_property_fontStyle = _textCreateInfo_property.fontStyle, fontStyle = _textCreateInfo_property_fontStyle === void 0 ? spec.FontStyle.normal : _textCreateInfo_property_fontStyle, _textCreateInfo_property_textAlign = _textCreateInfo_property.textAlign, textAlign = _textCreateInfo_property_textAlign === void 0 ? 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;
|
|
64585
|
+
var _textCreateInfo_id = textCreateInfo.id, id = _textCreateInfo_id === void 0 ? 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 ? spec.TextWeight.normal : _textCreateInfo_property_fontWeight, _textCreateInfo_property_fontStyle = _textCreateInfo_property.fontStyle, fontStyle = _textCreateInfo_property_fontStyle === void 0 ? spec.FontStyle.normal : _textCreateInfo_property_fontStyle, _textCreateInfo_property_textAlign = _textCreateInfo_property.textAlign, textAlign = _textCreateInfo_property_textAlign === void 0 ? 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;
|
|
64716
64586
|
var rotation = Array.isArray(sourceRotation) ? [].concat(sourceRotation) : [
|
|
64717
64587
|
0,
|
|
64718
64588
|
0,
|
|
@@ -64742,7 +64612,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64742
64612
|
fontSize: fontSize,
|
|
64743
64613
|
textColor: resutlTextColor,
|
|
64744
64614
|
fontWeight: fontWeight,
|
|
64745
|
-
letterSpace:
|
|
64615
|
+
letterSpace: letterSpacing,
|
|
64746
64616
|
textAlign: textAlign,
|
|
64747
64617
|
fontStyle: fontStyle,
|
|
64748
64618
|
textWidth: textWidth,
|
|
@@ -65673,7 +65543,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65673
65543
|
_this = this;
|
|
65674
65544
|
changeProeprty = function changeProeprty(targetCreateInfo) {
|
|
65675
65545
|
return _async_to_generator(function() {
|
|
65676
|
-
var currentCreateInfo
|
|
65546
|
+
var currentCreateInfo;
|
|
65677
65547
|
return _ts_generator(this, function(_state) {
|
|
65678
65548
|
switch(_state.label){
|
|
65679
65549
|
case 0:
|
|
@@ -65684,20 +65554,16 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65684
65554
|
2
|
|
65685
65555
|
];
|
|
65686
65556
|
}
|
|
65687
|
-
itemId = targetCreateInfo.id;
|
|
65688
65557
|
return [
|
|
65689
65558
|
4,
|
|
65690
65559
|
this.setItemProperty({
|
|
65691
|
-
itemId:
|
|
65560
|
+
itemId: currentCreateInfo.id,
|
|
65692
65561
|
type: currentCreateInfo.type,
|
|
65693
65562
|
property: targetCreateInfo.property
|
|
65694
65563
|
})
|
|
65695
65564
|
];
|
|
65696
65565
|
case 1:
|
|
65697
65566
|
_state.sent();
|
|
65698
|
-
if (targetCreateInfo.extension) {
|
|
65699
|
-
this.setItemExtension(itemId, targetCreateInfo.extension);
|
|
65700
|
-
}
|
|
65701
65567
|
return [
|
|
65702
65568
|
2
|
|
65703
65569
|
];
|
|
@@ -65753,6 +65619,51 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65753
65619
|
var result = box.clone().scale(scale, center).translate(translation);
|
|
65754
65620
|
return result;
|
|
65755
65621
|
};
|
|
65622
|
+
/**
|
|
65623
|
+
* @description 快照当前所有视频元素的播放状态(播放/暂停 + 当前播放进度),用于属性刷新后恢复,
|
|
65624
|
+
* 避免设置属性导致全量视频被自动播放或进度被重置回 0s
|
|
65625
|
+
*/ _proto.snapshotVideoPlayStates = function snapshotVideoPlayStates() {
|
|
65626
|
+
var states = new Map();
|
|
65627
|
+
var composition = this.getCurrentComposition();
|
|
65628
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(composition.items), _step; !(_step = _iterator()).done;){
|
|
65629
|
+
var item = _step.value;
|
|
65630
|
+
if (item.type === spec.ItemType.video) {
|
|
65631
|
+
var videoComponent = item.getComponent(VideoComponent);
|
|
65632
|
+
if (!videoComponent) {
|
|
65633
|
+
continue;
|
|
65634
|
+
}
|
|
65635
|
+
//@ts-expect-error @赤芍 played 字段未在类型中声明,参见 rebuildCompositionItems 处用法
|
|
65636
|
+
var played = !!videoComponent.played;
|
|
65637
|
+
var time = videoComponent.getCurrentTime();
|
|
65638
|
+
states.set(item.getInstanceId(), {
|
|
65639
|
+
played: played,
|
|
65640
|
+
time: time
|
|
65641
|
+
});
|
|
65642
|
+
}
|
|
65643
|
+
}
|
|
65644
|
+
return states;
|
|
65645
|
+
};
|
|
65646
|
+
/**
|
|
65647
|
+
* @description 按快照恢复视频元素的播放状态(先 pause 再 seek,最后按原状态 play/pause,避免进度抖动)
|
|
65648
|
+
*/ _proto.restoreVideoPlayStates = function restoreVideoPlayStates(states) {
|
|
65649
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(states), _step; !(_step = _iterator()).done;){
|
|
65650
|
+
var _step_value = _step.value, id = _step_value[0], _step_value_ = _step_value[1], played = _step_value_.played, time = _step_value_.time;
|
|
65651
|
+
var playerItem = this.getPlayerItemById(id);
|
|
65652
|
+
if ((playerItem == null ? void 0 : playerItem.type) !== spec.ItemType.video) {
|
|
65653
|
+
continue;
|
|
65654
|
+
}
|
|
65655
|
+
var videoComponent = playerItem.getComponent(VideoComponent);
|
|
65656
|
+
if (!videoComponent) {
|
|
65657
|
+
continue;
|
|
65658
|
+
}
|
|
65659
|
+
// 先暂停再 seek,避免播放状态下 seek 导致画面抖动
|
|
65660
|
+
videoComponent.pauseVideo();
|
|
65661
|
+
videoComponent.setCurrentTime(time);
|
|
65662
|
+
if (played) {
|
|
65663
|
+
videoComponent.playVideo();
|
|
65664
|
+
}
|
|
65665
|
+
}
|
|
65666
|
+
};
|
|
65756
65667
|
_proto.playVideoItem = function playVideoItem(id) {
|
|
65757
65668
|
var playerItem = this.getPlayerItemById(id);
|
|
65758
65669
|
if ((playerItem == null ? void 0 : playerItem.type) !== spec.ItemType.video) {
|
|
@@ -66015,56 +65926,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
66015
65926
|
};
|
|
66016
65927
|
_proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
|
|
66017
65928
|
return _async_to_generator(function() {
|
|
66018
|
-
var
|
|
65929
|
+
var _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, createInfo, id, type, url, textureId, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
|
|
66019
65930
|
return _ts_generator(this, function(_state) {
|
|
66020
65931
|
switch(_state.label){
|
|
66021
65932
|
case 0:
|
|
66022
|
-
|
|
66023
|
-
|
|
66024
|
-
|
|
66025
|
-
|
|
66026
|
-
|
|
66027
|
-
|
|
66028
|
-
|
|
66029
|
-
|
|
66030
|
-
|
|
66031
|
-
|
|
66032
|
-
|
|
66033
|
-
|
|
66034
|
-
|
|
66035
|
-
|
|
66036
|
-
|
|
66037
|
-
|
|
66038
|
-
};
|
|
66039
|
-
}
|
|
66040
|
-
default:
|
|
66041
|
-
{
|
|
66042
|
-
return {};
|
|
66043
|
-
}
|
|
66044
|
-
}
|
|
66045
|
-
}(), url = _ref.url, type = _ref.type;
|
|
66046
|
-
if (url && type) {
|
|
66047
|
-
var textureId = generateGUID();
|
|
66048
|
-
itemToTextureInfo.set(createInfo.id, {
|
|
65933
|
+
_this = this;
|
|
65934
|
+
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
65935
|
+
return Object.assign({}, createInfo, createInfo.id ? {} : {
|
|
65936
|
+
id: generateGUID()
|
|
65937
|
+
});
|
|
65938
|
+
});
|
|
65939
|
+
itemToTextureInfo = new Map();
|
|
65940
|
+
// 预处理所有 createInfo,分配 textureId
|
|
65941
|
+
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;){
|
|
65942
|
+
createInfo = _step.value;
|
|
65943
|
+
id = createInfo.id;
|
|
65944
|
+
type = createInfo.type;
|
|
65945
|
+
url = type === SDKItemType.SPRITE ? createInfo.property.image : type === SDKItemType.VIDEO ? createInfo.property.video : undefined;
|
|
65946
|
+
if ((type === SDKItemType.SPRITE || type === SDKItemType.VIDEO) && url) {
|
|
65947
|
+
textureId = generateGUID();
|
|
65948
|
+
itemToTextureInfo.set(id, {
|
|
66049
65949
|
id: textureId,
|
|
66050
65950
|
url: url,
|
|
66051
|
-
type: type
|
|
65951
|
+
type: type === SDKItemType.SPRITE ? 'image' : 'video'
|
|
66052
65952
|
});
|
|
66053
65953
|
Object.assign(createInfo, {
|
|
66054
65954
|
textureId: textureId
|
|
66055
65955
|
});
|
|
66056
65956
|
}
|
|
66057
|
-
}
|
|
66058
|
-
_this = this;
|
|
66059
|
-
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
66060
|
-
var _createInfo_id;
|
|
66061
|
-
return Object.assign({}, createInfo, {
|
|
66062
|
-
id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : generateGUID()
|
|
66063
|
-
});
|
|
66064
|
-
});
|
|
66065
|
-
itemToTextureInfo = new Map();
|
|
66066
|
-
// 预处理所有 createInfo,分配 textureId
|
|
66067
|
-
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
|
|
65957
|
+
}
|
|
66068
65958
|
// 并行创建所有 item
|
|
66069
65959
|
toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
|
|
66070
65960
|
return ![
|
|
@@ -67339,7 +67229,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67339
67229
|
};
|
|
67340
67230
|
_proto.autoLayoutPage = function autoLayoutPage() {
|
|
67341
67231
|
return _async_to_generator(function(param) {
|
|
67342
|
-
var _this, pageData, _param_mode, mode, ids, _param_focus, focus, _param_gap, gap, isPartialLayout, targetItems, layoutElements, moveInfos, anchor, _iterator, _step, moveInfo, sdkItem;
|
|
67232
|
+
var _this, pageData, _param_mode, mode, ids, _param_focus, focus, _param_gap, gap, shift, isPartialLayout, targetItems, layoutElements, moveInfos, anchor, _iterator, _step, moveInfo, sdkItem;
|
|
67343
67233
|
return _ts_generator(this, function(_state) {
|
|
67344
67234
|
switch(_state.label){
|
|
67345
67235
|
case 0:
|
|
@@ -67354,7 +67244,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67354
67244
|
2
|
|
67355
67245
|
];
|
|
67356
67246
|
}
|
|
67357
|
-
_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;
|
|
67247
|
+
_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;
|
|
67358
67248
|
isPartialLayout = !!(ids == null ? void 0 : ids.length);
|
|
67359
67249
|
// 1. 确定参与排布的顶层元素(过滤子元素)
|
|
67360
67250
|
targetItems = pageData.items.filter(function(item) {
|
|
@@ -67383,7 +67273,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67383
67273
|
// 4. 计算锚点偏移
|
|
67384
67274
|
// - 选中元素排布:以原始包围盒左上角为锚点
|
|
67385
67275
|
// - 全量排布:以视口中心为锚点
|
|
67386
|
-
anchor = isPartialLayout ? this.getPartialLayoutAnchor(layoutElements, moveInfos.boundingBox) : this.getGlobalLayoutAnchor(moveInfos.boundingBox);
|
|
67276
|
+
anchor = isPartialLayout ? this.getPartialLayoutAnchor(layoutElements, moveInfos.boundingBox) : this.getGlobalLayoutAnchor(moveInfos.boundingBox, shift);
|
|
67387
67277
|
_iterator = _create_for_of_iterator_helper_loose(moveInfos.items);
|
|
67388
67278
|
_state.label = 1;
|
|
67389
67279
|
case 1:
|
|
@@ -67426,7 +67316,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67426
67316
|
if (focus) {
|
|
67427
67317
|
this.setPageZoom(1, undefined, true);
|
|
67428
67318
|
this.setPageMove(new Vector2());
|
|
67429
|
-
this.viewportFit(
|
|
67319
|
+
this.viewportFit(shift, moveInfos.boundingBox.translate(anchor));
|
|
67430
67320
|
}
|
|
67431
67321
|
return [
|
|
67432
67322
|
2
|
|
@@ -67450,8 +67340,9 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
67450
67340
|
/**
|
|
67451
67341
|
* @description 计算全量排布的锚点偏移:以视口中心为锚点
|
|
67452
67342
|
* @param layoutBoundingBox 排布算法输出的包围盒
|
|
67453
|
-
*/ _proto.getGlobalLayoutAnchor = function getGlobalLayoutAnchor(layoutBoundingBox) {
|
|
67454
|
-
var
|
|
67343
|
+
*/ _proto.getGlobalLayoutAnchor = function getGlobalLayoutAnchor(layoutBoundingBox, shift) {
|
|
67344
|
+
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;
|
|
67345
|
+
var viewCenter = new Vector2(this.sdk._container.offsetWidth / 2 + left - right, this.sdk._container.offsetHeight / 2 + top - bottom);
|
|
67455
67346
|
var boundCenter = layoutBoundingBox.getCenter();
|
|
67456
67347
|
return new Vector2(viewCenter.x - boundCenter.x, viewCenter.y - boundCenter.y);
|
|
67457
67348
|
};
|
|
@@ -69053,6 +68944,8 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69053
68944
|
*/ _this.maskSprite = null, _this._config = {}, _this.boxGraphics = new Graphics(), _this.type = 'mask', _this.mode = 'paint', /**
|
|
69054
68945
|
* 蒙版工具独立的撤销重做实例
|
|
69055
68946
|
*/ _this._undoRedo = new GizmoUndoRedo(), /**
|
|
68947
|
+
* 框选擦除进行中标记(按下到松开之间),用于实时选框描边的显示控制
|
|
68948
|
+
*/ _this._isBoxErasing = false, /**
|
|
69056
68949
|
* 鼠标状态绘制结果
|
|
69057
68950
|
*/ _this.cursorResult = {
|
|
69058
68951
|
type: 'normal',
|
|
@@ -69069,10 +68962,22 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69069
68962
|
var _proto = MaskGizmo.prototype;
|
|
69070
68963
|
/**
|
|
69071
68964
|
* 设置模式
|
|
69072
|
-
* @param mode 模式类型:'paint'
|
|
68965
|
+
* @param mode 模式类型:'paint' 笔刷涂抹、'erase' 笔刷逐笔擦除、'box-erase' 框选擦除、'box-paint' 框选涂抹
|
|
69073
68966
|
*/ _proto.setMode = function setMode(mode) {
|
|
69074
68967
|
this.mode = mode;
|
|
69075
68968
|
};
|
|
68969
|
+
/**
|
|
68970
|
+
* @description 判断点是否在包围盒内
|
|
68971
|
+
*/ _proto._isPointInBox = function _isPointInBox(p, box) {
|
|
68972
|
+
return p.x >= box.min.x && p.x <= box.max.x && p.y >= box.min.y && p.y <= box.max.y;
|
|
68973
|
+
};
|
|
68974
|
+
/**
|
|
68975
|
+
* @description 将屏幕坐标转换为包围盒内的归一化坐标 [0,1](钳制在范围内)
|
|
68976
|
+
*/ _proto._toNormalized = function _toNormalized(p, box) {
|
|
68977
|
+
var x = Math.max(0, Math.min(1, (p.x - box.min.x) / (box.max.x - box.min.x)));
|
|
68978
|
+
var y = Math.max(0, Math.min(1, (p.y - box.min.y) / (box.max.y - box.min.y)));
|
|
68979
|
+
return new Vector2(x, y);
|
|
68980
|
+
};
|
|
69076
68981
|
_proto.initialize = function initialize() {};
|
|
69077
68982
|
_proto.preparationAction = function preparationAction(event) {
|
|
69078
68983
|
if (!this.interactive) {
|
|
@@ -69091,6 +68996,26 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69091
68996
|
};
|
|
69092
68997
|
// 更新鼠标位置
|
|
69093
68998
|
this.result.point = new Vector2(event.offsetX, event.offsetY);
|
|
68999
|
+
// 框选模式(框选擦除 / 框选涂抹):仅在元素包围盒内按下才触发
|
|
69000
|
+
if (this.mode === 'box-erase' || this.mode === 'box-paint') {
|
|
69001
|
+
var box = this.result.box;
|
|
69002
|
+
if (!box || !this._isPointInBox(this.result.point, box)) {
|
|
69003
|
+
// 包围盒外按下:不触发框选,交由其它 gizmo
|
|
69004
|
+
return undefined;
|
|
69005
|
+
}
|
|
69006
|
+
var start = this._toNormalized(this.result.point, box);
|
|
69007
|
+
this.result.lines.push({
|
|
69008
|
+
type: this.mode === 'box-paint' ? 'paint' : 'erase',
|
|
69009
|
+
shape: 'rect',
|
|
69010
|
+
brushSize: 0,
|
|
69011
|
+
points: [
|
|
69012
|
+
start,
|
|
69013
|
+
start.clone()
|
|
69014
|
+
]
|
|
69015
|
+
});
|
|
69016
|
+
this._isBoxErasing = true;
|
|
69017
|
+
return this.type;
|
|
69018
|
+
}
|
|
69094
69019
|
// 开启新画笔
|
|
69095
69020
|
this.result.lines.push({
|
|
69096
69021
|
type: this.mode,
|
|
@@ -69100,32 +69025,61 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69100
69025
|
return this.type;
|
|
69101
69026
|
};
|
|
69102
69027
|
_proto.action = function action(event) {
|
|
69103
|
-
var // 记录鼠标划线位置
|
|
69104
|
-
_this_result_lines_;
|
|
69105
69028
|
if (!this.interactive || this.result.status === 'init') {
|
|
69106
69029
|
return;
|
|
69107
69030
|
}
|
|
69108
69031
|
// 更新鼠标位置
|
|
69109
69032
|
var box = this.result.box;
|
|
69110
|
-
var point = new Vector2(
|
|
69111
|
-
|
|
69033
|
+
var point = new Vector2(event.offsetX, event.offsetY);
|
|
69034
|
+
this.result.point = point;
|
|
69035
|
+
var lastLine = this.result.lines[this.result.lines.length - 1];
|
|
69036
|
+
// 框选擦除:更新框选终点(钳制到包围盒内)
|
|
69037
|
+
if ((lastLine == null ? void 0 : lastLine.shape) === 'rect') {
|
|
69038
|
+
lastLine.points[1] = this._toNormalized(point, box);
|
|
69039
|
+
return;
|
|
69040
|
+
}
|
|
69041
|
+
// 记录鼠标划线位置(笔刷模式)
|
|
69042
|
+
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));
|
|
69043
|
+
lastLine == null ? void 0 : lastLine.points.push(np);
|
|
69112
69044
|
};
|
|
69113
69045
|
_proto.endAction = function endAction() {
|
|
69114
69046
|
if (!this.interactive) {
|
|
69115
69047
|
return undefined;
|
|
69116
69048
|
}
|
|
69117
|
-
// 记录操作到 undoRedo(仅当画线有实际点时才记录)
|
|
69118
69049
|
var lastLine = this.result.lines[this.result.lines.length - 1];
|
|
69050
|
+
// 框选擦除:起点==终点视为空框选,移除;否则提交 undoRedo
|
|
69051
|
+
if ((lastLine == null ? void 0 : lastLine.shape) === 'rect') {
|
|
69052
|
+
this._isBoxErasing = false;
|
|
69053
|
+
var _lastLine_points = lastLine.points, a = _lastLine_points[0], b = _lastLine_points[1];
|
|
69054
|
+
var isEmpty = !!a && !!b && a.x === b.x && a.y === b.y;
|
|
69055
|
+
if (this._oldLines && !isEmpty) {
|
|
69056
|
+
var operation = {
|
|
69057
|
+
type: 'update',
|
|
69058
|
+
oldData: this._oldLines,
|
|
69059
|
+
newData: {
|
|
69060
|
+
lines: JSON.parse(JSON.stringify(this.result.lines))
|
|
69061
|
+
}
|
|
69062
|
+
};
|
|
69063
|
+
this._undoRedo.push(operation);
|
|
69064
|
+
this._eventEmitter.emit('maskGizmoUndoRedoChange', operation);
|
|
69065
|
+
} else {
|
|
69066
|
+
// 空框选移除
|
|
69067
|
+
this.result.lines.pop();
|
|
69068
|
+
}
|
|
69069
|
+
this._oldLines = undefined;
|
|
69070
|
+
return this.type;
|
|
69071
|
+
}
|
|
69072
|
+
// 记录操作到 undoRedo(仅当画线有实际点时才记录)
|
|
69119
69073
|
if (this._oldLines && lastLine && lastLine.points.length > 0) {
|
|
69120
|
-
var
|
|
69074
|
+
var operation1 = {
|
|
69121
69075
|
type: 'update',
|
|
69122
69076
|
oldData: this._oldLines,
|
|
69123
69077
|
newData: {
|
|
69124
69078
|
lines: JSON.parse(JSON.stringify(this.result.lines))
|
|
69125
69079
|
}
|
|
69126
69080
|
};
|
|
69127
|
-
this._undoRedo.push(
|
|
69128
|
-
this._eventEmitter.emit('maskGizmoUndoRedoChange',
|
|
69081
|
+
this._undoRedo.push(operation1);
|
|
69082
|
+
this._eventEmitter.emit('maskGizmoUndoRedoChange', operation1);
|
|
69129
69083
|
} else if ((lastLine == null ? void 0 : lastLine.points.length) === 0) {
|
|
69130
69084
|
// 如果没有实际绘制点,移除空的线条
|
|
69131
69085
|
this.result.lines.pop();
|
|
@@ -69250,6 +69204,17 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69250
69204
|
this.boxGraphics.lineStyle(boxLineWidth, boxLineColor, boxLineAlpha);
|
|
69251
69205
|
this.boxGraphics.drawBox(box);
|
|
69252
69206
|
this.boxGraphics.endFill();
|
|
69207
|
+
// 框选擦除进行中:叠加当前拖动矩形的可视描边
|
|
69208
|
+
var lastLine = this.result.lines[this.result.lines.length - 1];
|
|
69209
|
+
if (this._isBoxErasing && (lastLine == null ? void 0 : lastLine.shape) === 'rect' && lastLine.points.length >= 2) {
|
|
69210
|
+
var _lastLine_points = lastLine.points, a = _lastLine_points[0], b = _lastLine_points[1];
|
|
69211
|
+
if (a && b) {
|
|
69212
|
+
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)));
|
|
69213
|
+
this.boxGraphics.lineStyle(boxLineWidth, boxLineColor, boxLineAlpha);
|
|
69214
|
+
this.boxGraphics.drawBox(selBox);
|
|
69215
|
+
this.boxGraphics.endFill();
|
|
69216
|
+
}
|
|
69217
|
+
}
|
|
69253
69218
|
// 1. 画线形(只用于遮罩,不直接显示
|
|
69254
69219
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.result.lines), _step; !(_step = _iterator()).done;){
|
|
69255
69220
|
var line = _step.value;
|
|
@@ -69257,6 +69222,32 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69257
69222
|
continue;
|
|
69258
69223
|
}
|
|
69259
69224
|
var lineGraphics = new Graphics();
|
|
69225
|
+
// 矩形框选:填充矩形,paint 用 NORMAL 叠加,erase 用 DST_OUT 抠除
|
|
69226
|
+
if (line.shape === 'rect') {
|
|
69227
|
+
var a1 = line.points[0];
|
|
69228
|
+
var b1 = line.points[1];
|
|
69229
|
+
if (a1 && b1) {
|
|
69230
|
+
var w = box.max.x - box.min.x;
|
|
69231
|
+
var h = box.max.y - box.min.y;
|
|
69232
|
+
var x0 = Math.min(a1.x, b1.x) * w;
|
|
69233
|
+
var y0 = Math.min(a1.y, b1.y) * h;
|
|
69234
|
+
var x1 = Math.max(a1.x, b1.x) * w;
|
|
69235
|
+
var y1 = Math.max(a1.y, b1.y) * h;
|
|
69236
|
+
// 太小(纯点击)不渲染,避免 1px 擦除/涂抹点
|
|
69237
|
+
if (x1 - x0 > 0.5 || y1 - y0 > 0.5) {
|
|
69238
|
+
lineGraphics.beginFill(brushColor);
|
|
69239
|
+
lineGraphics.drawRect(x0, y0, x1 - x0, y1 - y0);
|
|
69240
|
+
lineGraphics.endFill();
|
|
69241
|
+
lineGraphics.blendMode = line.type === 'paint' ? BLEND_MODES.NORMAL : BLEND_MODES.DST_OUT;
|
|
69242
|
+
this._app.renderer.render(lineGraphics, {
|
|
69243
|
+
renderTexture: this.maskRenderTexture,
|
|
69244
|
+
clear: false
|
|
69245
|
+
});
|
|
69246
|
+
}
|
|
69247
|
+
}
|
|
69248
|
+
lineGraphics.destroy();
|
|
69249
|
+
continue;
|
|
69250
|
+
}
|
|
69260
69251
|
lineGraphics.blendMode = line.type === 'paint' ? BLEND_MODES.NORMAL : BLEND_MODES.DST_OUT;
|
|
69261
69252
|
lineGraphics.lineStyle({
|
|
69262
69253
|
width: line.brushSize * viewportParam.scale,
|
|
@@ -69300,14 +69291,24 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69300
69291
|
if (!point || !box) {
|
|
69301
69292
|
return;
|
|
69302
69293
|
}
|
|
69303
|
-
|
|
69304
|
-
|
|
69294
|
+
var inside = point.x >= box.min.x && point.x <= box.max.x && point.y >= box.min.y && point.y <= box.max.y;
|
|
69295
|
+
if (!inside) {
|
|
69296
|
+
return;
|
|
69297
|
+
}
|
|
69298
|
+
// 框选模式(框选擦除 / 框选涂抹):crosshair
|
|
69299
|
+
if (this.mode === 'box-erase' || this.mode === 'box-paint') {
|
|
69305
69300
|
this.cursorResult = {
|
|
69306
|
-
type: '
|
|
69307
|
-
angle: 0
|
|
69308
|
-
radius: this.config.brushSize * viewportParam.scale / 2
|
|
69301
|
+
type: 'box-select',
|
|
69302
|
+
angle: 0
|
|
69309
69303
|
};
|
|
69304
|
+
return;
|
|
69310
69305
|
}
|
|
69306
|
+
var viewportParam = this._pageDataUtils.interactionUtils.viewportParam;
|
|
69307
|
+
this.cursorResult = {
|
|
69308
|
+
type: 'circle',
|
|
69309
|
+
angle: 0,
|
|
69310
|
+
radius: this.config.brushSize * viewportParam.scale / 2
|
|
69311
|
+
};
|
|
69311
69312
|
};
|
|
69312
69313
|
_proto.close = function close() {
|
|
69313
69314
|
this._config.maskImage = undefined;
|
|
@@ -69455,6 +69456,21 @@ var MaskGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
69455
69456
|
if (!line || line.points.length === 0) {
|
|
69456
69457
|
continue;
|
|
69457
69458
|
}
|
|
69459
|
+
// 矩形框选:填充矩形
|
|
69460
|
+
if (line.shape === 'rect') {
|
|
69461
|
+
var _line_points = line.points, a = _line_points[0], b1 = _line_points[1];
|
|
69462
|
+
if (!a || !b1) {
|
|
69463
|
+
continue;
|
|
69464
|
+
}
|
|
69465
|
+
var x0 = Math.min(a.x, b1.x) * width;
|
|
69466
|
+
var y0 = Math.min(a.y, b1.y) * height;
|
|
69467
|
+
var x1 = Math.max(a.x, b1.x) * width;
|
|
69468
|
+
var y1 = Math.max(a.y, b1.y) * height;
|
|
69469
|
+
ctx.globalCompositeOperation = 'source-over';
|
|
69470
|
+
ctx.fillStyle = line.type === 'paint' ? maskHexColor : maskBackgroundHexColor;
|
|
69471
|
+
ctx.fillRect(x0, y0, Math.max(1, x1 - x0), Math.max(1, y1 - y0));
|
|
69472
|
+
continue;
|
|
69473
|
+
}
|
|
69458
69474
|
ctx.lineWidth = line.brushSize * scale;
|
|
69459
69475
|
ctx.lineCap = 'round';
|
|
69460
69476
|
ctx.lineJoin = 'round';
|
|
@@ -71460,7 +71476,8 @@ var GestureHandler = /*#__PURE__*/ function() {
|
|
|
71460
71476
|
'active-hand',
|
|
71461
71477
|
'pointer',
|
|
71462
71478
|
'text-create',
|
|
71463
|
-
'frame-create'
|
|
71479
|
+
'frame-create',
|
|
71480
|
+
'box-select'
|
|
71464
71481
|
].includes(result.type)) {
|
|
71465
71482
|
var cursor = cursorMap[result.type];
|
|
71466
71483
|
if (cursor.type === 'svg') {
|
|
@@ -71632,6 +71649,7 @@ var GestureHandler = /*#__PURE__*/ function() {
|
|
|
71632
71649
|
return;
|
|
71633
71650
|
}
|
|
71634
71651
|
this.maskGizmo.setMode(mode);
|
|
71652
|
+
this.render();
|
|
71635
71653
|
};
|
|
71636
71654
|
_proto.openLoadingGizmo = function openLoadingGizmo(id, options) {
|
|
71637
71655
|
var _this__emitter;
|
|
@@ -83237,12 +83255,43 @@ var BaseConfig = {
|
|
|
83237
83255
|
},
|
|
83238
83256
|
cardConfig: {
|
|
83239
83257
|
backgroundColor: [
|
|
83240
|
-
|
|
83241
|
-
|
|
83242
|
-
|
|
83243
|
-
0
|
|
83258
|
+
0.6,
|
|
83259
|
+
0.6,
|
|
83260
|
+
0.6,
|
|
83261
|
+
0.12
|
|
83244
83262
|
],
|
|
83245
|
-
cardTypes: [
|
|
83263
|
+
cardTypes: [
|
|
83264
|
+
{
|
|
83265
|
+
type: 'character',
|
|
83266
|
+
label: '角色图',
|
|
83267
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83268
|
+
},
|
|
83269
|
+
{
|
|
83270
|
+
type: 'environment',
|
|
83271
|
+
label: '环境图',
|
|
83272
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83273
|
+
},
|
|
83274
|
+
{
|
|
83275
|
+
type: 'storyboard',
|
|
83276
|
+
label: '分镜图',
|
|
83277
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83278
|
+
},
|
|
83279
|
+
{
|
|
83280
|
+
type: 'scene-clip',
|
|
83281
|
+
label: '场景剪辑',
|
|
83282
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83283
|
+
},
|
|
83284
|
+
{
|
|
83285
|
+
type: 'video-compose',
|
|
83286
|
+
label: '视频合成',
|
|
83287
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83288
|
+
},
|
|
83289
|
+
{
|
|
83290
|
+
type: 'video-generate',
|
|
83291
|
+
label: '生成视频',
|
|
83292
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83293
|
+
}
|
|
83294
|
+
]
|
|
83246
83295
|
}
|
|
83247
83296
|
}
|
|
83248
83297
|
};
|
|
@@ -91571,18 +91620,11 @@ function isCardHTMLAutoHeightMessage(data, id) {
|
|
|
91571
91620
|
var message = data;
|
|
91572
91621
|
return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
|
|
91573
91622
|
}
|
|
91574
|
-
function requestCardHTMLAutoHeight(iframe, id) {
|
|
91575
|
-
var _iframe_contentWindow;
|
|
91576
|
-
(_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
|
|
91577
|
-
source: 'vvfx-card-html-auto-height-request',
|
|
91578
|
-
id: id
|
|
91579
|
-
}, '*');
|
|
91580
|
-
}
|
|
91581
91623
|
function withCardHTMLAutoHeightBridge(html, id) {
|
|
91582
91624
|
if (!id) {
|
|
91583
91625
|
return html;
|
|
91584
91626
|
}
|
|
91585
|
-
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const
|
|
91627
|
+
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>";
|
|
91586
91628
|
if (/<\/body>/i.test(html)) {
|
|
91587
91629
|
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91588
91630
|
}
|
|
@@ -91855,38 +91897,30 @@ function syncElementStackOrder(_container, elements) {
|
|
|
91855
91897
|
});
|
|
91856
91898
|
}
|
|
91857
91899
|
|
|
91858
|
-
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY
|
|
91900
|
+
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
|
|
91859
91901
|
if (offsetX === void 0) offsetX = 0;
|
|
91860
91902
|
if (offsetY === void 0) offsetY = 0;
|
|
91861
91903
|
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
91862
91904
|
var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
|
|
91863
|
-
var
|
|
91864
|
-
var
|
|
91865
|
-
var
|
|
91866
|
-
var
|
|
91867
|
-
var c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
91868
|
-
var d = (leftBottom.y - leftTop.y) / contentHeight;
|
|
91905
|
+
var a = (rightTop.x - leftTop.x) / width;
|
|
91906
|
+
var b = (rightTop.y - leftTop.y) / width;
|
|
91907
|
+
var c = (leftBottom.x - leftTop.x) / height;
|
|
91908
|
+
var d = (leftBottom.y - leftTop.y) / height;
|
|
91869
91909
|
var e = leftTop.x - offsetX;
|
|
91870
91910
|
var f = leftTop.y - offsetY;
|
|
91871
91911
|
return {
|
|
91872
91912
|
left: '0px',
|
|
91873
91913
|
top: '0px',
|
|
91874
|
-
width: "" +
|
|
91875
|
-
height: "" +
|
|
91876
|
-
contentWidth: contentWidth,
|
|
91877
|
-
contentHeight: contentHeight,
|
|
91914
|
+
width: "" + width + "px",
|
|
91915
|
+
height: "" + height + "px",
|
|
91878
91916
|
transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
|
|
91879
91917
|
};
|
|
91880
91918
|
}
|
|
91881
|
-
var contentWidth1 = box.max.x - box.min.x;
|
|
91882
|
-
var contentHeight1 = box.max.y - box.min.y;
|
|
91883
91919
|
return {
|
|
91884
91920
|
left: "" + (box.min.x - offsetX) + "px",
|
|
91885
91921
|
top: "" + (box.min.y - offsetY) + "px",
|
|
91886
|
-
width: "" +
|
|
91887
|
-
height: "" +
|
|
91888
|
-
contentWidth: contentWidth1,
|
|
91889
|
-
contentHeight: contentHeight1,
|
|
91922
|
+
width: "" + (box.max.x - box.min.x) + "px",
|
|
91923
|
+
height: "" + (box.max.y - box.min.y) + "px",
|
|
91890
91924
|
transform: ''
|
|
91891
91925
|
};
|
|
91892
91926
|
}
|
|
@@ -91909,10 +91943,6 @@ function formatMatrixNumber(value) {
|
|
|
91909
91943
|
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91910
91944
|
return Number(normalized.toFixed(6)).toString();
|
|
91911
91945
|
}
|
|
91912
|
-
function formatPixelNumber(value) {
|
|
91913
|
-
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91914
|
-
return Number(normalized.toFixed(6)).toString();
|
|
91915
|
-
}
|
|
91916
91946
|
|
|
91917
91947
|
function mountHTMLShell(container, content, shell) {
|
|
91918
91948
|
if (!shell) {
|
|
@@ -91933,26 +91963,6 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91933
91963
|
|
|
91934
91964
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91935
91965
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
91936
|
-
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
91937
|
-
'[data-vvfx-html-interaction-zone="self"]',
|
|
91938
|
-
'[data-vvfx-html-interaction-zone="subtree"]',
|
|
91939
|
-
'a[href]',
|
|
91940
|
-
'button:not([disabled])',
|
|
91941
|
-
'input:not([disabled])',
|
|
91942
|
-
'textarea:not([disabled])',
|
|
91943
|
-
'select:not([disabled])',
|
|
91944
|
-
'summary',
|
|
91945
|
-
'video[controls]',
|
|
91946
|
-
'audio[controls]',
|
|
91947
|
-
'[contenteditable]:not([contenteditable="false"])',
|
|
91948
|
-
'[role="button"]',
|
|
91949
|
-
'[role="link"]',
|
|
91950
|
-
'[role="textbox"]',
|
|
91951
|
-
'[tabindex]:not([tabindex="-1"])'
|
|
91952
|
-
].join(', ');
|
|
91953
|
-
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
91954
|
-
'[data-vvfx-html-interaction-zone="none"]'
|
|
91955
|
-
].join(', ');
|
|
91956
91966
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91957
91967
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91958
91968
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
@@ -91962,20 +91972,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91962
91972
|
var _this = this;
|
|
91963
91973
|
this.options = options;
|
|
91964
91974
|
this.eventCleanups = [];
|
|
91965
|
-
this.htmlRootConfigCleanups = new WeakMap();
|
|
91966
91975
|
this.state = {
|
|
91967
91976
|
frameElements: new Map(),
|
|
91968
91977
|
elements: new Map(),
|
|
91969
|
-
selectionElements: new Map(),
|
|
91970
91978
|
contentScaleElements: new Map(),
|
|
91971
91979
|
contentElements: new Map(),
|
|
91972
91980
|
contentMountElements: new Map(),
|
|
91973
|
-
contentInteractionZones: new Map(),
|
|
91974
|
-
contentInteractionZoneCleanups: new Map(),
|
|
91975
|
-
contentInteractionResizeCleanups: new Map(),
|
|
91976
91981
|
contents: new Map(),
|
|
91977
91982
|
cleanups: new Map(),
|
|
91978
|
-
autoHeightModes: new Map(),
|
|
91979
91983
|
autoHeightCleanups: new Map(),
|
|
91980
91984
|
autoHeightFrames: new Map()
|
|
91981
91985
|
};
|
|
@@ -91992,9 +91996,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91992
91996
|
}
|
|
91993
91997
|
return;
|
|
91994
91998
|
}
|
|
91995
|
-
if (!_this.isEditableCard(targetId)) {
|
|
91996
|
-
return;
|
|
91997
|
-
}
|
|
91998
91999
|
event.preventDefault();
|
|
91999
92000
|
event.stopPropagation();
|
|
92000
92001
|
_this.enterEditing(targetId);
|
|
@@ -92010,7 +92011,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92010
92011
|
_this.exitEditing();
|
|
92011
92012
|
};
|
|
92012
92013
|
this.handleContainerMouseMove = function(event) {
|
|
92013
|
-
_this.scheduleActiveContentInteractionSync(event);
|
|
92014
92014
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
92015
92015
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
92016
92016
|
return;
|
|
@@ -92024,16 +92024,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92024
92024
|
_this.syncContentInteraction(hoverShellInteractiveId);
|
|
92025
92025
|
}
|
|
92026
92026
|
};
|
|
92027
|
-
this.handleContainerMouseLeave = function(
|
|
92028
|
-
if (_this.isMouseLeaveWithinContainer(event)) {
|
|
92029
|
-
return;
|
|
92030
|
-
}
|
|
92031
|
-
if (_this.contentInteractionFrame !== undefined) {
|
|
92032
|
-
cancelAnimationFrame(_this.contentInteractionFrame);
|
|
92033
|
-
_this.contentInteractionFrame = undefined;
|
|
92034
|
-
}
|
|
92035
|
-
_this.pendingContentInteractionEvent = undefined;
|
|
92036
|
-
_this.setActiveContentInteraction(undefined);
|
|
92027
|
+
this.handleContainerMouseLeave = function() {
|
|
92037
92028
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
92038
92029
|
if (!previousId) {
|
|
92039
92030
|
return;
|
|
@@ -92041,33 +92032,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92041
92032
|
_this.state.hoverShellInteractiveId = undefined;
|
|
92042
92033
|
_this.syncContentInteraction(previousId);
|
|
92043
92034
|
};
|
|
92044
|
-
this.handleContainerContextMenu = function(event) {
|
|
92045
|
-
var activeInteraction = _this.state.activeContentInteraction;
|
|
92046
|
-
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92047
|
-
return;
|
|
92048
|
-
}
|
|
92049
|
-
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92050
|
-
if (!canvas) {
|
|
92051
|
-
return;
|
|
92052
|
-
}
|
|
92053
|
-
event.preventDefault();
|
|
92054
|
-
event.stopPropagation();
|
|
92055
|
-
_this.setActiveContentInteraction(undefined);
|
|
92056
|
-
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92057
|
-
bubbles: true,
|
|
92058
|
-
cancelable: true,
|
|
92059
|
-
clientX: event.clientX,
|
|
92060
|
-
clientY: event.clientY,
|
|
92061
|
-
screenX: event.screenX,
|
|
92062
|
-
screenY: event.screenY,
|
|
92063
|
-
button: event.button,
|
|
92064
|
-
buttons: event.buttons,
|
|
92065
|
-
ctrlKey: event.ctrlKey,
|
|
92066
|
-
shiftKey: event.shiftKey,
|
|
92067
|
-
altKey: event.altKey,
|
|
92068
|
-
metaKey: event.metaKey
|
|
92069
|
-
}));
|
|
92070
|
-
};
|
|
92071
92035
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
92072
92036
|
}
|
|
92073
92037
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -92081,6 +92045,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92081
92045
|
layer.style.position = 'absolute';
|
|
92082
92046
|
layer.style.inset = '0';
|
|
92083
92047
|
layer.style.pointerEvents = 'none';
|
|
92048
|
+
layer.style.zIndex = '1';
|
|
92084
92049
|
container.appendChild(layer);
|
|
92085
92050
|
this.state.layer = layer;
|
|
92086
92051
|
this.initDOMEvents();
|
|
@@ -92093,32 +92058,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92093
92058
|
cancelAnimationFrame(this.state.updateFrame);
|
|
92094
92059
|
this.state.updateFrame = undefined;
|
|
92095
92060
|
}
|
|
92096
|
-
if (this.contentInteractionFrame !== undefined) {
|
|
92097
|
-
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92098
|
-
this.contentInteractionFrame = undefined;
|
|
92099
|
-
}
|
|
92100
|
-
this.pendingContentInteractionEvent = undefined;
|
|
92101
92061
|
this.state.cleanups.forEach(function(cleanup) {
|
|
92102
92062
|
cleanup();
|
|
92103
92063
|
});
|
|
92104
92064
|
this.state.frameElements.clear();
|
|
92105
92065
|
this.state.elements.clear();
|
|
92106
|
-
this.state.selectionElements.clear();
|
|
92107
92066
|
this.state.contentScaleElements.clear();
|
|
92108
92067
|
this.state.contentElements.clear();
|
|
92109
92068
|
this.state.contentMountElements.clear();
|
|
92110
|
-
this.state.contentInteractionZones.clear();
|
|
92111
|
-
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92112
|
-
cleanup();
|
|
92113
|
-
});
|
|
92114
|
-
this.state.contentInteractionZoneCleanups.clear();
|
|
92115
|
-
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92116
|
-
cleanup();
|
|
92117
|
-
});
|
|
92118
|
-
this.state.contentInteractionResizeCleanups.clear();
|
|
92119
92069
|
this.state.contents.clear();
|
|
92120
92070
|
this.state.cleanups.clear();
|
|
92121
|
-
this.state.autoHeightModes.clear();
|
|
92122
92071
|
this.state.autoHeightCleanups.forEach(function(cleanup) {
|
|
92123
92072
|
cleanup();
|
|
92124
92073
|
});
|
|
@@ -92133,12 +92082,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92133
92082
|
this.eventCleanups = [];
|
|
92134
92083
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92135
92084
|
this.state.layer = undefined;
|
|
92136
|
-
this.state.selectionLayer = undefined;
|
|
92137
92085
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92138
92086
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92139
92087
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92140
92088
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92141
|
-
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92142
92089
|
};
|
|
92143
92090
|
_proto.scheduleRender = function scheduleRender() {
|
|
92144
92091
|
var _this = this;
|
|
@@ -92150,10 +92097,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92150
92097
|
_this.render();
|
|
92151
92098
|
});
|
|
92152
92099
|
};
|
|
92153
|
-
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92154
|
-
this.cleanupOverlayContent(id);
|
|
92155
|
-
this.invalidateContentInteractionZones(id);
|
|
92156
|
-
};
|
|
92157
92100
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92158
92101
|
return _async_to_generator(function() {
|
|
92159
92102
|
var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
|
|
@@ -92246,7 +92189,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92246
92189
|
var events = [
|
|
92247
92190
|
'pageDataChange',
|
|
92248
92191
|
'selectedItemChange',
|
|
92249
|
-
'preSelectedItemChange',
|
|
92250
92192
|
'itemPropertyChange',
|
|
92251
92193
|
'viewportTransform',
|
|
92252
92194
|
'viewRebuildFinish'
|
|
@@ -92256,7 +92198,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92256
92198
|
if (event === 'viewportTransform') {
|
|
92257
92199
|
_this.handleViewportTransform();
|
|
92258
92200
|
}
|
|
92259
|
-
_this.invalidateContentInteractionZones();
|
|
92260
92201
|
_this.scheduleRender();
|
|
92261
92202
|
});
|
|
92262
92203
|
});
|
|
@@ -92266,24 +92207,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92266
92207
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92267
92208
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92268
92209
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92269
|
-
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92270
|
-
};
|
|
92271
|
-
_proto.isMouseLeaveWithinContainer = function isMouseLeaveWithinContainer(event) {
|
|
92272
|
-
var relatedTarget = event.relatedTarget;
|
|
92273
|
-
if (!relatedTarget) {
|
|
92274
|
-
return false;
|
|
92275
|
-
}
|
|
92276
|
-
try {
|
|
92277
|
-
return this.options.container.contains(relatedTarget);
|
|
92278
|
-
} catch (unused) {
|
|
92279
|
-
return false;
|
|
92280
|
-
}
|
|
92281
|
-
};
|
|
92282
|
-
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92283
|
-
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92284
|
-
return false;
|
|
92285
|
-
}
|
|
92286
|
-
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92287
92210
|
};
|
|
92288
92211
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92289
92212
|
var editing = this.state.editing;
|
|
@@ -92303,16 +92226,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92303
92226
|
}
|
|
92304
92227
|
var items = this.options.getItems();
|
|
92305
92228
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92306
|
-
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92307
92229
|
var visibleCardIds = new Set();
|
|
92308
92230
|
var editingVisible = false;
|
|
92309
92231
|
items.forEach(function(item) {
|
|
92310
92232
|
var _this_state_editing;
|
|
92311
|
-
if (!isCardItem(item) || !item.visible) {
|
|
92312
|
-
return;
|
|
92313
|
-
}
|
|
92314
|
-
var html = _this.options.resolveCardHTML(item);
|
|
92315
|
-
if (html === undefined) {
|
|
92233
|
+
if (!isCardItem(item) || !item.visible || item.html === undefined) {
|
|
92316
92234
|
return;
|
|
92317
92235
|
}
|
|
92318
92236
|
var itemBox = _this.options.getViewBoxById(item.id);
|
|
@@ -92327,31 +92245,21 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92327
92245
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92328
92246
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92329
92247
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92330
|
-
var
|
|
92331
|
-
if (
|
|
92248
|
+
var html = item.html;
|
|
92249
|
+
if (html && _this.state.contents.get(item.id) !== html) {
|
|
92332
92250
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92333
92251
|
}
|
|
92334
|
-
_this.applyHTMLRootConfig(overlay, html);
|
|
92335
92252
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92336
92253
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92337
|
-
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY
|
|
92254
|
+
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY);
|
|
92338
92255
|
overlay.style.left = boxStyle.left;
|
|
92339
92256
|
overlay.style.top = boxStyle.top;
|
|
92340
92257
|
overlay.style.width = boxStyle.width;
|
|
92341
92258
|
overlay.style.height = boxStyle.height;
|
|
92342
92259
|
overlay.style.transform = boxStyle.transform;
|
|
92343
92260
|
overlay.style.transformOrigin = '0 0';
|
|
92344
|
-
|
|
92345
|
-
|
|
92346
|
-
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92347
|
-
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92348
|
-
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92349
|
-
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92350
|
-
selectionOverlay.style.transformOrigin = '0 0';
|
|
92351
|
-
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92352
|
-
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92353
|
-
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92354
|
-
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92261
|
+
_this.syncContentScale(item.id, item.property.width, item.property.height);
|
|
92262
|
+
_this.syncAutoHeight(item.id, item.property.autoHeight === true);
|
|
92355
92263
|
_this.syncContentInteraction(item.id);
|
|
92356
92264
|
});
|
|
92357
92265
|
elements.forEach(function(_overlay, id) {
|
|
@@ -92390,9 +92298,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92390
92298
|
}
|
|
92391
92299
|
}
|
|
92392
92300
|
syncElementStackOrder(layer, rootElements);
|
|
92393
|
-
if (this.state.selectionLayer) {
|
|
92394
|
-
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92395
|
-
}
|
|
92396
92301
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92397
92302
|
var frameElements = [];
|
|
92398
92303
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92408,28 +92313,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92408
92313
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92409
92314
|
});
|
|
92410
92315
|
};
|
|
92411
|
-
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92412
|
-
var _layer_ownerDocument;
|
|
92413
|
-
if (this.state.selectionLayer) {
|
|
92414
|
-
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92415
|
-
layer.appendChild(this.state.selectionLayer);
|
|
92416
|
-
}
|
|
92417
|
-
return this.state.selectionLayer;
|
|
92418
|
-
}
|
|
92419
|
-
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92420
|
-
if (!ownerDocument) {
|
|
92421
|
-
return layer;
|
|
92422
|
-
}
|
|
92423
|
-
var selectionLayer = ownerDocument.createElement('div');
|
|
92424
|
-
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92425
|
-
selectionLayer.style.position = 'absolute';
|
|
92426
|
-
selectionLayer.style.inset = '0';
|
|
92427
|
-
selectionLayer.style.pointerEvents = 'none';
|
|
92428
|
-
selectionLayer.style.zIndex = '1';
|
|
92429
|
-
layer.appendChild(selectionLayer);
|
|
92430
|
-
this.state.selectionLayer = selectionLayer;
|
|
92431
|
-
return selectionLayer;
|
|
92432
|
-
};
|
|
92433
92316
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92434
92317
|
var _this = this;
|
|
92435
92318
|
var visibleFrameIds = new Set();
|
|
@@ -92494,41 +92377,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92494
92377
|
elements.set(id, overlay);
|
|
92495
92378
|
return overlay;
|
|
92496
92379
|
};
|
|
92497
|
-
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92498
|
-
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92499
|
-
if (selectionOverlay) {
|
|
92500
|
-
if (selectionOverlay.parentElement !== parent) {
|
|
92501
|
-
parent.appendChild(selectionOverlay);
|
|
92502
|
-
}
|
|
92503
|
-
return selectionOverlay;
|
|
92504
|
-
}
|
|
92505
|
-
selectionOverlay = document.createElement('div');
|
|
92506
|
-
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92507
|
-
selectionOverlay.dataset.itemId = id;
|
|
92508
|
-
selectionOverlay.style.position = 'absolute';
|
|
92509
|
-
selectionOverlay.style.pointerEvents = 'none';
|
|
92510
|
-
selectionOverlay.style.zIndex = '1';
|
|
92511
|
-
parent.appendChild(selectionOverlay);
|
|
92512
|
-
this.state.selectionElements.set(id, selectionOverlay);
|
|
92513
|
-
return selectionOverlay;
|
|
92514
|
-
};
|
|
92515
|
-
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92516
|
-
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92517
|
-
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92518
|
-
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92519
|
-
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92520
|
-
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92521
|
-
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92522
|
-
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92523
|
-
};
|
|
92524
|
-
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92525
|
-
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92526
|
-
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92527
|
-
};
|
|
92528
|
-
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92529
|
-
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92530
|
-
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92531
|
-
};
|
|
92532
92380
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92533
92381
|
var layer = this.state.layer;
|
|
92534
92382
|
if (!layer) {
|
|
@@ -92538,7 +92386,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92538
92386
|
var items = this.options.getItems();
|
|
92539
92387
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92540
92388
|
var item = items[i];
|
|
92541
|
-
if (!isCardItem(item) || !item.visible ||
|
|
92389
|
+
if (!isCardItem(item) || !item.visible || item.html === undefined) {
|
|
92542
92390
|
continue;
|
|
92543
92391
|
}
|
|
92544
92392
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -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);
|
|
@@ -92567,206 +92415,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92567
92415
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92568
92416
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92569
92417
|
var isHoveringShellInteractive = interactiveElements.some(function(element) {
|
|
92570
|
-
|
|
92418
|
+
var rect = element.getBoundingClientRect();
|
|
92419
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
92571
92420
|
});
|
|
92572
92421
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92573
92422
|
}
|
|
92574
92423
|
return undefined;
|
|
92575
92424
|
};
|
|
92576
|
-
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92577
|
-
var decision = this.resolveHTMLInteractionTarget(event);
|
|
92578
|
-
if (decision.kind === 'canvas' && this.shouldKeepActiveContentInteractionForFocusedElement()) {
|
|
92579
|
-
return;
|
|
92580
|
-
}
|
|
92581
|
-
this.setActiveContentInteraction(decision.kind === 'html' ? decision.interaction : undefined);
|
|
92582
|
-
};
|
|
92583
|
-
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92584
|
-
var _this = this;
|
|
92585
|
-
if (typeof requestAnimationFrame !== 'function') {
|
|
92586
|
-
this.syncActiveContentInteraction(event);
|
|
92587
|
-
return;
|
|
92588
|
-
}
|
|
92589
|
-
this.pendingContentInteractionEvent = event;
|
|
92590
|
-
if (this.contentInteractionFrame !== undefined) {
|
|
92591
|
-
return;
|
|
92592
|
-
}
|
|
92593
|
-
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92594
|
-
_this.contentInteractionFrame = undefined;
|
|
92595
|
-
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92596
|
-
_this.pendingContentInteractionEvent = undefined;
|
|
92597
|
-
if (pendingEvent) {
|
|
92598
|
-
_this.syncActiveContentInteraction(pendingEvent);
|
|
92599
|
-
}
|
|
92600
|
-
});
|
|
92601
|
-
};
|
|
92602
|
-
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92603
|
-
var _this = this;
|
|
92604
|
-
var previous = this.state.activeContentInteraction;
|
|
92605
|
-
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)) {
|
|
92606
|
-
return;
|
|
92607
|
-
}
|
|
92608
|
-
this.state.activeContentInteraction = zone;
|
|
92609
|
-
var changedIds = new Set();
|
|
92610
|
-
if (previous) {
|
|
92611
|
-
changedIds.add(previous.id);
|
|
92612
|
-
}
|
|
92613
|
-
if (zone) {
|
|
92614
|
-
changedIds.add(zone.id);
|
|
92615
|
-
}
|
|
92616
|
-
changedIds.forEach(function(id) {
|
|
92617
|
-
_this.syncContentInteraction(id);
|
|
92618
|
-
});
|
|
92619
|
-
};
|
|
92620
|
-
_proto.shouldKeepActiveContentInteractionForFocusedElement = function shouldKeepActiveContentInteractionForFocusedElement() {
|
|
92621
|
-
var activeInteraction = this.state.activeContentInteraction;
|
|
92622
|
-
if (!activeInteraction || typeof document === 'undefined') {
|
|
92623
|
-
return false;
|
|
92624
|
-
}
|
|
92625
|
-
var activeElement = document.activeElement;
|
|
92626
|
-
if (!activeElement || activeElement === document.body) {
|
|
92627
|
-
return false;
|
|
92628
|
-
}
|
|
92629
|
-
var interactionElement = activeInteraction.element;
|
|
92630
|
-
return interactionElement === activeElement || typeof interactionElement.contains === 'function' && interactionElement.contains(activeElement);
|
|
92631
|
-
};
|
|
92632
|
-
_proto.resolveHTMLInteractionTarget = function resolveHTMLInteractionTarget(event) {
|
|
92633
|
-
var id = this.getHTMLCardIdByEvent(event);
|
|
92634
|
-
if (!id || this.isEditableCard(id)) {
|
|
92635
|
-
return {
|
|
92636
|
-
kind: 'canvas',
|
|
92637
|
-
id: id
|
|
92638
|
-
};
|
|
92639
|
-
}
|
|
92640
|
-
var contentOverlay = this.state.contentElements.get(id);
|
|
92641
|
-
if (!contentOverlay) {
|
|
92642
|
-
return {
|
|
92643
|
-
kind: 'canvas',
|
|
92644
|
-
id: id
|
|
92645
|
-
};
|
|
92646
|
-
}
|
|
92647
|
-
var activeSubtree = this.getActiveSubtreeInteractionAtEvent(id, event);
|
|
92648
|
-
if (activeSubtree) {
|
|
92649
|
-
return {
|
|
92650
|
-
kind: 'html',
|
|
92651
|
-
interaction: activeSubtree
|
|
92652
|
-
};
|
|
92653
|
-
}
|
|
92654
|
-
var matchedZones = this.getContentInteractionZones(id, contentOverlay).filter(function(zone) {
|
|
92655
|
-
return isMouseEventInsideRect(event, zone.rect);
|
|
92656
|
-
});
|
|
92657
|
-
var zone = this.resolveContentInteractionZone(matchedZones);
|
|
92658
|
-
if (zone) {
|
|
92659
|
-
return {
|
|
92660
|
-
kind: 'html',
|
|
92661
|
-
interaction: {
|
|
92662
|
-
id: id,
|
|
92663
|
-
element: zone.element,
|
|
92664
|
-
zone: zone.zone
|
|
92665
|
-
}
|
|
92666
|
-
};
|
|
92667
|
-
}
|
|
92668
|
-
return {
|
|
92669
|
-
kind: 'canvas',
|
|
92670
|
-
id: id
|
|
92671
|
-
};
|
|
92672
|
-
};
|
|
92673
|
-
_proto.getActiveSubtreeInteractionAtEvent = function getActiveSubtreeInteractionAtEvent(id, event) {
|
|
92674
|
-
var activeInteraction = this.state.activeContentInteraction;
|
|
92675
|
-
if ((activeInteraction == null ? void 0 : activeInteraction.id) !== id || activeInteraction.zone !== 'subtree') {
|
|
92676
|
-
return undefined;
|
|
92677
|
-
}
|
|
92678
|
-
var rect = activeInteraction.element.getBoundingClientRect();
|
|
92679
|
-
return isMouseEventInsideRect(event, rect) ? activeInteraction : undefined;
|
|
92680
|
-
};
|
|
92681
|
-
_proto.resolveContentInteractionZone = function resolveContentInteractionZone(zones) {
|
|
92682
|
-
if (zones.length <= 1) {
|
|
92683
|
-
return zones[0];
|
|
92684
|
-
}
|
|
92685
|
-
var subtreeRoot = zones.find(function(candidate) {
|
|
92686
|
-
return candidate.zone === 'subtree' && typeof candidate.element.contains === 'function' && zones.some(function(zone) {
|
|
92687
|
-
return zone.element !== candidate.element && candidate.element.contains(zone.element);
|
|
92688
|
-
});
|
|
92689
|
-
});
|
|
92690
|
-
return subtreeRoot != null ? subtreeRoot : zones[0];
|
|
92691
|
-
};
|
|
92692
|
-
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92693
|
-
var _this = this;
|
|
92694
|
-
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92695
|
-
if (cachedZones) {
|
|
92696
|
-
return cachedZones;
|
|
92697
|
-
}
|
|
92698
|
-
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92699
|
-
return !_this.isContentInteractionDisabled(element);
|
|
92700
|
-
}).map(function(element) {
|
|
92701
|
-
return {
|
|
92702
|
-
element: element,
|
|
92703
|
-
rect: element.getBoundingClientRect(),
|
|
92704
|
-
zone: _this.getContentInteractionZoneMode(element)
|
|
92705
|
-
};
|
|
92706
|
-
});
|
|
92707
|
-
this.state.contentInteractionZones.set(id, zones);
|
|
92708
|
-
this.observeContentInteractionZoneResizes(id, zones);
|
|
92709
|
-
return zones;
|
|
92710
|
-
};
|
|
92711
|
-
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92712
|
-
var _ref;
|
|
92713
|
-
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92714
|
-
var item = this.options.getItems().find(function(item) {
|
|
92715
|
-
return item.id === id;
|
|
92716
|
-
});
|
|
92717
|
-
if (!item) {
|
|
92718
|
-
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92719
|
-
}
|
|
92720
|
-
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 : [];
|
|
92721
|
-
if (selectors.length === 0) {
|
|
92722
|
-
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92723
|
-
}
|
|
92724
|
-
return [].concat([
|
|
92725
|
-
CONTENT_INTERACTIVE_SELECTOR
|
|
92726
|
-
], selectors).join(', ');
|
|
92727
|
-
};
|
|
92728
|
-
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92729
|
-
if (typeof element.closest !== 'function') {
|
|
92730
|
-
return false;
|
|
92731
|
-
}
|
|
92732
|
-
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92733
|
-
};
|
|
92734
|
-
_proto.getContentInteractionZoneMode = function getContentInteractionZoneMode(element) {
|
|
92735
|
-
var zone = element.dataset.vvfxHtmlInteractionZone;
|
|
92736
|
-
return zone === 'subtree' ? 'subtree' : 'self';
|
|
92737
|
-
};
|
|
92738
|
-
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92739
|
-
if (id) {
|
|
92740
|
-
var _this_state_contentInteractionResizeCleanups_get;
|
|
92741
|
-
this.state.contentInteractionZones.delete(id);
|
|
92742
|
-
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92743
|
-
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92744
|
-
return;
|
|
92745
|
-
}
|
|
92746
|
-
this.state.contentInteractionZones.clear();
|
|
92747
|
-
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92748
|
-
cleanup();
|
|
92749
|
-
});
|
|
92750
|
-
this.state.contentInteractionResizeCleanups.clear();
|
|
92751
|
-
};
|
|
92752
|
-
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92753
|
-
var _this = this;
|
|
92754
|
-
var _this_state_contentInteractionResizeCleanups_get;
|
|
92755
|
-
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92756
|
-
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92757
|
-
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92758
|
-
return;
|
|
92759
|
-
}
|
|
92760
|
-
var observer = new ResizeObserver(function() {
|
|
92761
|
-
_this.invalidateContentInteractionZones(id);
|
|
92762
|
-
});
|
|
92763
|
-
zones.forEach(function(zone) {
|
|
92764
|
-
observer.observe(zone.element);
|
|
92765
|
-
});
|
|
92766
|
-
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92767
|
-
observer.disconnect();
|
|
92768
|
-
});
|
|
92769
|
-
};
|
|
92770
92425
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92771
92426
|
var rect = this.options.container.getBoundingClientRect();
|
|
92772
92427
|
return {
|
|
@@ -92823,35 +92478,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92823
92478
|
if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
|
|
92824
92479
|
return;
|
|
92825
92480
|
}
|
|
92826
|
-
|
|
92827
|
-
|
|
92828
|
-
var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
|
|
92829
|
-
scaleOverlay.style.width = nextWidth;
|
|
92830
|
-
scaleOverlay.style.height = nextHeight;
|
|
92481
|
+
scaleOverlay.style.width = "" + width + "px";
|
|
92482
|
+
scaleOverlay.style.height = "" + height + "px";
|
|
92831
92483
|
scaleOverlay.style.transform = 'none';
|
|
92832
|
-
contentOverlay.style.width =
|
|
92833
|
-
contentOverlay.style.height =
|
|
92834
|
-
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92835
|
-
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92836
|
-
}
|
|
92837
|
-
if (sizeChanged) {
|
|
92838
|
-
this.invalidateContentInteractionZones(id);
|
|
92839
|
-
}
|
|
92840
|
-
};
|
|
92841
|
-
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92842
|
-
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92843
|
-
requestCardHTMLAutoHeight(iframe, id);
|
|
92844
|
-
});
|
|
92484
|
+
contentOverlay.style.width = "" + width + "px";
|
|
92485
|
+
contentOverlay.style.height = "" + height + "px";
|
|
92845
92486
|
};
|
|
92846
92487
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92847
|
-
var _this_state_editing
|
|
92488
|
+
var _this_state_editing;
|
|
92848
92489
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
92849
|
-
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92850
92490
|
var overlay = this.state.elements.get(id);
|
|
92851
92491
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92852
92492
|
var contentOverlay = this.state.contentElements.get(id);
|
|
92853
92493
|
var contentMount = this.state.contentMountElements.get(id);
|
|
92854
|
-
var isInteractive = isEditing || !!activeInteraction;
|
|
92855
92494
|
if (overlay) {
|
|
92856
92495
|
overlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92857
92496
|
overlay.style.pointerEvents = 'none';
|
|
@@ -92862,62 +92501,34 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92862
92501
|
}
|
|
92863
92502
|
if (contentOverlay) {
|
|
92864
92503
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92865
|
-
contentOverlay.style.pointerEvents =
|
|
92504
|
+
contentOverlay.style.pointerEvents = 'none';
|
|
92866
92505
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92867
|
-
|
|
92868
|
-
iframe.
|
|
92869
|
-
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92506
|
+
iframe.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92507
|
+
iframe.tabIndex = isEditing ? 0 : -1;
|
|
92870
92508
|
});
|
|
92871
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
92872
|
-
this.syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive);
|
|
92509
|
+
this.syncShellInteraction(id, contentOverlay, isEditing);
|
|
92873
92510
|
}
|
|
92874
92511
|
if (contentMount) {
|
|
92875
92512
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92876
|
-
contentMount.style.pointerEvents =
|
|
92877
|
-
contentMount.inert = !
|
|
92878
|
-
if (
|
|
92513
|
+
contentMount.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92514
|
+
contentMount.inert = !isEditing;
|
|
92515
|
+
if (isEditing) {
|
|
92879
92516
|
contentMount.removeAttribute('aria-hidden');
|
|
92880
92517
|
} else {
|
|
92881
92518
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92882
92519
|
}
|
|
92883
92520
|
}
|
|
92884
92521
|
};
|
|
92885
|
-
_proto.
|
|
92886
|
-
var _this = this;
|
|
92887
|
-
var activeElement = activeInteraction == null ? void 0 : activeInteraction.element;
|
|
92888
|
-
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
92889
|
-
if ((activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && activeElement && element !== activeElement && typeof activeElement.contains === 'function' && activeElement.contains(element)) {
|
|
92890
|
-
_this.clearContentInteractionState(element);
|
|
92891
|
-
return;
|
|
92892
|
-
}
|
|
92893
|
-
if (!isInteractive) {
|
|
92894
|
-
_this.clearContentInteractionState(element);
|
|
92895
|
-
return;
|
|
92896
|
-
}
|
|
92897
|
-
if (_this.isContentInteractionDisabled(element)) {
|
|
92898
|
-
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
92899
|
-
element.style.pointerEvents = 'none';
|
|
92900
|
-
return;
|
|
92901
|
-
}
|
|
92902
|
-
var isElementInteractive = isEditing || activeElement === element || (activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && typeof (activeElement == null ? void 0 : activeElement.contains) === 'function' && activeElement.contains(element);
|
|
92903
|
-
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
92904
|
-
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
92905
|
-
});
|
|
92906
|
-
};
|
|
92907
|
-
_proto.clearContentInteractionState = function clearContentInteractionState(element) {
|
|
92908
|
-
delete element.dataset.vvfxHtmlInteractionActive;
|
|
92909
|
-
element.style.pointerEvents = '';
|
|
92910
|
-
};
|
|
92911
|
-
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92522
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isEditing) {
|
|
92912
92523
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92913
|
-
var isShellInteractiveActive =
|
|
92524
|
+
var isShellInteractiveActive = isEditing || isHoveringShellInteractive;
|
|
92914
92525
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92915
92526
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92916
92527
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92917
92528
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92918
92529
|
});
|
|
92919
92530
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92920
|
-
element.style.pointerEvents =
|
|
92531
|
+
element.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92921
92532
|
});
|
|
92922
92533
|
};
|
|
92923
92534
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92925,9 +92536,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92925
92536
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92926
92537
|
return;
|
|
92927
92538
|
}
|
|
92928
|
-
if (!this.isEditableCard(id)) {
|
|
92929
|
-
return;
|
|
92930
|
-
}
|
|
92931
92539
|
var box = this.options.getViewBoxById(id);
|
|
92932
92540
|
if (box.isEmpty()) {
|
|
92933
92541
|
return;
|
|
@@ -92971,13 +92579,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92971
92579
|
this.options.setViewport(editing.restoreViewport);
|
|
92972
92580
|
this.scheduleRender();
|
|
92973
92581
|
};
|
|
92974
|
-
_proto.isEditableCard = function isEditableCard(id) {
|
|
92975
|
-
var _this_options_resolveCardTypeConfig;
|
|
92976
|
-
var item = this.options.getItems().find(function(item) {
|
|
92977
|
-
return item.id === id;
|
|
92978
|
-
});
|
|
92979
|
-
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
92980
|
-
};
|
|
92981
92582
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92982
92583
|
var viewportElement = this.options.container.parentElement;
|
|
92983
92584
|
if (!viewportElement) {
|
|
@@ -93002,7 +92603,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93002
92603
|
};
|
|
93003
92604
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
93004
92605
|
this.cleanupOverlayContent(id);
|
|
93005
|
-
this.invalidateContentInteractionZones(id);
|
|
93006
92606
|
overlay.innerHTML = '';
|
|
93007
92607
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
93008
92608
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -93012,81 +92612,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93012
92612
|
});
|
|
93013
92613
|
var contentCleanup = this.renderOverlayContent(shell.contentContainer, html.content, {
|
|
93014
92614
|
id: id,
|
|
93015
|
-
autoHeight:
|
|
92615
|
+
autoHeight: isCardItem(item) && item.property.autoHeight === true
|
|
93016
92616
|
});
|
|
93017
|
-
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
93018
92617
|
this.state.cleanups.set(id, function() {
|
|
93019
92618
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
93020
92619
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
93021
92620
|
});
|
|
93022
92621
|
this.state.contents.set(id, html);
|
|
93023
92622
|
};
|
|
93024
|
-
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
93025
|
-
var _this = this;
|
|
93026
|
-
var _this_state_contentInteractionZoneCleanups_get;
|
|
93027
|
-
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93028
|
-
this.state.contentInteractionZoneCleanups.delete(id);
|
|
93029
|
-
if (typeof MutationObserver !== 'function') {
|
|
93030
|
-
return;
|
|
93031
|
-
}
|
|
93032
|
-
var observer = new MutationObserver(function() {
|
|
93033
|
-
_this.invalidateContentInteractionZones(id);
|
|
93034
|
-
});
|
|
93035
|
-
observer.observe(contentContainer, {
|
|
93036
|
-
attributes: true,
|
|
93037
|
-
childList: true,
|
|
93038
|
-
subtree: true
|
|
93039
|
-
});
|
|
93040
|
-
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
93041
|
-
observer.disconnect();
|
|
93042
|
-
});
|
|
93043
|
-
};
|
|
93044
|
-
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
93045
|
-
var _ref, _config_style;
|
|
93046
|
-
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
93047
|
-
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
93048
|
-
this.htmlRootConfigCleanups.delete(root);
|
|
93049
|
-
var config = html.root;
|
|
93050
|
-
if (!config) {
|
|
93051
|
-
return;
|
|
93052
|
-
}
|
|
93053
|
-
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
93054
|
-
var styleProperties = [];
|
|
93055
|
-
classNames.forEach(function(className) {
|
|
93056
|
-
root.classList.add(className);
|
|
93057
|
-
});
|
|
93058
|
-
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
93059
|
-
var property = param[0], value = param[1];
|
|
93060
|
-
if (value === undefined) {
|
|
93061
|
-
return;
|
|
93062
|
-
}
|
|
93063
|
-
styleProperties.push(property);
|
|
93064
|
-
if (property.startsWith('--') || property.includes('-')) {
|
|
93065
|
-
root.style.setProperty(property, String(value));
|
|
93066
|
-
return;
|
|
93067
|
-
}
|
|
93068
|
-
root.style[property] = String(value);
|
|
93069
|
-
});
|
|
93070
|
-
this.htmlRootConfigCleanups.set(root, function() {
|
|
93071
|
-
classNames.forEach(function(className) {
|
|
93072
|
-
root.classList.remove(className);
|
|
93073
|
-
});
|
|
93074
|
-
styleProperties.forEach(function(property) {
|
|
93075
|
-
if (property.startsWith('--') || property.includes('-')) {
|
|
93076
|
-
root.style.removeProperty(property);
|
|
93077
|
-
return;
|
|
93078
|
-
}
|
|
93079
|
-
root.style[property] = '';
|
|
93080
|
-
});
|
|
93081
|
-
});
|
|
93082
|
-
};
|
|
93083
92623
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
93084
92624
|
var _this = this;
|
|
93085
92625
|
switch(content.kind){
|
|
93086
92626
|
case 'inline':
|
|
93087
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93088
|
-
this.state.autoHeightModes.set(options.id, 'message');
|
|
93089
|
-
}
|
|
93090
92627
|
return this.chainCleanups(function() {
|
|
93091
92628
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
93092
92629
|
}, renderDocumentContent(overlay, {
|
|
@@ -93103,9 +92640,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93103
92640
|
}));
|
|
93104
92641
|
case 'dom':
|
|
93105
92642
|
{
|
|
93106
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93107
|
-
this.state.autoHeightModes.set(options.id, 'measure');
|
|
93108
|
-
}
|
|
93109
92643
|
if (content.target === 'iframe') {
|
|
93110
92644
|
return renderDOMContentInIframe(overlay, content.render, content.cleanup);
|
|
93111
92645
|
}
|
|
@@ -93115,9 +92649,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93115
92649
|
} : undefined;
|
|
93116
92650
|
}
|
|
93117
92651
|
case 'document':
|
|
93118
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93119
|
-
this.state.autoHeightModes.set(options.id, 'message');
|
|
93120
|
-
}
|
|
93121
92652
|
return this.chainCleanups(function() {
|
|
93122
92653
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
93123
92654
|
}, renderDocumentContent(overlay, content, {
|
|
@@ -93145,7 +92676,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93145
92676
|
};
|
|
93146
92677
|
};
|
|
93147
92678
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93148
|
-
var _this_state_contentInteractionZoneCleanups_get;
|
|
93149
92679
|
var cleanup = this.state.cleanups.get(id);
|
|
93150
92680
|
if (cleanup) {
|
|
93151
92681
|
cleanup();
|
|
@@ -93153,19 +92683,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93153
92683
|
}
|
|
93154
92684
|
this.state.contents.delete(id);
|
|
93155
92685
|
this.state.contentMountElements.delete(id);
|
|
93156
|
-
this.state.autoHeightModes.delete(id);
|
|
93157
|
-
this.invalidateContentInteractionZones(id);
|
|
93158
|
-
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93159
|
-
this.state.contentInteractionZoneCleanups.delete(id);
|
|
93160
92686
|
this.cleanupAutoHeight(id);
|
|
93161
92687
|
};
|
|
93162
92688
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
93163
|
-
var _this_state_elements_get
|
|
92689
|
+
var _this_state_elements_get;
|
|
93164
92690
|
this.cleanupOverlayContent(id);
|
|
93165
92691
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93166
|
-
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
93167
92692
|
this.state.elements.delete(id);
|
|
93168
|
-
this.state.selectionElements.delete(id);
|
|
93169
92693
|
this.state.contentScaleElements.delete(id);
|
|
93170
92694
|
this.state.contentElements.delete(id);
|
|
93171
92695
|
};
|
|
@@ -93174,27 +92698,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93174
92698
|
this.cleanupAutoHeight(id);
|
|
93175
92699
|
return;
|
|
93176
92700
|
}
|
|
93177
|
-
this.ensureAutoHeightMode(id);
|
|
93178
|
-
if (this.state.autoHeightModes.get(id) === 'message') {
|
|
93179
|
-
this.cleanupAutoHeight(id);
|
|
93180
|
-
return;
|
|
93181
|
-
}
|
|
93182
92701
|
if (!this.state.autoHeightCleanups.has(id)) {
|
|
93183
92702
|
this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
|
|
93184
92703
|
}
|
|
93185
92704
|
this.scheduleAutoHeightMeasure(id);
|
|
93186
92705
|
};
|
|
93187
|
-
_proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
|
|
93188
|
-
var _this_state_contents_get;
|
|
93189
|
-
if (this.state.autoHeightModes.has(id)) {
|
|
93190
|
-
return;
|
|
93191
|
-
}
|
|
93192
|
-
var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
|
|
93193
|
-
if (!content) {
|
|
93194
|
-
return;
|
|
93195
|
-
}
|
|
93196
|
-
this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
|
|
93197
|
-
};
|
|
93198
92706
|
_proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
|
|
93199
92707
|
var _this = this;
|
|
93200
92708
|
var cleanupFns = [];
|
|
@@ -93282,7 +92790,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93282
92790
|
var item = this.options.getItems().find(function(candidate) {
|
|
93283
92791
|
return candidate.id === id;
|
|
93284
92792
|
});
|
|
93285
|
-
if (!
|
|
92793
|
+
if (!isCardItem(item) || item.property.autoHeight !== true) {
|
|
93286
92794
|
this.cleanupAutoHeight(id);
|
|
93287
92795
|
return;
|
|
93288
92796
|
}
|
|
@@ -93301,9 +92809,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93301
92809
|
}).filter(function(height) {
|
|
93302
92810
|
return typeof height === 'number' && Number.isFinite(height) && height > 0;
|
|
93303
92811
|
});
|
|
93304
|
-
var childHeight = this.getChildrenNaturalHeight(element
|
|
93305
|
-
includeIframes: iframeHeights.length === 0
|
|
93306
|
-
});
|
|
92812
|
+
var childHeight = this.getChildrenNaturalHeight(element);
|
|
93307
92813
|
var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
|
|
93308
92814
|
childHeight
|
|
93309
92815
|
], iframeHeights));
|
|
@@ -93323,29 +92829,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93323
92829
|
}
|
|
93324
92830
|
return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
|
|
93325
92831
|
};
|
|
93326
|
-
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element
|
|
93327
|
-
|
|
93328
|
-
|
|
93329
|
-
|
|
93330
|
-
var _child_textContent;
|
|
93331
|
-
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
93332
|
-
var childElement = child;
|
|
93333
|
-
if (!includeIframes && childElement.tagName === 'IFRAME') {
|
|
93334
|
-
return height;
|
|
93335
|
-
}
|
|
93336
|
-
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
93337
|
-
}
|
|
93338
|
-
if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
|
|
93339
|
-
var range = element.ownerDocument.createRange();
|
|
93340
|
-
range.selectNodeContents(child);
|
|
93341
|
-
var rects = Array.from(range.getClientRects());
|
|
93342
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
93343
|
-
range.detach();
|
|
93344
|
-
return rects.reduce(function(textHeight, rect) {
|
|
93345
|
-
return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
|
|
93346
|
-
}, height);
|
|
93347
|
-
}
|
|
93348
|
-
return height;
|
|
92832
|
+
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element) {
|
|
92833
|
+
return Array.from(element.children).reduce(function(height, child) {
|
|
92834
|
+
var childElement = child;
|
|
92835
|
+
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
93349
92836
|
}, 0);
|
|
93350
92837
|
};
|
|
93351
92838
|
_proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
|
|
@@ -93364,48 +92851,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93364
92851
|
var item = this.options.getItems().find(function(candidate) {
|
|
93365
92852
|
return candidate.id === id;
|
|
93366
92853
|
});
|
|
93367
|
-
if (!isCardItem(item) ||
|
|
92854
|
+
if (!isCardItem(item) || item.property.autoHeight !== true) {
|
|
93368
92855
|
return;
|
|
93369
92856
|
}
|
|
93370
|
-
if (!Number.isFinite(height) || height <= 0) {
|
|
92857
|
+
if (!Number.isFinite(height) || height <= 0 || Math.abs(height - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
93371
92858
|
return;
|
|
93372
92859
|
}
|
|
93373
|
-
|
|
93374
|
-
if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
93375
|
-
return;
|
|
93376
|
-
}
|
|
93377
|
-
this.options.setCardItemHeight(id, nextHeight);
|
|
93378
|
-
};
|
|
93379
|
-
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
93380
|
-
if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
|
|
93381
|
-
return contentHeight;
|
|
93382
|
-
}
|
|
93383
|
-
var scaleOverlay = this.state.contentScaleElements.get(item.id);
|
|
93384
|
-
var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
|
|
93385
|
-
if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
|
|
93386
|
-
return contentHeight;
|
|
93387
|
-
}
|
|
93388
|
-
return contentHeight / displayedHeight * item.property.height;
|
|
93389
|
-
};
|
|
93390
|
-
_proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
|
|
93391
|
-
var _this_options_resolveCardTypeConfig;
|
|
93392
|
-
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
|
|
92860
|
+
this.options.setCardItemHeight(id, Math.ceil(height));
|
|
93393
92861
|
};
|
|
93394
|
-
_proto.isAutoScaleEnabled = function isAutoScaleEnabled(item) {
|
|
93395
|
-
var _this_options_resolveCardTypeConfig;
|
|
93396
|
-
if (!isCardItem(item)) {
|
|
93397
|
-
return true;
|
|
93398
|
-
}
|
|
93399
|
-
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
93400
|
-
};
|
|
93401
|
-
_create_class(HTMLOverlayManager, [
|
|
93402
|
-
{
|
|
93403
|
-
key: "layerElement",
|
|
93404
|
-
get: function get() {
|
|
93405
|
-
return this.state.layer;
|
|
93406
|
-
}
|
|
93407
|
-
}
|
|
93408
|
-
]);
|
|
93409
92862
|
return HTMLOverlayManager;
|
|
93410
92863
|
}();
|
|
93411
92864
|
function waitForCardCaptureReady(root) {
|
|
@@ -93447,17 +92900,6 @@ function waitForCardCaptureReady(root) {
|
|
|
93447
92900
|
});
|
|
93448
92901
|
})();
|
|
93449
92902
|
}
|
|
93450
|
-
function formatCssColor(color, alpha) {
|
|
93451
|
-
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93452
|
-
var red = normalizedColor >> 16 & 0xFF;
|
|
93453
|
-
var green = normalizedColor >> 8 & 0xFF;
|
|
93454
|
-
var blue = normalizedColor & 0xFF;
|
|
93455
|
-
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93456
|
-
}
|
|
93457
|
-
function formatCssNumber(value) {
|
|
93458
|
-
var normalized = Number.isFinite(value) ? value : 0;
|
|
93459
|
-
return Number(normalized.toFixed(6)).toString();
|
|
93460
|
-
}
|
|
93461
92903
|
function nextAnimationFrame() {
|
|
93462
92904
|
return new Promise(function(resolve) {
|
|
93463
92905
|
requestAnimationFrame(function() {
|
|
@@ -93876,9 +93318,6 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93876
93318
|
});
|
|
93877
93319
|
return replacement;
|
|
93878
93320
|
}
|
|
93879
|
-
function isMouseEventInsideRect(event, rect) {
|
|
93880
|
-
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
93881
|
-
}
|
|
93882
93321
|
function createFlattenedIframeContent(iframe) {
|
|
93883
93322
|
var doc = iframe.contentDocument;
|
|
93884
93323
|
if (!doc) {
|
|
@@ -93918,19 +93357,6 @@ function withTimeout(promise, timeout) {
|
|
|
93918
93357
|
});
|
|
93919
93358
|
}
|
|
93920
93359
|
|
|
93921
|
-
function orderSDKCanvasLayers(param) {
|
|
93922
|
-
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
93923
|
-
[
|
|
93924
|
-
playerContainer,
|
|
93925
|
-
htmlOverlayLayer,
|
|
93926
|
-
gestureCanvas
|
|
93927
|
-
].forEach(function(layer) {
|
|
93928
|
-
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
93929
|
-
container.appendChild(layer);
|
|
93930
|
-
}
|
|
93931
|
-
});
|
|
93932
|
-
}
|
|
93933
|
-
|
|
93934
93360
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93935
93361
|
var SDK = /*#__PURE__*/ function() {
|
|
93936
93362
|
function SDK(container, mode) {
|
|
@@ -94036,45 +93462,9 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94036
93462
|
propertyName: 'height',
|
|
94037
93463
|
propertyValue: height
|
|
94038
93464
|
});
|
|
94039
|
-
},
|
|
94040
|
-
getSelectedItemIds: function getSelectedItemIds() {
|
|
94041
|
-
var _ref;
|
|
94042
|
-
var _this__pageData;
|
|
94043
|
-
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
94044
|
-
},
|
|
94045
|
-
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
94046
|
-
var _this__pageData;
|
|
94047
|
-
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
94048
|
-
},
|
|
94049
|
-
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
94050
|
-
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;
|
|
94051
|
-
return {
|
|
94052
|
-
color: wireframeColor,
|
|
94053
|
-
alpha: wireframeAlpha,
|
|
94054
|
-
width: wireframeWidth
|
|
94055
|
-
};
|
|
94056
|
-
},
|
|
94057
|
-
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
94058
|
-
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
94059
|
-
return {
|
|
94060
|
-
color: preSelectedColor,
|
|
94061
|
-
alpha: 1,
|
|
94062
|
-
width: preSelectedWidth
|
|
94063
|
-
};
|
|
94064
|
-
},
|
|
94065
|
-
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
94066
|
-
var _this__gestureHandler;
|
|
94067
|
-
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
94068
|
-
},
|
|
94069
|
-
resolveCardHTML: function resolveCardHTML(item) {
|
|
94070
|
-
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
94071
|
-
},
|
|
94072
|
-
resolveCardTypeConfig: function resolveCardTypeConfig(item) {
|
|
94073
|
-
return isCardItem(item) ? _this.resolveCardTypeConfig(item) : undefined;
|
|
94074
93465
|
}
|
|
94075
93466
|
});
|
|
94076
93467
|
this._htmlOverlayManager.attach();
|
|
94077
|
-
this.syncCanvasLayerOrder();
|
|
94078
93468
|
}
|
|
94079
93469
|
var _proto = SDK.prototype;
|
|
94080
93470
|
_proto.dispose = function dispose() {
|
|
@@ -94170,7 +93560,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94170
93560
|
this.initPlayer(SDK.config.mode);
|
|
94171
93561
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
94172
93562
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94173
|
-
this.syncCanvasLayerOrder();
|
|
94174
93563
|
return [
|
|
94175
93564
|
4,
|
|
94176
93565
|
this.runByPageData(this.pageData)
|
|
@@ -94220,16 +93609,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94220
93609
|
env: 'editor'
|
|
94221
93610
|
});
|
|
94222
93611
|
this.player.resize();
|
|
94223
|
-
this.syncCanvasLayerOrder();
|
|
94224
|
-
};
|
|
94225
|
-
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94226
|
-
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94227
|
-
orderSDKCanvasLayers({
|
|
94228
|
-
container: this._container,
|
|
94229
|
-
playerContainer: this._playerContainer,
|
|
94230
|
-
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94231
|
-
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94232
|
-
});
|
|
94233
93612
|
};
|
|
94234
93613
|
_proto.getInitParam = function getInitParam(param) {
|
|
94235
93614
|
return _async_to_generator(function() {
|
|
@@ -95324,7 +94703,8 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95324
94703
|
* @param ignoreClamp 是否忽视约束
|
|
95325
94704
|
*/ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
|
|
95326
94705
|
assertExist$1(this._pageData);
|
|
95327
|
-
this.
|
|
94706
|
+
this._pageData.property.zoom = zoom;
|
|
94707
|
+
this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
|
|
95328
94708
|
this._gestureHandler.render();
|
|
95329
94709
|
};
|
|
95330
94710
|
/**
|
|
@@ -95564,7 +94944,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95564
94944
|
};
|
|
95565
94945
|
/**
|
|
95566
94946
|
* @description 设置蒙版工具模式
|
|
95567
|
-
* @param mode 模式类型:'paint'
|
|
94947
|
+
* @param mode 模式类型:'paint' 笔刷涂抹、'erase' 笔刷逐笔擦除、'box-erase' 框选擦除、'box-paint' 框选涂抹
|
|
95568
94948
|
*/ _proto.setMaskGizmoMode = function setMaskGizmoMode(mode) {
|
|
95569
94949
|
this._gestureHandler.setMaskGizmoMode(mode);
|
|
95570
94950
|
};
|
|
@@ -96220,44 +95600,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
96220
95600
|
});
|
|
96221
95601
|
};
|
|
96222
95602
|
/**
|
|
96223
|
-
* @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
|
|
96224
|
-
* @param item 卡片元素
|
|
96225
|
-
* @returns HTML 渲染配置
|
|
96226
|
-
*/ _proto.resolveCardHTML = function resolveCardHTML(item) {
|
|
96227
|
-
var _cardTypeConfig_html;
|
|
96228
|
-
var cardTypeConfig = this.resolveCardTypeConfig(item);
|
|
96229
|
-
return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
|
|
96230
|
-
};
|
|
96231
|
-
/**
|
|
96232
|
-
* @description 按 cardType 从注册表解析卡片类型配置。
|
|
96233
|
-
* @param item 卡片元素
|
|
96234
|
-
* @returns 卡片类型配置
|
|
96235
|
-
*/ _proto.resolveCardTypeConfig = function resolveCardTypeConfig(item) {
|
|
96236
|
-
return SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
96237
|
-
return t.type === item.cardType;
|
|
96238
|
-
});
|
|
96239
|
-
};
|
|
96240
|
-
/**
|
|
96241
|
-
* @description 重新解析并挂载指定卡片的 HTML 内容。
|
|
96242
|
-
* @description 当 inline/document 内容依赖 extension 或外部状态变化时,可调用此方法刷新 DOM。
|
|
96243
|
-
* @param id 卡片元素 ID
|
|
96244
|
-
* @returns 是否成功触发刷新
|
|
96245
|
-
*/ _proto.refreshCardHTML = function refreshCardHTML(id) {
|
|
96246
|
-
var _this__htmlOverlayManager, _this__htmlOverlayManager1;
|
|
96247
|
-
var item = this.getSDKItem(id);
|
|
96248
|
-
if (!isCardItem(item)) {
|
|
96249
|
-
console.warn('CardItem "' + id + '" not found.');
|
|
96250
|
-
return false;
|
|
96251
|
-
}
|
|
96252
|
-
if (!this.resolveCardHTML(item)) {
|
|
96253
|
-
console.warn('CardItem "' + id + '" has no registered HTML renderer.');
|
|
96254
|
-
return false;
|
|
96255
|
-
}
|
|
96256
|
-
(_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.invalidateCardHTML(id);
|
|
96257
|
-
(_this__htmlOverlayManager1 = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager1.scheduleRender();
|
|
96258
|
-
return true;
|
|
96259
|
-
};
|
|
96260
|
-
/**
|
|
96261
95603
|
* @description 创建卡片元素
|
|
96262
95604
|
* @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
|
|
96263
95605
|
* @param createInfo 卡片创建信息
|
|
@@ -96544,5 +95886,166 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
96544
95886
|
}();
|
|
96545
95887
|
SDK.config = BaseConfig;
|
|
96546
95888
|
|
|
95889
|
+
/**
|
|
95890
|
+
* @description 卡片元素 SDKItem 类
|
|
95891
|
+
* @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
|
|
95892
|
+
* @description 支持设置卡片类型(cardType)
|
|
95893
|
+
*/ var CardItem = /*#__PURE__*/ function(BaseItem) {
|
|
95894
|
+
_inherits(CardItem, BaseItem);
|
|
95895
|
+
function CardItem(options) {
|
|
95896
|
+
var _this;
|
|
95897
|
+
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
|
|
95898
|
+
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5, _SDK_config_itemConfig_cardConfig_cardTypes_, _options_property6, _options_property7;
|
|
95899
|
+
_this = BaseItem.call(this, options) || this, /**
|
|
95900
|
+
* @description 元素类型
|
|
95901
|
+
*/ _this.type = SDKItemType.CARD;
|
|
95902
|
+
// 初始化属性(包含 cardType)
|
|
95903
|
+
_this.property = {
|
|
95904
|
+
position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
|
|
95905
|
+
0,
|
|
95906
|
+
0
|
|
95907
|
+
],
|
|
95908
|
+
rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
|
|
95909
|
+
0,
|
|
95910
|
+
0,
|
|
95911
|
+
0
|
|
95912
|
+
],
|
|
95913
|
+
width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
|
|
95914
|
+
height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
|
|
95915
|
+
scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
|
|
95916
|
+
1,
|
|
95917
|
+
1
|
|
95918
|
+
],
|
|
95919
|
+
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 : '',
|
|
95920
|
+
autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
|
|
95921
|
+
html: (_options_property7 = options.property) == null ? void 0 : _options_property7.html
|
|
95922
|
+
};
|
|
95923
|
+
return _this;
|
|
95924
|
+
}
|
|
95925
|
+
var _proto = CardItem.prototype;
|
|
95926
|
+
// ==================== 实现抽象方法 ====================
|
|
95927
|
+
/**
|
|
95928
|
+
* @description 转换为 CardCreateInfo
|
|
95929
|
+
* @param withParent 是否包含父节点ID
|
|
95930
|
+
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
95931
|
+
var extension = this.getAllExtension();
|
|
95932
|
+
var property = deepClone(this.property);
|
|
95933
|
+
property.html = this.html;
|
|
95934
|
+
return {
|
|
95935
|
+
type: SDKItemType.CARD,
|
|
95936
|
+
id: this.id,
|
|
95937
|
+
name: this.name,
|
|
95938
|
+
parentId: withParent ? this.parentId : undefined,
|
|
95939
|
+
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
95940
|
+
property: property
|
|
95941
|
+
};
|
|
95942
|
+
};
|
|
95943
|
+
/**
|
|
95944
|
+
* @description 克隆 SDKItem
|
|
95945
|
+
*/ _proto.clone = function clone() {
|
|
95946
|
+
var property = deepClone(this.property);
|
|
95947
|
+
property.html = this.html;
|
|
95948
|
+
return new CardItem({
|
|
95949
|
+
id: generateGUID(),
|
|
95950
|
+
name: this.name,
|
|
95951
|
+
parentId: this.parentId,
|
|
95952
|
+
duration: this.duration,
|
|
95953
|
+
delay: this.delay,
|
|
95954
|
+
endBehavior: this.endBehavior,
|
|
95955
|
+
isLocked: this.isLocked,
|
|
95956
|
+
isCoreEditable: this.isCoreEditable,
|
|
95957
|
+
property: property,
|
|
95958
|
+
extension: this.getAllExtension()
|
|
95959
|
+
});
|
|
95960
|
+
};
|
|
95961
|
+
_create_class(CardItem, [
|
|
95962
|
+
{
|
|
95963
|
+
key: "cardType",
|
|
95964
|
+
get: // ==================== cardType 访问器 ====================
|
|
95965
|
+
/**
|
|
95966
|
+
* @description 卡片类型
|
|
95967
|
+
*/ function get() {
|
|
95968
|
+
return this.property.cardType;
|
|
95969
|
+
},
|
|
95970
|
+
set: function set(value) {
|
|
95971
|
+
this.property.cardType = value;
|
|
95972
|
+
}
|
|
95973
|
+
},
|
|
95974
|
+
{
|
|
95975
|
+
key: "html",
|
|
95976
|
+
get: /**
|
|
95977
|
+
* @description HTML 覆盖层配置
|
|
95978
|
+
*/ function get() {
|
|
95979
|
+
return this.property.html;
|
|
95980
|
+
},
|
|
95981
|
+
set: function set(value) {
|
|
95982
|
+
this.property.html = value;
|
|
95983
|
+
}
|
|
95984
|
+
},
|
|
95985
|
+
{
|
|
95986
|
+
key: "position",
|
|
95987
|
+
get: // ==================== 便捷访问器 ====================
|
|
95988
|
+
/**
|
|
95989
|
+
* @description 位置
|
|
95990
|
+
*/ function get() {
|
|
95991
|
+
return this.property.position;
|
|
95992
|
+
},
|
|
95993
|
+
set: function set(value) {
|
|
95994
|
+
this.property.position = value;
|
|
95995
|
+
}
|
|
95996
|
+
},
|
|
95997
|
+
{
|
|
95998
|
+
key: "width",
|
|
95999
|
+
get: /**
|
|
96000
|
+
* @description 宽度
|
|
96001
|
+
*/ function get() {
|
|
96002
|
+
return this.property.width;
|
|
96003
|
+
},
|
|
96004
|
+
set: function set(value) {
|
|
96005
|
+
this.property.width = value;
|
|
96006
|
+
}
|
|
96007
|
+
},
|
|
96008
|
+
{
|
|
96009
|
+
key: "height",
|
|
96010
|
+
get: /**
|
|
96011
|
+
* @description 高度
|
|
96012
|
+
*/ function get() {
|
|
96013
|
+
return this.property.height;
|
|
96014
|
+
},
|
|
96015
|
+
set: function set(value) {
|
|
96016
|
+
this.property.height = value;
|
|
96017
|
+
}
|
|
96018
|
+
},
|
|
96019
|
+
{
|
|
96020
|
+
key: "rotation",
|
|
96021
|
+
get: /**
|
|
96022
|
+
* @description 旋转(二维旋转角度)
|
|
96023
|
+
*/ function get() {
|
|
96024
|
+
return this.property.rotation[2];
|
|
96025
|
+
},
|
|
96026
|
+
set: function set(value) {
|
|
96027
|
+
this.property.rotation[2] = value;
|
|
96028
|
+
}
|
|
96029
|
+
},
|
|
96030
|
+
{
|
|
96031
|
+
key: "fullRotation",
|
|
96032
|
+
get: /**
|
|
96033
|
+
* @description 完整旋转(包含 x, y, z)
|
|
96034
|
+
*/ function get() {
|
|
96035
|
+
return this.property.rotation;
|
|
96036
|
+
},
|
|
96037
|
+
set: function set(value) {
|
|
96038
|
+
this.property.rotation = value;
|
|
96039
|
+
}
|
|
96040
|
+
}
|
|
96041
|
+
]);
|
|
96042
|
+
return CardItem;
|
|
96043
|
+
}(BaseItem);
|
|
96044
|
+
/**
|
|
96045
|
+
* @description 类型守卫:检查是否是 CardItem
|
|
96046
|
+
*/ function isCardItem(obj) {
|
|
96047
|
+
return _instanceof(obj, CardItem);
|
|
96048
|
+
}
|
|
96049
|
+
|
|
96547
96050
|
export { BackgroundManager, BaseItem, Box2, CardItem, DefaultVFXItems, EffectsItem, FrameItem, GeneratorItem, GroupItem, InteractionUtils, ItemOrderAction, PageDataUtils, SDK, SDKItemType, SafeConstraint, SpriteItem, TextItem, VFXItemFactory, Vector2, VideoItem, addCompositionItemByComposition, addItemInfoToScene, adjustOtherElementsLayoutInfo, arrAdd, assertExist, asserts, autoLayout, calculateAutoLayoutIndicatorLine, calculateAutoLayoutPositionByMouse, calculateDisplacement, calculateInsertPositionFromLayout, calculateLayoutDisplacements, clearItemParentInfo, createCompositionItemJSON, createFrameCompositionScene, createNullItemJSON, createSpriteItemJSON, createTextItemJSON, createVideoGeneratorItemJSON, createVideoItemJSON, deepClone, deepEquals, deleteCompositionFromScene, deleteCompositionItemFromScene, deleteItemInfoFromScene, downloadBlob, extractSubCompositionToScene, fixStandardJSON, getBasicScene, getColorByNormalizeColor, getCompositionDataByRefCompositionItemId, getCompositionIdByRefCompositionItemId, getNormalizeColorByColor, getTextureUrlById, getTransformRatioByViewAndCamera, getUniqueName, globalAutoLayout, isBaseItem, isCardItem, isEffectsItem, isEqual, isFrameItem, isGeneratorItem, isGroupItem, isObj, isSpriteItem, isTextItem, isVideoItem, loadScriptAsync, logger, moveItemBetweenCompositions, removeItemInfoFromScene, resetSubCompositionItemId, setItemJSONParentId, setJSONItemName, updateItemLayoutInfo };
|
|
96548
96051
|
//# sourceMappingURL=index.js.map
|