@inweb/markup 26.4.0 → 26.4.2

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.
Files changed (38) hide show
  1. package/dist/markup.js +561 -126
  2. package/dist/markup.js.map +1 -1
  3. package/dist/markup.min.js +1 -1
  4. package/dist/markup.module.js +672 -138
  5. package/dist/markup.module.js.map +1 -1
  6. package/lib/markup/IMarkupArrow.d.ts +8 -8
  7. package/lib/markup/IMarkupCloud.d.ts +12 -5
  8. package/lib/markup/IMarkupEllipse.d.ts +4 -4
  9. package/lib/markup/IMarkupImage.d.ts +3 -3
  10. package/lib/markup/IMarkupLine.d.ts +2 -2
  11. package/lib/markup/IMarkupObject.d.ts +4 -0
  12. package/lib/markup/IMarkupRectangle.d.ts +10 -3
  13. package/lib/markup/IMarkupText.d.ts +3 -3
  14. package/lib/markup/Konva/KonvaArrow.d.ts +4 -1
  15. package/lib/markup/Konva/KonvaCloud.d.ts +4 -1
  16. package/lib/markup/Konva/KonvaEllipse.d.ts +4 -1
  17. package/lib/markup/Konva/KonvaImage.d.ts +4 -1
  18. package/lib/markup/Konva/KonvaLine.d.ts +4 -1
  19. package/lib/markup/Konva/KonvaMarkup.d.ts +2 -2
  20. package/lib/markup/Konva/KonvaRectangle.d.ts +4 -1
  21. package/lib/markup/Konva/KonvaText.d.ts +4 -1
  22. package/package.json +3 -3
  23. package/src/markup/IMarkupArrow.ts +8 -8
  24. package/src/markup/IMarkupCloud.ts +10 -5
  25. package/src/markup/IMarkupEllipse.ts +4 -4
  26. package/src/markup/IMarkupImage.ts +3 -3
  27. package/src/markup/IMarkupLine.ts +2 -2
  28. package/src/markup/IMarkupObject.ts +5 -0
  29. package/src/markup/IMarkupRectangle.ts +8 -3
  30. package/src/markup/IMarkupText.ts +3 -3
  31. package/src/markup/Konva/KonvaArrow.ts +49 -4
  32. package/src/markup/Konva/KonvaCloud.ts +110 -11
  33. package/src/markup/Konva/KonvaEllipse.ts +102 -2
  34. package/src/markup/Konva/KonvaImage.ts +60 -2
  35. package/src/markup/Konva/KonvaLine.ts +97 -3
  36. package/src/markup/Konva/KonvaMarkup.ts +182 -166
  37. package/src/markup/Konva/KonvaRectangle.ts +103 -4
  38. package/src/markup/Konva/KonvaText.ts +61 -2
package/dist/markup.js CHANGED
@@ -12001,16 +12001,50 @@
12001
12001
  }
12002
12002
  }
12003
12003
 
12004
+ ///////////////////////////////////////////////////////////////////////////////
12005
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
12006
+ // All rights reserved.
12007
+ //
12008
+ // This software and its documentation and related materials are owned by
12009
+ // the Alliance. The software may only be incorporated into application
12010
+ // programs owned by members of the Alliance, subject to a signed
12011
+ // Membership Agreement and Supplemental Software License Agreement with the
12012
+ // Alliance. The structure and organization of this software are the valuable
12013
+ // trade secrets of the Alliance and its suppliers. The software is also
12014
+ // protected by copyright law and international treaty provisions. Application
12015
+ // programs incorporating this software must include the following statement
12016
+ // with their copyright notices:
12017
+ //
12018
+ // This application incorporates Open Design Alliance software pursuant to a
12019
+ // license agreement with Open Design Alliance.
12020
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
12021
+ // All rights reserved.
12022
+ //
12023
+ // By use of this software, its documentation or related materials, you
12024
+ // acknowledge and accept the above terms.
12025
+ ///////////////////////////////////////////////////////////////////////////////
12004
12026
  const LineTypeSpecs = new Map([
12005
12027
  ["solid", []],
12006
12028
  ["dot", [30, 30, 0.001, 30]],
12007
12029
  ["dash", [30, 30]],
12008
12030
  ]);
12009
12031
  class KonvaLine {
12010
- constructor(params, ref = null) {
12032
+ constructor(params, ref = null, worldTransformer = new WorldTransform()) {
12011
12033
  var _a, _b;
12034
+ this._worldTransformer = worldTransformer;
12012
12035
  if (ref) {
12013
12036
  this._ref = ref;
12037
+ let wcsPoints = this._ref.getAttr("wcsPoints");
12038
+ if (!wcsPoints) {
12039
+ wcsPoints = [];
12040
+ let points = this._ref.points();
12041
+ let wcsPoint;
12042
+ for (let i = 0; i < points.length; i += 2) {
12043
+ wcsPoint = this._worldTransformer.screenToWorld({ x: points[i], y: points[i + 1] });
12044
+ wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
12045
+ }
12046
+ this._ref.setAttr("wcsPoints", wcsPoints);
12047
+ }
12014
12048
  return;
12015
12049
  }
12016
12050
  if (!params)
@@ -12021,7 +12055,12 @@
12021
12055
  { x: 100, y: 100 },
12022
12056
  ];
12023
12057
  const konvaPoints = [];
12024
- params.points.forEach((point) => konvaPoints.push(point.x, point.y));
12058
+ const wcsPoints = [];
12059
+ params.points.forEach((point) => {
12060
+ konvaPoints.push(point.x, point.y);
12061
+ let wcsPoint = this._worldTransformer.screenToWorld({ x: point.x, y: point.y });
12062
+ wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
12063
+ });
12025
12064
  this._ref = new Konva.Line({
12026
12065
  stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
12027
12066
  strokeWidth: (_b = params.width) !== null && _b !== undefined ? _b : 4,
@@ -12033,11 +12072,36 @@
12033
12072
  strokeScaleEnabled: false,
12034
12073
  dash: LineTypeSpecs.get(params.type) || [],
12035
12074
  });
12075
+ this._ref.setAttr("wcsPoints", wcsPoints);
12036
12076
  this._ref.on("transform", (e) => {
12037
12077
  const attrs = e.target.attrs;
12038
12078
  if (attrs.rotation !== this._ref.rotation())
12039
12079
  this._ref.rotation(attrs.rotation);
12040
12080
  });
12081
+ this._ref.on("transformend", (e) => {
12082
+ const absoluteTransform = this._ref.getAbsoluteTransform();
12083
+ let wcsPoints = [];
12084
+ let points = this._ref.points();
12085
+ let wcsPoint;
12086
+ for (let i = 0; i < points.length; i += 2) {
12087
+ const position = absoluteTransform.point({ x: points[i], y: points[i + 1] });
12088
+ wcsPoint = this._worldTransformer.screenToWorld({ x: position.x, y: position.y });
12089
+ wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
12090
+ }
12091
+ this._ref.setAttr("wcsPoints", wcsPoints);
12092
+ });
12093
+ this._ref.on("dragend", (e) => {
12094
+ const absoluteTransform = this._ref.getAbsoluteTransform();
12095
+ let wcsPoints = [];
12096
+ let points = this._ref.points();
12097
+ let wcsPoint;
12098
+ for (let i = 0; i < points.length; i += 2) {
12099
+ const position = absoluteTransform.point({ x: points[i], y: points[i + 1] });
12100
+ wcsPoint = this._worldTransformer.screenToWorld({ x: position.x, y: position.y });
12101
+ wcsPoints.push({ x: wcsPoint.x, y: wcsPoint.y, z: wcsPoint.z });
12102
+ }
12103
+ this._ref.setAttr("wcsPoints", wcsPoints);
12104
+ });
12041
12105
  this._ref.id(this._ref._id.toString());
12042
12106
  }
12043
12107
  ref() {
@@ -12106,19 +12170,64 @@
12106
12170
  }
12107
12171
  addPoints(points) {
12108
12172
  let newPoints = this._ref.points();
12173
+ let wcsPoints = this._ref.getAttr("wcsPoints");
12109
12174
  points.forEach((point) => {
12110
12175
  newPoints = newPoints.concat([point.x, point.y]);
12176
+ let wcsPoint = this._worldTransformer.screenToWorld(point);
12177
+ wcsPoints.push(wcsPoint);
12111
12178
  });
12112
12179
  this._ref.points(newPoints);
12113
12180
  }
12181
+ updateScreenCoordinates() {
12182
+ let wcsPoints = this._ref.getAttr("wcsPoints");
12183
+ let points = [];
12184
+ let invert = this._ref.getAbsoluteTransform().copy();
12185
+ invert = invert.invert();
12186
+ wcsPoints.forEach((point) => {
12187
+ let screenPoint = this._worldTransformer.worldToScreen(point);
12188
+ screenPoint = invert.point({ x: screenPoint.x, y: screenPoint.y });
12189
+ points.push(screenPoint.x);
12190
+ points.push(screenPoint.y);
12191
+ });
12192
+ this._ref.points([]);
12193
+ this._ref.points(points);
12194
+ this._ref.clearCache();
12195
+ }
12114
12196
  }
