@inweb/markup 25.8.11 → 25.8.13
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 +41 -23
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +35 -26
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/Konva/KonvaMarkup.d.ts +3 -1
- 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 +1 -1
- package/src/markup/Konva/KonvaLine.ts +1 -1
- package/src/markup/Konva/KonvaMarkup.ts +43 -15
- package/src/markup/Konva/KonvaRectangle.ts +1 -1
- package/src/markup/Konva/KonvaText.ts +1 -1
package/dist/markup.module.js
CHANGED
|
@@ -91,7 +91,7 @@ class KonvaLine {
|
|
|
91
91
|
this._ref.draggable(value);
|
|
92
92
|
}
|
|
93
93
|
type() {
|
|
94
|
-
return "
|
|
94
|
+
return "Line";
|
|
95
95
|
}
|
|
96
96
|
getColor() {
|
|
97
97
|
return this._ref.stroke();
|
|
@@ -211,7 +211,7 @@ class KonvaText {
|
|
|
211
211
|
this._ref.draggable(value);
|
|
212
212
|
}
|
|
213
213
|
type() {
|
|
214
|
-
return "
|
|
214
|
+
return "Text";
|
|
215
215
|
}
|
|
216
216
|
getColor() {
|
|
217
217
|
return this._ref.fill();
|
|
@@ -336,7 +336,7 @@ class KonvaRectangle {
|
|
|
336
336
|
this._ref.draggable(value);
|
|
337
337
|
}
|
|
338
338
|
type() {
|
|
339
|
-
return "
|
|
339
|
+
return "Rectangle";
|
|
340
340
|
}
|
|
341
341
|
getColor() {
|
|
342
342
|
return this._ref.stroke();
|
|
@@ -464,7 +464,7 @@ class KonvaEllipse {
|
|
|
464
464
|
this._ref.draggable(value);
|
|
465
465
|
}
|
|
466
466
|
type() {
|
|
467
|
-
return "
|
|
467
|
+
return "Ellipse";
|
|
468
468
|
}
|
|
469
469
|
getColor() {
|
|
470
470
|
return this._ref.stroke();
|
|
@@ -525,7 +525,7 @@ class KonvaArrow {
|
|
|
525
525
|
this._ref.draggable(value);
|
|
526
526
|
}
|
|
527
527
|
type() {
|
|
528
|
-
return "
|
|
528
|
+
return "Arrow";
|
|
529
529
|
}
|
|
530
530
|
getColor() {
|
|
531
531
|
return this._ref.stroke();
|
|
@@ -678,7 +678,7 @@ class KonvaImage {
|
|
|
678
678
|
this._ref.draggable(value);
|
|
679
679
|
}
|
|
680
680
|
type() {
|
|
681
|
-
return "
|
|
681
|
+
return "Image";
|
|
682
682
|
}
|
|
683
683
|
getRotation() {
|
|
684
684
|
return this._ref.rotation();
|
|
@@ -829,7 +829,7 @@ class KonvaCloud {
|
|
|
829
829
|
this._ref.draggable(value);
|
|
830
830
|
}
|
|
831
831
|
type() {
|
|
832
|
-
return "
|
|
832
|
+
return "Cloud";
|
|
833
833
|
}
|
|
834
834
|
getColor() {
|
|
835
835
|
return this._ref.stroke();
|
|
@@ -889,8 +889,7 @@ const MarkupMode2Konva = {
|
|
|
889
889
|
},
|
|
890
890
|
Line: {
|
|
891
891
|
name: "Line",
|
|
892
|
-
initializer: (ref, params = null) => new KonvaLine(params, ref)
|
|
893
|
-
zIndex: 1
|
|
892
|
+
initializer: (ref, params = null) => new KonvaLine(params, ref)
|
|
894
893
|
},
|
|
895
894
|
Text: {
|
|
896
895
|
name: "Text",
|
|
@@ -898,28 +897,23 @@ const MarkupMode2Konva = {
|
|
|
898
897
|
},
|
|
899
898
|
Rectangle: {
|
|
900
899
|
name: "Rect",
|
|
901
|
-
initializer: (ref, params = null) => new KonvaRectangle(params, ref)
|
|
902
|
-
zIndex: 1
|
|
900
|
+
initializer: (ref, params = null) => new KonvaRectangle(params, ref)
|
|
903
901
|
},
|
|
904
902
|
Ellipse: {
|
|
905
903
|
name: "Ellipse",
|
|
906
|
-
initializer: (ref, params = null) => new KonvaEllipse(params, ref)
|
|
907
|
-
zIndex: 1
|
|
904
|
+
initializer: (ref, params = null) => new KonvaEllipse(params, ref)
|
|
908
905
|
},
|
|
909
906
|
Arrow: {
|
|
910
907
|
name: "Arrow",
|
|
911
|
-
initializer: (ref, params = null) => new KonvaArrow(params, ref)
|
|
912
|
-
zIndex: 1
|
|
908
|
+
initializer: (ref, params = null) => new KonvaArrow(params, ref)
|
|
913
909
|
},
|
|
914
910
|
Image: {
|
|
915
911
|
name: "Image",
|
|
916
|
-
initializer: (ref, params = null) => new KonvaImage(params, ref)
|
|
917
|
-
zIndex: 0
|
|
912
|
+
initializer: (ref, params = null) => new KonvaImage(params, ref)
|
|
918
913
|
},
|
|
919
914
|
Cloud: {
|
|
920
915
|
name: "Cloud",
|
|
921
|
-
initializer: (ref, params = null) => new KonvaCloud(params, ref)
|
|
922
|
-
zIndex: 1
|
|
916
|
+
initializer: (ref, params = null) => new KonvaCloud(params, ref)
|
|
923
917
|
}
|
|
924
918
|
};
|
|
925
919
|
|
|
@@ -928,7 +922,6 @@ class KonvaMarkup {
|
|
|
928
922
|
this._pointerEvents = [];
|
|
929
923
|
this._markupIsActive = false;
|
|
930
924
|
this._markupColor = new MarkupColor(255, 0, 0);
|
|
931
|
-
this._zIndex = 1;
|
|
932
925
|
this.lineWidth = 4;
|
|
933
926
|
this.lineType = "solid";
|
|
934
927
|
this.fontSize = 34;
|
|
@@ -1028,6 +1021,9 @@ class KonvaMarkup {
|
|
|
1028
1021
|
}
|
|
1029
1022
|
setViewpoint(viewpoint) {
|
|
1030
1023
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1024
|
+
this.clearSelected();
|
|
1025
|
+
this.removeTextInput();
|
|
1026
|
+
this.removeImageInput();
|
|
1031
1027
|
const markupColor = ((_a = viewpoint.custom_fields) === null || _a === void 0 ? void 0 : _a.markup_color) || {
|
|
1032
1028
|
r: 255,
|
|
1033
1029
|
g: 0,
|
|
@@ -1090,6 +1086,8 @@ class KonvaMarkup {
|
|
|
1090
1086
|
enableEditMode(mode) {
|
|
1091
1087
|
if (!mode || !MarkupMode2Konva[mode]) {
|
|
1092
1088
|
this.clearSelected();
|
|
1089
|
+
this.removeTextInput();
|
|
1090
|
+
this.removeImageInput();
|
|
1093
1091
|
this._markupIsActive = false;
|
|
1094
1092
|
} else {
|
|
1095
1093
|
this._markupMode = mode;
|
|
@@ -1098,13 +1096,10 @@ class KonvaMarkup {
|
|
|
1098
1096
|
return this;
|
|
1099
1097
|
}
|
|
1100
1098
|
createObject(type, params) {
|
|
1101
|
-
var _a;
|
|
1102
1099
|
const konvaShape = MarkupMode2Konva[type];
|
|
1103
1100
|
if (!konvaShape || !konvaShape.initializer) throw new Error(`Markup CreateObject - unsupported markup type ${type}`);
|
|
1104
1101
|
const object = konvaShape.initializer(null, params);
|
|
1105
1102
|
this.addObject(object);
|
|
1106
|
-
object.setZIndex((_a = konvaShape.zIndex) !== null && _a !== void 0 ? _a : this._zIndex);
|
|
1107
|
-
this._zIndex++;
|
|
1108
1103
|
return object;
|
|
1109
1104
|
}
|
|
1110
1105
|
getObjects() {
|
|
@@ -1132,13 +1127,13 @@ class KonvaMarkup {
|
|
|
1132
1127
|
if (this._konvaTransformer) this._konvaTransformer.nodes([]);
|
|
1133
1128
|
}
|
|
1134
1129
|
addObject(object) {
|
|
1135
|
-
if (this.
|
|
1130
|
+
if (object.type() === "Image") this._groupImages.add(object.ref()); else if (object.type() === "Text") this._groupTexts.add(object.ref()); else this._groupGeometry.add(object.ref());
|
|
1136
1131
|
}
|
|
1137
1132
|
konvaLayerFind(type) {
|
|
1138
1133
|
if (!this._konvaLayer) return [];
|
|
1139
1134
|
const konvaShape = MarkupMode2Konva[type];
|
|
1140
1135
|
if (!konvaShape || !konvaShape.initializer) return [];
|
|
1141
|
-
return this._konvaLayer.find(konvaShape.name).filter((ref => ref.parent === this._konvaLayer));
|
|
1136
|
+
return this._konvaLayer.find(konvaShape.name).filter((ref => ref.parent === this._konvaLayer || ref.parent === this._groupImages || ref.parent === this._groupGeometry || ref.parent === this._groupTexts));
|
|
1142
1137
|
}
|
|
1143
1138
|
initializeKonva() {
|
|
1144
1139
|
const stage = new Konva.Stage({
|
|
@@ -1151,6 +1146,12 @@ class KonvaMarkup {
|
|
|
1151
1146
|
pixelRation: window.devicePixelRatio
|
|
1152
1147
|
});
|
|
1153
1148
|
stage.add(layer);
|
|
1149
|
+
this._groupImages = new Konva.Group;
|
|
1150
|
+
layer.add(this._groupImages);
|
|
1151
|
+
this._groupGeometry = new Konva.Group;
|
|
1152
|
+
layer.add(this._groupGeometry);
|
|
1153
|
+
this._groupTexts = new Konva.Group;
|
|
1154
|
+
layer.add(this._groupTexts);
|
|
1154
1155
|
this._konvaLayer = layer;
|
|
1155
1156
|
const transformer = new Konva.Transformer({
|
|
1156
1157
|
shouldOverdrawWholeArea: false,
|
|
@@ -1316,7 +1317,7 @@ class KonvaMarkup {
|
|
|
1316
1317
|
this.removeImageInput();
|
|
1317
1318
|
}
|
|
1318
1319
|
}
|
|
1319
|
-
if (transformer.nodes().filter((x => x.className === "Cloud")).length > 0 || e.target.className === "Cloud") {
|
|
1320
|
+
if (transformer.nodes().filter((x => x.className === "Cloud" || x.className === "Image")).length > 0 || e.target.className === "Cloud" || e.target.className === "Image") {
|
|
1320
1321
|
transformer.rotateEnabled(false);
|
|
1321
1322
|
} else {
|
|
1322
1323
|
transformer.rotateEnabled(true);
|
|
@@ -1349,8 +1350,13 @@ class KonvaMarkup {
|
|
|
1349
1350
|
}
|
|
1350
1351
|
destroyKonva() {
|
|
1351
1352
|
var _a;
|
|
1353
|
+
this.removeTextInput();
|
|
1354
|
+
this.removeImageInput();
|
|
1352
1355
|
this.clearOverlay();
|
|
1353
1356
|
(_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1357
|
+
this._groupImages = undefined;
|
|
1358
|
+
this._groupGeometry = undefined;
|
|
1359
|
+
this._groupTexts = undefined;
|
|
1354
1360
|
this._konvaLayer = undefined;
|
|
1355
1361
|
this._konvaTransformer = undefined;
|
|
1356
1362
|
this._konvaStage = undefined;
|
|
@@ -1547,6 +1553,9 @@ class KonvaMarkup {
|
|
|
1547
1553
|
this._textInputRef.style.display = "block";
|
|
1548
1554
|
this._textInputRef.style.top = inputY + "px";
|
|
1549
1555
|
this._textInputRef.style.left = inputX + "px";
|
|
1556
|
+
this._textInputRef.style.fontSize = `${this.fontSize}px`;
|
|
1557
|
+
this._textInputRef.style.color = `${this._markupColor.HexColor}`;
|
|
1558
|
+
this._textInputRef.style.fontFamily = "Calibri";
|
|
1550
1559
|
this._textInputRef.onkeydown = event => {
|
|
1551
1560
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
1552
1561
|
event.preventDefault();
|