@inweb/viewer-visualize 25.6.0 → 25.6.1

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.
@@ -14591,8 +14591,8 @@
14591
14591
  });
14592
14592
  this._ref.on("transform", (e) => {
14593
14593
  const attrs = e.target.attrs;
14594
- if (attrs.rotation !== this.getRotation())
14595
- this.setRotation(attrs.rotation);
14594
+ if (attrs.rotation !== this._ref.rotation())
14595
+ this._ref.rotation(attrs.rotation);
14596
14596
  });
14597
14597
  this._ref.id(this._ref._id.toString());
14598
14598
  }
@@ -14693,19 +14693,25 @@
14693
14693
  this._ref.width(this._ref.getTextWidth());
14694
14694
  this._ref.on("transform", (e) => {
14695
14695
  const attrs = e.target.attrs;
14696
- if (attrs.rotation !== this.getRotation())
14697
- this.setRotation(attrs.rotation);
14698
- const newWidth = this._ref.width() * attrs.scaleX;
14699
- const newHeight = this._ref.height() * attrs.scaleY;
14696
+ if (attrs.rotation !== this._ref.rotation())
14697
+ this._ref.rotation(attrs.rotation);
14698
+ const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
14699
+ const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
14700
+ let newWidth = this._ref.width();
14701
+ if (scaleByX)
14702
+ newWidth *= attrs.scaleX;
14703
+ let newHeight = this._ref.height();
14704
+ if (scaleByY)
14705
+ newHeight *= attrs.scaleY;
14700
14706
  const minWidth = 50;
14701
- if (newWidth < minWidth || newHeight < Math.round(this.getFontSize())) {
14702
- this._ref.scale({ x: 1, y: 1 });
14703
- return;
14704
- }
14705
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
14707
+ if (newWidth < minWidth)
14708
+ newWidth = minWidth;
14709
+ if (newHeight < Math.round(this.getFontSize()))
14710
+ newHeight = Math.round(this.getFontSize());
14711
+ if (scaleByX) {
14706
14712
  this._ref.width(newWidth);
14707
14713
  }
14708
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
14714
+ if (scaleByY) {
14709
14715
  this._ref.height(newHeight);
14710
14716
  }
14711
14717
  this._ref.scale({ x: 1, y: 1 });
@@ -14790,21 +14796,27 @@
14790
14796
  });
14791
14797
  this._ref.on("transform", (e) => {
14792
14798
  const attrs = e.target.attrs;
14793
- if (attrs.rotation !== this.getRotation())
14794
- this.setRotation(attrs.rotation);
14795
- let newWidth = this._ref.width() * attrs.scaleX;
14796
- let newHeight = this._ref.height() * attrs.scaleY;
14799
+ if (attrs.rotation !== this._ref.rotation())
14800
+ this._ref.rotation(attrs.rotation);
14801
+ const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
14802
+ const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
14803
+ let newWidth = this._ref.width();
14804
+ if (scaleByX)
14805
+ newWidth *= attrs.scaleX;
14806
+ let newHeight = this._ref.height();
14807
+ if (scaleByY)
14808
+ newHeight *= attrs.scaleY;
14797
14809
  const minWidth = 50;
14798
14810
  const minHeight = 50;
14799
- if (newWidth < minWidth || newHeight < minHeight) {
14800
- this._ref.scale({ x: 1, y: 1 });
14801
- return;
14802
- }
14803
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
14804
- this.setWidth(newWidth);
14811
+ if (newWidth < minWidth)
14812
+ newWidth = minWidth;
14813
+ if (newHeight < minHeight)
14814
+ newHeight = minHeight;
14815
+ if (scaleByX) {
14816
+ this._ref.width(newWidth);
14805
14817
  }
14806
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
14807
- this.setHeight(newHeight);
14818
+ if (scaleByY) {
14819
+ this._ref.height(newHeight);
14808
14820
  }
14809
14821
  this._ref.scale({ x: 1, y: 1 });
14810
14822
  });
@@ -14894,21 +14906,32 @@
14894
14906
  });
14895
14907
  this._ref.on("transform", (e) => {
14896
14908
  const attrs = e.target.attrs;
14897
- if (attrs.rotation !== this.getRotation())
14898
- this.setRotation(attrs.rotation);
14899
- const newRadiusX = this._ref.radiusX() * attrs.scaleX;
14900
- const newRadiusY = this._ref.radiusY() * attrs.scaleY;
14909
+ if (attrs.rotation !== this._ref.rotation())
14910
+ this._ref.rotation(attrs.rotation);
14911
+ const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
14912
+ const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
14913
+ let newRadiusX = this._ref.radiusX();
14914
+ if (scaleByX)
14915
+ newRadiusX *= attrs.scaleX;
14916
+ let newRadiusY = this._ref.radiusY();
14917
+ if (scaleByY)
14918
+ newRadiusY *= attrs.scaleY;
14901
14919
  const minRadiusX = 25;
14902
14920
  const minRadiusY = 25;
14903
- if (newRadiusX < minRadiusX || newRadiusY < minRadiusY) {
14904
- this._ref.scale({ x: 1, y: 1 });
14905
- return;
14906
- }
14907
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
14908
- this.setRadiusX(newRadiusX);
14921
+ if (newRadiusX < minRadiusX)
14922
+ newRadiusX = minRadiusX;
14923
+ if (newRadiusY < minRadiusY)
14924
+ newRadiusY = minRadiusY;
14925
+ if (e.evt.ctrlKey || e.evt.shiftKey) {
14926
+ if (scaleByX) {
14927
+ this._ref.radius({ x: newRadiusX, y: newRadiusX });
14928
+ }
14929
+ else {
14930
+ this._ref.radius({ x: newRadiusY, y: newRadiusY });
14931
+ }
14909
14932
  }
14910
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
14911
- this.setRadiusY(newRadiusY);
14933
+ else {
14934
+ this._ref.radius({ x: newRadiusX, y: newRadiusY });
14912
14935
  }
14913
14936
  this._ref.scale({ x: 1, y: 1 });
14914
14937
  });
