@vvfx/sdk 0.0.0-alpha.42 → 0.0.0-alpha.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@ type SetItemPropertyValueParam = {
47
47
  }[keyof PageFormTypeAndPropertyReference] | {
48
48
  itemId: string;
49
49
  type: spec.ItemType;
50
- propertyName: 'position';
50
+ propertyName: 'position' | 'size';
51
51
  propertyValue: spec.vec2 | spec.vec3;
52
52
  };
53
53
 
@@ -159,6 +159,18 @@ declare class Vector2 extends math.Vector2 {
159
159
  d: number;
160
160
  t: number;
161
161
  };
162
+ /**
163
+ * 二维向量与x轴夹角
164
+ * @returns {number} 弧度值
165
+ */
166
+ angle(): number;
167
+ /**
168
+ * 二维点绕点旋转
169
+ * @param {Vec2} center 旋转中心
170
+ * @param {number} angle 旋转角度
171
+ * @returns {Vec2} 旋转结果
172
+ */
173
+ rotateAround(center: Vector2, angle: number): this;
162
174
  }
163
175
 
164
176
  /**
@@ -190,6 +202,10 @@ declare class Box2 {
190
202
  * @returns {Box2} 二维包围盒
191
203
  */
192
204
  setFromVec2Array(vecArray: Vector2[]): this;
205
+ /**
206
+ * 通过屏幕坐标点设置二维包围盒 - 点为屏幕坐标点,x正方向为右,y正方向为向上
207
+ * @param vecArray 屏幕坐标点
208
+ */
193
209
  setFromVec2ArrayWithOutCorners(vecArray: Vector2[]): this;
194
210
  /**
195
211
  * 通过中心与大小设置二维包围盒
@@ -319,6 +335,7 @@ declare class Box2 {
319
335
  * @returns {boolean} 相交判断结果
320
336
  */
321
337
  intersectsBox(box: Box2, isOrthogonal?: boolean): boolean;
338
+ rotate(angle: number, center?: Vector2): this;
322
339
  }
323
340
 
324
341
  declare const MEDIA_TYPE: {
@@ -519,6 +536,12 @@ type SDKConfig = {
519
536
  transformGizmoConfig: TransformGizmoConfig;
520
537
  pictureCutGizmoEnabled: boolean;
521
538
  pictureCutGizmoConfig: PictureCutGizmoConfig;
539
+ pictureExpandGizmoEnabled: boolean;
540
+ pictureExpandGizmoConfig: PictureExpandGizmoConfig;
541
+ textGizmoEnbaled: boolean;
542
+ textGizmoConfig: TextGizmoConfig;
543
+ maskGizmoEnabled: boolean;
544
+ maskGizmoConfig: MaskGizmoConfig;
522
545
  };
523
546
  };
524
547
  /**
@@ -545,6 +568,14 @@ type PageConfig$1 = {
545
568
  * @description 成组操作元素显隐
546
569
  */
547
570
  groupVisible: boolean;
571
+ /**
572
+ * @description 缩放最大值
573
+ */
574
+ maxZoom: number;
575
+ /**
576
+ * @description 缩放最小值
577
+ */
578
+ minZoom: number;
548
579
  };
549
580
  /**
550
581
  * @description 视频导出功能配置
@@ -696,6 +727,22 @@ type TransformGizmoConfig = {
696
727
  * @description 交互框旋转圆半径
697
728
  */
698
729
  rotationCircleSize: number;
730
+ /**
731
+ * @description 图片Logo地址
732
+ */
733
+ pictureLogoUrl: string;
734
+ /**
735
+ * @description
736
+ */
737
+ nullLogoUrl: string;
738
+ /**
739
+ * @description 大小文字颜色
740
+ */
741
+ sizeTextColor: number;
742
+ /**
743
+ * @description 名称文字颜色
744
+ */
745
+ nameTextColor: number;
699
746
  };
700
747
  /**
701
748
  * @description 图片裁切参数
@@ -762,8 +809,136 @@ type PictureCutGizmoConfig = {
762
809
  */
