@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
|
@@ -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,23 @@ class KonvaText {
|
|
|
3156
3160
|
draggable: true,
|
|
3157
3161
|
rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0
|
|
3158
3162
|
});
|
|
3163
|
+
this._ref.width(this._ref.getTextWidth());
|
|
3164
|
+
this._ref.on("transform", (e => {
|
|
3165
|
+
const attrs = e.target.attrs;
|
|
3166
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3167
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
3168
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
3169
|
+
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3170
|
+
this._ref.width(newWidth);
|
|
3171
|
+
}
|
|
3172
|
+
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3173
|
+
this._ref.height(newHeight);
|
|
3174
|
+
}
|
|
3175
|
+
this._ref.scale({
|
|
3176
|
+
x: 1,
|
|
3177
|
+
y: 1
|
|
3178
|
+
});
|
|
3179
|
+
}));
|
|
3159
3180
|
this._ref.id(this._ref._id.toString());
|
|
3160
3181
|
}
|
|
3161
3182
|
ref() {
|
|
@@ -3236,6 +3257,22 @@ class KonvaRectangle {
|
|
|
3236
3257
|
draggable: true,
|
|
3237
3258
|
strokeScaleEnabled: false
|
|
3238
3259
|
});
|
|
3260
|
+
this._ref.on("transform", (e => {
|
|
3261
|
+
const attrs = e.target.attrs;
|
|
3262
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3263
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
3264
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
3265
|
+
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3266
|
+
this.setWidth(newWidth);
|
|
3267
|
+
}
|
|
3268
|
+
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3269
|
+
this.setHeight(newHeight);
|
|
3270
|
+
}
|
|
3271
|
+
this._ref.scale({
|
|
3272
|
+
x: 1,
|
|
3273
|
+
y: 1
|
|
3274
|
+
});
|
|
3275
|
+
}));
|
|
3239
3276
|
this._ref.id(this._ref._id.toString());
|
|
3240
3277
|
}
|
|
3241
3278
|
getPosition() {
|
|
@@ -3322,6 +3359,22 @@ class KonvaEllipse {
|
|
|
3322
3359
|
draggable: true,
|
|
3323
3360
|
strokeScaleEnabled: false
|
|
3324
3361
|
});
|
|
3362
|
+
this._ref.on("transform", (e => {
|
|
3363
|
+
const attrs = e.target.attrs;
|
|
3364
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3365
|
+
const newRadiusX = this._ref.radiusX() * attrs.scaleX;
|
|
3366
|
+
const newRadiusY = this._ref.radiusY() * attrs.scaleY;
|
|
3367
|
+
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3368
|
+
this.setRadiusX(newRadiusX);
|
|
3369
|
+
}
|
|
3370
|
+
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3371
|
+
this.setRadiusY(newRadiusY);
|
|
3372
|
+
}
|
|
3373
|
+
this._ref.scale({
|
|
3374
|
+
x: 1,
|
|
3375
|
+
y: 1
|
|
3376
|
+
});
|
|
3377
|
+
}));
|
|
3325
3378
|
this._ref.id(this._ref._id.toString());
|
|
3326
3379
|
}
|
|
3327
3380
|
getPosition() {
|
|
@@ -3337,19 +3390,13 @@ class KonvaEllipse {
|
|
|
3337
3390
|
return this._ref.radiusX();
|
|
3338
3391
|
}
|
|
3339
3392
|
setRadiusX(r) {
|
|
3340
|
-
this._ref.
|
|
3341
|
-
x: r,
|
|
3342
|
-
y: this._ref.radiusY()
|
|
3343
|
-
});
|
|
3393
|
+
this._ref.radiusX(r);
|
|
3344
3394
|
}
|
|
3345
3395
|
getRadiusY() {
|
|
3346
3396
|
return this._ref.radiusY();
|
|
3347
3397
|
}
|
|
3348
3398
|
setRadiusY(r) {
|
|
3349
|
-
this._ref.
|
|
3350
|
-
x: this._ref.radiusX(),
|
|
3351
|
-
y: r
|
|
3352
|
-
});
|
|
3399
|
+
this._ref.radiusY(r);
|
|
3353
3400
|
}
|
|
3354
3401
|
getLineWidth() {
|
|
3355
3402
|
return this._ref.strokeWidth();
|
|
@@ -3412,6 +3459,10 @@ class KonvaArrow {
|
|
|
3412
3459
|
draggable: true,
|
|
3413
3460
|
strokeScaleEnabled: false
|
|
3414
3461
|
});
|
|
3462
|
+
this._ref.on("transform", (e => {
|
|
3463
|
+
const attrs = e.target.attrs;
|
|
3464
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3465
|
+
}));
|
|
3415
3466
|
this._ref.id(this._ref._id.toString());
|
|
3416
3467
|
}
|
|
3417
3468
|
ref() {
|
|
@@ -3431,6 +3482,7 @@ class KonvaArrow {
|
|
|
3431
3482
|
}
|
|
3432
3483
|
setColor(hex) {
|
|
3433
3484
|
this._ref.stroke(hex);
|
|
3485
|
+
this._ref.fill(hex);
|
|
3434
3486
|
}
|
|
3435
3487
|
getRotation() {
|
|
3436
3488
|
return this._ref.rotation();
|
|
@@ -3514,6 +3566,22 @@ class KonvaImage {
|
|
|
3514
3566
|
this._ratio = this._ref.height() === 0 || this._ref.width() === 0 ? 1 : this._ref.height() / this._ref.width();
|
|
3515
3567
|
};
|
|
3516
3568
|
this._canvasImage.src = params.src;
|
|
3569
|
+
this._ref.on("transform", (e => {
|
|
3570
|
+
const attrs = e.target.attrs;
|
|
3571
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3572
|
+
const newWidth = this._ref.width() * attrs.scaleX;
|
|
3573
|
+
const newHeight = this._ref.height() * attrs.scaleY;
|
|
3574
|
+
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3575
|
+
this.setWidth(newWidth);
|
|
3576
|
+
}
|
|
3577
|
+
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3578
|
+
this.setHeight(newHeight);
|
|
3579
|
+
}
|
|
3580
|
+
this._ref.scale({
|
|
3581
|
+
x: 1,
|
|
3582
|
+
y: 1
|
|
3583
|
+
});
|
|
3584
|
+
}));
|
|
3517
3585
|
this._ref.id(this._ref._id.toString());
|
|
3518
3586
|
}
|
|
3519
3587
|
getSrc() {
|
|
@@ -3657,10 +3725,11 @@ class KonvaCloud {
|
|
|
3657
3725
|
this._ref.className = "Cloud";
|
|
3658
3726
|
this._ref.on("transform", (e => {
|
|
3659
3727
|
const attrs = e.target.attrs;
|
|
3660
|
-
|
|
3661
|
-
const minHeight = 100;
|
|
3728
|
+
if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
|
|
3662
3729
|
const newWidth = this._ref.width() * attrs.scaleX;
|
|
3663
3730
|
const newHeight = this._ref.height() * attrs.scaleY;
|
|
3731
|
+
const minWidth = 100;
|
|
3732
|
+
const minHeight = 100;
|
|
3664
3733
|
if (newWidth < minWidth || newHeight < minHeight) {
|
|
3665
3734
|
this._ref.scale({
|
|
3666
3735
|
x: 1,
|
|
@@ -3669,10 +3738,10 @@ class KonvaCloud {
|
|
|
3669
3738
|
return;
|
|
3670
3739
|
}
|
|
3671
3740
|
if (Math.abs(attrs.scaleX - 1) > 1e-5) {
|
|
3672
|
-
this.
|
|
3741
|
+
this.setWidth(newWidth);
|
|
3673
3742
|
}
|
|
3674
3743
|
if (Math.abs(attrs.scaleY - 1) > 1e-5) {
|
|
3675
|
-
this.
|
|
3744
|
+
this.setHeight(newHeight);
|
|
3676
3745
|
}
|
|
3677
3746
|
this._ref.scale({
|
|
3678
3747
|
x: 1,
|
|
@@ -4236,23 +4305,27 @@ class KonvaMarkup {
|
|
|
4236
4305
|
transformer.nodes([]);
|
|
4237
4306
|
return;
|
|
4238
4307
|
}
|
|
4239
|
-
if (
|
|
4240
|
-
if (
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4308
|
+
if (this._markupMode === MarkupMode.Text) {
|
|
4309
|
+
if (e.target.className === "Text" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
|
|
4310
|
+
if (this._textInputRef && this._textInputRef.value) this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle); else this.createTextInput({
|
|
4311
|
+
x: e.target.attrs.x,
|
|
4312
|
+
y: e.target.attrs.y
|
|
4313
|
+
}, e.evt.pageX, e.evt.pageY, e.target.attrs.rotation, e.target.attrs.text);
|
|
4314
|
+
return;
|
|
4315
|
+
} else {
|
|
4316
|
+
this.removeTextInput();
|
|
4317
|
+
}
|
|
4247
4318
|
}
|
|
4248
|
-
if (
|
|
4249
|
-
if (
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4319
|
+
if (this._markupMode === MarkupMode.Image) {
|
|
4320
|
+
if (e.target.className === "Image" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
|
|
4321
|
+
if (this._imageInputRef && this._imageInputRef.value) this.addImage(this._imageInputPos, this._imageInputRef.value, 0, 0); else this.createImageInput({
|
|
4322
|
+
x: e.target.attrs.x,
|
|
4323
|
+
y: e.target.attrs.y
|
|
4324
|
+
});
|
|
4325
|
+
return;
|
|
4326
|
+
} else {
|
|
4327
|
+
this.removeImageInput();
|
|
4328
|
+
}
|
|
4256
4329
|
}
|
|
4257
4330
|
if (transformer.nodes().filter((x => x.className === "Cloud")).length > 0 || e.target.className === "Cloud") {
|
|
4258
4331
|
transformer.rotateEnabled(false);
|
|
@@ -4545,7 +4618,7 @@ class KonvaMarkup {
|
|
|
4545
4618
|
this._textInputRef.style.top = inputY + "px";
|
|
4546
4619
|
this._textInputRef.style.left = inputX + "px";
|
|
4547
4620
|
this._textInputRef.onkeydown = event => {
|
|
4548
|
-
if (event.key === "Enter") {
|
|
4621
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
4549
4622
|
event.preventDefault();
|
|
4550
4623
|
this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
|
|
4551
4624
|
}
|