@inweb/markup 25.8.8 → 25.8.10

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/markup.js CHANGED
@@ -11571,7 +11571,7 @@
11571
11571
  this._ref = ref;
11572
11572
  return;
11573
11573
  }
11574
- if (!params.points)
11574
+ if (!params || !params.points)
11575
11575
  return;
11576
11576
  const konvaPoints = [];
11577
11577
  params.points.forEach((point) => konvaPoints.push(point.x, point.y));
@@ -11674,7 +11674,7 @@
11674
11674
  this._ref = ref;
11675
11675
  return;
11676
11676
  }
11677
- if (!params || !params.text)
11677
+ if (!params || !params.position || !params.text)
11678
11678
  return;
11679
11679
  this._ref = new Konva.Text({
11680
11680
  x: params.position.x,
@@ -11776,7 +11776,7 @@
11776
11776
  this._ref = ref;
11777
11777
  return;
11778
11778
  }
11779
- if (!params.position)
11779
+ if (!params || !params.position)
11780
11780
  return;
11781
11781
  this._ref = new Konva.Rect({
11782
11782
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
@@ -11886,7 +11886,7 @@
11886
11886
  this._ref = ref;
11887
11887
  return;
11888
11888
  }
11889
- if (!params.position)
11889
+ if (!params || !params.position || !params.radius)
11890
11890
  return;
11891
11891
  this._ref = new Konva.Ellipse({
11892
11892
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
@@ -12002,7 +12002,7 @@
12002
12002
  this._ref = ref;
12003
12003
  return;
12004
12004
  }
12005
- if (!params.start || !params.end)
12005
+ if (!params || !params.start || !params.end)
12006
12006
  return;
12007
12007
  this._ref = new Konva.Arrow({
12008
12008
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
@@ -12089,24 +12089,24 @@
12089
12089
 
12090
12090
  class KonvaImage {
12091
12091
  constructor(params, ref = null) {
12092
+ var _a, _b;
12092
12093
  this._ratio = 1;
12093
12094
  if (ref) {
12094
- if (ref.height() === 0 || ref.width() === 0)
12095
- return;
12095
+ // if (ref.height() === 0 || ref.width() === 0) return;
12096
12096
  this._ref = ref;
12097
12097
  this._canvasImage = ref.image();
12098
- this._ratio = this._ref.height() / this._ref.width();
12098
+ this._ratio = this._ref.height() === 0 || this._ref.width() === 0 ? 1 : this._ref.height() / this._ref.width();
12099
12099
  return;
12100
12100
  }
12101
- if (!params.position || !params.src)
12101
+ if (!params || !params.position || !params.src)
12102
12102
  return;
12103
12103
  this._canvasImage = new Image();
12104
12104
  this._ref = new Konva.Image({
12105
12105
  x: params.position.x,
12106
12106
  y: params.position.y,
12107
12107
  image: this._canvasImage,
12108
- width: params.width,
12109
- height: params.height,
12108
+ width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
12109
+ height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
12110
12110
  draggable: true,
12111
12111
  });
12112
12112
  this._canvasImage.onload = () => {
@@ -12215,7 +12215,7 @@
12215
12215
  this._ref = ref;
12216
12216
  return;
12217
12217
  }
12218
- if (!params.position || !params.width || !params.height)
12218
+ if (!params || !params.position)
12219
12219
  return;
12220
12220
  const arcRadius = 16;
12221
12221
  this._ref = new Konva.Shape({
@@ -12410,7 +12410,7 @@
12410
12410
  },
12411
12411
  Cloud: {
12412
12412
  name: "Cloud",
12413
- initializer: (ref) => new KonvaCloud(null, ref),
12413
+ initializer: (ref, params = null) => new KonvaCloud(params, ref),
12414
12414
  zIndex: 1,
12415
12415
  },
12416
12416
  };