763
810
  directionScaleInteractionDistance: number;
764
811
  };
812
+ /**
813
+ * @description 图片扩边参数
814
+ */
815
+ type PictureExpandGizmoConfig = {
816
+ /**
817
+ * @description 蒙版颜色
818
+ */
819
+ maskColor: number;
820
+ /**
821
+ * @description 蒙版透明度
822
+ */
823
+ maskAlpha: number;
824
+ /**
825
+ * @description 扩边包围盒线框宽度
826
+ */
827
+ expandBoxLineWidth: number;
828
+ /**
829
+ * @description 扩边包围盒线框颜色
830
+ */
831
+ expandBoxLineColor: number;
832
+ /**
833
+ * @description 扩边包围盒线框透明度
834
+ */
835
+ expandBoxLineAlpha: number;
836
+ /**
837
+ * @description 扩边包围盒角度半径
838
+ */
839
+ expandBoxCornerRadius: number;
840
+ /**
841
+ * @description 扩边包围盒角点宽度
842
+ */
843
+ expandBoxCornerLineWidth: number;
844
+ /**
845
+ * @description 扩边包围盒角点颜色
846
+ */
847
+ expandBoxCornerLineColor: number;
848
+ /**
849
+ * @description 扩边包围盒角点透明度
850
+ */
851
+ expandBoxCornerLineAlpha: number;
852
+ /**
853
+ * @description 扩边包围盒角点填充色
854
+ */
855
+ expandBoxCornerFillColor: number;
856
+ /**
857
+ * @description 缩放判断距离
858
+ */
859
+ scaleInteractionDistance: number;
860
+ /**
861
+ * @description 单向缩放判断距离
862
+ */
863
+ directionScaleInteractionDistance: number;
864
+ };
865
+ /**
866
+ * @description 文本交互控制器参数
867
+ */
868
+ type TextGizmoConfig = {
869
+ /**
870
+ * @description 包围盒线宽
871
+ */
872
+ boxLineWidth: number;
873
+ /**
874
+ * @description 包围盒线色
875
+ */
876
+ boxLineColor: number;
877
+ /**
878
+ * @description 缩放交互点半径
879
+ */
880
+ scaleCornerRadius: number;
881
+ /**
882
+ * @description 旋转交互点边长
883
+ */
884
+ rotationCornerWidth: number;
885
+ /**
886
+ * @description 旋转交互贴图地址
887
+ */
888
+ rotationCornerTexture: string;
889
+ /**
890
+ * @description 缩放交互点填充色
891
+ */
892
+ scaleCornerFillColor: number;
893
+ /**
894
+ * @description 缩放交互点描边宽度
895
+ */
896
+ scaleCornerStrokeWidth: number;
897
+ /**
898
+ * @description 缩放交互点描边颜色
899
+ */
900
+ scaleCornerStrokeColor: number;
901
+ };
902
+ /**
903
+ * @description 蒙版参数
904
+ */
905
+ type MaskGizmoConfig = {
906
+ /**
907
+ * @description 画笔大小
908
+ */
909
+ brushSize: number;
910
+ /**
911
+ * @description 笔刷颜色
912
+ */
913
+ brushColor: number;
914
+ /**
915
+ * @description 笔刷透明度
916
+ */
917
+ brushAlpha: number;
918
+ /**
919
+ * @description 蒙版颜色
920
+ */
921
+ maskColor: number;
922
+ /**
923
+ * @description 蒙版透明度
924
+ */
925
+ maskAlpha: number;
926
+ /**
927
+ * @description 元素包围盒线框宽度
928
+ */
929
+ boxLineWidth: number;
930
+ /**
931
+ * @description 元素包围盒线框颜色
932
+ */
933
+ boxLineColor: number;
934
+ /**
935
+ * @description 元素包围盒线框透明度
936
+ */
937
+ boxLineAlpha: number;
938
+ };
765
939
 
