@inweb/markup 25.8.19 → 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.
- package/dist/markup.js +59 -23
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +65 -15
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/Konva/KonvaArrow.d.ts +2 -2
- package/lib/markup/Konva/KonvaCloud.d.ts +1 -1
- package/lib/markup/Konva/KonvaEllipse.d.ts +2 -2
- package/lib/markup/Konva/KonvaImage.d.ts +4 -2
- package/lib/markup/Konva/KonvaLine.d.ts +1 -1
- package/lib/markup/Konva/KonvaRectangle.d.ts +1 -1
- package/lib/markup/Konva/KonvaText.d.ts +2 -2
- package/package.json +3 -3
- package/src/markup/Konva/KonvaArrow.ts +5 -3
- package/src/markup/Konva/KonvaCloud.ts +3 -2
- package/src/markup/Konva/KonvaEllipse.ts +5 -3
- package/src/markup/Konva/KonvaImage.ts +26 -13
- package/src/markup/Konva/KonvaLine.ts +7 -2
- package/src/markup/Konva/KonvaRectangle.ts +3 -2
- package/src/markup/Konva/KonvaText.ts +5 -3
package/dist/markup.js
CHANGED
|
@@ -11571,8 +11571,13 @@
|
|
|
11571
11571
|
this._ref = ref;
|
|
11572
11572
|
return;
|
|
11573
11573
|
}
|
|
11574
|
-
if (!params
|
|
11575
|
-
|
|
11574
|
+
if (!params)
|
|
11575
|
+
params = {};
|
|
11576
|
+
if (!params.points)
|
|
11577
|
+
params.points = [
|
|
11578
|
+
{ x: 50, y: 50 },
|
|
11579
|
+
{ x: 100, y: 100 },
|
|
11580
|
+
];
|
|
11576
11581
|
const konvaPoints = [];
|
|
11577
11582
|
params.points.forEach((point) => konvaPoints.push(point.x, point.y));
|
|
11578
11583
|
this._ref = new Konva.Line({
|
|
@@ -11674,8 +11679,12 @@
|
|
|
11674
11679
|
this._ref = ref;
|
|
11675
11680
|
return;
|
|
11676
11681
|
}
|
|
11677
|
-
if (!params
|
|
11678
|
-
|
|
11682
|
+
if (!params)
|
|
11683
|
+
params = {};
|
|
11684
|
+
if (!params.position)
|
|
11685
|
+
params.position = { x: 100, y: 100 };
|
|
11686
|
+
if (!params.text)
|
|
11687
|
+
params.text = "default";
|
|
11679
11688
|
this._ref = new Konva.Text({
|
|
11680
11689
|
x: params.position.x,
|
|
11681
11690
|
y: params.position.y,
|
|
@@ -11776,8 +11785,10 @@
|
|
|
11776
11785
|
this._ref = ref;
|
|
11777
11786
|
return;
|
|
11778
11787
|
}
|
|
11779
|
-
if (!params
|
|
11780
|
-
|
|
11788
|
+
if (!params)
|
|
11789
|
+
params = {};
|
|
11790
|
+
if (!params.position)
|
|
11791
|
+
params.position = { x: 100, y: 100 };
|
|
11781
11792
|
this._ref = new Konva.Rect({
|
|
11782
11793
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
11783
11794
|
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
@@ -11886,8 +11897,12 @@
|
|
|
11886
11897
|
this._ref = ref;
|
|
11887
11898
|
return;
|
|
11888
11899
|
}
|
|
11889
|
-
if (!params
|
|
11890
|
-
|
|
11900
|
+
if (!params)
|
|
11901
|
+
params = {};
|
|
11902
|
+
if (!params.position)
|
|
11903
|
+
params.position = { x: 100, y: 100 };
|
|
11904
|
+
if (!params.radius)
|
|
11905
|
+
params.radius = { x: 25, y: 25 };
|
|
11891
11906
|
this._ref = new Konva.Ellipse({
|
|
11892
11907
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
11893
11908
|
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
@@ -12002,8 +12017,12 @@
|
|
|
12002
12017
|
this._ref = ref;
|
|
12003
12018
|
return;
|
|
12004
12019
|
}
|
|
12005
|
-
if (!params
|
|
12006
|
-
|
|
12020
|
+
if (!params)
|
|
12021
|
+
params = {};
|
|
12022
|
+
if (!params.start)
|
|
12023
|
+
params.start = { x: 50, y: 50 };
|
|
12024
|
+
if (!params.end)
|
|
12025
|
+
params.end = { x: 100, y: 100 };
|
|
12007
12026
|
this._ref = new Konva.Arrow({
|
|
12008
12027
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
12009
12028
|
fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
|
|
@@ -12092,8 +12111,15 @@
|
|
|
12092
12111
|
var _a, _b;
|
|
12093
12112
|
this._ratio = 1;
|
|
12094
12113
|
this.EPSILON = 10e-6;
|
|
12114
|
+
this.BASE64_NOT_FOUND = "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAADsAAAA7AF5KHG9AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAmhJREFUWIXtlr9rVEEQxz+H8RQUJIdeIopYm0vkCg0GBBtbG1NF7Kxt7dR/IGIw/uhTaBNLERURg2kCEUyCYCPi70b0InjGS57FzOZN3r19d+9HJIVfWO52dma/s7Mz8xa2KAaBCWAR+AkECWOmSOIdwC1gtQOpHc+NfQ8wClQ8+1d0vcdH/lQ3bSIRGAZ2pTjAqNovANXIWlXlAXA2zvi2Ln4AjqYgtagYEutENSLvjRoOImFv5iB32Ae8UrLXwFBk3h9ndF0VJnKSO9gTu3yKu5Z1LKnS8YIcABgw5Ks692JZFXcXRJ46Aq6kikCnHNi/mQ50WwVtfaIoBzL3gRk2drSscJ2wrc4VvUoe2wn/41/iBfoVLRnBGnDSY3AAKacy8AmYR+o7K1zCl6wgrgpOAc/MuhvfgMuk+1JGHQgSBcAloKXy78AjYBppJk5/noTulseBMZ23iD/piHFkEdgTQzKk+5wHjmHC3cmBg0BD5xcSTrFXyQPgIWFtDwMvab+2N8DpbhyY1v/3E8gdDgNfVX9SCVZ0/gW4B0wB71S2BpxLcuCM/jaQSHSDEeAX4VMuAG4gTzyHbcAVXXO6GxxwIX+vvxe7JHcYQ07nHqklj96UIW/YhSWzMKcep8VVtf8B1Dw6h4DfhB+sdbgn2R+gnoEc5NR3dZ+3QJ9H74HqXLPCGlJyTfI9y3YCs0owq3OLOpKkLeBI1HhSDT/mdKIPiUCARMTlQx34TMLjtww8IczmO8AJ/N/2JNSQXAiQ671JePePge0+wzJSQq4FFzlaenIvucUAkiQLhC/mLGNZ9xgn5s63BP4CCk0QDtm4BhoAAAAASUVORK5CYII=";
|
|
12115
|
+
this.BASE64_HEADER_START = "data:image/";
|
|
12095
12116
|
if (ref) {
|
|
12096
|
-
|
|
12117
|
+
if (!ref.src || !ref.src.startsWith(this.BASE64_HEADER_START))
|
|
12118
|
+
ref.src = this.BASE64_NOT_FOUND;
|
|
12119
|
+
if (ref.height() <= this.EPSILON)
|
|
12120
|
+
ref.height(32);
|
|
12121
|
+
if (ref.width() <= this.EPSILON)
|
|
12122
|
+
ref.width(32);
|
|
12097
12123
|
this._ref = ref;
|
|
12098
12124
|
this._canvasImage = ref.image();
|
|
12099
12125
|
this._ratio =
|
|
@@ -12102,17 +12128,13 @@
|
|
|
12102
12128
|
: this._ref.height() / this._ref.width();
|
|
12103
12129
|
return;
|
|
12104
12130
|
}
|
|
12105
|
-
if (!params
|
|
12106
|
-
|
|
12131
|
+
if (!params)
|
|
12132
|
+
params = {};
|
|
12133
|
+
if (!params.position)
|
|
12134
|
+
params.position = { x: 50, y: 50 };
|
|
12135
|
+
if (!params.src || !params.src.startsWith(this.BASE64_HEADER_START))
|
|
12136
|
+
params.src = this.BASE64_NOT_FOUND;
|
|
12107
12137
|
this._canvasImage = new Image();
|
|
12108
|
-
this._ref = new Konva.Image({
|
|
12109
|
-
x: params.position.x,
|
|
12110
|
-
y: params.position.y,
|
|
12111
|
-
image: this._canvasImage,
|
|
12112
|
-
width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
|
|
12113
|
-
height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
|
|
12114
|
-
draggable: true,
|
|
12115
|
-
});
|
|
12116
12138
|
this._canvasImage.onload = () => {
|
|
12117
12139
|
this._ref.image(this._canvasImage);
|
|
12118
12140
|
if (this._ref.height() <= this.EPSILON)
|
|
@@ -12140,7 +12162,19 @@
|
|
|
12140
12162
|
}
|
|
12141
12163
|
}
|
|
12142
12164
|
};
|
|
12165
|
+
this._canvasImage.onerror = () => {
|
|
12166
|
+
this._canvasImage.onerror = function () { };
|
|
12167
|
+
this._canvasImage.src = this.BASE64_NOT_FOUND;
|
|
12168
|
+
};
|
|
12143
12169
|
this._canvasImage.src = params.src;
|
|
12170
|
+
this._ref = new Konva.Image({
|
|
12171
|
+
x: params.position.x,
|
|
12172
|
+
y: params.position.y,
|
|
12173
|
+
image: this._canvasImage,
|
|
12174
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
|
|
12175
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
|
|
12176
|
+
draggable: true,
|
|
12177
|
+
});
|
|
12144
12178
|
this._ref.on("transform", (e) => {
|
|
12145
12179
|
const attrs = e.target.attrs;
|
|
12146
12180
|
if (attrs.rotation !== this._ref.rotation())
|
|
@@ -12238,8 +12272,10 @@
|
|
|
12238
12272
|
this._ref = ref;
|
|
12239
12273
|
return;
|
|
12240
12274
|
}
|
|
12241
|
-
if (!params
|
|
12242
|
-
|
|
12275
|
+
if (!params)
|
|
12276
|
+
params = {};
|
|
12277
|
+
if (!params.position)
|
|
12278
|
+
params.position = { x: 100, y: 100 };
|
|
12243
12279
|
const arcRadius = 16;
|
|
12244
12280
|
this._ref = new Konva.Shape({
|
|
12245
12281
|
x: params.position.x,
|