@inweb/markup 25.8.7 → 25.8.9

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.
@@ -19,7 +19,7 @@ export class KonvaEllipse implements IMarkupEllipse {
19
19
  return;
20
20
  }
21
21
 
22
- if (!params.position) return;
22
+ if (!params || !params.position || !params.radius) return;
23
23
 
24
24
  this._ref = new Konva.Ellipse({
25
25
  stroke: params.color ?? "#ff0000",
@@ -7,7 +7,13 @@ export class KonvaImage implements IMarkupImage {
7
7
  private _ratio = 1;
8
8
 
9
9
  constructor(
10
- params: { position: { x: number; y: number }; src: string; width: number; height: number; id?: string },
10
+ params: {
11
+ position: { x: number; y: number };
12
+ src: string;
13
+ width?: number;
14
+ height?: number;
15
+ id?: string;
16
+ },
11
17
  ref = null
12
18
  ) {
13
19
  if (ref) {
@@ -19,15 +25,16 @@ export class KonvaImage implements IMarkupImage {
19
25
  return;
20
26
  }
21
27
 
22
- if (!params.position || !params.src) return;
28
+ if (!params || !params.position || !params.src) return;
29
+
23
30
  this._canvasImage = new Image();
24
31
 
25
32
  this._ref = new Konva.Image({
26
33
  x: params.position.x,
27
34
  y: params.position.y,
28
35
  image: this._canvasImage,
29
- width: params.width,
30
- height: params.height,
36
+ width: params.width ?? 0,
37
+ height: params.height ?? 0,
31
38
  draggable: true,
32
39
  });
33
40
 
@@ -11,7 +11,13 @@ export class KonvaLine implements IMarkupLine {
11
11
  private _ref: Konva.Line;
12
12
 
13
13
  constructor(
14
- params: { points: { x: number; y: number }[]; type?: MarkupLineType; width?: number; color?: string; id?: string },
14
+ params: {
15
+ points: { x: number; y: number }[];
16
+ type?: MarkupLineType;
17
+ width?: number;
18
+ color?: string;
19
+ id?: string;
20
+ },
15
21
  ref = null
16
22
  ) {
17
23
  if (ref) {
@@ -19,7 +25,7 @@ export class KonvaLine implements IMarkupLine {
19
25
  return;
20
26
  }
21
27
 
22
- if (!params.points) return;
28
+ if (!params || !params.points) return;
23
29
 
24
30
  const konvaPoints = [];
25
31
  params.points.forEach((point) => konvaPoints.push(point.x, point.y));
@@ -86,7 +86,7 @@ const MarkupMode2Konva = {
86
86
  },
87
87
  Cloud: {
88
88
  name: "Cloud",
89
- initializer: (ref: any) => new KonvaCloud(null, ref),
89
+ initializer: (ref: any, params = null) => new KonvaCloud(params, ref),
90
90
  zIndex: 1,
91
91
  },
92
92
  };
@@ -20,7 +20,7 @@ export class KonvaRectangle implements IMarkupRectangle {
20
20
  return;
21
21
  }
22
22
 
23
- if (!params.position) return;
23
+ if (!params || !params.position) return;
24
24
 
25
25
  this._ref = new Konva.Rect({
26
26
  stroke: params.color ?? "#ff0000",
@@ -21,7 +21,7 @@ export class KonvaText implements IMarkupText {
21
21
  return;
22
22
  }
23
23
 
24
- if (!params || !params.text) return;
24
+ if (!params || !params.position || !params.text) return;
25
25
 
26
26
  this._ref = new Konva.Text({
27
27
  x: params.position.x,