@inweb/markup 25.8.16 → 25.8.20

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.
@@ -12,7 +12,7 @@ export class KonvaLine implements IMarkupLine {
12
12
 
13
13
  constructor(
14
14
  params: {
15
- points: { x: number; y: number }[];
15
+ points?: { x: number; y: number }[];
16
16
  type?: MarkupLineType;
17
17
  width?: number;
18
18
  color?: string;
@@ -25,7 +25,12 @@ export class KonvaLine implements IMarkupLine {
25
25
  return;
26
26
  }
27
27
 
28
- if (!params || !params.points) return;
28
+ if (!params) params = {};
29
+ if (!params.points)
30
+ params.points = [
31
+ { x: 50, y: 50 },
32
+ { x: 100, y: 100 },
33
+ ];
29
34
 
30
35
  const konvaPoints = [];
31
36
  params.points.forEach((point) => konvaPoints.push(point.x, point.y));
@@ -1103,6 +1103,8 @@ export class KonvaMarkup implements IMarkup {
1103
1103
  src,
1104
1104
  width,
1105
1105
  height,
1106
+ maxWidth: this._konvaStage.width() - position.x,
1107
+ maxHeight: this._konvaStage.height() - position.y,
1106
1108
  id,
1107
1109
  });
1108
1110
 
@@ -6,7 +6,7 @@ export class KonvaRectangle implements IMarkupRectangle {
6
6
 
7
7
  constructor(
8
8
  params: {
9
- position: { x: number; y: number };
9
+ position?: { x: number; y: number };
10
10
  width?: number;
11
11
  height?: number;
12
12
  lineWidth?: number;
@@ -20,7 +20,8 @@ export class KonvaRectangle implements IMarkupRectangle {
20
20
  return;
21
21
  }
22
22
 
23
- if (!params || !params.position) return;
23
+ if (!params) params = {};
24
+ if (!params.position) params.position = { x: 100, y: 100 };
24
25
 
25
26
  this._ref = new Konva.Rect({
26
27
  stroke: params.color ?? "#ff0000",
@@ -7,8 +7,8 @@ export class KonvaText implements IMarkupText {
7
7
 
8
8
  constructor(
9
9
  params: {
10
- position: { x: number; y: number };
11
- text: string;
10
+ position?: { x: number; y: number };
11
+ text?: string;
12
12
  rotation?: number;
13
13
  fontSize?: number;
14
14
  color?: string;
@@ -21,7 +21,9 @@ export class KonvaText implements IMarkupText {
21
21
  return;
22
22
  }
23
23
 
24
- if (!params || !params.position || !params.text) return;
24
+ if (!params) params = {};
25
+ if (!params.position) params.position = { x: 100, y: 100 };
26
+ if (!params.text) params.text = "default";
25
27
 
26
28
  this._ref = new Konva.Text({
27
29
  x: params.position.x,