@8btc/whiteboard 0.0.2 → 0.0.4

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
@@ -14,6 +14,11 @@ export declare class CanvasApi extends CanvasCore {
14
14
  * 设置当前工具类型
15
15
  */
16
16
  setToolType(type: ToolType): void;
17
+ /**
18
+ * 手动创建多个节点
19
+ * 如果你不知道自己在干什么,请使用更高层的封装方法,如 createImageNode
20
+ */
21
+ createNodes(nodes: INode[]): void;
17
22
  /**
18
23
  * 更新视口位置
19
24
  */
@@ -27,9 +32,16 @@ export declare class CanvasApi extends CanvasCore {
27
32
  }): void;
28
33
  /**
29
34
  * 在当前所有节点的左下角插入图片,并将其居中显示
35
+ * 如果没有节点,插入到画布中心
30
36
  * @param imageUrl - 图片 URL
37
+ * @param options - 配置选项
38
+ * @param options.width - 图片宽度
39
+ * @param options.height - 图片高度
31
40
  */
32
- insertImageAtBottomLeft(imageUrl: string): void;
41
+ insertImageAtBottomLeft(imageUrl: string, options?: {
42
+ width?: number;
43
+ height?: number;
44
+ }): void;
33
45
  /**
34
46
  * 导出全部图形为图片
35
47
  * @param options - 导出配置
@@ -64,15 +76,18 @@ export declare class CanvasApi extends CanvasCore {
64
76
  deleteNodes(nodeIds: string[]): void;
65
77
  /**
66
78
  * 滚动到内容区域
67
- * - 如果有选中的节点,将选中节点居中显示
79
+ * - 如果提供了 nodeIds,将指定的节点居中显示
80
+ * - 如果没有提供 nodeIds 但有选中的节点,将选中节点居中显示
68
81
  * - 如果没有选中节点,将所有内容居中显示
69
82
  * @param options - 配置选项
70
83
  * @param options.padding - 内容周围的留白,默认 50px
71
84
  * @param options.scale - 是否自动调整缩放以适应内容,默认 false
85
+ * @param options.nodeIds - 要滚动到的节点 ID 数组
72
86
  */
73
87
  scrollToContent(options?: {
74
88
  padding?: number;
75
89
  scale?: boolean;
90
+ nodeIds?: string[];
76
91
  }): void;
77
92
  }
78
93
 
@@ -353,6 +368,8 @@ declare interface IViewport {
353
368
  scale: number;
354
369
  }
355
370
 
371
+ export declare const NODE_NAME_FOR_SELECT = "shapeNameForSelect";
372
+
356
373
  export declare type NodeType = "rectangle" | "image" | "image-marker";
357
374
 
358
375
  export declare function PureCanvas({ setApi }: PureCanvasProps): JSX.Element;