@inweb/viewer-visualize 25.4.11 → 25.5.3
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 +68 -32
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +73 -32
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Markup/IMarkup.d.ts +10 -1
- package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +3 -1
- package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +2 -0
- package/package.json +5 -5
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +8 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +10 -2
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +11 -2
- package/src/Viewer/Markup/IMarkup.ts +12 -1
- package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +44 -29
- package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +3 -1
package/dist/viewer-visualize.js
CHANGED
|
@@ -3060,6 +3060,7 @@
|
|
|
3060
3060
|
*/
|
|
3061
3061
|
var MarkupMode;
|
|
3062
3062
|
(function (MarkupMode) {
|
|
3063
|
+
MarkupMode["SelectMarkup"] = "SelectMarkup";
|
|
3063
3064
|
MarkupMode["Line"] = "Line";
|
|
3064
3065
|
MarkupMode["Text"] = "Text";
|
|
3065
3066
|
MarkupMode["Rectangle"] = "Rectangle";
|
|
@@ -14689,17 +14690,23 @@
|
|
|
14689
14690
|
draggable: true,
|
|
14690
14691
|
rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0,
|
|
14691
14692
|
});
|
|
14693
|
+
this._ref.width(this._ref.getTextWidth());
|
|
14692
14694
|
this._ref.on("transform", (e) => {
|
|
14693
14695
|
const attrs = e.target.attrs;
|
|
14694
14696
|
if (attrs.rotation !== this.getRotation())
|
|
14695
14697
|
this.setRotation(attrs.rotation);
|
|
14696
14698
|
const newWidth = this._ref.width() * attrs.scaleX;
|
|
14697
14699
|
const newHeight = this._ref.height() * attrs.scaleY;
|
|
14700
|
+
const minWidth = 50;
|
|
14701
|
+
if (newWidth < minWidth || newHeight < Math.round(this.getFontSize())) {
|
|
14702
|
+
this._ref.scale({ x: 1, y: 1 });
|
|
14703
|
+
return;
|
|
14704
|
+
}
|
|
14698
14705
|
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
14699
|
-
this.
|
|
14706
|
+
this._ref.width(newWidth);
|
|
14700
14707
|
}
|
|
14701
14708
|
if (Math.abs(attrs.scaleY - 1) > 10e-6) {
|
|
14702
|
-
this.
|
|
14709
|
+
this._ref.height(newHeight);
|
|
14703
14710
|
}
|
|
14704
14711
|
this._ref.scale({ x: 1, y: 1 });
|
|
14705
14712
|
});
|
|
@@ -14785,8 +14792,14 @@
|
|
|
14785
14792
|
const attrs = e.target.attrs;
|
|
14786
14793
|
if (attrs.rotation !== this.getRotation())
|
|
14787
14794
|
this.setRotation(attrs.rotation);
|
|
14788
|
-
|
|
14789
|
-
|
|
14795
|
+
let newWidth = this._ref.width() * attrs.scaleX;
|
|
14796
|
+
let newHeight = this._ref.height() * attrs.scaleY;
|
|
14797
|
+
const minWidth = 50;
|
|
14798
|
+
const minHeight = 50;
|
|
14799
|
+
if (newWidth < minWidth || newHeight < minHeight) {
|
|
14800
|
+
this._ref.scale({ x: 1, y: 1 });
|
|
14801
|
+
return;
|
|
14802
|
+
}
|
|
14790
14803
|
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
14791
14804
|
this.setWidth(newWidth);
|
|
14792
14805
|
}
|
|
@@ -14885,6 +14898,12 @@
|
|
|
14885
14898
|
this.setRotation(attrs.rotation);
|
|
14886
14899
|
const newRadiusX = this._ref.radiusX() * attrs.scaleX;
|
|
14887
14900
|
const newRadiusY = this._ref.radiusY() * attrs.scaleY;
|
|
14901
|
+
const minRadiusX = 25;
|
|
14902
|
+
const minRadiusY = 25;
|
|
14903
|
+
if (newRadiusX < minRadiusX || newRadiusY < minRadiusY) {
|
|
14904
|
+
this._ref.scale({ x: 1, y: 1 });
|
|
14905
|
+
return;
|
|
14906
|
+
}
|
|
14888
14907
|
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
14889
14908
|
this.setRadiusX(newRadiusX);
|
|
14890
14909
|
}
|
|
@@ -15313,6 +15332,13 @@
|
|
|
15313
15332
|
///////////////////////////////////////////////////////////////////////////////
|
|
15314
15333
|
// move to separate class and create factory with enum?
|
|
15315
15334
|
const MarkupMode2Konva = new Map([
|
|
15335
|
+
[
|
|
15336
|
+
MarkupMode.SelectMarkup,
|
|
15337
|
+
{
|
|
15338
|
+
name: "SelectMarkup",
|
|
15339
|
+
initializer: () => { },
|
|
15340
|
+
},
|
|
15341
|
+
],
|
|
15316
15342
|
[
|
|
15317
15343
|
MarkupMode.Line,
|
|
15318
15344
|
{
|
|
@@ -15383,6 +15409,8 @@
|
|
|
15383
15409
|
this._zIndex = 1;
|
|
15384
15410
|
this._markupContainerName = "markupContainer";
|
|
15385
15411
|
this.lineWidth = 4;
|
|
15412
|
+
this.lineType = "solid";
|
|
15413
|
+
this.fontSize = 34;
|
|
15386
15414
|
this.changeActiveDragger = (event) => {
|
|
15387
15415
|
const draggerName = event.data;
|
|
15388
15416
|
this._markupContainer.className = this._canvasOriginal.className
|
|
@@ -15476,8 +15504,9 @@
|
|
|
15476
15504
|
const hex = new MarkupColor(r, g, b).HexColor;
|
|
15477
15505
|
Object.values(MarkupMode).forEach((mode) => {
|
|
15478
15506
|
this.konvaLayerFind(mode).forEach((x) => {
|
|
15479
|
-
|
|
15480
|
-
|
|
15507
|
+
var _a;
|
|
15508
|
+
const konvaObj = (_a = MarkupMode2Konva.get(mode)) === null || _a === void 0 ? void 0 : _a.initializer(x);
|
|
15509
|
+
if (konvaObj && konvaObj.setColor)
|
|
15481
15510
|
konvaObj.setColor(hex);
|
|
15482
15511
|
});
|
|
15483
15512
|
});
|
|
@@ -15678,6 +15707,7 @@
|
|
|
15678
15707
|
const konvaShapes = this._konvaLayer.find(konvaShape.name).filter((x) => x.parent instanceof Konva.Layer);
|
|
15679
15708
|
return konvaShapes;
|
|
15680
15709
|
}
|
|
15710
|
+
return [];
|
|
15681
15711
|
}
|
|
15682
15712
|
initializeKonva() {
|
|
15683
15713
|
// first we need Konva core things: stage and layer
|
|
@@ -15692,6 +15722,7 @@
|
|
|
15692
15722
|
this._konvaLayer = layer;
|
|
15693
15723
|
const transformer = new Konva.Transformer({
|
|
15694
15724
|
shouldOverdrawWholeArea: false,
|
|
15725
|
+
keepRatio: false,
|
|
15695
15726
|
});
|
|
15696
15727
|
this._konvaTransformer = transformer;
|
|
15697
15728
|
layer.add(transformer);
|
|
@@ -15822,25 +15853,29 @@
|
|
|
15822
15853
|
transformer.nodes([]);
|
|
15823
15854
|
return;
|
|
15824
15855
|
}
|
|
15825
|
-
if (
|
|
15826
|
-
if (
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
if (this._imageInputRef && this._imageInputRef.value)
|
|
15837
|
-
this.addImage(this._imageInputPos, this._imageInputRef.value, 0, 0);
|
|
15838
|
-
else
|
|
15839
|
-
this.createImageInput({ x: e.target.attrs.x, y: e.target.attrs.y });
|
|
15840
|
-
return;
|
|
15856
|
+
if (this._markupMode === MarkupMode.Text || this._markupMode === MarkupMode.SelectMarkup) {
|
|
15857
|
+
if (e.target.className === "Text" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
|
|
15858
|
+
if (this._textInputRef && this._textInputRef.value)
|
|
15859
|
+
this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
|
|
15860
|
+
else
|
|
15861
|
+
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);
|
|
15862
|
+
return;
|
|
15863
|
+
}
|
|
15864
|
+
else {
|
|
15865
|
+
this.removeTextInput();
|
|
15866
|
+
}
|
|
15841
15867
|
}
|
|
15842
|
-
|
|
15843
|
-
|
|
15868
|
+
if (this._markupMode === MarkupMode.Image || this._markupMode === MarkupMode.SelectMarkup) {
|
|
15869
|
+
if (e.target.className === "Image" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
|
|
15870
|
+
if (this._imageInputRef && this._imageInputRef.value)
|
|
15871
|
+
this.addImage(this._imageInputPos, this._imageInputRef.value, 0, 0);
|
|
15872
|
+
else
|
|
15873
|
+
this.createImageInput({ x: e.target.attrs.x, y: e.target.attrs.y });
|
|
15874
|
+
return;
|
|
15875
|
+
}
|
|
15876
|
+
else {
|
|
15877
|
+
this.removeImageInput();
|
|
15878
|
+
}
|
|
15844
15879
|
}
|
|
15845
15880
|
if (transformer.nodes().filter((x) => x.className === "Cloud").length > 0 || e.target.className === "Cloud") {
|
|
15846
15881
|
transformer.rotateEnabled(false);
|
|
@@ -15918,9 +15953,9 @@
|
|
|
15918
15953
|
lines.push({
|
|
15919
15954
|
id: konvaLine.id(),
|
|
15920
15955
|
points: worldPoints.map((p) => this.getPoint3dFromArray(p)),
|
|
15921
|
-
color: konvaLine.getColor() || "ff0000",
|
|
15922
|
-
type: konvaLine.getLineType() ||
|
|
15923
|
-
width: konvaLine.getLineWidth() ||
|
|
15956
|
+
color: konvaLine.getColor() || "#ff0000",
|
|
15957
|
+
type: konvaLine.getLineType() || this.lineType,
|
|
15958
|
+
width: konvaLine.getLineWidth() || this.lineWidth,
|
|
15924
15959
|
});
|
|
15925
15960
|
});
|
|
15926
15961
|
return lines;
|
|
@@ -16110,7 +16145,7 @@
|
|
|
16110
16145
|
}
|
|
16111
16146
|
const konvaLine = new KonvaLine({
|
|
16112
16147
|
points,
|
|
16113
|
-
type: type ||
|
|
16148
|
+
type: type || this.lineType,
|
|
16114
16149
|
width: width || this.lineWidth,
|
|
16115
16150
|
color: color || this._markupColor.HexColor,
|
|
16116
16151
|
id,
|
|
@@ -16130,7 +16165,7 @@
|
|
|
16130
16165
|
this._textInputRef.style.top = inputY + "px";
|
|
16131
16166
|
this._textInputRef.style.left = inputX + "px";
|
|
16132
16167
|
this._textInputRef.onkeydown = (event) => {
|
|
16133
|
-
if (event.key === "Enter") {
|
|
16168
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
16134
16169
|
event.preventDefault();
|
|
16135
16170
|
this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
|
|
16136
16171
|
}
|
|
@@ -16217,7 +16252,7 @@
|
|
|
16217
16252
|
position: { x: position.x, y: position.y },
|
|
16218
16253
|
text: specifiedText,
|
|
16219
16254
|
rotation: angle,
|
|
16220
|
-
fontSize,
|
|
16255
|
+
fontSize: fontSize || this.fontSize,
|
|
16221
16256
|
color: color || this._markupColor.HexColor,
|
|
16222
16257
|
id,
|
|
16223
16258
|
});
|
|
@@ -16439,7 +16474,8 @@
|
|
|
16439
16474
|
class VisualizeMarkup {
|
|
16440
16475
|
constructor() {
|
|
16441
16476
|
this._markupColor = { r: 255, g: 0, b: 0 };
|
|
16442
|
-
this.lineWidth =
|
|
16477
|
+
this.lineWidth = 4;
|
|
16478
|
+
this.fontSize = 34;
|
|
16443
16479
|
}
|
|
16444
16480
|
initialize(viewer, canvas, canvasEvents) {
|
|
16445
16481
|
this._viewer = viewer;
|
|
@@ -16724,7 +16760,7 @@
|
|
|
16724
16760
|
* library instance or leave it blank to use the default URL defined by `Client.js`.
|
|
16725
16761
|
*/
|
|
16726
16762
|
configure(params) {
|
|
16727
|
-
this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/25.
|
|
16763
|
+
this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/25.5/Visualize.js";
|
|
16728
16764
|
return this;
|
|
16729
16765
|
}
|
|
16730
16766
|
/**
|