12115
12197
 
12198
+ ///////////////////////////////////////////////////////////////////////////////
12199
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
12200
+ // All rights reserved.
12201
+ //
12202
+ // This software and its documentation and related materials are owned by
12203
+ // the Alliance. The software may only be incorporated into application
12204
+ // programs owned by members of the Alliance, subject to a signed
12205
+ // Membership Agreement and Supplemental Software License Agreement with the
12206
+ // Alliance. The structure and organization of this software are the valuable
12207
+ // trade secrets of the Alliance and its suppliers. The software is also
12208
+ // protected by copyright law and international treaty provisions. Application
12209
+ // programs incorporating this software must include the following statement
12210
+ // with their copyright notices:
12211
+ //
12212
+ // This application incorporates Open Design Alliance software pursuant to a
12213
+ // license agreement with Open Design Alliance.
12214
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
12215
+ // All rights reserved.
12216
+ //
12217
+ // By use of this software, its documentation or related materials, you
12218
+ // acknowledge and accept the above terms.
12219
+ ///////////////////////////////////////////////////////////////////////////////
12116
12220
  class KonvaText {
12117
- constructor(params, ref = null) {
12221
+ constructor(params, ref = null, worldTransformer = new WorldTransform()) {
12118
12222
  var _a, _b, _c;
12119
12223
  this.TEXT_FONT_FAMILY = "Calibri";
12224
+ this._worldTransformer = worldTransformer;
12120
12225
  if (ref) {
12121
12226
  this._ref = ref;
12227
+ const wcsStart = this._ref.getAttr("wcsStart");
12228
+ if (!wcsStart) {
12229
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
12230
+ }
12122
12231
  return;
12123
12232
  }
12124
12233
  if (!params)
@@ -12139,6 +12248,7 @@
12139
12248
  rotation: (_c = params.rotation) !== null && _c !== undefined ? _c : 0,
12140
12249
  });
12141
12250
  this._ref.width(this._ref.getTextWidth());
12251
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
12142
12252
  this._ref.on("transform", (e) => {
12143
12253
  const attrs = e.target.attrs;
12144
12254
  if (attrs.rotation !== this._ref.rotation())
@@ -12164,6 +12274,19 @@
12164
12274
  }
12165
12275
  this._ref.scale({ x: 1, y: 1 });
12166
12276
  });
12277
+ this._ref.on("transformend", (e) => {
12278
+ const attrs = e.target.attrs;
12279
+ if (attrs.rotation !== this._ref.rotation())
12280
+ this._ref.rotation(attrs.rotation);
12281
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12282
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
12283
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
12284
+ });
12285
+ this._ref.on("dragend", (e) => {
12286
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12287
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
12288
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
12289
+ });
12167
12290
  this._ref.id(this._ref._id.toString());
12168
12291
  }
12169
12292
  ref() {
@@ -12211,6 +12334,7 @@
12211
12334
  }
12212
12335
  setPosition(x, y) {
12213
12336
  this._ref.setPosition({ x, y });
12337
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
12214
12338
  }
12215
12339
  getFontSize() {
12216
12340
  return this._ref.fontSize();
@@ -12218,19 +12342,72 @@
12218
12342
  setFontSize(size) {
12219
12343
  this._ref.fontSize(size);
12220
12344
  }
12345
+ updateScreenCoordinates() {
12346
+ let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
12347
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
12348
+ invert = invert.invert();
12349
+ const positionStart = invert.point(screenPositionStart);
12350
+ this._ref.position({ x: positionStart.x, y: positionStart.y });
12351
+ }
12221
12352
  }
12222
12353
 
12354
+ ///////////////////////////////////////////////////////////////////////////////
12355
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
12356
+ // All rights reserved.
12357
+ //
12358
+ // This software and its documentation and related materials are owned by
12359
+ // the Alliance. The software may only be incorporated into application
12360
+ // programs owned by members of the Alliance, subject to a signed
12361
+ // Membership Agreement and Supplemental Software License Agreement with the
12362
+ // Alliance. The structure and organization of this software are the valuable
12363
+ // trade secrets of the Alliance and its suppliers. The software is also
12364
+ // protected by copyright law and international treaty provisions. Application
12365
+ // programs incorporating this software must include the following statement
12366
+ // with their copyright notices:
12367
+ //
12368
+ // This application incorporates Open Design Alliance software pursuant to a
12369
+ // license agreement with Open Design Alliance.
12370
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
12371
+ // All rights reserved.
12372
+ //
12373
+ // By use of this software, its documentation or related materials, you
12374
+ // acknowledge and accept the above terms.
12375
+ ///////////////////////////////////////////////////////////////////////////////
12223
12376
  class KonvaRectangle {
12224
- constructor(params, ref = null) {
12377
+ constructor(params, ref = null, worldTransformer = new WorldTransform()) {
12225
12378
  var _a, _b, _c, _d;
12379
+ this._worldTransformer = worldTransformer;
12226
12380
  if (ref) {
12227
12381
  this._ref = ref;
12382
+ const wcsStart = this._ref.getAttr("wcsStart");
12383
+ const wcsEnd = this._ref.getAttr("wcsEnd");
12384
+ if (!wcsStart) {
12385
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
12386
+ }
12387
+ if (!wcsEnd) {
12388
+ const rightBottomPoint = { x: ref.x() + ref.width(), y: ref.y() + ref.height() };
12389
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: rightBottomPoint.x, y: rightBottomPoint.y }));
12390
+ }
12228
12391
  return;
12229
12392
  }
12230
12393
  if (!params)
12231
12394
  params = {};
12232
12395
  if (!params.position)
12233
12396
  params.position = { x: 0, y: 0 };
12397
+ if (params.position2) {
12398
+ params.width = params.position.x - params.position2.x;
12399
+ params.height = params.position.y - params.position2.y;
12400
+ }
12401
+ else {
12402
+ if (!params.width || !params.height) {
12403
+ params.position2 = { x: 200, y: 200 };
12404
+ params.width = 200;
12405
+ params.height = 200;
12406
+ }
12407
+ else {
12408
+ params.position2 = { x: params.position.x + params.width, y: params.position.y + params.height };
12409
+ }
12410
+ }
12234
12411
  this._ref = new Konva.Rect({
12235
12412
  stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
12236
12413
  strokeWidth: (_b = params.lineWidth) !== null && _b !== undefined ? _b : 4,
@@ -12244,10 +12421,10 @@
12244
12421
  draggable: true,
12245
12422
  strokeScaleEnabled: false,
12246
12423
  });
12424
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
12425
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: params.position2.x, y: params.position2.y }));
12247
12426
  this._ref.on("transform", (e) => {
12248
12427
  const attrs = e.target.attrs;
12249
- if (attrs.rotation !== this._ref.rotation())
12250
- this._ref.rotation(attrs.rotation);
12251
12428
  const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
12252
12429
  const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
12253
12430
  let newWidth = this._ref.width();
@@ -12270,6 +12447,21 @@
12270
12447
  }
12271
12448
  this._ref.scale({ x: 1, y: 1 });
12272
12449
  });