@@ -14997,8 +15020,8 @@
14997
15020
  });
14998
15021
  this._ref.on("transform", (e) => {
14999
15022
  const attrs = e.target.attrs;
15000
- if (attrs.rotation !== this.getRotation())
15001
- this.setRotation(attrs.rotation);
15023
+ if (attrs.rotation !== this._ref.rotation())
15024
+ this._ref.rotation(attrs.rotation);
15002
15025
  });
15003
15026
  this._ref.id(this._ref._id.toString());
15004
15027
  }
@@ -15100,15 +15123,33 @@
15100
15123
  this._canvasImage.src = params.src;
15101
15124
  this._ref.on("transform", (e) => {
15102
15125
  const attrs = e.target.attrs;
15103
- if (attrs.rotation !== this.getRotation())
15104
- this.setRotation(attrs.rotation);
15105
- const newWidth = this._ref.width() * attrs.scaleX;
15106
- const newHeight = this._ref.height() * attrs.scaleY;
15107
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
15108
- this.setWidth(newWidth);
15126
+ if (attrs.rotation !== this._ref.rotation())
15127
+ this._ref.rotation(attrs.rotation);
15128
+ const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
15129
+ const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
15130
+ let newWidth = this._ref.width();
15131
+ if (scaleByX)
15132
+ newWidth *= attrs.scaleX;
15133
+ let newHeight = this._ref.height();
15134
+ if (scaleByY)
15135
+ newHeight *= attrs.scaleY;
15136
+ if (e.evt.ctrlKey || e.evt.shiftKey) {
15137
+ if (scaleByX) {
15138
+ this._ref.width(newWidth);
15139
+ this._ref.height(newWidth * this._ratio);
15140
+ }
15141
+ else {
15142
+ this._ref.width(newHeight / this._ratio);
15143
+ this._ref.height(newHeight);
15144
+ }
15109
15145
  }
15110
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
15111
- this.setHeight(newHeight);
15146
+ else {
15147
+ if (scaleByX) {
15148
+ this._ref.width(newWidth);
15149
+ }
15150
+ if (scaleByY) {
15151
+ this._ref.height(newHeight);
15152
+ }
15112
15153
  }
15113
15154
  this._ref.scale({ x: 1, y: 1 });
15114
15155
  });
@@ -15241,21 +15282,27 @@
15241
15282
  this._ref.className = "Cloud";
15242
15283
  this._ref.on("transform", (e) => {
15243
15284
  const attrs = e.target.attrs;
15244
- if (attrs.rotation !== this.getRotation())
15245
- this.setRotation(attrs.rotation);
15246
- const newWidth = this._ref.width() * attrs.scaleX;
15247
- const newHeight = this._ref.height() * attrs.scaleY;
15285
+ if (attrs.rotation !== this._ref.rotation())
15286
+ this._ref.rotation(attrs.rotation);
15287
+ const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
15288
+ const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
15289
+ let newWidth = this._ref.width();
15290
+ if (scaleByX)
15291
+ newWidth *= attrs.scaleX;
15292
+ let newHeight = this._ref.height();
15293
+ if (scaleByY)
15294
+ newHeight *= attrs.scaleY;
15248
15295
  const minWidth = 100;
15249
15296
  const minHeight = 100;
15250
- if (newWidth < minWidth || newHeight < minHeight) {
15251
- this._ref.scale({ x: 1, y: 1 });
15252
- return;
15253
- }
15254
- if (Math.abs(attrs.scaleX - 1) > 10e-6) {
15255
- this.setWidth(newWidth);
15297
+ if (newWidth < minWidth)
15298
+ newWidth = minWidth;
15299
+ if (newHeight < minHeight)
15300
+ newHeight = minHeight;
15301
+ if (scaleByX) {
15302
+ this._ref.width(newWidth);
15256
15303
  }
15257
- if (Math.abs(attrs.scaleY - 1) > 10e-6) {
15258
- this.setHeight(newHeight);
15304
+ if (scaleByY) {
15305
+ this._ref.height(newHeight);
15259
15306
  }
15260
15307
  this._ref.scale({ x: 1, y: 1 });
15261
15308
  });
@@ -15723,6 +15770,7 @@
15723
15770
  const transformer = new Konva.Transformer({
15724
15771
  shouldOverdrawWholeArea: false,
15725
15772
  keepRatio: false,
15773
+ flipEnabled: false,
15726
15774
  });
15727
15775
  this._konvaTransformer = transformer;
15728
15776
  layer.add(transformer);