766
940
  type SDKEvents = {
941
+ 'loadingItemChange': [id: string[]];
767
942
  'selectedItemChange': [id: string[]];
768
943
  'preSelectedItemChange': [id: string | undefined];
769
944
  'selectedViewChange': [id: number];
@@ -784,6 +959,11 @@ type SDKEvents = {
784
959
  'exportComplete': [success: boolean, taskInfos: ExportMediaItemOptions[], buffers?: FileBuffer[]];
785
960
  'sdkConfigChange': [preSDKConfig: SDKConfig, curSDKConfig: SDKConfig];
786
961
  'cutBoxChange': [box: Box2];
962
+ 'expandBoxChange': [box: Box2];
963
+ 'textInput': [{
964
+ text: string;
965
+ fontFamily: string;
966
+ }];
787
967
  };
788
968
  declare class SDK {
789
969
  static config: SDKConfig;
@@ -800,11 +980,12 @@ declare class SDK {
800
980
  _container: HTMLElement;
801
981
  private _playerContainer;
802
982
  constructor(container: HTMLElement);
983
+ get container(): HTMLElement;
803
984
  get pageData(): PageData | undefined;
804
985
  get exportStatus(): string | undefined;
805
986
  private get exportOptions();
806
987
  dispose(): void;
807
- on: <E extends "progress" | "selectedItemChange" | "preSelectedItemChange" | "selectedViewChange" | "pageDataChange" | "zoomChange" | "itemPropertyChange" | "exportProgress" | "exportDone" | "exportComplete" | "sdkConfigChange" | "cutBoxChange">(eventName: E, listener: _galacean_effects.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects.EventEmitterOptions) => () => void;
988
+ on: <E extends "progress" | "loadingItemChange" | "selectedItemChange" | "preSelectedItemChange" | "selectedViewChange" | "pageDataChange" | "zoomChange" | "itemPropertyChange" | "exportProgress" | "exportDone" | "exportComplete" | "sdkConfigChange" | "cutBoxChange" | "expandBoxChange" | "textInput">(eventName: E, listener: _galacean_effects.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects.EventEmitterOptions) => () => void;
808
989
  private getInitParam;
809
990
  /**
810
991
  * 检测导出是否需要重新初始化
@@ -860,10 +1041,10 @@ declare class SDK {
860
1041
  * @description 获取场景预览图
861
1042
  * @returns 视图预览图
862
1043
  */
863
- getViewThumbnail(): {
1044
+ getViewThumbnail(): Promise<{
864
1045
  id: number;
865
- thumbnail: Promise<string | undefined>;
866
- }[];
1046
+ thumbnail: string | undefined;
1047
+ }>[];
867
1048
  /**
868
1049
  * @description 获取视图JSON产物
869
1050
  * @returns 当前所有视图JSON产物
@@ -976,15 +1157,52 @@ declare class SDK {
976
1157
  * @description 创建图层元素
977
1158
  * @param spriteInfo 图层元素信息
978
1159
  */
979
- addSpriteItem(spriteInfo: SpriteCreateInfo): Promise<void>;
1160
+ addSpriteItem(spriteInfo: SpriteCreateInfo): Promise<string | undefined>;
980
1161
  openPictureCutGizmo(): void;
981
1162
  closePictureCutGizmo(): void;
1163
+ getCutInfo(): {
1164
+ cutBox: Box2;
1165
+ itemBox: Box2;
1166
+ } | undefined;
1167
+ setCutBox(min: Vector2, max: Vector2): Box2 | undefined;
1168
+ openPictureExpandGizmo(): void;
1169
+ closePictureExpandGizmo(): void;
1170
+ getExpandInfo(): {
1171
+ expandBox: Box2;
1172
+ itemBox: Box2;
1173
+ } | undefined;
1174
+ setExpandBox(min: Vector2, max: Vector2): Box2 | undefined;
1175
+ openMaskGizmo(brushSize: number): void;
1176
+ clearMaskGizmo(): void;
1177
+ closeMaskGizmo(): void;
1178
+ getMask(): string | null | undefined;
1179
+ openLoadingGizmo(id: string): void;
1180
+ closeLoadingGizmo(id: string): void;
982
1181
  /**
983
1182
  * @description 元素打组
984
1183
  * @param children 子元素ID
985
1184
  */
986
- groupItems(nullInfo: NullCreateInfo): void;
1185
+ groupItems(nullInfo: NullCreateInfo): string | undefined;
1186
+ addTextItem(textInfo: TextCreateInfo): Promise<void>;
987
1187
  deleteItems(idInfo: string | string[]): void;
1188
+ getItemCreateInfo(idInfo: string | string[]): ItemCreateInfo[];
1189
+ createScreenShotSceneByIds(idInfo: string | string[], time?: number): Promise<string | undefined>;
1190
+ getChildrenIds(id: string): string[];
1191
+ /**
1192
+ * @description 更新元素在图层中的顺序
1193
+ * @param id 元素ID
1194
+ * @param action 排序操作:BringToFront(置于顶层)、SendToBack(置于底层)、BringForward(上移一层)、SendBackward(下移一层)
1195
+ */
1196
+ updateItemOrder(id: string, action: ItemOrderAction): void;
1197
+ /**
1198
+ * @description 导出JSON
1199
+ * @param idInfo 视图序号信息
1200
+ * @returns JSON数组
1201
+ */
1202
+ exportJSON(idInfo?: number | number[]): spec.JSONScene[];
1203
+ getViewBoxById(id: string): Box2;
1204
+ getViewItemById(id: string): ViewItem | undefined;
1205
+ getViewProperty(id: number): ViewProperty | undefined;
988
1206
  }
989
1207
 
990
1208
  type SizeAdaptDirection = 'x' | 'y';
@@ -1000,11 +1218,17 @@ type SpriteFormProperty = BaseFormProperty & {
1000
1218
  image: string;
1001
1219
  };
1002
1220
  type TextFormProperty = BaseFormProperty & {
1003
- font: string;
1004
- color: [number, number, number, number];
1005
- weight: spec.TextWeight;
1221
+ fontFamily: string;
1222
+ textColor: [number, number, number, number];
1223
+ fontWeight: spec.TextWeight;
1006
1224
  text: string;
1007
- alignment: spec.TextAlignment;
1225
+ textAlign: spec.TextAlignment;
1226
+ fontSize: number;
1227
+ fontStyle: spec.FontStyle;
1228
+ textWidth: number;
1229
+ lineHeight: number;
1230
+ outlineColor?: spec.vec4;
1231
+ outlineWidth?: number;
1008
1232
  };
1009
1233
  /**
1010
1234
  * @description 页面表单类型和属性引用
@@ -1261,6 +1485,10 @@ type ActiveData = {
1261
1485
  * @description 预选中元素
1262
1486
  */
1263
1487
  preSelectedItem?: string;
1488
+ /**
1489
+ * @description 执行中元素
1490
+ */
1491
+ loadingItems?: string[];
1264
1492
  };
1265
1493
  /**
1266
1494
  * @description 视图元素
@@ -1300,6 +1528,7 @@ type SDKBackgroundType = 'color' | 'image' | 'chess-board';
1300
1528
  * @description 图层创建信息
1301
1529
  */
1302
1530
  type SpriteCreateInfo = {
1531
+ type: 'sprite';
1303
1532
  /**
1304
1533
  * @description 图层名称
1305
1534
  */
@@ -1308,6 +1537,10 @@ type SpriteCreateInfo = {
1308
1537
  * @description 元素id
1309
1538
  */
1310
1539
  id?: string;
1540
+ /**
1541
+ * @description 父节点id
1542
+ */
1543
+ parentId?: string;
1311
1544
  /**
1312
1545
  * @description 图片资源地址
1313
1546
  */
@@ -1333,10 +1566,15 @@ type SpriteCreateInfo = {
1333
1566
  * @description 空节点创建信息
1334
1567
  */
1335
1568
  type NullCreateInfo = {
1569
+ type: 'null';
1336
1570
  /**
1337
1571
  * @description 元素id
1338
1572
  */
1339
1573
  id?: string;
1574
+ /**
1575
+ * @description 父节点id
1576
+ */
1577
+ parentId?: string;
1340
1578
  /**
1341
1579
  * @description 元素名称
1342
1580
  */
@@ -1356,7 +1594,92 @@ type NullCreateInfo = {
1356
1594
  /**
1357
1595
  * @description 空节点位移
1358
1596
  */
1359
- translation?: spec.vec2;
1597
+ position?: spec.vec2;
1360
1598
  };
1599
+ /**
1600
+ * @description 文本创建信息
1601
+ */
1602
+ type TextCreateInfo = {
1603
+ type: 'text';
1604
+ /**
1605
+ * @description 元素id
1606
+ */
1607
+ id?: string;
1608
+ /**
1609
+ * @description 父节点id
1610
+ */
1611
+ parentId?: string;
1612
+ /**
1613
+ * @description 元素名称
1614
+ */
1615
+ name?: string;
1616
+ /**
1617
+ * @description 单行高度
1618
+ */
1619
+ lineHeight: number;
1620
+ /**
1621
+ * @description 文本高度
1622
+ */
1623
+ textHeight?: number;
1624
+ /**
1625
+ * @description 宽度
1626
+ */
1627
+ textWidth: number;
1628
+ /**
1629
+ * @description 字体名称
1630
+ */
1631
+ fontFamily: string;
1632
+ /**
1633
+ * @description 文本位置
1634
+ */
1635
+ position?: spec.vec2;
1636
+ /**
1637
+ * @description 文本旋转
1638
+ */
1639
+ rotation?: number;
1640
+ /**
1641
+ * @description 文字大小
1642
+ */
1643
+ fontSize: number;
1644
+ /**
1645
+ * @description 字重
1646
+ */
1647
+ fontWeight?: spec.TextWeight;
1648
+ /**
1649
+ * @description 字体格式
1650
+ */
1651
+ fontStyle?: spec.FontStyle;
1652
+ /**
1653
+ * @description 对齐方式
1654
+ */
1655
+ textAlign?: spec.TextAlignment;
1656
+ /**
1657
+ * @description 文本信息
1658
+ */
1659
+ text: string;
1660
+ /**
1661
+ * @description 填充色
1662
+ */
1663
+ textColor: spec.vec4;
1664
+ /**
1665
+ * @description 描边色
1666
+ */
1667
+ outlineColor?: spec.vec4;
1668
+ /**
1669
+ * @description 描边宽度
1670
+ */
1671
+ outlineWidth?: number;
1672
+ /**
1673
+ * @description 字体文件地址
1674
+ */
1675
+ url?: string;
1676
+ };
1677
+ type ItemCreateInfo = NullCreateInfo | SpriteCreateInfo | TextCreateInfo;
1678
+ declare enum ItemOrderAction {
1679
+ BringToFront = 0,
1680
+ SendToBack = 1,
1681
+ BringForward = 2,
1682
+ SendBackward = 3
1683
+ }
1361
1684
 
1362
- export { type ActiveData, type BaseFormProperty, Box2, type PageData, type PageFormTypedProperty, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKOptions, type SpecificPageFormProps, type SpriteCreateInfo, type SpriteFormProperty, type TextFormProperty, type ViewItem, type ViewParam, type ViewProperty };
1685
+ export { type ActiveData, type BaseFormProperty, Box2, ItemOrderAction, type NullCreateInfo, type PageData, type PageFormTypedProperty, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKOptions, type SpecificPageFormProps, type SpriteCreateInfo, type SpriteFormProperty, type TextCreateInfo, type TextFormProperty, Vector2, type ViewItem, type ViewItemTypedProperty, type ViewParam, type ViewProperty };