12450
+ this._ref.on("transformend", (e) => {
12451
+ const attrs = e.target.attrs;
12452
+ if (attrs.rotation !== this._ref.rotation())
12453
+ this._ref.rotation(attrs.rotation);
12454
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12455
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
12456
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
12457
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
12458
+ });
12459
+ this._ref.on("dragend", (e) => {
12460
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12461
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
12462
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
12463
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
12464
+ });
12273
12465
  this._ref.id(this._ref._id.toString());
12274
12466
  }
12275
12467
  getPosition() {
@@ -12283,12 +12475,19 @@
12283
12475
  }
12284
12476
  setWidth(w) {
12285
12477
  this._ref.width(w);
12478
+ const rightLowerPoint = { x: this._ref.x() + w, y: this._ref.y() + this._ref.height() };
12479
+ const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
12480
+ this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
12286
12481
  }
12287
12482
  setHeight(h) {
12288
12483
  this._ref.height(h);
12484
+ const rightLowerPoint = { x: this._ref.x() + this._ref.width(), y: this._ref.y() + h };
12485
+ const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
12486
+ this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
12289
12487
  }
12290
12488
  setPosition(x, y) {
12291
12489
  this._ref.setPosition({ x, y });
12490
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
12292
12491
  }
12293
12492
  ref() {
12294
12493
  return this._ref;
@@ -12330,13 +12529,59 @@
12330
12529
  getLineWidth() {
12331
12530
  return this._ref.strokeWidth();
12332
12531
  }
12532
+ updateScreenCoordinates() {
12533
+ let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
12534
+ let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
12535
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
12536
+ invert = invert.invert();
12537
+ const positionStart = invert.point(screenPositionStart);
12538
+ const positionEnd = invert.point(screenPositionEnd);
12539
+ this._ref.position({ x: positionStart.x, y: positionStart.y });
12540
+ this._ref.width(Math.abs(positionEnd.x - positionStart.x));
12541
+ this._ref.height(Math.abs(positionEnd.y - positionStart.y));
12542
+ }
12333
12543
  }
12334
12544
 
12545
+ ///////////////////////////////////////////////////////////////////////////////
12546
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
12547
+ // All rights reserved.
12548
+ //
12549
+ // This software and its documentation and related materials are owned by
12550
+ // the Alliance. The software may only be incorporated into application
12551
+ // programs owned by members of the Alliance, subject to a signed
12552
+ // Membership Agreement and Supplemental Software License Agreement with the
12553
+ // Alliance. The structure and organization of this software are the valuable
12554
+ // trade secrets of the Alliance and its suppliers. The software is also
12555
+ // protected by copyright law and international treaty provisions. Application
12556
+ // programs incorporating this software must include the following statement
12557
+ // with their copyright notices:
12558
+ //
12559
+ // This application incorporates Open Design Alliance software pursuant to a
12560
+ // license agreement with Open Design Alliance.
12561
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
12562
+ // All rights reserved.
12563
+ //
12564
+ // By use of this software, its documentation or related materials, you
12565
+ // acknowledge and accept the above terms.
12566
+ ///////////////////////////////////////////////////////////////////////////////
12335
12567
  class KonvaEllipse {
12336
- constructor(params, ref = null) {
12568
+ constructor(params, ref = null, worldTransformer = new WorldTransform()) {
12337
12569
  var _a, _b;
12570
+ this._worldTransformer = worldTransformer;
12338
12571
  if (ref) {
12339
12572
  this._ref = ref;
12573
+ const wcsPosition = this._ref.getAttr("wcsPosition");
12574
+ const radiusX = this._ref.getAttr("wcsRadiusX");
12575
+ const radiusY = this._ref.getAttr("wcsRadiusY");
12576
+ if (!wcsPosition) {
12577
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
12578
+ }
12579
+ if (!radiusX) {
12580
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({ x: ref.x() + ref.radiusX(), y: ref.y() }));
12581
+ }
12582
+ if (!radiusY) {
12583
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() + ref.radiusY() }));
12584
+ }
12340
12585
  return;
12341
12586
  }
12342
12587
  if (!params)
@@ -12358,6 +12603,9 @@
12358
12603
  draggable: true,
12359
12604
  strokeScaleEnabled: false,
12360
12605
  });
12606
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
12607
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({ x: this._ref.x() + params.radius.x, y: this._ref.y() }));
12608
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({ x: this._ref.x(), y: this._ref.y() + params.radius.y }));
12361
12609
  this._ref.on("transform", (e) => {
12362
12610
  const attrs = e.target.attrs;
12363
12611
  if (attrs.rotation !== this._ref.rotation())
@@ -12389,6 +12637,24 @@
12389
12637
  }
12390
12638
  this._ref.scale({ x: 1, y: 1 });
12391
12639
  });
12640
+ this._ref.on("transformend", (e) => {
12641
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12642
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
12643
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld(position));
12644
+ const radiusX = absoluteTransform.point({ x: this._ref.x() + this._ref.radiusX(), y: this._ref.y() });
12645
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld(radiusX));
12646
+ const radiusY = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() + this._ref.radiusY() });
12647
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld(radiusY));
12648
+ });
12649
+ this._ref.on("dragend", (e) => {
12650
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12651
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
12652
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld(position));
12653
+ const radiusX = absoluteTransform.point({ x: this._ref.x() + this._ref.radiusX(), y: this._ref.y() });
12654
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld(radiusX));
12655
+ const radiusY = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() + this._ref.radiusY() });
12656
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld(radiusY));
12657
+ });
12392
12658
  this._ref.id(this._ref._id.toString());
12393
12659
  }
12394
12660
  getPosition() {
@@ -12396,18 +12662,21 @@
12396
12662
  }
12397
12663
  setPosition(x, y) {
12398
12664
  this._ref.setPosition({ x, y });
12665
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({ x, y }));
12399
12666
  }
12400
12667
  getRadiusX() {
12401
12668
  return this._ref.radiusX();
12402
12669
  }
12403
12670
  setRadiusX(r) {
12404
12671
  this._ref.radiusX(r);
12672
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({ x: this._ref.x() + r, y: this._ref.y() }));
12405
12673
  }
12406
12674
  getRadiusY() {
12407
12675
  return this._ref.radiusY();
12408
12676
  }
12409
12677
  setRadiusY(r) {
12410
12678
  this._ref.radiusY(r);
12679
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({ x: this._ref.x(), y: this._ref.y() + r }));
12411
12680
  }
12412
12681
  getLineWidth() {
12413
12682
  return this._ref.strokeWidth();
@@ -12449,6 +12718,19 @@
12449
12718
  this._ref.destroy();
12450
12719
  this._ref = null;
12451
12720
  }
12721
+ updateScreenCoordinates() {
12722
+ let screenPosition = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsPosition"));
12723
+ let radiusX = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusX"));
12724
+ let radiusY = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusY"));
12725
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
12726
+ invert = invert.invert();
12727
+ const position = invert.point({ x: screenPosition.x, y: screenPosition.y });
12728
+ this._ref.position({ x: position.x, y: position.y });
12729
+ this._ref.radius({
12730
+ x: Math.abs(invert.point(radiusX).x - position.x),
12731
+ y: Math.abs(invert.point(radiusY).y - position.y),
12732
+ });
12733
+ }
12452
12734
  }
12453
12735
 
12454
12736
  ///////////////////////////////////////////////////////////////////////////////
@@ -12474,10 +12756,17 @@
12474
12756
  // acknowledge and accept the above terms.
12475
12757
  ///////////////////////////////////////////////////////////////////////////////
