@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.
- package/dist/markup.js +11 -10
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +11 -10
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/Konva/KonvaImage.d.ts +2 -2
- package/package.json +3 -3
- package/src/markup/Konva/KonvaArrow.ts +1 -1
- package/src/markup/Konva/KonvaCloud.ts +1 -1
- package/src/markup/Konva/KonvaEllipse.ts +1 -1
- package/src/markup/Konva/KonvaImage.ts +11 -4
- package/src/markup/Konva/KonvaLine.ts +8 -2
- package/src/markup/Konva/KonvaMarkup.ts +1 -1
- package/src/markup/Konva/KonvaRectangle.ts +1 -1
- package/src/markup/Konva/KonvaText.ts +1 -1
package/dist/markup.module.js
CHANGED
|
@@ -61,7 +61,7 @@ class KonvaLine {
|
|
|
61
61
|
this._ref = ref;
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
if (!params.points) return;
|
|
64
|
+
if (!params || !params.points) return;
|
|
65
65
|
const konvaPoints = [];
|
|
66
66
|
params.points.forEach((point => konvaPoints.push(point.x, point.y)));
|
|
67
67
|
this._ref = new Konva.Line({
|
|
@@ -163,7 +163,7 @@ class KonvaText {
|
|
|
163
163
|
this._ref = ref;
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
|
-
if (!params || !params.text) return;
|
|
166
|
+
if (!params || !params.position || !params.text) return;
|
|
167
167
|
this._ref = new Konva.Text({
|
|
168
168
|
x: params.position.x,
|
|
169
169
|
y: params.position.y,
|
|
@@ -265,7 +265,7 @@ class KonvaRectangle {
|
|
|
265
265
|
this._ref = ref;
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
if (!params.position) return;
|
|
268
|
+
if (!params || !params.position) return;
|
|
269
269
|
this._ref = new Konva.Rect({
|
|
270
270
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
271
271
|
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
@@ -375,7 +375,7 @@ class KonvaEllipse {
|
|
|
375
375
|
this._ref = ref;
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
|
-
if (!params.position) return;
|
|
378
|
+
if (!params || !params.position || !params.radius) return;
|
|
379
379
|
this._ref = new Konva.Ellipse({
|
|
380
380
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
381
381
|
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
@@ -497,7 +497,7 @@ class KonvaArrow {
|
|
|
497
497
|
this._ref = ref;
|
|
498
498
|
return;
|
|
499
499
|
}
|
|
500
|
-
if (!params.start || !params.end) return;
|
|
500
|
+
if (!params || !params.start || !params.end) return;
|
|
501
501
|
this._ref = new Konva.Arrow({
|
|
502
502
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
503
503
|
fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
|
|
@@ -591,6 +591,7 @@ class KonvaArrow {
|
|
|
591
591
|
|
|
592
592
|
class KonvaImage {
|
|
593
593
|
constructor(params, ref = null) {
|
|
594
|
+
var _a, _b;
|
|
594
595
|
this._ratio = 1;
|
|
595
596
|
if (ref) {
|
|
596
597
|
if (ref.height() === 0 || ref.width() === 0) return;
|
|
@@ -599,14 +600,14 @@ class KonvaImage {
|
|
|
599
600
|
this._ratio = this._ref.height() / this._ref.width();
|
|
600
601
|
return;
|
|
601
602
|
}
|
|
602
|
-
if (!params.position || !params.src) return;
|
|
603
|
+
if (!params || !params.position || !params.src) return;
|
|
603
604
|
this._canvasImage = new Image;
|
|
604
605
|
this._ref = new Konva.Image({
|
|
605
606
|
x: params.position.x,
|
|
606
607
|
y: params.position.y,
|
|
607
608
|
image: this._canvasImage,
|
|
608
|
-
width: params.width,
|
|
609
|
-
height: params.height,
|
|
609
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
|
|
610
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
|
|
610
611
|
draggable: true
|
|
611
612
|
});
|
|
612
613
|
this._canvasImage.onload = () => {
|
|
@@ -714,7 +715,7 @@ class KonvaCloud {
|
|
|
714
715
|
this._ref = ref;
|
|
715
716
|
return;
|
|
716
717
|
}
|
|
717
|
-
if (!params
|
|
718
|
+
if (!params || !params.position) return;
|
|
718
719
|
const arcRadius = 16;
|
|
719
720
|
this._ref = new Konva.Shape({
|
|
720
721
|
x: params.position.x,
|
|
@@ -918,7 +919,7 @@ const MarkupMode2Konva = {
|
|
|
918
919
|
},
|
|
919
920
|
Cloud: {
|
|
920
921
|
name: "Cloud",
|
|
921
|
-
initializer: ref => new KonvaCloud(
|
|
922
|
+
initializer: (ref, params = null) => new KonvaCloud(params, ref),
|
|
922
923
|
zIndex: 1
|
|
923
924
|
}
|
|
924
925
|
};
|