@inweb/viewer-visualize 25.4.4 → 25.4.7
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 +158 -19
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +84 -18
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +31 -0
- package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +36 -0
- package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +11 -0
- package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +36 -0
- package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +36 -0
- package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +27 -0
- package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +37 -1
- package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +36 -0
- package/lib/Viewer/Markup/Api/IMarkupText.d.ts +28 -0
- package/lib/Viewer/Markup/IMarkup.d.ts +85 -0
- package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +17 -0
- package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +0 -1
- package/lib/Viewer/Markup/MarkupFactory.d.ts +6 -0
- package/lib/Viewer/Viewer.d.ts +2 -0
- package/package.json +4 -4
- package/src/Viewer/Markup/Api/IMarkupArrow.ts +57 -0
- package/src/Viewer/Markup/Api/IMarkupCloud.ts +63 -0
- package/src/Viewer/Markup/Api/IMarkupColorable.ts +35 -0
- package/src/Viewer/Markup/Api/IMarkupEllipse.ts +63 -0
- package/src/Viewer/Markup/Api/IMarkupImage.ts +63 -0
- package/src/Viewer/Markup/Api/IMarkupLine.ts +52 -0
- package/src/Viewer/Markup/Api/IMarkupObject.ts +65 -2
- package/src/Viewer/Markup/Api/IMarkupRectangle.ts +63 -0
- package/src/Viewer/Markup/Api/IMarkupText.ts +54 -0
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +30 -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 +19 -0
- package/src/Viewer/Markup/IMarkup.ts +120 -0
- package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +29 -4
- package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +40 -0
- package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +0 -4
- package/src/Viewer/Markup/MarkupFactory.ts +29 -0
- package/src/Viewer/Viewer.ts +4 -2
|
@@ -3060,6 +3060,10 @@ class KonvaLine {
|
|
|
3060
3060
|
strokeScaleEnabled: false,
|
|
3061
3061
|
dash: LineTypeSpecs.get(params.type) || []
|
|
3062
3062
|
});
|
|
3063
|
+
this._ref.on("transform", (e => {
|
|
3064
|
+
const attrs = e.target.attrs;
|
|
3065
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3066
|
+
}));
|
|
3063
3067
|
this._ref.id(this._ref._id.toString());
|
|
3064
3068
|
}
|
|
3065
3069
|
ref() {
|
|
@@ -3156,6 +3160,22 @@ class KonvaText {
|
|
|
3156
3160
|
draggable: true,
|
|
3157
3161
|
rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0
|
|
3158
3162
|
});
|
|
3163
|
+
this._ref.on("transform", (e => {
|
|
3164
|
+
const attrs = e.target.attrs;
|
|
3165
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3166
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
3167
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
3168
|
+
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3169
|
+
this.setFontSize(Math.round(this.getFontSize() * newWidth / this._ref.width()));
|
|
3170
|
+
}
|
|
3171
|
+
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3172
|
+
this.setFontSize(Math.round(this.getFontSize() * newHeight / this._ref.height()));
|
|
3173
|
+
}
|
|
3174
|
+
this._ref.scale({
|
|
3175
|
+
x: 1,
|
|
3176
|
+
y: 1
|
|
3177
|
+
});
|
|
3178
|
+
}));
|
|
3159
3179
|
this._ref.id(this._ref._id.toString());
|
|
3160
3180
|
}
|
|
3161
3181
|
ref() {
|
|
@@ -3236,6 +3256,22 @@ class KonvaRectangle {
|
|
|
3236
3256
|
draggable: true,
|
|
3237
3257
|
strokeScaleEnabled: false
|
|
3238
3258
|
});
|
|
3259
|
+
this._ref.on("transform", (e => {
|
|
3260
|
+
const attrs = e.target.attrs;
|
|
3261
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3262
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
3263
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
3264
|
+
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3265
|
+
this.setWidth(newWidth);
|
|
3266
|
+
}
|
|
3267
|
+
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3268
|
+
this.setHeight(newHeight);
|
|
3269
|
+
}
|
|
3270
|
+
this._ref.scale({
|
|
3271
|
+
x: 1,
|
|
3272
|
+
y: 1
|
|
3273
|
+
});
|
|
3274
|
+
}));
|
|
3239
3275
|
this._ref.id(this._ref._id.toString());
|
|
3240
3276
|
}
|
|
3241
3277
|
getPosition() {
|
|
@@ -3322,6 +3358,22 @@ class KonvaEllipse {
|
|
|
3322
3358
|
draggable: true,
|
|
3323
3359
|
strokeScaleEnabled: false
|
|
3324
3360
|
});
|
|
3361
|
+
this._ref.on("transform", (e => {
|
|
3362
|
+
const attrs = e.target.attrs;
|
|
3363
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3364
|
+
const newRadiusX = this._ref.radiusX() * attrs.scaleX;
|
|
3365
|
+
const newRadiusY = this._ref.radiusY() * attrs.scaleY;
|
|
3366
|
+
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3367
|
+
this.setRadiusX(newRadiusX);
|
|
3368
|
+
}
|
|
3369
|
+
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3370
|
+
this.setRadiusY(newRadiusY);
|
|
3371
|
+
}
|
|
3372
|
+
this._ref.scale({
|
|
3373
|
+
x: 1,
|
|
3374
|
+
y: 1
|
|
3375
|
+
});
|
|
3376
|
+
}));
|
|
3325
3377
|
this._ref.id(this._ref._id.toString());
|
|
3326
3378
|
}
|
|
3327
3379
|
getPosition() {
|
|
@@ -3337,19 +3389,13 @@ class KonvaEllipse {
|
|
|
3337
3389
|
return this._ref.radiusX();
|
|
3338
3390
|
}
|
|
3339
3391
|
setRadiusX(r) {
|
|
3340
|
-
this._ref.
|
|
3341
|
-
x: r,
|
|
3342
|
-
y: this._ref.radiusY()
|
|
3343
|
-
});
|
|
3392
|
+
this._ref.radiusX(r);
|
|
3344
3393
|
}
|
|
3345
3394
|
getRadiusY() {
|
|
3346
3395
|
return this._ref.radiusY();
|
|
3347
3396
|
}
|
|
3348
3397
|
setRadiusY(r) {
|
|
3349
|
-
this._ref.
|
|
3350
|
-
x: this._ref.radiusX(),
|
|
3351
|
-
y: r
|
|
3352
|
-
});
|
|
3398
|
+
this._ref.radiusY(r);
|
|
3353
3399
|
}
|
|
3354
3400
|
getLineWidth() {
|
|
3355
3401
|
return this._ref.strokeWidth();
|
|
@@ -3412,6 +3458,10 @@ class KonvaArrow {
|
|
|
3412
3458
|
draggable: true,
|
|
3413
3459
|
strokeScaleEnabled: false
|
|
3414
3460
|
});
|
|
3461
|
+
this._ref.on("transform", (e => {
|
|
3462
|
+
const attrs = e.target.attrs;
|
|
3463
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3464
|
+
}));
|
|
3415
3465
|
this._ref.id(this._ref._id.toString());
|
|
3416
3466
|
}
|
|
3417
3467
|
ref() {
|
|
@@ -3431,6 +3481,7 @@ class KonvaArrow {
|
|
|
3431
3481
|
}
|
|
3432
3482
|
setColor(hex) {
|
|
3433
3483
|
this._ref.stroke(hex);
|
|
3484
|
+
this._ref.fill(hex);
|
|
3434
3485
|
}
|
|
3435
3486
|
getRotation() {
|
|
3436
3487
|
return this._ref.rotation();
|
|
@@ -3514,6 +3565,22 @@ class KonvaImage {
|
|
|
3514
3565
|
this._ratio = this._ref.height() === 0 || this._ref.width() === 0 ? 1 : this._ref.height() / this._ref.width();
|
|
3515
3566
|
};
|
|
3516
3567
|
this._canvasImage.src = params.src;
|
|
3568
|
+
this._ref.on("transform", (e => {
|
|
3569
|
+
const attrs = e.target.attrs;
|
|
3570
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3571
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
3572
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
3573
|
+
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3574
|
+
this.setWidth(newWidth);
|
|
3575
|
+
}
|
|
3576
|
+
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3577
|
+
this.setHeight(newHeight);
|
|
3578
|
+
}
|
|
3579
|
+
this._ref.scale({
|
|
3580
|
+
x: 1,
|
|
3581
|
+
y: 1
|
|
3582
|
+
});
|
|
3583
|
+
}));
|
|
3517
3584
|
this._ref.id(this._ref._id.toString());
|
|
3518
3585
|
}
|
|
3519
3586
|
getSrc() {
|
|
@@ -3657,10 +3724,11 @@ class KonvaCloud {
|
|
|
3657
3724
|
this._ref.className = "Cloud";
|
|
3658
3725
|
this._ref.on("transform", (e => {
|
|
3659
3726
|
const attrs = e.target.attrs;
|
|
3660
|
-
|
|
3661
|
-
const minHeight = 100;
|
|
3727
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3662
3728
|
const newWidth = this._ref.width() * attrs.scaleX;
|
|
3663
3729
|
const newHeight = this._ref.height() * attrs.scaleY;
|
|
3730
|
+
const minWidth = 100;
|
|
3731
|
+
const minHeight = 100;
|
|
3664
3732
|
if (newWidth < minWidth || newHeight < minHeight) {
|
|
3665
3733
|
this._ref.scale({
|
|
3666
3734
|
x: 1,
|
|
@@ -3669,10 +3737,10 @@ class KonvaCloud {
|
|
|
3669
3737
|
return;
|
|
3670
3738
|
}
|
|
3671
3739
|
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3672
|
-
this.
|
|
3740
|
+
this.setWidth(newWidth);
|
|
3673
3741
|
}
|
|
3674
3742
|
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3675
|
-
this.
|
|
3743
|
+
this.setHeight(newHeight);
|
|
3676
3744
|
}
|
|
3677
3745
|
this._ref.scale({
|
|
3678
3746
|
x: 1,
|
|
@@ -3913,7 +3981,7 @@ class KonvaMarkup {
|
|
|
3913
3981
|
createObject(type, params) {
|
|
3914
3982
|
let object;
|
|
3915
3983
|
let zIndex = this._zIndex;
|
|
3916
|
-
switch (type) {
|
|
3984
|
+
switch (type.toLocaleLowerCase()) {
|
|
3917
3985
|
case "line":
|
|
3918
3986
|
object = new KonvaLine(params);
|
|
3919
3987
|
zIndex = 1;
|
|
@@ -4701,8 +4769,9 @@ class KonvaMarkup {
|
|
|
4701
4769
|
}
|
|
4702
4770
|
addImage(position, src, width, height, id) {
|
|
4703
4771
|
if (!position) return;
|
|
4772
|
+
let konvaImage;
|
|
4704
4773
|
if (src) {
|
|
4705
|
-
|
|
4774
|
+
konvaImage = new KonvaImage({
|
|
4706
4775
|
position: position,
|
|
4707
4776
|
src: src,
|
|
4708
4777
|
width: width,
|
|
@@ -4718,7 +4787,7 @@ class KonvaMarkup {
|
|
|
4718
4787
|
}
|
|
4719
4788
|
}
|
|
4720
4789
|
this.removeImageInput();
|
|
4721
|
-
return;
|
|
4790
|
+
return konvaImage;
|
|
4722
4791
|
}
|
|
4723
4792
|
}
|
|
4724
4793
|
|
|
@@ -5011,9 +5080,6 @@ class VisualizeMarkup {
|
|
|
5011
5080
|
viewpoint.description = (new Date).toDateString();
|
|
5012
5081
|
return viewpoint;
|
|
5013
5082
|
}
|
|
5014
|
-
getLayer() {
|
|
5015
|
-
throw new Error("Not implemented yet");
|
|
5016
|
-
}
|
|
5017
5083
|
createObject(type, params) {
|
|
5018
5084
|
throw new Error("Not implemented yet");
|
|
5019
5085
|
}
|