12476
12758
  class KonvaArrow {
12477
- constructor(params, ref = null) {
12759
+ constructor(params, ref = null, worldTransformer = new WorldTransform()) {
12478
12760
  var _a, _b;
12761
+ this._worldTransformer = worldTransformer;
12479
12762
  if (ref) {
12480
12763
  this._ref = ref;
12764
+ const wcsStart = this._ref.getAttr("wcsStart");
12765
+ const wcsEnd = this._ref.getAttr("wcsEnd");
12766
+ if (!wcsStart)
12767
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.points()[0], y: ref.points()[1] }));
12768
+ if (!wcsEnd)
12769
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: ref.points()[2], y: ref.points()[3] }));
12481
12770
  return;
12482
12771
  }
12483
12772
  if (!params)
@@ -12497,10 +12786,26 @@
12497
12786
  draggable: true,
12498
12787
  strokeScaleEnabled: false,
12499
12788
  });
12500
- this._ref.on("transform", (e) => {
12789
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.start.x, y: params.start.y }));
12790
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: params.end.x, y: params.end.y }));
12791
+ this._ref.on("transformend", (e) => {
12501
12792
  const attrs = e.target.attrs;
12502
12793
  if (attrs.rotation !== this._ref.rotation())
12503
12794
  this._ref.rotation(attrs.rotation);
12795
+ const points = this._ref.points();
12796
+ const absoluteTransform = this._ref.getAbsoluteTransform();
12797
+ const transformStart = absoluteTransform.point({ x: points[0], y: points[1] });
12798
+ const transformEnd = absoluteTransform.point({ x: points[2], y: points[3] });
12799
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(transformStart));
12800
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld(transformEnd));
12801
+ });
12802
+ this._ref.on("dragend", (e) => {
12803
+ const points = this._ref.points();
12804
+ const absoluteTransform = e.target.getAbsoluteTransform();
12805
+ const transformStart = absoluteTransform.point({ x: points[0], y: points[1] });
12806
+ const transformEnd = absoluteTransform.point({ x: points[2], y: points[3] });
12807
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(transformStart));
12808
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld(transformEnd));
12504
12809
  });
12505
12810
  this._ref.id(this._ref._id.toString());
12506
12811
  }
@@ -12548,6 +12853,8 @@
12548
12853
  }
12549
12854
  setPoints(points) {
12550
12855
  if (points.length === 2) {
12856
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: points[0].x, y: points[0].y }));
12857
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: points[1].x, y: points[1].y }));
12551
12858
  this._ref.points([points[0].x, points[0].y, points[1].x, points[1].y]);
12552
12859
  }
12553
12860
  }
@@ -12558,6 +12865,7 @@
12558
12865
  setStartPoint(x, y) {
12559
12866
  const points = this._ref.points();
12560
12867
  this._ref.points([x, y, points[2], points[3]]);
12868
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
12561
12869
  }
12562
12870
  getEndPoint() {
12563
12871
  const points = this._ref.points();
@@ -12566,16 +12874,49 @@
12566
12874
  setEndPoint(x, y) {
12567
12875
  const points = this._ref.points();
12568
12876
  this._ref.points([points[0], points[1], x, y]);
12877
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x, y }));
12878
+ }
12879
+ updateScreenCoordinates() {
12880
+ let screenStartPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
12881
+ let screenEndPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
12882
+ let invert = this._ref.getAbsoluteTransform().copy();
12883
+ invert = invert.invert();
12884
+ const startPoint = invert.point({ x: screenStartPoint.x, y: screenStartPoint.y });
12885
+ const endPoint = invert.point({ x: screenEndPoint.x, y: screenEndPoint.y });
12886
+ this._ref.points([startPoint.x, startPoint.y, endPoint.x, endPoint.y]);
12569
12887
  }
12570
12888
  }
12571
12889
 
12890
+ ///////////////////////////////////////////////////////////////////////////////
12891
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
12892
+ // All rights reserved.
12893
+ //
12894
+ // This software and its documentation and related materials are owned by
12895
+ // the Alliance. The software may only be incorporated into application
12896
+ // programs owned by members of the Alliance, subject to a signed
12897
+ // Membership Agreement and Supplemental Software License Agreement with the
12898
+ // Alliance. The structure and organization of this software are the valuable
12899
+ // trade secrets of the Alliance and its suppliers. The software is also
12900
+ // protected by copyright law and international treaty provisions. Application
12901
+ // programs incorporating this software must include the following statement
12902
+ // with their copyright notices:
12903
+ //
12904
+ // This application incorporates Open Design Alliance software pursuant to a
12905
+ // license agreement with Open Design Alliance.
12906
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
12907
+ // All rights reserved.
12908
+ //
12909
+ // By use of this software, its documentation or related materials, you
12910
+ // acknowledge and accept the above terms.
12911
+ ///////////////////////////////////////////////////////////////////////////////
12572
12912
  class KonvaImage {
12573
- constructor(params, ref = null) {
12913
+ constructor(params, ref = null, worldTransformer = new WorldTransform()) {
12574
12914
  var _a, _b;
12575
12915
  this._ratio = 1;
12576
12916
  this.EPSILON = 10e-6;
12577
12917
  this.BASE64_HEADER_START = "data:image/";
12578
12918
  this.BASE64_NOT_FOUND = "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAADsAAAA7AF5KHG9AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAmhJREFUWIXtlr9rVEEQxz+H8RQUJIdeIopYm0vkCg0GBBtbG1NF7Kxt7dR/IGIw/uhTaBNLERURg2kCEUyCYCPi70b0InjGS57FzOZN3r19d+9HJIVfWO52dma/s7Mz8xa2KAaBCWAR+AkECWOmSOIdwC1gtQOpHc+NfQ8wClQ8+1d0vcdH/lQ3bSIRGAZ2pTjAqNovANXIWlXlAXA2zvi2Ln4AjqYgtagYEutENSLvjRoOImFv5iB32Ae8UrLXwFBk3h9ndF0VJnKSO9gTu3yKu5Z1LKnS8YIcABgw5Ks692JZFXcXRJ46Aq6kikCnHNi/mQ50WwVtfaIoBzL3gRk2drSscJ2wrc4VvUoe2wn/41/iBfoVLRnBGnDSY3AAKacy8AmYR+o7K1zCl6wgrgpOAc/MuhvfgMuk+1JGHQgSBcAloKXy78AjYBppJk5/noTulseBMZ23iD/piHFkEdgTQzKk+5wHjmHC3cmBg0BD5xcSTrFXyQPgIWFtDwMvab+2N8DpbhyY1v/3E8gdDgNfVX9SCVZ0/gW4B0wB71S2BpxLcuCM/jaQSHSDEeAX4VMuAG4gTzyHbcAVXXO6GxxwIX+vvxe7JHcYQ07nHqklj96UIW/YhSWzMKcep8VVtf8B1Dw6h4DfhB+sdbgn2R+gnoEc5NR3dZ+3QJ9H74HqXLPCGlJyTfI9y3YCs0owq3OLOpKkLeBI1HhSDT/mdKIPiUCARMTlQx34TMLjtww8IczmO8AJ/N/2JNSQXAiQ671JePePge0+wzJSQq4FFzlaenIvucUAkiQLhC/mLGNZ9xgn5s63BP4CCk0QDtm4BhoAAAAASUVORK5CYII=";
12919
+ this._worldTransformer = worldTransformer;
12579
12920
  if (ref) {
12580
12921
  if (!ref.src || !ref.src.startsWith(this.BASE64_HEADER_START))
12581
12922
  ref.src = this.BASE64_NOT_FOUND;
@@ -12589,6 +12930,10 @@
12589
12930
  this._ref.height() <= this.EPSILON || this._ref.width() <= this.EPSILON
12590
12931
  ? 1
12591
12932
  : this._ref.height() / this._ref.width();
12933
+ const wcsStart = this._ref.getAttr("wcsStart");
12934
+ if (!wcsStart) {
12935
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
12936
+ }
12592
12937
  return;
12593
12938
  }
12594
12939
  if (!params)
@@ -12638,6 +12983,7 @@
12638
12983
  height: (_b = params.height) !== null && _b !== undefined ? _b : 0,
12639
12984
  draggable: true,
12640
12985
  });
12986
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
12641
12987
  this._ref.on("transform", (e) => {
12642
12988
  const attrs = e.target.attrs;
12643
12989
  if (attrs.rotation !== this._ref.rotation())
@@ -12670,6 +13016,16 @@
12670
13016
  }
12671
13017
  this._ref.scale({ x: 1, y: 1 });
12672
13018
  });
