@inweb/viewer-visualize 25.4.10 → 25.4.11

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