@inweb/viewer-visualize 25.4.7 → 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.
@@ -14689,6 +14689,7 @@
14689
14689
  draggable: true,
14690
14690
  rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0,
14691
14691
  });
14692
+ this._ref.width(this._ref.getTextWidth());
14692
14693
  this._ref.on("transform", (e) => {
14693
14694
  const attrs = e.target.attrs;
14694
14695
  if (attrs.rotation !== this.getRotation())
@@ -14696,10 +14697,10 @@
14696
14697
  const newWidth = this._ref.width() * attrs.scaleX;
14697
14698
  const newHeight = this._ref.height() * attrs.scaleY;
14698
14699
  if (Math.abs(attrs.scaleX - 1) > 10e-6) {
14699
- this.setFontSize(Math.round((this.getFontSize() * newWidth) / this._ref.width()));
14700
+ this._ref.width(newWidth);
14700
14701
  }
14701
14702
  if (Math.abs(attrs.scaleY - 1) > 10e-6) {
14702
- this.setFontSize(Math.round((this.getFontSize() * newHeight) / this._ref.height()));
14703
+ this._ref.height(newHeight);
14703
14704
  }
14704
14705
  this._ref.scale({ x: 1, y: 1 });
14705
14706
  });
@@ -15822,25 +15823,29 @@
15822
15823
  transformer.nodes([]);
15823
15824
  return;
15824
15825
  }
15825
- if (e.target.className === "Text" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
15826
- if (this._textInputRef && this._textInputRef.value)
15827
- this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
15828
- else
15829
- 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);
15830
- return;
15831
- }
15832
- else {
15833
- this.removeTextInput();
15834
- }
15835
- if (e.target.className === "Image" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
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;
15826
+ if (this._markupMode === MarkupMode.Text) {
15827
+ if (e.target.className === "Text" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
15828
+ if (this._textInputRef && this._textInputRef.value)
15829
+ this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
15830
+ else
15831
+ 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);
15832
+ return;
15833
+ }
15834
+ else {
15835
+ this.removeTextInput();
15836
+ }
15841
15837
  }
15842
- else {
15843
- this.removeImageInput();
15838
+ if (this._markupMode === MarkupMode.Image) {
15839
+ if (e.target.className === "Image" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
15840
+ if (this._imageInputRef && this._imageInputRef.value)
15841
+ this.addImage(this._imageInputPos, this._imageInputRef.value, 0, 0);
15842
+ else
15843
+ this.createImageInput({ x: e.target.attrs.x, y: e.target.attrs.y });
15844
+ return;
15845
+ }
15846
+ else {
15847
+ this.removeImageInput();
15848
+ }
15844
15849
  }
15845
15850
  if (transformer.nodes().filter((x) => x.className === "Cloud").length > 0 || e.target.className === "Cloud") {
15846
15851
  transformer.rotateEnabled(false);
@@ -16130,7 +16135,7 @@
16130
16135
  this._textInputRef.style.top = inputY + "px";
16131
16136
  this._textInputRef.style.left = inputX + "px";
16132
16137
  this._textInputRef.onkeydown = (event) => {
16133
- if (event.key === "Enter") {
16138
+ if (event.key === "Enter" && !event.shiftKey) {
16134
16139
  event.preventDefault();
16135
16140
  this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
16136
16141
  }