13019
+ this._ref.on("transformend", (e) => {
13020
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13021
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
13022
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
13023
+ });
13024
+ this._ref.on("dragend", (e) => {
13025
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13026
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
13027
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
13028
+ });
12673
13029
  this._ref.id(this._ref._id.toString());
12674
13030
  }
12675
13031
  getSrc() {
@@ -12725,21 +13081,75 @@
12725
13081
  }
12726
13082
  setPosition(x, y) {
12727
13083
  this._ref.setPosition({ x, y });
13084
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
13085
+ }
13086
+ updateScreenCoordinates() {
13087
+ let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
13088
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
13089
+ invert = invert.invert();
13090
+ const positionStart = invert.point(screenPositionStart);
13091
+ this._ref.position({ x: positionStart.x, y: positionStart.y });
12728
13092
  }
12729
13093
  }
12730
13094
 
13095
+ ///////////////////////////////////////////////////////////////////////////////
13096
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
13097
+ // All rights reserved.
13098
+ //
13099
+ // This software and its documentation and related materials are owned by
13100
+ // the Alliance. The software may only be incorporated into application
13101
+ // programs owned by members of the Alliance, subject to a signed
13102
+ // Membership Agreement and Supplemental Software License Agreement with the
13103
+ // Alliance. The structure and organization of this software are the valuable
13104
+ // trade secrets of the Alliance and its suppliers. The software is also
13105
+ // protected by copyright law and international treaty provisions. Application
13106
+ // programs incorporating this software must include the following statement
13107
+ // with their copyright notices:
13108
+ //
13109
+ // This application incorporates Open Design Alliance software pursuant to a
13110
+ // license agreement with Open Design Alliance.
13111
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
13112
+ // All rights reserved.
13113
+ //
13114
+ // By use of this software, its documentation or related materials, you
13115
+ // acknowledge and accept the above terms.
13116
+ ///////////////////////////////////////////////////////////////////////////////
12731
13117
  class KonvaCloud {
12732
- constructor(params, ref = null) {
13118
+ constructor(params, ref = null, worldTransformer = new WorldTransform()) {
12733
13119
  var _a, _b, _c, _d;
13120
+ this._worldTransformer = worldTransformer;
12734
13121
  if (ref) {
12735
13122
  this._ref = ref;
13123
+ const wcsStart = this._ref.getAttr("wcsStart");
13124
+ const wcsEnd = this._ref.getAttr("wcsEnd");
13125
+ if (!wcsStart) {
13126
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: ref.x(), y: ref.y() }));
13127
+ }
13128
+ if (!wcsEnd) {
13129
+ const rightBottomPoint = { x: ref.x() + ref.width(), y: ref.y() + ref.height() };
13130
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: rightBottomPoint.x, y: rightBottomPoint.y }));
13131
+ }
12736
13132
  return;
12737
13133
  }
12738
13134
  if (!params)
12739
13135
  params = {};
12740
13136
  if (!params.position)
12741
13137
  params.position = { x: 0, y: 0 };
12742
- const arcRadius = 16;
13138
+ if (params.position2) {
13139
+ params.width = params.position.x - params.position2.x;
13140
+ params.height = params.position.y - params.position2.y;
13141
+ }
13142
+ else {
13143
+ if (!params.width || !params.height) {
13144
+ params.position2 = { x: 200, y: 200 };
13145
+ params.width = 200;
13146
+ params.height = 200;
13147
+ }
13148
+ else {
13149
+ params.position2 = { x: params.position.x + params.width, y: params.position.y + params.height };
13150
+ }
13151
+ }
13152
+ const ARC_RADIUS = 16;
12743
13153
  this._ref = new Konva.Shape({
12744
13154
  x: params.position.x,
12745
13155
  y: params.position.y,
@@ -12783,10 +13193,10 @@
12783
13193
  const counterClockwise = pX > midPoint.x && pY > midPoint.y;
12784
13194
  for (let iArc = 0; iArc < arcCount; iArc++) {
12785
13195
  if (counterClockwise) {
12786
- context.arc(pX, pY, arcRadius, endAngle, startAngle);
13196
+ context.arc(pX, pY, ARC_RADIUS, endAngle, startAngle);
12787
13197
  }
12788
13198
  else {
12789
- context.arc(pX, pY, arcRadius, startAngle, endAngle);
13199
+ context.arc(pX, pY, ARC_RADIUS, startAngle, endAngle);
12790
13200
  }
12791
13201
  pX += dx / arcCount;
12792
13202
  pY += dy / arcCount;
@@ -12799,10 +13209,10 @@
12799
13209
  },
12800
13210
  });
12801
13211
  this._ref.className = "Cloud";
13212
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x: params.position.x, y: params.position.y }));
13213
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: params.position2.x, y: params.position2.y }));
12802
13214
  this._ref.on("transform", (e) => {
12803
13215
  const attrs = e.target.attrs;
12804
- if (attrs.rotation !== this._ref.rotation())
12805
- this._ref.rotation(attrs.rotation);
12806
13216
  const scaleByX = Math.abs(attrs.scaleX - 1) > 10e-6;
12807
13217
  const scaleByY = Math.abs(attrs.scaleY - 1) > 10e-6;
12808
13218
  let newWidth = this._ref.width();
@@ -12825,12 +13235,27 @@
12825
13235
  }
12826
13236
  this._ref.scale({ x: 1, y: 1 });
12827
13237
  });
13238
+ this._ref.on("transformend", (e) => {
13239
+ const attrs = e.target.attrs;
13240
+ if (attrs.rotation !== this._ref.rotation())
13241
+ this._ref.rotation(attrs.rotation);
13242
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13243
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
13244
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
13245
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
13246
+ });
13247
+ this._ref.on("dragend", (e) => {
13248
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13249
+ const position = absoluteTransform.point({ x: this._ref.x(), y: this._ref.y() });
13250
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
13251
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({ x: position.x + this._ref.width(), y: position.y + this._ref.height() }));
13252
+ });
12828
13253
  this._ref.getSelfRect = () => {
12829
13254
  return {
12830
- x: 0 - arcRadius,
12831
- y: 0 - arcRadius,
12832
- width: this._ref.width() + 2 * arcRadius,
12833
- height: this._ref.height() + 2 * arcRadius,
13255
+ x: 0 - ARC_RADIUS,
13256
+ y: 0 - ARC_RADIUS,
13257
+ width: this._ref.width() + 2 * ARC_RADIUS,
13258
+ height: this._ref.height() + 2 * ARC_RADIUS,
12834
13259
  };
12835
13260
  };
12836
13261
  this._ref.id(this._ref._id.toString());
@@ -12874,18 +13299,25 @@
12874
13299
  }
12875
13300
  setPosition(x, y) {
12876
13301
  this._ref.position({ x, y });
13302
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({ x, y }));
12877
13303
  }
12878
13304
  getWidth() {
12879
13305
  return this._ref.width();
12880
13306
  }
12881
13307
  setWidth(w) {
12882
13308
  this._ref.width(w);
13309
+ const rightLowerPoint = { x: this._ref.x() + w, y: this._ref.y() + this._ref.height() };
13310
+ const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
13311
+ this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
12883
13312
  }
12884
13313
  getHeigth() {
12885
13314
  return this._ref.height();
12886
13315
  }
12887
13316
  setHeight(h) {
12888
13317
  this._ref.height(h);
13318
+ const rightLowerPoint = { x: this._ref.x() + this._ref.width(), y: this._ref.y() + h };
13319
+ const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
13320
+ this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
12889
13321
  }
