@inweb/viewer-visualize 25.4.6 → 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 +75 -13
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +80 -12
- 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 +19 -0
|
@@ -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,
|