@8btc/whiteboard 0.0.20-alpha.35 → 0.0.20-alpha.36

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
@@ -112,6 +112,12 @@ export declare class CanvasApi extends CanvasCore {
112
112
  * 如果删除的是 image 节点,会同步删除所有关联的 image-marker
113
113
  */
114
114
  deleteSelectedNodes(): void;
115
+ /**
116
+ * 选中指定节点
117
+ * @param nodeIds - 要选中的节点 ID 数组,不传则取消所有选中
118
+ * @param multiSelect - 是否多选(追加到已选中节点),默认 false
119
+ */
120
+ selectNodes(nodeIds?: string[], multiSelect?: boolean): void;
115
121
  /**
116
122
  * 更新节点样式属性
117
123
  * @param nodeIds - 要更新的节点 ID 数组
package/dist/index.js CHANGED
@@ -2993,7 +2993,10 @@ class No extends So {
2993
2993
  if (!i) return null;
2994
2994
  const s = e?.pixelRatio ?? 2, o = i.x(), a = i.y(), l = i.width() * i.scaleX(), c = i.height() * i.scaleY(), u = (this.getState().nodes || []).filter(
2995
2995
  (R) => R.$_type === "image-brush" && R.$_imageId === t
2996
- ).map((R) => R.id), f = new k.Group(), g = i.clone();
2996
+ ).map((R) => R.id);
2997
+ if (u.length === 0)
2998
+ throw new Error(`No brush nodes found for image: ${t}`);
2999
+ const f = new k.Group(), g = i.clone();
2997
3000
  g.x(0), g.y(0), g.scaleX(1), g.scaleY(1), g.width(l), g.height(c), f.add(g);
2998
3001
  const p = f.toDataURL({ x: 0, y: 0, width: l, height: c, pixelRatio: s });
2999
3002
  f.destroy();
@@ -3148,6 +3151,14 @@ class No extends So {
3148
3151
  const t = this.getState().selectedNodeIds || [];
3149
3152
  this.deleteNodes(t);
3150
3153
  }
3154
+ /**
3155
+ * 选中指定节点
3156
+ * @param nodeIds - 要选中的节点 ID 数组,不传则取消所有选中
3157
+ * @param multiSelect - 是否多选(追加到已选中节点),默认 false
3158
+ */
3159
+ selectNodes(t, e = !1) {
3160
+ this._selectNodes(t, e);
3161
+ }
3151
3162
  /**
3152
3163
  * 更新节点样式属性
3153
3164
  * @param nodeIds - 要更新的节点 ID 数组
package/dist/maze.d.ts CHANGED
@@ -121,6 +121,12 @@ declare class CanvasApi extends CanvasCore {
121
121
  * 如果删除的是 image 节点,会同步删除所有关联的 image-marker
122
122
  */
123
123
  deleteSelectedNodes(): void;
124
+ /**
125
+ * 选中指定节点
126
+ * @param nodeIds - 要选中的节点 ID 数组,不传则取消所有选中
127
+ * @param multiSelect - 是否多选(追加到已选中节点),默认 false
128
+ */
129
+ selectNodes(nodeIds?: string[], multiSelect?: boolean): void;
124
130
  /**
125
131
  * 更新节点样式属性
126
132
  * @param nodeIds - 要更新的节点 ID 数组
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8btc/whiteboard",
3
3
  "private": false,
4
- "version": "0.0.20-alpha.35",
4
+ "version": "0.0.20-alpha.36",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.js",