12890
13322
  getLineWidth() {
12891
13323
  return this._ref.strokeWidth();
@@ -12893,6 +13325,17 @@
12893
13325
  setLineWidth(size) {
12894
13326
  this._ref.strokeWidth(size);
12895
13327
  }
13328
+ updateScreenCoordinates() {
13329
+ let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
13330
+ let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
13331
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
13332
+ invert = invert.invert();
13333
+ const positionStart = invert.point(screenPositionStart);
13334
+ const positionEnd = invert.point(screenPositionEnd);
13335
+ this._ref.position({ x: positionStart.x, y: positionStart.y });
13336
+ this._ref.width(Math.abs(positionEnd.x - positionStart.x));
13337
+ this._ref.height(Math.abs(positionEnd.y - positionStart.y));
13338
+ }
12896
13339
  }
12897
13340
 
12898
13341
  ///////////////////////////////////////////////////////////////////////////////
@@ -12924,39 +13367,50 @@
12924
13367
  },
12925
13368
  Line: {
12926
13369
  name: "Line",
12927
- initializer: (ref, params = null) => new KonvaLine(params, ref),
13370
+ initializer: (ref, params = null, ...attr) => new KonvaLine(params, ref, ...attr),
12928
13371
  },
12929
13372
  Text: {
12930
13373
  name: "Text",
12931
- initializer: (ref, params = null) => new KonvaText(params, ref),
13374
+ initializer: (ref, params = null, ...attr) => new KonvaText(params, ref, ...attr),
12932
13375
  },
12933
13376
  Rectangle: {
12934
13377
  name: "Rect",
12935
- initializer: (ref, params = null) => new KonvaRectangle(params, ref),
13378
+ initializer: (ref, params = null, ...attr) => new KonvaRectangle(params, ref, ...attr),
12936
13379
  },
12937
13380
  Ellipse: {
12938
13381
  name: "Ellipse",
12939
- initializer: (ref, params = null) => new KonvaEllipse(params, ref),
13382
+ initializer: (ref, params = null, ...attr) => new KonvaEllipse(params, ref, ...attr),
12940
13383
  },
12941
13384
  Arrow: {
12942
13385
  name: "Arrow",
12943
- initializer: (ref, params = null) => new KonvaArrow(params, ref),
13386
+ initializer: (ref, params = null, ...attr) => new KonvaArrow(params, ref, ...attr),
12944
13387
  },
12945
13388
  Image: {
12946
13389
  name: "Image",
12947
- initializer: (ref, params = null) => new KonvaImage(params, ref),
13390
+ initializer: (ref, params = null, ...attr) => new KonvaImage(params, ref, ...attr),
12948
13391
  },
12949
13392
  Cloud: {
12950
13393
  name: "Cloud",
12951
- initializer: (ref, params = null) => new KonvaCloud(params, ref),
13394
+ initializer: (ref, params = null, ...attr) => new KonvaCloud(params, ref, ...attr),
12952
13395
  },
12953
13396
  };
13397
+ function debounce(func, wait) {
13398
+ let timeout = null;
13399
+ return (...args) => {
13400
+ if (timeout) {
13401
+ clearTimeout(timeout);
13402
+ }
13403
+ timeout = setTimeout(() => {
13404
+ timeout = null;
13405
+ func(...args);
13406
+ }, wait);
13407
+ };
13408
+ }
12954
13409
  /**
12955
13410
  * 2D markup core.
12956
13411
  */
12957
13412
  class KonvaMarkup {
12958
13413
  constructor() {
12959
- this._containerEvents = [];
12960
13414
  this._markupIsActive = false;
12961
13415
  this._markupColor = new MarkupColor(255, 0, 0);
12962
13416
  this.lineWidth = 4;
@@ -12982,22 +13436,31 @@
12982
13436
  return;
12983
13437
  this._konvaStage.width(width);
12984
13438
  this._konvaStage.height(height);
13439
+ this.getObjects().forEach((markupObject) => {
13440
+ markupObject.updateScreenCoordinates();
13441
+ });
13442
+ };
13443
+ this.resizeViewer = (event) => {
13444
+ const { width, height } = event;
13445
+ if (!width || !height)
13446
+ return; // <- invisible container, or container with parent removed
13447
+ if (!this._konvaStage)
13448
+ return;
13449
+ this._konvaStage.width(width);
13450
+ this._konvaStage.height(height);
13451
+ this.getObjects().forEach((markupObject) => {
13452
+ markupObject.updateScreenCoordinates();
13453
+ });
12985
13454
  };
12986
13455
  this.pan = (event) => {
12987
- const newPos = {
12988
- x: this._konvaStage.x() + event.dX,
12989
- y: this._konvaStage.y() + event.dY,
12990
- };
12991
- this._konvaStage.position(newPos);
13456
+ this.getObjects().forEach((markupObject) => {
13457
+ markupObject.updateScreenCoordinates();
13458
+ });
12992
13459
  };
12993
13460
  this.zoomAt = (event) => {
12994
- const newScale = this._konvaStage.scaleX() * event.data;
12995
- this._konvaStage.scale({ x: newScale, y: newScale });
12996
- const newPos = {
12997
- x: event.x - (event.x - this._konvaStage.x()) * event.data,
12998
- y: event.y - (event.y - this._konvaStage.y()) * event.data,
12999
- };
13000
- this._konvaStage.position(newPos);
13461
+ this.getObjects().forEach((markupObject) => {
13462
+ markupObject.updateScreenCoordinates();
13463
+ });
13001
13464
  };
13002
13465
  this.redirectToViewer = (event) => {
13003
13466
  if (this._viewer)
@@ -13022,7 +13485,6 @@
13022
13485
  this._viewer = viewer;
13023
13486
  this._worldTransformer = worldTransformer !== null && worldTransformer !== undefined ? worldTransformer : new WorldTransform();
13024
13487
  this._container = container;
13025
- this._containerEvents = containerEvents !== null && containerEvents !== undefined ? containerEvents : [];
13026
13488
  this._markupContainer = document.createElement("div");
13027
13489
  this._markupContainer.id = "markup-container";
13028
13490
  this._markupContainer.style.position = "absolute";
@@ -13032,12 +13494,13 @@
13032
13494
  this._markupContainer.style.pointerEvents = "none";
13033
13495
  const parentDiv = this._container.parentElement;
13034
13496
  parentDiv.appendChild(this._markupContainer);
13035
- this._resizeObserver = new ResizeObserver(this.resizeContainer);
13036
- this._resizeObserver.observe(parentDiv);
13497
+ if (viewer)
13498
+ this._viewer.addEventListener("resize", this.resizeViewer);
13499
+ else
13500
+ this._resizeObserver = new ResizeObserver(debounce(this.resizeContainer, 100));
13037
13501
  this._markupColor.setColor(255, 0, 0);
13038
13502
  this.initializeKonva();
13039
13503
  if (this._viewer) {
13040
- // this._containerEvents.forEach((x) => this._markupContainer.addEventListener(x, this.redirectToViewer));
13041
13504
  this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
13042
13505
  this._viewer.addEventListener("pan", this.pan);
13043
13506
  this._viewer.addEventListener("zoomat", this.zoomAt);
@@ -13049,7 +13512,6 @@
13049
13512
  this._viewer.removeEventListener("zoomat", this.zoomAt);
13050
13513
  this._viewer.removeEventListener("pan", this.pan);
13051
13514
  this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
13052
- // this._containerEvents.forEach((x) => this._markupContainer.removeEventListener(x, this.redirectToViewer));
13053
13515
  }
13054
13516
  this.destroyKonva();
13055
13517
  (_a = this._resizeObserver) === null || _a === undefined ? undefined : _a.disconnect();
@@ -13107,7 +13569,7 @@
13107
13569
  });
13108
13570
  (_d = viewpoint.rectangles) === null || _d === undefined ? undefined : _d.forEach((rect) => {
13109
13571
  const screenPoint = this._worldTransformer.worldToScreen(rect.position);
13110
- this.addRectangle(screenPoint, rect.width, rect.height, rect.line_width, rect.color, rect.id);
13572
+ this.addRectangle(screenPoint, null, rect.width, rect.height, rect.line_width, rect.color, rect.id);
13111
13573
  });
