@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 +13 -13
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +12 -12
- 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 +13 -6
- 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,22 +591,22 @@ 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
|
-
if (ref.height() === 0 || ref.width() === 0) return;
|
|
597
597
|
this._ref = ref;
|
|
598
598
|
this._canvasImage = ref.image();
|
|
599
|
-
this._ratio = this._ref.height() / this._ref.width();
|
|
599
|
+
this._ratio = this._ref.height() === 0 || this._ref.width() === 0 ? 1 : this._ref.height() / this._ref.width();
|
|
600
600
|
return;
|
|
601
601
|
}
|
|
602
|
-
if (!params.position || !params.src) return;
|
|
602
|
+
if (!params || !params.position || !params.src) return;
|
|
603
603
|
this._canvasImage = new Image;
|
|
604
604
|
this._ref = new Konva.Image({
|
|
605
605
|
x: params.position.x,
|
|
606
606
|
y: params.position.y,
|
|
607
607
|
image: this._canvasImage,
|
|
608
|
-
width: params.width,
|
|
609
|
-
height: params.height,
|
|
608
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
|
|
609
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
|
|
610
610
|
draggable: true
|
|
611
611
|
});
|
|
612
612
|
this._canvasImage.onload = () => {
|
|
@@ -714,7 +714,7 @@ class KonvaCloud {
|
|
|
714
714
|
this._ref = ref;
|
|
715
715
|
return;
|
|
716
716
|
}
|
|
717
|
-
if (!params
|
|
717
|
+
if (!params || !params.position) return;
|
|
718
718
|
const arcRadius = 16;
|
|
719
719
|
this._ref = new Konva.Shape({
|
|
720
720
|
x: params.position.x,
|
|
@@ -918,7 +918,7 @@ const MarkupMode2Konva = {
|
|
|
918
918
|
},
|
|
919
919
|
Cloud: {
|
|
920
920
|
name: "Cloud",
|
|
921
|
-
initializer: ref => new KonvaCloud(
|
|
921
|
+
initializer: (ref, params = null) => new KonvaCloud(params, ref),
|
|
922
922
|
zIndex: 1
|
|
923
923
|
}
|
|
924
924
|
};
|