@8btc/whiteboard 0.0.16 → 0.0.18

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
@@ -58,7 +58,7 @@ export declare class CanvasApi extends CanvasCore {
58
58
  /**
59
59
  * 导出带有标注的图片节点为图片
60
60
  * @param id - 图片节点 ID
61
- * @returns DataURL 格式的图片数据,如果节点不存在则返回 null
61
+ * @returns DataURL 格式的图片数据,如果节点或者 marker 不存在则返回 null
62
62
  */
63
63
  exportImageWithMarker(id: string, options?: {
64
64
  pixelRatio?: number;
package/dist/index.js CHANGED
@@ -945,7 +945,7 @@ class ImageMarkerNode extends BaseCanvasNode {
945
945
  y: 0,
946
946
  width,
947
947
  height,
948
- stroke: "#3B82F6",
948
+ stroke: "#F44336",
949
949
  strokeWidth: rectStrokeWidth,
950
950
  dash: rectDash,
951
951
  fill: "transparent",
@@ -963,7 +963,7 @@ class ImageMarkerNode extends BaseCanvasNode {
963
963
  const fontSize = 16 / stageScale;
964
964
  const circle = new Konva.Circle({
965
965
  radius,
966
- fill: "#3B82F6",
966
+ fill: "#F44336",
967
967
  stroke: "white",
968
968
  strokeWidth
969
969
  });
@@ -1148,7 +1148,7 @@ const createNodeByType = (type, position, style, meta) => {
1148
1148
  ...baseNode,
1149
1149
  style: {
1150
1150
  ...baseNode.style,
1151
- color: "#3B82F6"
1151
+ color: "#F44336"
1152
1152
  }
1153
1153
  };
1154
1154
  }
@@ -1400,7 +1400,7 @@ class CanvasCore extends CanvasState {
1400
1400
  visible: true
1401
1401
  },
1402
1402
  style: {
1403
- color: "#3B82F6",
1403
+ color: "#F44336",
1404
1404
  line: "dashed",
1405
1405
  size: "medium",
1406
1406
  opacity: 1
@@ -1804,7 +1804,7 @@ class CanvasApi extends CanvasCore {
1804
1804
  /**
1805
1805
  * 导出带有标注的图片节点为图片
1806
1806
  * @param id - 图片节点 ID
1807
- * @returns DataURL 格式的图片数据,如果节点不存在则返回 null
1807
+ * @returns DataURL 格式的图片数据,如果节点或者 marker 不存在则返回 null
1808
1808
  */
1809
1809
  exportImageWithMarker(id, options) {
1810
1810
  const imageShape = this.getStage().findOne(`#${id}`);
@@ -1816,6 +1816,10 @@ class CanvasApi extends CanvasCore {
1816
1816
  const markerNodes = nodes.filter(
1817
1817
  (n) => n.type === "image-marker" && n.meta.parent === id
1818
1818
  );
1819
+ if (markerNodes.length === 0) {
1820
+ console.warn("No image-marker nodes found for the given image ID");
1821
+ return null;
1822
+ }
1819
1823
  const tempGroup = new Konva.Group();
1820
1824
  const imageClone = imageShape.clone();
1821
1825
  tempGroup.add(imageClone);
package/dist/index.umd.js CHANGED
@@ -2262,7 +2262,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2262
2262
  y: 0,
2263
2263
  width,
2264
2264
  height,
2265
- stroke: "#3B82F6",
2265
+ stroke: "#F44336",
2266
2266
  strokeWidth: rectStrokeWidth,
2267
2267
  dash: rectDash,
2268
2268
  fill: "transparent",
@@ -2280,7 +2280,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2280
2280
  const fontSize = 16 / stageScale;
2281
2281
  const circle = new Konva.Circle({
2282
2282
  radius,
2283
- fill: "#3B82F6",
2283
+ fill: "#F44336",
2284
2284
  stroke: "white",
2285
2285
  strokeWidth
2286
2286
  });
@@ -2465,7 +2465,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2465
2465
  ...baseNode,
2466
2466
  style: {
2467
2467
  ...baseNode.style,
2468
- color: "#3B82F6"
2468
+ color: "#F44336"
2469
2469
  }
2470
2470
  };
2471
2471
  }
@@ -2717,7 +2717,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2717
2717
  visible: true
2718
2718
  },
2719
2719
  style: {
2720
- color: "#3B82F6",
2720
+ color: "#F44336",
2721
2721
  line: "dashed",
2722
2722
  size: "medium",
2723
2723
  opacity: 1
@@ -3121,7 +3121,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3121
3121
  /**
3122
3122
  * 导出带有标注的图片节点为图片
3123
3123
  * @param id - 图片节点 ID
3124
- * @returns DataURL 格式的图片数据,如果节点不存在则返回 null
3124
+ * @returns DataURL 格式的图片数据,如果节点或者 marker 不存在则返回 null
3125
3125
  */
3126
3126
  exportImageWithMarker(id, options) {
3127
3127
  const imageShape = this.getStage().findOne(`#${id}`);
@@ -3133,6 +3133,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3133
3133
  const markerNodes = nodes.filter(
3134
3134
  (n) => n.type === "image-marker" && n.meta.parent === id
3135
3135
  );
3136
+ if (markerNodes.length === 0) {
3137
+ console.warn("No image-marker nodes found for the given image ID");
3138
+ return null;
3139
+ }
3136
3140
  const tempGroup = new Konva.Group();
3137
3141
  const imageClone = imageShape.clone();
3138
3142
  tempGroup.add(imageClone);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8btc/whiteboard",
3
3
  "private": false,
4
- "version": "0.0.16",
4
+ "version": "0.0.18",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.js",