13112
13574
  (_e = viewpoint.ellipses) === null || _e === undefined ? undefined : _e.forEach((ellipse) => {
13113
13575
  const screenPoint = this._worldTransformer.worldToScreen(ellipse.position);
@@ -13120,7 +13582,7 @@
13120
13582
  });
13121
13583
  (_g = viewpoint.clouds) === null || _g === undefined ? undefined : _g.forEach((cloud) => {
13122
13584
  const screenPoint = this._worldTransformer.worldToScreen(cloud.position);
13123
- this.addCloud(screenPoint, cloud.width, cloud.height, cloud.line_width, cloud.color, cloud.id);
13585
+ this.addCloud(screenPoint, null, cloud.width, cloud.height, cloud.line_width, cloud.color, cloud.id);
13124
13586
  });
13125
13587
  (_h = viewpoint.images) === null || _h === undefined ? undefined : _h.forEach((image) => {
13126
13588
  const screenPoint = this._worldTransformer.worldToScreen(image.position);
@@ -13160,7 +13622,7 @@
13160
13622
  const konvaShape = MarkupMode2Konva[type];
13161
13623
  if (!konvaShape || !konvaShape.initializer)
13162
13624
  throw new Error(`Markup CreateObject - unsupported markup type ${type}`);
13163
- const object = konvaShape.initializer(null, params);
13625
+ const object = konvaShape.initializer(null, params, this._worldTransformer);
13164
13626
  this.addObject(object);
13165
13627
  return object;
13166
13628
  }
@@ -13168,7 +13630,7 @@
13168
13630
  const objects = [];
13169
13631
  Object.keys(MarkupMode2Konva).forEach((type) => {
13170
13632
  const konvaShape = MarkupMode2Konva[type];
13171
- this.konvaLayerFind(type).forEach((ref) => objects.push(konvaShape.initializer(ref)));
13633
+ this.konvaLayerFind(type).forEach((ref) => objects.push(konvaShape.initializer(ref, null, this._worldTransformer)));
13172
13634
  });
13173
13635
  return objects;
13174
13636
  }
@@ -13180,7 +13642,7 @@
13180
13642
  .map((ref) => {
13181
13643
  const name = ref.className;
13182
13644
  const konvaShape = Object.values(MarkupMode2Konva).find((shape) => shape.name === name);
13183
- return konvaShape ? konvaShape.initializer(ref) : null;
13645
+ return konvaShape ? konvaShape.initializer(ref, null, this._worldTransformer) : null;
13184
13646
  })
13185
13647
  .filter((x) => x);
13186
13648
  }
@@ -13272,7 +13734,7 @@
13272
13734
  const dY = defParams ? 200 : Math.abs(mouseDownPos.y - pos.y);
13273
13735
  if (defParams) {
13274
13736
  if (this._markupMode === "Rectangle") {
13275
- this.addRectangle({ x: startX, y: startY }, dX, dY);
13737
+ this.addRectangle({ x: startX, y: startY }, null, dX, dY);
13276
13738
  }
13277
13739
  else if (this._markupMode === "Ellipse") {
13278
13740
  this.addEllipse({ x: startX, y: startY }, { x: dX / 2, y: dY / 2 });
@@ -13281,7 +13743,7 @@
13281
13743
  this.addArrow({ x: mouseDownPos.x, y: mouseDownPos.y }, { x: defParams ? mouseDownPos.x + 200 : pos.x, y: defParams ? startY : pos.y });
13282
13744
  }
13283
13745
  else if (this._markupMode === "Cloud") {
13284
- this.addCloud({ x: startX, y: startY }, Math.max(100, dX), Math.max(100, dY));
13746
+ this.addCloud({ x: startX, y: startY }, null, Math.max(100, dX), Math.max(100, dY));
13285
13747
  }
13286
13748
  }
13287
13749
  }
@@ -13318,7 +13780,7 @@
13318
13780
  lastObj.setHeight(dY);
13319
13781
  }
13320
13782
  else
13321
- lastObj = this.addRectangle({ x: startX, y: startY }, dX, dY);
13783
+ lastObj = this.addRectangle({ x: startX, y: startY }, null, dX, dY);
13322
13784
  }
13323
13785
  else if (this._markupMode === "Ellipse") {
13324
13786
  if (lastObj) {
@@ -13336,7 +13798,7 @@
13336
13798
  lastObj.setHeight(Math.max(100, dY));
13337
13799
  }
13338
13800
  else
13339
- lastObj = this.addCloud({ x: startX, y: startY }, dX, dY);
13801
+ lastObj = this.addCloud({ x: startX, y: startY }, null, dX, dY);
13340
13802
  }
13341
13803
  });
13342
13804
  // clicks should select/deselect shapes
