@inweb/viewer-visualize 25.4.6 → 25.4.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/viewer-visualize.js +99 -32
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +102 -29
- package/dist/viewer-visualize.module.js.map +1 -1
- package/package.json +4 -4
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +7 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +6 -4
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +21 -2
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +19 -9
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +6 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +19 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +21 -0
- package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +26 -22
package/dist/viewer-visualize.js
CHANGED
|
@@ -14588,6 +14588,11 @@
|
|
|
14588
14588
|
strokeScaleEnabled: false,
|
|
14589
14589
|
dash: LineTypeSpecs.get(params.type) || [],
|
|
14590
14590
|
});
|
|
14591
|
+
this._ref.on("transform", (e) => {
|
|
14592
|
+
const attrs = e.target.attrs;
|
|
14593
|
+
if (attrs.rotation !== this.getRotation())
|
|
14594
|
+
this.setRotation(attrs.rotation);
|
|
14595
|
+
});
|
|
14591
14596
|
this._ref.id(this._ref._id.toString());
|
|
14592
14597
|
}
|
|
14593
14598
|
ref() {
|
|
@@ -14684,6 +14689,21 @@
|
|
|
14684
14689
|
draggable: true,
|
|
14685
14690
|
rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0,
|
|
14686
14691
|
});
|
|
14692
|
+
this._ref.width(this._ref.getTextWidth());
|
|
14693
|
+
this._ref.on("transform", (e) => {
|
|
14694
|
+
const attrs = e.target.attrs;
|
|
14695
|
+
if (attrs.rotation !== this.getRotation())
|
|
14696
|
+
this.setRotation(attrs.rotation);
|
|
14697
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
14698
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
14699
|
+
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
14700
|
+
this._ref.width(newWidth);
|
|
14701
|
+
}
|
|
14702
|
+
if (Math.abs(attrs.scaleY - 1) > 10e-6) {
|
|
14703
|
+
this._ref.height(newHeight);
|
|
14704
|
+
}
|
|
14705
|
+
this._ref.scale({ x: 1, y: 1 });
|
|
14706
|
+
});
|
|
14687
14707
|
this._ref.id(this._ref._id.toString());
|
|
14688
14708
|
}
|
|
14689
14709
|
ref() {
|
|
@@ -14762,6 +14782,20 @@
|
|
|
14762
14782
|
draggable: true,
|
|
14763
14783
|
strokeScaleEnabled: false,
|
|
14764
14784
|
});
|
|
14785
|
+
this._ref.on("transform", (e) => {
|
|
14786
|
+
const attrs = e.target.attrs;
|
|
14787
|
+
if (attrs.rotation !== this.getRotation())
|
|
14788
|
+
this.setRotation(attrs.rotation);
|
|
14789
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
14790
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
14791
|
+
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
14792
|
+
this.setWidth(newWidth);
|
|
14793
|
+
}
|
|
14794
|
+
if (Math.abs(attrs.scaleY - 1) > 10e-6) {
|
|
14795
|
+
this.setHeight(newHeight);
|
|
14796
|
+
}
|
|
14797
|
+
this._ref.scale({ x: 1, y: 1 });
|
|
14798
|
+
});
|
|
14765
14799
|
this._ref.id(this._ref._id.toString());
|
|
14766
14800
|
}
|
|
14767
14801
|
getPosition() {
|
|
@@ -14846,6 +14880,20 @@
|
|
|
14846
14880
|
draggable: true,
|
|
14847
14881
|
strokeScaleEnabled: false,
|
|
14848
14882
|
});
|
|
14883
|
+
this._ref.on("transform", (e) => {
|
|
14884
|
+
const attrs = e.target.attrs;
|
|
14885
|
+
if (attrs.rotation !== this.getRotation())
|
|
14886
|
+
this.setRotation(attrs.rotation);
|
|
14887
|
+
const newRadiusX = this._ref.radiusX() * attrs.scaleX;
|
|
14888
|
+
const newRadiusY = this._ref.radiusY() * attrs.scaleY;
|
|
14889
|
+
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
14890
|
+
this.setRadiusX(newRadiusX);
|
|
14891
|
+
}
|
|
14892
|
+
if (Math.abs(attrs.scaleY - 1) > 10e-6) {
|
|
14893
|
+
this.setRadiusY(newRadiusY);
|
|
14894
|
+
}
|
|
14895
|
+
this._ref.scale({ x: 1, y: 1 });
|
|
14896
|
+
});
|
|
14849
14897
|
this._ref.id(this._ref._id.toString());
|
|
14850
14898
|
}
|
|
14851
14899
|
getPosition() {
|
|
@@ -14858,13 +14906,13 @@
|
|
|
14858
14906
|
return this._ref.radiusX();
|
|
14859
14907
|
}
|
|
14860
14908
|
setRadiusX(r) {
|
|
14861
|
-
this._ref.
|
|
14909
|
+
this._ref.radiusX(r);
|
|
14862
14910
|
}
|
|
14863
14911
|
getRadiusY() {
|
|
14864
14912
|
return this._ref.radiusY();
|
|
14865
14913
|
}
|
|
14866
14914
|
setRadiusY(r) {
|
|
14867
|
-
this._ref.
|
|
14915
|
+
this._ref.radiusY(r);
|
|
14868
14916
|
}
|
|
14869
14917
|
getLineWidth() {
|
|
14870
14918
|
return this._ref.strokeWidth();
|
|
@@ -14929,6 +14977,11 @@
|
|
|
14929
14977
|
draggable: true,
|
|
14930
14978
|
strokeScaleEnabled: false,
|
|
14931
14979
|
});
|
|
14980
|
+
this._ref.on("transform", (e) => {
|
|
14981
|
+
const attrs = e.target.attrs;
|
|
14982
|
+
if (attrs.rotation !== this.getRotation())
|
|
14983
|
+
this.setRotation(attrs.rotation);
|
|
14984
|
+
});
|
|
14932
14985
|
this._ref.id(this._ref._id.toString());
|
|
14933
14986
|
}
|
|
14934
14987
|
ref() {
|
|
@@ -14948,6 +15001,7 @@
|
|
|
14948
15001
|
}
|
|
14949
15002
|
setColor(hex) {
|
|
14950
15003
|
this._ref.stroke(hex);
|
|
15004
|
+
this._ref.fill(hex);
|
|
14951
15005
|
}
|
|
14952
15006
|
getRotation() {
|
|
14953
15007
|
return this._ref.rotation();
|
|
@@ -15026,6 +15080,20 @@
|
|
|
15026
15080
|
this._ratio = this._ref.height() === 0 || this._ref.width() === 0 ? 1 : this._ref.height() / this._ref.width();
|
|
15027
15081
|
};
|
|
15028
15082
|
this._canvasImage.src = params.src;
|
|
15083
|
+
this._ref.on("transform", (e) => {
|
|
15084
|
+
const attrs = e.target.attrs;
|
|
15085
|
+
if (attrs.rotation !== this.getRotation())
|
|
15086
|
+
this.setRotation(attrs.rotation);
|
|
15087
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
15088
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
15089
|
+
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
15090
|
+
this.setWidth(newWidth);
|
|
15091
|
+
}
|
|
15092
|
+
if (Math.abs(attrs.scaleY - 1) > 10e-6) {
|
|
15093
|
+
this.setHeight(newHeight);
|
|
15094
|
+
}
|
|
15095
|
+
this._ref.scale({ x: 1, y: 1 });
|
|
15096
|
+
});
|
|
15029
15097
|
this._ref.id(this._ref._id.toString());
|
|
15030
15098
|
}
|
|
15031
15099
|
getSrc() {
|
|
@@ -15060,13 +15128,6 @@
|
|
|
15060
15128
|
type() {
|
|
15061
15129
|
return "image";
|
|
15062
15130
|
}
|
|
15063
|
-
// we can break Liskov Substitution Principle, need to use separate IColorable
|
|
15064
|
-
// getColor(): string {
|
|
15065
|
-
// return this._ref.fill();
|
|
15066
|
-
// }
|
|
15067
|
-
// setColor(hex: string) {
|
|
15068
|
-
// this._ref.fill(hex);
|
|
15069
|
-
// }
|
|
15070
15131
|
getRotation() {
|
|
15071
15132
|
return this._ref.rotation();
|
|
15072
15133
|
}
|
|
@@ -15162,19 +15223,21 @@
|
|
|
15162
15223
|
this._ref.className = "Cloud";
|
|
15163
15224
|
this._ref.on("transform", (e) => {
|
|
15164
15225
|
const attrs = e.target.attrs;
|
|
15165
|
-
|
|
15166
|
-
|
|
15226
|
+
if (attrs.rotation !== this.getRotation())
|
|
15227
|
+
this.setRotation(attrs.rotation);
|
|
15167
15228
|
const newWidth = this._ref.width() * attrs.scaleX;
|
|
15168
15229
|
const newHeight = this._ref.height() * attrs.scaleY;
|
|
15230
|
+
const minWidth = 100;
|
|
15231
|
+
const minHeight = 100;
|
|
15169
15232
|
if (newWidth < minWidth || newHeight < minHeight) {
|
|
15170
15233
|
this._ref.scale({ x: 1, y: 1 });
|
|
15171
15234
|
return;
|
|
15172
15235
|
}
|
|
15173
15236
|
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
15174
|
-
this.
|
|
15237
|
+
this.setWidth(newWidth);
|
|
15175
15238
|
}
|
|
15176
15239
|
if (Math.abs(attrs.scaleY - 1) > 10e-6) {
|
|
15177
|
-
this.
|
|
15240
|
+
this.setHeight(newHeight);
|
|
15178
15241
|
}
|
|
15179
15242
|
this._ref.scale({ x: 1, y: 1 });
|
|
15180
15243
|
});
|
|
@@ -15760,25 +15823,29 @@
|
|
|
15760
15823
|
transformer.nodes([]);
|
|
15761
15824
|
return;
|
|
15762
15825
|
}
|
|
15763
|
-
if (
|
|
15764
|
-
if (
|
|
15765
|
-
|
|
15766
|
-
|
|
15767
|
-
|
|
15768
|
-
|
|
15769
|
-
|
|
15770
|
-
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
if (this._imageInputRef && this._imageInputRef.value)
|
|
15775
|
-
this.addImage(this._imageInputPos, this._imageInputRef.value, 0, 0);
|
|
15776
|
-
else
|
|
15777
|
-
this.createImageInput({ x: e.target.attrs.x, y: e.target.attrs.y });
|
|
15778
|
-
return;
|
|
15826
|
+
if (this._markupMode === MarkupMode.Text) {
|
|
15827
|
+
if (e.target.className === "Text" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
|
|
15828
|
+
if (this._textInputRef && this._textInputRef.value)
|
|
15829
|
+
this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
|
|
15830
|
+
else
|
|
15831
|
+
this.createTextInput({ x: e.target.attrs.x, y: e.target.attrs.y }, e.evt.pageX, e.evt.pageY, e.target.attrs.rotation, e.target.attrs.text);
|
|
15832
|
+
return;
|
|
15833
|
+
}
|
|
15834
|
+
else {
|
|
15835
|
+
this.removeTextInput();
|
|
15836
|
+
}
|
|
15779
15837
|
}
|
|
15780
|
-
|
|
15781
|
-
|
|
15838
|
+
if (this._markupMode === MarkupMode.Image) {
|
|
15839
|
+
if (e.target.className === "Image" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
|
|
15840
|
+
if (this._imageInputRef && this._imageInputRef.value)
|
|
15841
|
+
this.addImage(this._imageInputPos, this._imageInputRef.value, 0, 0);
|
|
15842
|
+
else
|
|
15843
|
+
this.createImageInput({ x: e.target.attrs.x, y: e.target.attrs.y });
|
|
15844
|
+
return;
|
|
15845
|
+
}
|
|
15846
|
+
else {
|
|
15847
|
+
this.removeImageInput();
|
|
15848
|
+
}
|
|
15782
15849
|
}
|
|
15783
15850
|
if (transformer.nodes().filter((x) => x.className === "Cloud").length > 0 || e.target.className === "Cloud") {
|
|
15784
15851
|
transformer.rotateEnabled(false);
|
|
@@ -16068,7 +16135,7 @@
|
|
|
16068
16135
|
this._textInputRef.style.top = inputY + "px";
|
|
16069
16136
|
this._textInputRef.style.left = inputX + "px";
|
|
16070
16137
|
this._textInputRef.onkeydown = (event) => {
|
|
16071
|
-
if (event.key === "Enter") {
|
|
16138
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
16072
16139
|
event.preventDefault();
|
|
16073
16140
|
this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
|
|
16074
16141
|
}
|