@inweb/viewer-visualize 25.4.11 → 25.5.4

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.
@@ -3160,16 +3160,17 @@ class KonvaText {
3160
3160
  draggable: true,
3161
3161
  rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0
3162
3162
  });
3163
+ this._ref.width(this._ref.getTextWidth());
3163
3164
  this._ref.on("transform", (e => {
3164
3165
  const attrs = e.target.attrs;
3165
3166
  if (attrs.rotation !== this.getRotation()) this.setRotation(attrs.rotation);
3166
3167
  const newWidth = this._ref.width() * attrs.scaleX;
3167
3168
  const newHeight = this._ref.height() * attrs.scaleY;
3168
3169
  if (Math.abs(attrs.scaleX - 1) > 1e-5) {
3169
- this.setFontSize(Math.round(this.getFontSize() * newWidth / this._ref.width()));
3170
+ this._ref.width(newWidth);
3170
3171
  }
3171
3172
  if (Math.abs(attrs.scaleY - 1) > 1e-5) {
3172
- this.setFontSize(Math.round(this.getFontSize() * newHeight / this._ref.height()));
3173
+ this._ref.height(newHeight);
3173
3174
  }
3174
3175
  this._ref.scale({
3175
3176
  x: 1,
@@ -4304,23 +4305,27 @@ class KonvaMarkup {
4304
4305
  transformer.nodes([]);
4305
4306
  return;
4306
4307
  }
4307
- if (e.target.className === "Text" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
4308
- if (this._textInputRef && this._textInputRef.value) this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle); else this.createTextInput({
4309
- x: e.target.attrs.x,
4310
- y: e.target.attrs.y
4311
- }, e.evt.pageX, e.evt.pageY, e.target.attrs.rotation, e.target.attrs.text);
4312
- return;
4313
- } else {
4314
- this.removeTextInput();
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
+ }
4315
4318
  }
4316
- if (e.target.className === "Image" && transformer.nodes().length === 1 && transformer.nodes()[0] === e.target) {
4317
- if (this._imageInputRef && this._imageInputRef.value) this.addImage(this._imageInputPos, this._imageInputRef.value, 0, 0); else this.createImageInput({
4318
- x: e.target.attrs.x,
4319
- y: e.target.attrs.y
4320
- });
4321
- return;
4322
- } else {
4323
- this.removeImageInput();
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
+ }
4324
4329
  }
4325
4330
  if (transformer.nodes().filter((x => x.className === "Cloud")).length > 0 || e.target.className === "Cloud") {
4326
4331
  transformer.rotateEnabled(false);
@@ -4613,7 +4618,7 @@ class KonvaMarkup {
4613
4618
  this._textInputRef.style.top = inputY + "px";
4614
4619
  this._textInputRef.style.left = inputX + "px";
4615
4620
  this._textInputRef.onkeydown = event => {
4616
- if (event.key === "Enter") {
4621
+ if (event.key === "Enter" && !event.shiftKey) {
4617
4622
  event.preventDefault();
4618
4623
  this.addText(this._textInputRef.value, this._textInputPos, this._textInputAngle);
4619
4624
  }
@@ -5170,7 +5175,7 @@ class Viewer extends EventEmitter2 {
5170
5175
  return this._visualizeJsUrl;
5171
5176
  }
5172
5177
  configure(params) {
5173
- this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/25.4/Visualize.js";
5178
+ this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js";
5174
5179
  return this;
5175
5180
  }
5176
5181
  async initialize(canvas, onProgress) {