@@ -13450,25 +13912,13 @@
13450
13912
  getMarkupLines() {
13451
13913
  const lines = [];
13452
13914
  this.konvaLayerFind("Line").forEach((ref) => {
13453
- const linePoints = ref.points();
13454
- if (!linePoints)
13915
+ const wcsPoints = ref.getAttr("wcsPoints");
13916
+ if (!wcsPoints)
13455
13917
  return;
13456
- const worldPoints = [];
13457
- const absoluteTransform = ref.getAbsoluteTransform();
13458
- for (let i = 0; i < linePoints.length; i += 2) {
13459
- // we need getAbsoluteTransform because inside Konva position starts from {0, 0}
13460
- // https://stackoverflow.com/a/57641487 - check answer's comments
13461
- const atPoint = absoluteTransform.point({
13462
- x: linePoints[i],
13463
- y: linePoints[i + 1],
13464
- });
13465
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13466
- worldPoints.push(worldPoint);
13467
- }
13468
- const konvaLine = new KonvaLine(null, ref);
13918
+ const konvaLine = new KonvaLine(null, ref, this._worldTransformer);
13469
13919
  const line = {
13470
13920
  id: konvaLine.id(),
13471
- points: worldPoints,
13921
+ points: wcsPoints,
13472
13922
  color: konvaLine.getColor() || "#ff0000",
13473
13923
  type: konvaLine.getLineType() || this.lineType,
13474
13924
  width: konvaLine.getLineWidth() || this.lineWidth,
@@ -13482,14 +13932,12 @@
13482
13932
  this.konvaLayerFind("Text").forEach((ref) => {
13483
13933
  const textSize = 0.02;
13484
13934
  const textScale = this._worldTransformer.getScale();
13485
- const position = ref.position();
13935
+ const wcsPosition = ref.getAttr("wcsStart");
13486
13936
  const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13487
- const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
13488
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13489
- const shape = new KonvaText(null, ref);
13937
+ const shape = new KonvaText(null, ref, this._worldTransformer);
13490
13938
  const text = {
13491
13939
  id: shape.id(),
13492
- position: worldPoint,
13940
+ position: wcsPosition,
13493
13941
  text: shape.getText(),
13494
13942
  text_size: textSize * textScale.y,
13495
13943
  angle: shape.getRotation(),
@@ -13503,17 +13951,16 @@
13503
13951
  getMarkupRectangles() {
13504
13952
  const rectangles = [];
13505
13953
  this.konvaLayerFind("Rectangle").forEach((ref) => {
13506
- const position = ref.position();
13507
- const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13508
- const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
13509
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13510
- const scale = stageAbsoluteTransform.getMatrix()[0];
13511
- const shape = new KonvaRectangle(null, ref);
13954
+ const wcsStart = ref.getAttr("wcsStart");
13955
+ const wcsEnd = ref.getAttr("wcsEnd");
13956
+ const screenStart = this._worldTransformer.worldToScreen(wcsStart);
13957
+ const screenEnd = this._worldTransformer.worldToScreen(wcsEnd);
13958
+ const shape = new KonvaRectangle(null, ref, this._worldTransformer);
13512
13959
  const rectangle = {
13513
13960
  id: shape.id(),
13514
- position: worldPoint,
13515
- width: shape.getWidth() * scale,
13516
- height: shape.getHeigth() * scale,
13961
+ position: wcsStart,
13962
+ width: Math.abs(screenStart.x - screenEnd.x),
13963
+ height: Math.abs(screenStart.y - screenEnd.y),
13517
13964
  line_width: shape.getLineWidth(),
13518
13965
  color: shape.getColor(),
13519
13966
  };
@@ -13524,15 +13971,13 @@
13524
13971
  getMarkupEllipses() {
13525
13972
  const ellipses = [];
13526
13973
  this.konvaLayerFind("Ellipse").forEach((ref) => {
13527
- const position = ref.position();
13974
+ const wcsPosition = ref.getAttr("wcsPosition");
13528
13975
  const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13529
- const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
13530
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13531
13976
  const scale = stageAbsoluteTransform.getMatrix()[0];
13532
- const shape = new KonvaEllipse(null, ref);
13977
+ const shape = new KonvaEllipse(null, ref, this._worldTransformer);
13533
13978
  const ellipse = {
13534
13979
  id: shape.id(),
13535
- position: worldPoint,
13980
+ position: wcsPosition,
13536
13981
  radius: {
13537
13982
  x: ref.getRadiusX() * scale,
13538
13983
  y: ref.getRadiusY() * scale,
@@ -13548,22 +13993,13 @@
13548
13993
  const arrows = [];
13549
13994
  this.konvaLayerFind("Arrow").forEach((ref) => {
13550
13995
  // we need getAbsoluteTransform because inside Konva position starts from {0, 0}
13551
- const absoluteTransform = ref.getAbsoluteTransform();
13552
- const atStartPoint = absoluteTransform.point({
13553
- x: ref.points()[0],
13554
- y: ref.points()[1],
13555
- });
13556
- const worldStartPoint = this._worldTransformer.screenToWorld(atStartPoint);
13557
- const atEndPoint = absoluteTransform.point({
13558
- x: ref.points()[2],
13559
- y: ref.points()[3],
13560
- });
13561
- const worldEndPoint = this._worldTransformer.screenToWorld(atEndPoint);
13562
- const shape = new KonvaArrow(null, ref);
13996
+ const wcsStart = ref.getAttr("wcsStart");
13997
+ const wcsEnd = ref.getAttr("wcsEnd");
13998
+ const shape = new KonvaArrow(null, ref, this._worldTransformer);
13563
13999
  const arrow = {
13564
14000
  id: shape.id(),
13565
- start: worldStartPoint,
13566
- end: worldEndPoint,
14001
+ start: wcsStart,
14002
+ end: wcsEnd,
13567
14003
  color: shape.getColor(),
13568
14004
  };
13569
14005
  arrows.push(arrow);
@@ -13573,15 +14009,13 @@
13573
14009
  getMarkupImages() {
13574
14010
  const images = [];
13575
14011
  this.konvaLayerFind("Image").forEach((ref) => {
13576
- const position = ref.position();
14012
+ const wcsStart = ref.getAttr("wcsStart");
13577
14013
  const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13578
- const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
13579
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13580
14014
  const scale = stageAbsoluteTransform.getMatrix()[0];
13581
- const shape = new KonvaImage(null, ref);
14015
+ const shape = new KonvaImage(null, ref, this._worldTransformer);
13582
14016
  const image = {
13583
14017
  id: shape.id(),
13584
- position: worldPoint,
14018
+ position: wcsStart,
13585
14019
  src: shape.getSrc(),
13586
14020
  width: shape.getWidth() * scale,
13587
14021
  height: shape.getHeight() * scale,
@@ -13593,17 +14027,16 @@
13593
14027
  getMarkupClouds() {
13594
14028
  const clouds = [];
13595
14029
  this.konvaLayerFind("Cloud").forEach((ref) => {
13596
- const position = ref.position();
13597
- const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13598
- const atPoint = stageAbsoluteTransform.point({ x: position.x, y: position.y });
13599
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13600
- const scale = stageAbsoluteTransform.getMatrix()[0];
13601
- const shape = new KonvaCloud(null, ref);
14030
+ const wcsStart = ref.getAttr("wcsStart");
14031
+ const wcsEnd = ref.getAttr("wcsEnd");
14032
+ const screenStart = this._worldTransformer.worldToScreen(wcsStart);
14033
+ const screenEnd = this._worldTransformer.worldToScreen(wcsEnd);
14034
+ const shape = new KonvaCloud(null, ref, this._worldTransformer);
13602
14035
  const cloud = {
13603
14036
  id: shape.id(),
13604
- position: worldPoint,
13605
- width: shape.getWidth() * scale,
13606
- height: shape.getHeigth() * scale,
14037
+ position: wcsStart,
14038
+ width: Math.abs(screenStart.x - screenEnd.x),
14039
+ height: Math.abs(screenStart.y - screenEnd.y),
13607
14040
  line_width: shape.getLineWidth(),
13608
14041
  color: shape.getColor(),
13609
14042
  };
@@ -13637,7 +14070,7 @@
13637
14070
  width: width || this.lineWidth,
13638
14071
  color: color || this._markupColor.asHex(),
13639
14072
  id,
13640
- });
14073
+ }, null, this._worldTransformer);
13641
14074
  this.addObject(konvaLine);
13642
14075
  return konvaLine;
13643
14076
  }
@@ -13746,21 +14179,22 @@
13746
14179
  fontSize: fontSize || this.fontSize,
13747
14180
  color: color || this._markupColor.asHex(),
13748
14181
  id,
13749
- });
14182
+ }, null, this._worldTransformer);
13750
14183
  this.addObject(konvaText);
13751
14184
  return konvaText;
13752
14185
  }
13753
- addRectangle(position, width, height, lineWidth, color, id) {
14186
+ addRectangle(position, position2, width, height, lineWidth, color, id) {
13754
14187
  if (!position)
13755
14188
  return;
13756
14189
  const konvaRectangle = new KonvaRectangle({
13757
14190
  position,
14191
+ position2,
13758
14192
  width,
13759
14193
  height,
13760
14194
  lineWidth: lineWidth || this.lineWidth,
13761
14195
  color: color || this._markupColor.asHex(),
13762
14196
  id,
13763
- });
14197
+ }, null, this._worldTransformer);
13764
14198
  this.addObject(konvaRectangle);
13765
14199
  return konvaRectangle;
13766
14200
  }
@@ -13773,7 +14207,7 @@
13773
14207
  lineWidth,
13774
14208
  color: color || this._markupColor.asHex(),
13775
14209
  id,
13776
- });
14210
+ }, null, this._worldTransformer);
13777
14211
  this.addObject(konvaEllipse);
13778
14212
  return konvaEllipse;
13779
14213
  }
@@ -13785,21 +14219,22 @@
13785
14219
  end,
13786
14220
  color: color || this._markupColor.asHex(),
13787
14221
  id,
13788
- });
14222
+ }, null, this._worldTransformer);
13789
14223
  this.addObject(konvaArrow);
13790
14224
  return konvaArrow;
13791
14225
  }
13792
- addCloud(position, width, height, lineWidth, color, id) {
14226
+ addCloud(position, position2, width, height, lineWidth, color, id) {
13793
14227
  if (!position || !width || !height)
13794
14228
  return;
13795
14229
  const konvaCloud = new KonvaCloud({
13796
14230
  position,
14231
+ position2,
13797
14232
  width,
13798
14233
  height,
13799
14234
  color: color || this._markupColor.asHex(),
13800
14235
  lineWidth: lineWidth || this.lineWidth,
13801
14236
  id,
13802
- });
14237
+ }, null, this._worldTransformer);
13803
14238
  this.addObject(konvaCloud);
13804
14239
  return konvaCloud;
13805
14240
  }
@@ -13819,7 +14254,7 @@
13819
14254
  maxWidth: this._konvaStage.width() - position.x,
13820
14255
  maxHeight: this._konvaStage.height() - position.y,
13821
14256
  id,
13822
- });
14257
+ }, null, this._worldTransformer);
13823
14258
  this.addObject(konvaImage);
13824
14259
  return konvaImage;
13825
14260
  }