@inweb/viewer-three 26.3.3 → 26.4.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.
@@ -39,7 +39,7 @@
39
39
  }
40
40
  const {handler: handler, thisArg: thisArg} = command;
41
41
  const result = handler.apply(thisArg, [ viewer, ...args ]);
42
- viewer === null || viewer === void 0 ? void 0 : viewer.emit({
42
+ viewer === null || viewer === undefined ? undefined : viewer.emit({
43
43
  type: "command",
44
44
  data: id,
45
45
  args: args
@@ -484,7 +484,7 @@
484
484
  hasRequiredGlobal = 1;
485
485
  (function (exports) {
486
486
  Object.defineProperty(exports, "__esModule", { value: true });
487
- exports._registerNode = exports.Konva = exports.glob = void 0;
487
+ exports._registerNode = exports.Konva = exports.glob = undefined;
488
488
  const PI_OVER_180 = Math.PI / 180;
489
489
  function detectBrowser() {
490
490
  return (typeof window !== 'undefined' &&
@@ -500,7 +500,7 @@
500
500
  : {};
501
501
  exports.Konva = {
502
502
  _global: exports.glob,
503
- version: '9.3.20',
503
+ version: '9.3.18',
504
504
  isBrowser: detectBrowser(),
505
505
  isUnminified: /param/.test(function (param) { }.toString()),
506
506
  dblClickWindow: 400,
@@ -532,7 +532,7 @@
532
532
  },
533
533
  isTransforming() {
534
534
  var _a;
535
- return (_a = exports.Konva['Transformer']) === null || _a === void 0 ? void 0 : _a.isTransforming();
535
+ return (_a = exports.Konva['Transformer']) === null || _a === undefined ? undefined : _a.isTransforming();
536
536
  },
537
537
  isDragReady() {
538
538
  return !!exports.Konva['DD'].node;
@@ -561,7 +561,7 @@
561
561
  hasRequiredUtil = 1;
562
562
  (function (exports) {
563
563
  Object.defineProperty(exports, "__esModule", { value: true });
564
- exports.Util = exports.Transform = void 0;
564
+ exports.Util = exports.Transform = undefined;
565
565
  const Global_1 = requireGlobal();
566
566
  class Transform {
567
567
  constructor(m = [1, 0, 0, 1, 0, 0]) {
@@ -1579,7 +1579,7 @@
1579
1579
  hasRequiredFactory = 1;
1580
1580
  (function (exports) {
1581
1581
  Object.defineProperty(exports, "__esModule", { value: true });
1582
- exports.Factory = void 0;
1582
+ exports.Factory = undefined;
1583
1583
  const Util_1 = requireUtil();
1584
1584
  const Validators_1 = requireValidators();
1585
1585
  const GET = 'get';
@@ -1717,7 +1717,7 @@
1717
1717
  if (hasRequiredContext) return Context;
1718
1718
  hasRequiredContext = 1;
1719
1719
  Object.defineProperty(Context, "__esModule", { value: true });
1720
- Context.HitContext = Context.SceneContext = Context.Context = void 0;
1720
+ Context.HitContext = Context.SceneContext = Context.Context = undefined;
1721
1721
  const Util_1 = requireUtil();
1722
1722
  const Global_1 = requireGlobal();
1723
1723
  function simplifyArray(arr) {
@@ -2206,7 +2206,7 @@
2206
2206
  }
2207
2207
  _applyShadow(shape) {
2208
2208
  var _a, _b, _c;
2209
- const color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : {
2209
+ const color = (_a = shape.getShadowRGBA()) !== null && _a !== undefined ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== undefined ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== undefined ? _c : {
2210
2210
  x: 0,
2211
2211
  y: 0,
2212
2212
  }, scale = shape.getAbsoluteScale(), ratio = this.canvas.getPixelRatio(), scaleX = scale.x * ratio, scaleY = scale.y * ratio;
@@ -2265,10 +2265,12 @@
2265
2265
  if (hasRequiredCanvas) return Canvas;
2266
2266
  hasRequiredCanvas = 1;
2267
2267
  Object.defineProperty(Canvas, "__esModule", { value: true });
2268
- Canvas.HitCanvas = Canvas.SceneCanvas = Canvas.Canvas = void 0;
2268
+ Canvas.HitCanvas = Canvas.SceneCanvas = Canvas.Canvas = undefined;
2269
2269
  const Util_1 = requireUtil();
2270
2270
  const Context_1 = requireContext();
2271
2271
  const Global_1 = requireGlobal();
2272
+ const Factory_1 = requireFactory();
2273
+ const Validators_1 = requireValidators();
2272
2274
  let _pixelRatio;
2273
2275
  function getDevicePixelRatio() {
2274
2276
  if (_pixelRatio) {
@@ -2357,6 +2359,7 @@
2357
2359
  }
2358
2360
  };
2359
2361
  Canvas.Canvas = Canvas$1;
2362
+ Factory_1.Factory.addGetterSetter(Canvas$1, 'pixelRatio', undefined, (0, Validators_1.getNumberValidator)());
2360
2363
  class SceneCanvas extends Canvas$1 {
2361
2364
  constructor(config = { width: 0, height: 0, willReadFrequently: false }) {
2362
2365
  super(config);
@@ -2388,7 +2391,7 @@
2388
2391
  hasRequiredDragAndDrop = 1;
2389
2392
  (function (exports) {
2390
2393
  Object.defineProperty(exports, "__esModule", { value: true });
2391
- exports.DD = void 0;
2394
+ exports.DD = undefined;
2392
2395
  const Global_1 = requireGlobal();
2393
2396
  const Util_1 = requireUtil();
2394
2397
  exports.DD = {
@@ -2509,7 +2512,7 @@
2509
2512
  if (hasRequiredNode) return Node;
2510
2513
  hasRequiredNode = 1;
2511
2514
  Object.defineProperty(Node, "__esModule", { value: true });
2512
- Node.Node = void 0;
2515
+ Node.Node = undefined;
2513
2516
  const Util_1 = requireUtil();
2514
2517
  const Factory_1 = requireFactory();
2515
2518
  const Canvas_1 = requireCanvas();
@@ -3414,7 +3417,7 @@
3414
3417
  var _a, _b;
3415
3418
  const m = this._cache.get(TRANSFORM) || new Util_1.Transform();
3416
3419
  m.reset();
3417
- const x = this.x(), y = this.y(), rotation = Global_1.Konva.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;
3420
+ const x = this.x(), y = this.y(), rotation = Global_1.Konva.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== undefined ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== undefined ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;
3418
3421
  if (x !== 0 || y !== 0) {
3419
3422
  m.translate(x, y);
3420
3423
  }
@@ -3616,7 +3619,7 @@
3616
3619
  _requestDraw() {
3617
3620
  if (Global_1.Konva.autoDrawEnabled) {
3618
3621
  const drawNode = this.getLayer() || this.getStage();
3619
- drawNode === null || drawNode === void 0 ? void 0 : drawNode.batchDraw();
3622
+ drawNode === null || drawNode === undefined ? undefined : drawNode.batchDraw();
3620
3623
  }
3621
3624
  }
3622
3625
  _setAttr(key, val) {
@@ -3677,13 +3680,13 @@
3677
3680
  }
3678
3681
  _getProtoListeners(eventType) {
3679
3682
  var _a, _b, _c;
3680
- const allListeners = (_a = this._cache.get(ALL_LISTENERS)) !== null && _a !== void 0 ? _a : {};
3681
- let events = allListeners === null || allListeners === void 0 ? void 0 : allListeners[eventType];
3683
+ const allListeners = (_a = this._cache.get(ALL_LISTENERS)) !== null && _a !== undefined ? _a : {};
3684
+ let events = allListeners === null || allListeners === undefined ? undefined : allListeners[eventType];
3682
3685
  if (events === undefined) {
3683
3686
  events = [];
3684
3687
  let obj = Object.getPrototypeOf(this);
3685
3688
  while (obj) {
3686
- const hierarchyEvents = (_c = (_b = obj.eventListeners) === null || _b === void 0 ? void 0 : _b[eventType]) !== null && _c !== void 0 ? _c : [];
3689
+ const hierarchyEvents = (_c = (_b = obj.eventListeners) === null || _b === undefined ? undefined : _b[eventType]) !== null && _c !== undefined ? _c : [];
3687
3690
  events.push(...hierarchyEvents);
3688
3691
  obj = Object.getPrototypeOf(obj);
3689
3692
  }
@@ -3949,7 +3952,7 @@
3949
3952
  if (hasRequiredContainer) return Container;
3950
3953
  hasRequiredContainer = 1;
3951
3954
  Object.defineProperty(Container, "__esModule", { value: true });
3952
- Container.Container = void 0;
3955
+ Container.Container = undefined;
3953
3956
  const Factory_1 = requireFactory();
3954
3957
  const Node_1 = requireNode();
3955
3958
  const Validators_1 = requireValidators();
@@ -4106,13 +4109,13 @@
4106
4109
  if (this.isCached()) {
4107
4110
  return;
4108
4111
  }
4109
- (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (node) {
4112
+ (_a = this.children) === null || _a === undefined ? undefined : _a.forEach(function (node) {
4110
4113
  node._clearSelfAndDescendantCache(attr);
4111
4114
  });
4112
4115
  }
4113
4116
  _setChildrenIndices() {
4114
4117
  var _a;
4115
- (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child, n) {
4118
+ (_a = this.children) === null || _a === undefined ? undefined : _a.forEach(function (child, n) {
4116
4119
  child.index = n;
4117
4120
  });
4118
4121
  this._requestDraw();
@@ -4183,7 +4186,7 @@
4183
4186
  context.save();
4184
4187
  context._applyGlobalCompositeOperation(this);
4185
4188
  }
4186
- (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
4189
+ (_a = this.children) === null || _a === undefined ? undefined : _a.forEach(function (child) {
4187
4190
  child[drawMethod](canvas, top, bufferCanvas);
4188
4191
  });
4189
4192
  if (hasComposition) {
@@ -4205,7 +4208,7 @@
4205
4208
  height: 0,
4206
4209
  };
4207
4210
  const that = this;
4208
- (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
4211
+ (_a = this.children) === null || _a === undefined ? undefined : _a.forEach(function (child) {
4209
4212
  if (!child.visible()) {
4210
4213
  return;
4211
4214
  }
@@ -4337,7 +4340,7 @@
4337
4340
  hasRequiredStage = 1;
4338
4341
  (function (exports) {
4339
4342
  Object.defineProperty(exports, "__esModule", { value: true });
4340
- exports.Stage = exports.stages = void 0;
4343
+ exports.Stage = exports.stages = undefined;
4341
4344
  const Util_1 = requireUtil();
4342
4345
  const Factory_1 = requireFactory();
4343
4346
  const Container_1 = requireContainer();
@@ -5054,7 +5057,7 @@
5054
5057
  hasRequiredShape = 1;
5055
5058
  (function (exports) {
5056
5059
  Object.defineProperty(exports, "__esModule", { value: true });
5057
- exports.Shape = exports.shapes = void 0;
5060
+ exports.Shape = exports.shapes = undefined;
5058
5061
  const Global_1 = requireGlobal();
5059
5062
  const Util_1 = requireUtil();
5060
5063
  const Factory_1 = requireFactory();
@@ -5287,7 +5290,7 @@
5287
5290
  }
5288
5291
  _useBufferCanvas(forceFill) {
5289
5292
  var _a;
5290
- const perfectDrawEnabled = (_a = this.attrs.perfectDrawEnabled) !== null && _a !== void 0 ? _a : true;
5293
+ const perfectDrawEnabled = (_a = this.attrs.perfectDrawEnabled) !== null && _a !== undefined ? _a : true;
5291
5294
  if (!perfectDrawEnabled) {
5292
5295
  return false;
5293
5296
  }
@@ -5607,7 +5610,7 @@
5607
5610
  if (hasRequiredLayer) return Layer;
5608
5611
  hasRequiredLayer = 1;
5609
5612
  Object.defineProperty(Layer, "__esModule", { value: true });
5610
- Layer.Layer = void 0;
5613
+ Layer.Layer = undefined;
5611
5614
  const Util_1 = requireUtil();
5612
5615
  const Container_1 = requireContainer();
5613
5616
  const Node_1 = requireNode();
@@ -5925,7 +5928,7 @@
5925
5928
  if (hasRequiredFastLayer) return FastLayer;
5926
5929
  hasRequiredFastLayer = 1;
5927
5930
  Object.defineProperty(FastLayer, "__esModule", { value: true });
5928
- FastLayer.FastLayer = void 0;
5931
+ FastLayer.FastLayer = undefined;
5929
5932
  const Util_1 = requireUtil();
5930
5933
  const Layer_1 = requireLayer();
5931
5934
  const Global_1 = requireGlobal();
@@ -5950,7 +5953,7 @@
5950
5953
  if (hasRequiredGroup) return Group$1;
5951
5954
  hasRequiredGroup = 1;
5952
5955
  Object.defineProperty(Group$1, "__esModule", { value: true });
5953
- Group$1.Group = void 0;
5956
+ Group$1.Group = undefined;
5954
5957
  const Util_1 = requireUtil();
5955
5958
  const Container_1 = requireContainer();
5956
5959
  const Global_1 = requireGlobal();
@@ -5976,7 +5979,7 @@
5976
5979
  if (hasRequiredAnimation) return Animation;
5977
5980
  hasRequiredAnimation = 1;
5978
5981
  Object.defineProperty(Animation, "__esModule", { value: true });
5979
- Animation.Animation = void 0;
5982
+ Animation.Animation = undefined;
5980
5983
  const Global_1 = requireGlobal();
5981
5984
  const Util_1 = requireUtil();
5982
5985
  const now = (function () {
@@ -6132,7 +6135,7 @@
6132
6135
  hasRequiredTween = 1;
6133
6136
  (function (exports) {
6134
6137
  Object.defineProperty(exports, "__esModule", { value: true });
6135
- exports.Easings = exports.Tween = void 0;
6138
+ exports.Easings = exports.Tween = undefined;
6136
6139
  const Util_1 = requireUtil();
6137
6140
  const Animation_1 = requireAnimation();
6138
6141
  const Node_1 = requireNode();
@@ -6665,7 +6668,7 @@
6665
6668
  hasRequired_CoreInternals = 1;
6666
6669
  (function (exports) {
6667
6670
  Object.defineProperty(exports, "__esModule", { value: true });
6668
- exports.Konva = void 0;
6671
+ exports.Konva = undefined;
6669
6672
  const Global_1 = requireGlobal();
6670
6673
  const Util_1 = requireUtil();
6671
6674
  const Node_1 = requireNode();
@@ -6712,7 +6715,7 @@
6712
6715
  if (hasRequiredArc) return Arc;
6713
6716
  hasRequiredArc = 1;
6714
6717
  Object.defineProperty(Arc, "__esModule", { value: true });
6715
- Arc.Arc = void 0;
6718
+ Arc.Arc = undefined;
6716
6719
  const Factory_1 = requireFactory();
6717
6720
  const Shape_1 = requireShape();
6718
6721
  const Global_1 = requireGlobal();
@@ -6763,12 +6766,7 @@
6763
6766
  Arc.Arc = Arc$1;
6764
6767
  Arc$1.prototype._centroid = true;
6765
6768
  Arc$1.prototype.className = 'Arc';
6766
- Arc$1.prototype._attrsAffectingSize = [
6767
- 'innerRadius',
6768
- 'outerRadius',
6769
- 'angle',
6770
- 'clockwise',
6771
- ];
6769
+ Arc$1.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];
6772
6770
  (0, Global_2._registerNode)(Arc$1);
6773
6771
  Factory_1.Factory.addGetterSetter(Arc$1, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
6774
6772
  Factory_1.Factory.addGetterSetter(Arc$1, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
@@ -6787,7 +6785,7 @@
6787
6785
  if (hasRequiredLine) return Line$1;
6788
6786
  hasRequiredLine = 1;
6789
6787
  Object.defineProperty(Line$1, "__esModule", { value: true });
6790
- Line$1.Line = void 0;
6788
+ Line$1.Line = undefined;
6791
6789
  const Factory_1 = requireFactory();
6792
6790
  const Global_1 = requireGlobal();
6793
6791
  const Shape_1 = requireShape();
@@ -6958,7 +6956,7 @@
6958
6956
  hasRequiredBezierFunctions = 1;
6959
6957
  (function (exports) {
6960
6958
  Object.defineProperty(exports, "__esModule", { value: true });
6961
- exports.t2length = exports.getQuadraticArcLength = exports.getCubicArcLength = exports.binomialCoefficients = exports.cValues = exports.tValues = void 0;
6959
+ exports.t2length = exports.getQuadraticArcLength = exports.getCubicArcLength = exports.binomialCoefficients = exports.cValues = exports.tValues = undefined;
6962
6960
  exports.tValues = [
6963
6961
  [],
6964
6962
  [],
@@ -7756,7 +7754,7 @@
7756
7754
  if (hasRequiredPath) return Path;
7757
7755
  hasRequiredPath = 1;
7758
7756
  Object.defineProperty(Path, "__esModule", { value: true });
7759
- Path.Path = void 0;
7757
+ Path.Path = undefined;
7760
7758
  const Factory_1 = requireFactory();
7761
7759
  const Shape_1 = requireShape();
7762
7760
  const Global_1 = requireGlobal();
@@ -7939,8 +7937,8 @@
7939
7937
  return null;
7940
7938
  }
7941
7939
  static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX, fromY) {
7942
- fromX = fromX !== null && fromX !== void 0 ? fromX : P1x;
7943
- fromY = fromY !== null && fromY !== void 0 ? fromY : P1y;
7940
+ fromX = fromX !== null && fromX !== undefined ? fromX : P1x;
7941
+ fromY = fromY !== null && fromY !== undefined ? fromY : P1y;
7944
7942
  const len = this.getLineLength(P1x, P1y, P2x, P2y);
7945
7943
  if (len < 1e-10) {
7946
7944
  return { x: P1x, y: P1y };
@@ -8369,7 +8367,7 @@
8369
8367
  if (hasRequiredArrow) return Arrow;
8370
8368
  hasRequiredArrow = 1;
8371
8369
  Object.defineProperty(Arrow, "__esModule", { value: true });
8372
- Arrow.Arrow = void 0;
8370
+ Arrow.Arrow = undefined;
8373
8371
  const Factory_1 = requireFactory();
8374
8372
  const Line_1 = requireLine();
8375
8373
  const Validators_1 = requireValidators();
@@ -8481,7 +8479,7 @@
8481
8479
  if (hasRequiredCircle) return Circle;
8482
8480
  hasRequiredCircle = 1;
8483
8481
  Object.defineProperty(Circle, "__esModule", { value: true });
8484
- Circle.Circle = void 0;
8482
+ Circle.Circle = undefined;
8485
8483
  const Factory_1 = requireFactory();
8486
8484
  const Shape_1 = requireShape();
8487
8485
  const Validators_1 = requireValidators();
@@ -8527,7 +8525,7 @@
8527
8525
  if (hasRequiredEllipse) return Ellipse;
8528
8526
  hasRequiredEllipse = 1;
8529
8527
  Object.defineProperty(Ellipse, "__esModule", { value: true });
8530
- Ellipse.Ellipse = void 0;
8528
+ Ellipse.Ellipse = undefined;
8531
8529
  const Factory_1 = requireFactory();
8532
8530
  const Shape_1 = requireShape();
8533
8531
  const Validators_1 = requireValidators();
@@ -8577,7 +8575,7 @@
8577
8575
  if (hasRequiredImage) return Image$1;
8578
8576
  hasRequiredImage = 1;
8579
8577
  Object.defineProperty(Image$1, "__esModule", { value: true });
8580
- Image$1.Image = void 0;
8578
+ Image$1.Image = undefined;
8581
8579
  const Util_1 = requireUtil();
8582
8580
  const Factory_1 = requireFactory();
8583
8581
  const Shape_1 = requireShape();
@@ -8586,11 +8584,7 @@
8586
8584
  class Image extends Shape_1.Shape {
8587
8585
  constructor(attrs) {
8588
8586
  super(attrs);
8589
- this._loadListener = () => {
8590
- this._requestDraw();
8591
- };
8592
- this.on('imageChange.konva', (props) => {
8593
- this._removeImageLoad(props.oldVal);
8587
+ this.on('imageChange.konva', () => {
8594
8588
  this._setImageLoad();
8595
8589
  });
8596
8590
  this._setImageLoad();
@@ -8604,19 +8598,11 @@
8604
8598
  return;
8605
8599
  }
8606
8600
  if (image && image['addEventListener']) {
8607
- image['addEventListener']('load', this._loadListener);
8608
- }
8609
- }
8610
- _removeImageLoad(image) {
8611
- if (image && image['removeEventListener']) {
8612
- image['removeEventListener']('load', this._loadListener);
8601
+ image['addEventListener']('load', () => {
8602
+ this._requestDraw();
8603
+ });
8613
8604
  }
8614
8605
  }
8615
- destroy() {
8616
- this._removeImageLoad(this.image());
8617
- super.destroy();
8618
- return this;
8619
- }
8620
8606
  _useBufferCanvas() {
8621
8607
  const hasCornerRadius = !!this.cornerRadius();
8622
8608
  const hasShadow = this.hasShadow();
@@ -8680,11 +8666,11 @@
8680
8666
  }
8681
8667
  getWidth() {
8682
8668
  var _a, _b;
8683
- return (_a = this.attrs.width) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.width;
8669
+ return (_a = this.attrs.width) !== null && _a !== undefined ? _a : (_b = this.image()) === null || _b === undefined ? undefined : _b.width;
8684
8670
  }
8685
8671
  getHeight() {
8686
8672
  var _a, _b;
8687
- return (_a = this.attrs.height) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.height;
8673
+ return (_a = this.attrs.height) !== null && _a !== undefined ? _a : (_b = this.image()) === null || _b === undefined ? undefined : _b.height;
8688
8674
  }
8689
8675
  static fromURL(url, callback, onError = null) {
8690
8676
  const img = Util_1.Util.createImageElement();
@@ -8720,7 +8706,7 @@
8720
8706
  if (hasRequiredLabel) return Label;
8721
8707
  hasRequiredLabel = 1;
8722
8708
  Object.defineProperty(Label, "__esModule", { value: true });
8723
- Label.Tag = Label.Label = void 0;
8709
+ Label.Tag = Label.Label = undefined;
8724
8710
  const Factory_1 = requireFactory();
8725
8711
  const Shape_1 = requireShape();
8726
8712
  const Group_1 = requireGroup();
@@ -8907,7 +8893,7 @@
8907
8893
  if (hasRequiredRect) return Rect;
8908
8894
  hasRequiredRect = 1;
8909
8895
  Object.defineProperty(Rect, "__esModule", { value: true });
8910
- Rect.Rect = void 0;
8896
+ Rect.Rect = undefined;
8911
8897
  const Factory_1 = requireFactory();
8912
8898
  const Shape_1 = requireShape();
8913
8899
  const Global_1 = requireGlobal();
@@ -8942,7 +8928,7 @@
8942
8928
  if (hasRequiredRegularPolygon) return RegularPolygon;
8943
8929
  hasRequiredRegularPolygon = 1;
8944
8930
  Object.defineProperty(RegularPolygon, "__esModule", { value: true });
8945
- RegularPolygon.RegularPolygon = void 0;
8931
+ RegularPolygon.RegularPolygon = undefined;
8946
8932
  const Factory_1 = requireFactory();
8947
8933
  const Shape_1 = requireShape();
8948
8934
  const Validators_1 = requireValidators();
@@ -9020,7 +9006,7 @@
9020
9006
  if (hasRequiredRing) return Ring;
9021
9007
  hasRequiredRing = 1;
9022
9008
  Object.defineProperty(Ring, "__esModule", { value: true });
9023
- Ring.Ring = void 0;
9009
+ Ring.Ring = undefined;
9024
9010
  const Factory_1 = requireFactory();
9025
9011
  const Shape_1 = requireShape();
9026
9012
  const Validators_1 = requireValidators();
@@ -9066,7 +9052,7 @@
9066
9052
  if (hasRequiredSprite) return Sprite$1;
9067
9053
  hasRequiredSprite = 1;
9068
9054
  Object.defineProperty(Sprite$1, "__esModule", { value: true });
9069
- Sprite$1.Sprite = void 0;
9055
+ Sprite$1.Sprite = undefined;
9070
9056
  const Factory_1 = requireFactory();
9071
9057
  const Shape_1 = requireShape();
9072
9058
  const Animation_1 = requireAnimation();
@@ -9187,7 +9173,7 @@
9187
9173
  if (hasRequiredStar) return Star;
9188
9174
  hasRequiredStar = 1;
9189
9175
  Object.defineProperty(Star, "__esModule", { value: true });
9190
- Star.Star = void 0;
9176
+ Star.Star = undefined;
9191
9177
  const Factory_1 = requireFactory();
9192
9178
  const Shape_1 = requireShape();
9193
9179
  const Validators_1 = requireValidators();
@@ -9238,7 +9224,7 @@
9238
9224
  if (hasRequiredText) return Text;
9239
9225
  hasRequiredText = 1;
9240
9226
  Object.defineProperty(Text, "__esModule", { value: true });
9241
- Text.Text = void 0;
9227
+ Text.Text = undefined;
9242
9228
  Text.stringToArray = stringToArray;
9243
9229
  const Util_1 = requireUtil();
9244
9230
  const Factory_1 = requireFactory();
@@ -9484,17 +9470,17 @@
9484
9470
  _context.restore();
9485
9471
  const scaleFactor = fontSize / 100;
9486
9472
  return {
9487
- actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !== void 0 ? _a : 71.58203125 * scaleFactor,
9488
- actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !== void 0 ? _b : 0,
9489
- actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !== void 0 ? _c : -7.421875 * scaleFactor,
9490
- actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !== void 0 ? _d : 75.732421875 * scaleFactor,
9491
- alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !== void 0 ? _e : 0,
9492
- emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !== void 0 ? _f : 100 * scaleFactor,
9493
- emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !== void 0 ? _g : -20 * scaleFactor,
9494
- fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !== void 0 ? _h : 91 * scaleFactor,
9495
- fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !== void 0 ? _j : 21 * scaleFactor,
9496
- hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !== void 0 ? _k : 72.80000305175781 * scaleFactor,
9497
- ideographicBaseline: (_l = metrics.ideographicBaseline) !== null && _l !== void 0 ? _l : -21 * scaleFactor,
9473
+ actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !== undefined ? _a : 71.58203125 * scaleFactor,
9474
+ actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !== undefined ? _b : 0,
9475
+ actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !== undefined ? _c : -7.421875 * scaleFactor,
9476
+ actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !== undefined ? _d : 75.732421875 * scaleFactor,
9477
+ alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !== undefined ? _e : 0,
9478
+ emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !== undefined ? _f : 100 * scaleFactor,
9479
+ emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !== undefined ? _g : -20 * scaleFactor,
9480
+ fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !== undefined ? _h : 91 * scaleFactor,
9481
+ fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !== undefined ? _j : 21 * scaleFactor,
9482
+ hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !== undefined ? _k : 72.80000305175781 * scaleFactor,
9483
+ ideographicBaseline: (_l = metrics.ideographicBaseline) !== null && _l !== undefined ? _l : -21 * scaleFactor,
9498
9484
  width: metrics.width,
9499
9485
  height: fontSize,
9500
9486
  };
@@ -9538,14 +9524,8 @@
9538
9524
  while (line.length > 0) {
9539
9525
  let low = 0, high = stringToArray(line).length, match = '', matchWidth = 0;
9540
9526
  while (low < high) {
9541
- const mid = (low + high) >>> 1, lineArray = stringToArray(line), substr = lineArray.slice(0, mid + 1).join(''), substrWidth = this._getTextWidth(substr);
9542
- const shouldConsiderEllipsis = shouldAddEllipsis &&
9543
- fixedHeight &&
9544
- currentHeightPx + lineHeightPx > maxHeightPx;
9545
- const effectiveWidth = shouldConsiderEllipsis
9546
- ? substrWidth + additionalWidth
9547
- : substrWidth;
9548
- if (effectiveWidth <= maxWidth) {
9527
+ const mid = (low + high) >>> 1, lineArray = stringToArray(line), substr = lineArray.slice(0, mid + 1).join(''), substrWidth = this._getTextWidth(substr) + additionalWidth;
9528
+ if (substrWidth <= maxWidth) {
9549
9529
  low = mid + 1;
9550
9530
  match = substr;
9551
9531
  matchWidth = substrWidth;
@@ -9692,7 +9672,7 @@
9692
9672
  if (hasRequiredTextPath) return TextPath;
9693
9673
  hasRequiredTextPath = 1;
9694
9674
  Object.defineProperty(TextPath, "__esModule", { value: true });
9695
- TextPath.TextPath = void 0;
9675
+ TextPath.TextPath = undefined;
9696
9676
  const Util_1 = requireUtil();
9697
9677
  const Factory_1 = requireFactory();
9698
9678
  const Shape_1 = requireShape();
@@ -9942,7 +9922,7 @@
9942
9922
  if (hasRequiredTransformer) return Transformer;
9943
9923
  hasRequiredTransformer = 1;
9944
9924
  Object.defineProperty(Transformer, "__esModule", { value: true });
9945
- Transformer.Transformer = void 0;
9925
+ Transformer.Transformer = undefined;
9946
9926
  const Util_1 = requireUtil();
9947
9927
  const Factory_1 = requireFactory();
9948
9928
  const Node_1 = requireNode();
@@ -10139,12 +10119,10 @@
10139
10119
  this.update();
10140
10120
  }
10141
10121
  };
10142
- if (node._attrsAffectingSize.length) {
10143
- const additionalEvents = node._attrsAffectingSize
10144
- .map((prop) => prop + 'Change.' + this._getEventNamespace())
10145
- .join(' ');
10146
- node.on(additionalEvents, onChange);
10147
- }
10122
+ const additionalEvents = node._attrsAffectingSize
10123
+ .map((prop) => prop + 'Change.' + this._getEventNamespace())
10124
+ .join(' ');
10125
+ node.on(additionalEvents, onChange);
10148
10126
  node.on(TRANSFORM_CHANGE_STR.map((e) => e + `.${this._getEventNamespace()}`).join(' '), onChange);
10149
10127
  node.on(`absoluteTransformChange.${this._getEventNamespace()}`, onChange);
10150
10128
  this._proxyDrag(node);
@@ -10619,12 +10597,12 @@
10619
10597
  const node = this.getNode();
10620
10598
  activeTransformersCount--;
10621
10599
  this._fire('transformend', { evt: e, target: node });
10622
- (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
10600
+ (_a = this.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
10623
10601
  if (node) {
10624
10602
  this._nodes.forEach((target) => {
10625
10603
  var _a;
10626
10604
  target._fire('transformend', { evt: e, target });
10627
- (_a = target.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
10605
+ (_a = target.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
10628
10606
  });
10629
10607
  }
10630
10608
  this._movingAnchorName = null;
@@ -10737,7 +10715,7 @@
10737
10715
  .multiply(localTransform);
10738
10716
  const attrs = newLocalTransform.decompose();
10739
10717
  node.setAttrs(attrs);
10740
- (_a = node.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
10718
+ (_a = node.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
10741
10719
  });
10742
10720
  this.rotation(Util_1.Util._getRotation(newAttrs.rotation));
10743
10721
  this._nodes.forEach((node) => {
@@ -10852,7 +10830,7 @@
10852
10830
  styleFunc(node);
10853
10831
  });
10854
10832
  }
10855
- (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
10833
+ (_a = this.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
10856
10834
  }
10857
10835
  isTransforming() {
10858
10836
  return this._transforming;
@@ -10959,7 +10937,7 @@
10959
10937
  if (hasRequiredWedge) return Wedge;
10960
10938
  hasRequiredWedge = 1;
10961
10939
  Object.defineProperty(Wedge, "__esModule", { value: true });
10962
- Wedge.Wedge = void 0;
10940
+ Wedge.Wedge = undefined;
10963
10941
  const Factory_1 = requireFactory();
10964
10942
  const Shape_1 = requireShape();
10965
10943
  const Global_1 = requireGlobal();
@@ -11010,7 +10988,7 @@
11010
10988
  if (hasRequiredBlur) return Blur;
11011
10989
  hasRequiredBlur = 1;
11012
10990
  Object.defineProperty(Blur, "__esModule", { value: true });
11013
- Blur.Blur = void 0;
10991
+ Blur.Blur = undefined;
11014
10992
  const Factory_1 = requireFactory();
11015
10993
  const Node_1 = requireNode();
11016
10994
  const Validators_1 = requireValidators();
@@ -11258,7 +11236,7 @@
11258
11236
  if (hasRequiredBrighten) return Brighten;
11259
11237
  hasRequiredBrighten = 1;
11260
11238
  Object.defineProperty(Brighten, "__esModule", { value: true });
11261
- Brighten.Brighten = void 0;
11239
+ Brighten.Brighten = undefined;
11262
11240
  const Factory_1 = requireFactory();
11263
11241
  const Node_1 = requireNode();
11264
11242
  const Validators_1 = requireValidators();
@@ -11283,7 +11261,7 @@
11283
11261
  if (hasRequiredContrast) return Contrast;
11284
11262
  hasRequiredContrast = 1;
11285
11263
  Object.defineProperty(Contrast, "__esModule", { value: true });
11286
- Contrast.Contrast = void 0;
11264
+ Contrast.Contrast = undefined;
11287
11265
  const Factory_1 = requireFactory();
11288
11266
  const Node_1 = requireNode();
11289
11267
  const Validators_1 = requireValidators();
@@ -11331,7 +11309,7 @@
11331
11309
  if (hasRequiredEmboss) return Emboss;
11332
11310
  hasRequiredEmboss = 1;
11333
11311
  Object.defineProperty(Emboss, "__esModule", { value: true });
11334
- Emboss.Emboss = void 0;
11312
+ Emboss.Emboss = undefined;
11335
11313
  const Factory_1 = requireFactory();
11336
11314
  const Node_1 = requireNode();
11337
11315
  const Util_1 = requireUtil();
@@ -11447,7 +11425,7 @@
11447
11425
  if (hasRequiredEnhance) return Enhance;
11448
11426
  hasRequiredEnhance = 1;
11449
11427
  Object.defineProperty(Enhance, "__esModule", { value: true });
11450
- Enhance.Enhance = void 0;
11428
+ Enhance.Enhance = undefined;
11451
11429
  const Factory_1 = requireFactory();
11452
11430
  const Node_1 = requireNode();
11453
11431
  const Validators_1 = requireValidators();
@@ -11544,7 +11522,7 @@
11544
11522
  if (hasRequiredGrayscale) return Grayscale;
11545
11523
  hasRequiredGrayscale = 1;
11546
11524
  Object.defineProperty(Grayscale, "__esModule", { value: true });
11547
- Grayscale.Grayscale = void 0;
11525
+ Grayscale.Grayscale = undefined;
11548
11526
  const Grayscale$1 = function (imageData) {
11549
11527
  const data = imageData.data, len = data.length;
11550
11528
  for (let i = 0; i < len; i += 4) {
@@ -11566,7 +11544,7 @@
11566
11544
  if (hasRequiredHSL) return HSL;
11567
11545
  hasRequiredHSL = 1;
11568
11546
  Object.defineProperty(HSL, "__esModule", { value: true });
11569
- HSL.HSL = void 0;
11547
+ HSL.HSL = undefined;
11570
11548
  const Factory_1 = requireFactory();
11571
11549
  const Node_1 = requireNode();
11572
11550
  const Validators_1 = requireValidators();
@@ -11603,7 +11581,7 @@
11603
11581
  if (hasRequiredHSV) return HSV;
11604
11582
  hasRequiredHSV = 1;
11605
11583
  Object.defineProperty(HSV, "__esModule", { value: true });
11606
- HSV.HSV = void 0;
11584
+ HSV.HSV = undefined;
11607
11585
  const Factory_1 = requireFactory();
11608
11586
  const Node_1 = requireNode();
11609
11587
  const Validators_1 = requireValidators();
@@ -11640,7 +11618,7 @@
11640
11618
  if (hasRequiredInvert) return Invert;
11641
11619
  hasRequiredInvert = 1;
11642
11620
  Object.defineProperty(Invert, "__esModule", { value: true });
11643
- Invert.Invert = void 0;
11621
+ Invert.Invert = undefined;
11644
11622
  const Invert$1 = function (imageData) {
11645
11623
  const data = imageData.data, len = data.length;
11646
11624
  for (let i = 0; i < len; i += 4) {
@@ -11661,7 +11639,7 @@
11661
11639
  if (hasRequiredKaleidoscope) return Kaleidoscope;
11662
11640
  hasRequiredKaleidoscope = 1;
11663
11641
  Object.defineProperty(Kaleidoscope, "__esModule", { value: true });
11664
- Kaleidoscope.Kaleidoscope = void 0;
11642
+ Kaleidoscope.Kaleidoscope = undefined;
11665
11643
  const Factory_1 = requireFactory();
11666
11644
  const Node_1 = requireNode();
11667
11645
  const Util_1 = requireUtil();
@@ -11807,7 +11785,7 @@
11807
11785
  if (hasRequiredMask) return Mask;
11808
11786
  hasRequiredMask = 1;
11809
11787
  Object.defineProperty(Mask, "__esModule", { value: true });
11810
- Mask.Mask = void 0;
11788
+ Mask.Mask = undefined;
11811
11789
  const Factory_1 = requireFactory();
11812
11790
  const Node_1 = requireNode();
11813
11791
  const Validators_1 = requireValidators();
@@ -11961,7 +11939,7 @@
11961
11939
  if (hasRequiredNoise) return Noise;
11962
11940
  hasRequiredNoise = 1;
11963
11941
  Object.defineProperty(Noise, "__esModule", { value: true });
11964
- Noise.Noise = void 0;
11942
+ Noise.Noise = undefined;
11965
11943
  const Factory_1 = requireFactory();
11966
11944
  const Node_1 = requireNode();
11967
11945
  const Validators_1 = requireValidators();
@@ -11986,7 +11964,7 @@
11986
11964
  if (hasRequiredPixelate) return Pixelate;
11987
11965
  hasRequiredPixelate = 1;
11988
11966
  Object.defineProperty(Pixelate, "__esModule", { value: true });
11989
- Pixelate.Pixelate = void 0;
11967
+ Pixelate.Pixelate = undefined;
11990
11968
  const Factory_1 = requireFactory();
11991
11969
  const Util_1 = requireUtil();
11992
11970
  const Node_1 = requireNode();
@@ -12059,7 +12037,7 @@
12059
12037
  if (hasRequiredPosterize) return Posterize;
12060
12038
  hasRequiredPosterize = 1;
12061
12039
  Object.defineProperty(Posterize, "__esModule", { value: true });
12062
- Posterize.Posterize = void 0;
12040
+ Posterize.Posterize = undefined;
12063
12041
  const Factory_1 = requireFactory();
12064
12042
  const Node_1 = requireNode();
12065
12043
  const Validators_1 = requireValidators();
@@ -12082,7 +12060,7 @@
12082
12060
  if (hasRequiredRGB) return RGB;
12083
12061
  hasRequiredRGB = 1;
12084
12062
  Object.defineProperty(RGB, "__esModule", { value: true });
12085
- RGB.RGB = void 0;
12063
+ RGB.RGB = undefined;
12086
12064
  const Factory_1 = requireFactory();
12087
12065
  const Node_1 = requireNode();
12088
12066
  const Validators_1 = requireValidators();
@@ -12133,7 +12111,7 @@
12133
12111
  if (hasRequiredRGBA) return RGBA;
12134
12112
  hasRequiredRGBA = 1;
12135
12113
  Object.defineProperty(RGBA, "__esModule", { value: true });
12136
- RGBA.RGBA = void 0;
12114
+ RGBA.RGBA = undefined;
12137
12115
  const Factory_1 = requireFactory();
12138
12116
  const Node_1 = requireNode();
12139
12117
  const Validators_1 = requireValidators();
@@ -12195,7 +12173,7 @@
12195
12173
  if (hasRequiredSepia) return Sepia;
12196
12174
  hasRequiredSepia = 1;
12197
12175
  Object.defineProperty(Sepia, "__esModule", { value: true });
12198
- Sepia.Sepia = void 0;
12176
+ Sepia.Sepia = undefined;
12199
12177
  const Sepia$1 = function (imageData) {
12200
12178
  const data = imageData.data, nPixels = data.length;
12201
12179
  for (let i = 0; i < nPixels; i += 4) {
@@ -12219,7 +12197,7 @@
12219
12197
  if (hasRequiredSolarize) return Solarize;
12220
12198
  hasRequiredSolarize = 1;
12221
12199
  Object.defineProperty(Solarize, "__esModule", { value: true });
12222
- Solarize.Solarize = void 0;
12200
+ Solarize.Solarize = undefined;
12223
12201
  const Solarize$1 = function (imageData) {
12224
12202
  const data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4;
12225
12203
  let y = h;
@@ -12258,7 +12236,7 @@
12258
12236
  if (hasRequiredThreshold) return Threshold;
12259
12237
  hasRequiredThreshold = 1;
12260
12238
  Object.defineProperty(Threshold, "__esModule", { value: true });
12261
- Threshold.Threshold = void 0;
12239
+ Threshold.Threshold = undefined;
12262
12240
  const Factory_1 = requireFactory();
12263
12241
  const Node_1 = requireNode();
12264
12242
  const Validators_1 = requireValidators();
@@ -12279,7 +12257,7 @@
12279
12257
  if (hasRequired_FullInternals) return _FullInternals;
12280
12258
  hasRequired_FullInternals = 1;
12281
12259
  Object.defineProperty(_FullInternals, "__esModule", { value: true });
12282
- _FullInternals.Konva = void 0;
12260
+ _FullInternals.Konva = undefined;
12283
12261
  const _CoreInternals_1 = require_CoreInternals();
12284
12262
  const Arc_1 = requireArc();
12285
12263
  const Arrow_1 = requireArrow();
@@ -12432,10 +12410,29 @@
12432
12410
  const LineTypeSpecs = new Map([ [ "solid", [] ], [ "dot", [ 30, 30, .001, 30 ] ], [ "dash", [ 30, 30 ] ] ]);
12433
12411
 
12434
12412
  class KonvaLine {
12435
- constructor(params, ref = null) {
12413
+ constructor(params, ref = null, worldTransformer = new WorldTransform) {
12436
12414
  var _a, _b;
12415
+ this._worldTransformer = worldTransformer;
12437
12416
  if (ref) {
12438
12417
  this._ref = ref;
12418
+ let wcsPoints = this._ref.getAttr("wcsPoints");
12419
+ if (!wcsPoints) {
12420
+ wcsPoints = [];
12421
+ let points = this._ref.points();
12422
+ let wcsPoint;
12423
+ for (let i = 0; i < points.length; i += 2) {
12424
+ wcsPoint = this._worldTransformer.screenToWorld({
12425
+ x: points[i],
12426
+ y: points[i + 1]
12427
+ });
12428
+ wcsPoints.push({
12429
+ x: wcsPoint.x,
12430
+ y: wcsPoint.y,
12431
+ z: wcsPoint.z
12432
+ });
12433
+ }
12434
+ this._ref.setAttr("wcsPoints", wcsPoints);
12435
+ }
12439
12436
  return;
12440
12437
  }
12441
12438
  if (!params) params = {};
@@ -12447,10 +12444,22 @@
12447
12444
  y: 100
12448
12445
  } ];
12449
12446
  const konvaPoints = [];
12450
- params.points.forEach((point => konvaPoints.push(point.x, point.y)));
12447
+ const wcsPoints = [];
12448
+ params.points.forEach((point => {
12449
+ konvaPoints.push(point.x, point.y);
12450
+ let wcsPoint = this._worldTransformer.screenToWorld({
12451
+ x: point.x,
12452
+ y: point.y
12453
+ });
12454
+ wcsPoints.push({
12455
+ x: wcsPoint.x,
12456
+ y: wcsPoint.y,
12457
+ z: wcsPoint.z
12458
+ });
12459
+ }));
12451
12460
  this._ref = new Konva.Line({
12452
- stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12453
- strokeWidth: (_b = params.width) !== null && _b !== void 0 ? _b : 4,
12461
+ stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
12462
+ strokeWidth: (_b = params.width) !== null && _b !== undefined ? _b : 4,
12454
12463
  globalCompositeOperation: "source-over",
12455
12464
  lineCap: "round",
12456
12465
  lineJoin: "round",
@@ -12459,10 +12468,55 @@
12459
12468
  strokeScaleEnabled: false,
12460
12469
  dash: LineTypeSpecs.get(params.type) || []
12461
12470
  });
12471
+ this._ref.setAttr("wcsPoints", wcsPoints);
12462
12472
  this._ref.on("transform", (e => {
12463
12473
  const attrs = e.target.attrs;
12464
12474
  if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
12465
12475
  }));
12476
+ this._ref.on("transformend", (e => {
12477
+ const absoluteTransform = this._ref.getAbsoluteTransform();
12478
+ let wcsPoints = [];
12479
+ let points = this._ref.points();
12480
+ let wcsPoint;
12481
+ for (let i = 0; i < points.length; i += 2) {
12482
+ const position = absoluteTransform.point({
12483
+ x: points[i],
12484
+ y: points[i + 1]
12485
+ });
12486
+ wcsPoint = this._worldTransformer.screenToWorld({
12487
+ x: position.x,
12488
+ y: position.y
12489
+ });
12490
+ wcsPoints.push({
12491
+ x: wcsPoint.x,
12492
+ y: wcsPoint.y,
12493
+ z: wcsPoint.z
12494
+ });
12495
+ }
12496
+ this._ref.setAttr("wcsPoints", wcsPoints);
12497
+ }));
12498
+ this._ref.on("dragend", (e => {
12499
+ const absoluteTransform = this._ref.getAbsoluteTransform();
12500
+ let wcsPoints = [];
12501
+ let points = this._ref.points();
12502
+ let wcsPoint;
12503
+ for (let i = 0; i < points.length; i += 2) {
12504
+ const position = absoluteTransform.point({
12505
+ x: points[i],
12506
+ y: points[i + 1]
12507
+ });
12508
+ wcsPoint = this._worldTransformer.screenToWorld({
12509
+ x: position.x,
12510
+ y: position.y
12511
+ });
12512
+ wcsPoints.push({
12513
+ x: wcsPoint.x,
12514
+ y: wcsPoint.y,
12515
+ z: wcsPoint.z
12516
+ });
12517
+ }
12518
+ this._ref.setAttr("wcsPoints", wcsPoints);
12519
+ }));
12466
12520
  this._ref.id(this._ref._id.toString());
12467
12521
  }
12468
12522
  ref() {
@@ -12532,19 +12586,48 @@
12532
12586
  }
12533
12587
  addPoints(points) {
12534
12588
  let newPoints = this._ref.points();
12589
+ let wcsPoints = this._ref.getAttr("wcsPoints");
12535
12590
  points.forEach((point => {
12536
12591
  newPoints = newPoints.concat([ point.x, point.y ]);
12592
+ let wcsPoint = this._worldTransformer.screenToWorld(point);
12593
+ wcsPoints.push(wcsPoint);
12537
12594
  }));
12538
12595
  this._ref.points(newPoints);
12539
12596
  }
12597
+ updateScreenCoordinates() {
12598
+ let wcsPoints = this._ref.getAttr("wcsPoints");
12599
+ let points = [];
12600
+ let invert = this._ref.getAbsoluteTransform().copy();
12601
+ invert = invert.invert();
12602
+ wcsPoints.forEach((point => {
12603
+ let screenPoint = this._worldTransformer.worldToScreen(point);
12604
+ screenPoint = invert.point({
12605
+ x: screenPoint.x,
12606
+ y: screenPoint.y
12607
+ });
12608
+ points.push(screenPoint.x);
12609
+ points.push(screenPoint.y);
12610
+ }));
12611
+ this._ref.points([]);
12612
+ this._ref.points(points);
12613
+ this._ref.clearCache();
12614
+ }
12540
12615
  }
12541
12616
 
12542
12617
  class KonvaText {
12543
- constructor(params, ref = null) {
12618
+ constructor(params, ref = null, worldTransformer = new WorldTransform) {
12544
12619
  var _a, _b, _c;
12545
12620
  this.TEXT_FONT_FAMILY = "Calibri";
12621
+ this._worldTransformer = worldTransformer;
12546
12622
  if (ref) {
12547
12623
  this._ref = ref;
12624
+ const wcsStart = this._ref.getAttr("wcsStart");
12625
+ if (!wcsStart) {
12626
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
12627
+ x: ref.x(),
12628
+ y: ref.y()
12629
+ }));
12630
+ }
12548
12631
  return;
12549
12632
  }
12550
12633
  if (!params) params = {};
@@ -12557,14 +12640,18 @@
12557
12640
  x: params.position.x,
12558
12641
  y: params.position.y,
12559
12642
  text: params.text,
12560
- fontSize: (_a = params.fontSize) !== null && _a !== void 0 ? _a : 34,
12643
+ fontSize: (_a = params.fontSize) !== null && _a !== undefined ? _a : 34,
12561
12644
  fontFamily: this.TEXT_FONT_FAMILY,
12562
- fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
12645
+ fill: (_b = params.color) !== null && _b !== undefined ? _b : "#ff0000",
12563
12646
  align: "left",
12564
12647
  draggable: true,
12565
- rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0
12648
+ rotation: (_c = params.rotation) !== null && _c !== undefined ? _c : 0
12566
12649
  });
12567
12650
  this._ref.width(this._ref.getTextWidth());
12651
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
12652
+ x: params.position.x,
12653
+ y: params.position.y
12654
+ }));
12568
12655
  this._ref.on("transform", (e => {
12569
12656
  const attrs = e.target.attrs;
12570
12657
  if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
@@ -12588,6 +12675,24 @@
12588
12675
  y: 1
12589
12676
  });
12590
12677
  }));
12678
+ this._ref.on("transformend", (e => {
12679
+ const attrs = e.target.attrs;
12680
+ if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
12681
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12682
+ const position = absoluteTransform.point({
12683
+ x: this._ref.x(),
12684
+ y: this._ref.y()
12685
+ });
12686
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
12687
+ }));
12688
+ this._ref.on("dragend", (e => {
12689
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12690
+ const position = absoluteTransform.point({
12691
+ x: this._ref.x(),
12692
+ y: this._ref.y()
12693
+ });
12694
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
12695
+ }));
12591
12696
  this._ref.id(this._ref._id.toString());
12592
12697
  }
12593
12698
  ref() {
@@ -12638,6 +12743,10 @@
12638
12743
  x: x,
12639
12744
  y: y
12640
12745
  });
12746
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
12747
+ x: x,
12748
+ y: y
12749
+ }));
12641
12750
  }
12642
12751
  getFontSize() {
12643
12752
  return this._ref.fontSize();
@@ -12645,13 +12754,42 @@
12645
12754
  setFontSize(size) {
12646
12755
  this._ref.fontSize(size);
12647
12756
  }
12757
+ updateScreenCoordinates() {
12758
+ let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
12759
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
12760
+ invert = invert.invert();
12761
+ const positionStart = invert.point(screenPositionStart);
12762
+ this._ref.position({
12763
+ x: positionStart.x,
12764
+ y: positionStart.y
12765
+ });
12766
+ }
12648
12767
  }
12649
12768
 
12650
12769
  class KonvaRectangle {
12651
- constructor(params, ref = null) {
12770
+ constructor(params, ref = null, worldTransformer = new WorldTransform) {
12652
12771
  var _a, _b, _c, _d;
12772
+ this._worldTransformer = worldTransformer;
12653
12773
  if (ref) {
12654
12774
  this._ref = ref;
12775
+ const wcsStart = this._ref.getAttr("wcsStart");
12776
+ const wcsEnd = this._ref.getAttr("wcsEnd");
12777
+ if (!wcsStart) {
12778
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
12779
+ x: ref.x(),
12780
+ y: ref.y()
12781
+ }));
12782
+ }
12783
+ if (!wcsEnd) {
12784
+ const rightBottomPoint = {
12785
+ x: ref.x() + ref.width(),
12786
+ y: ref.y() + ref.height()
12787
+ };
12788
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
12789
+ x: rightBottomPoint.x,
12790
+ y: rightBottomPoint.y
12791
+ }));
12792
+ }
12655
12793
  return;
12656
12794
  }
12657
12795
  if (!params) params = {};
@@ -12659,22 +12797,47 @@
12659
12797
  x: 0,
12660
12798
  y: 0
12661
12799
  };
12800
+ if (params.position2) {
12801
+ params.width = params.position.x - params.position2.x;
12802
+ params.height = params.position.y - params.position2.y;
12803
+ } else {
12804
+ if (!params.width || !params.height) {
12805
+ params.position2 = {
12806
+ x: 200,
12807
+ y: 200
12808
+ };
12809
+ params.width = 200;
12810
+ params.height = 200;
12811
+ } else {
12812
+ params.position2 = {
12813
+ x: params.position.x + params.width,
12814
+ y: params.position.y + params.height
12815
+ };
12816
+ }
12817
+ }
12662
12818
  this._ref = new Konva.Rect({
12663
- stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12664
- strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
12819
+ stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
12820
+ strokeWidth: (_b = params.lineWidth) !== null && _b !== undefined ? _b : 4,
12665
12821
  globalCompositeOperation: "source-over",
12666
12822
  lineCap: "round",
12667
12823
  lineJoin: "round",
12668
12824
  x: params.position.x,
12669
12825
  y: params.position.y,
12670
- width: (_c = params.width) !== null && _c !== void 0 ? _c : 200,
12671
- height: (_d = params.height) !== null && _d !== void 0 ? _d : 200,
12826
+ width: (_c = params.width) !== null && _c !== undefined ? _c : 200,
12827
+ height: (_d = params.height) !== null && _d !== undefined ? _d : 200,
12672
12828
  draggable: true,
12673
12829
  strokeScaleEnabled: false
12674
12830
  });
12831
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
12832
+ x: params.position.x,
12833
+ y: params.position.y
12834
+ }));
12835
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
12836
+ x: params.position2.x,
12837
+ y: params.position2.y
12838
+ }));
12675
12839
  this._ref.on("transform", (e => {
12676
12840
  const attrs = e.target.attrs;
12677
- if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
12678
12841
  const scaleByX = Math.abs(attrs.scaleX - 1) > 1e-5;
12679
12842
  const scaleByY = Math.abs(attrs.scaleY - 1) > 1e-5;
12680
12843
  let newWidth = this._ref.width();
@@ -12696,6 +12859,32 @@
12696
12859
  y: 1
12697
12860
  });
12698
12861
  }));
12862
+ this._ref.on("transformend", (e => {
12863
+ const attrs = e.target.attrs;
12864
+ if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
12865
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12866
+ const position = absoluteTransform.point({
12867
+ x: this._ref.x(),
12868
+ y: this._ref.y()
12869
+ });
12870
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
12871
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
12872
+ x: position.x + this._ref.width(),
12873
+ y: position.y + this._ref.height()
12874
+ }));
12875
+ }));
12876
+ this._ref.on("dragend", (e => {
12877
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
12878
+ const position = absoluteTransform.point({
12879
+ x: this._ref.x(),
12880
+ y: this._ref.y()
12881
+ });
12882
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
12883
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
12884
+ x: position.x + this._ref.width(),
12885
+ y: position.y + this._ref.height()
12886
+ }));
12887
+ }));
12699
12888
  this._ref.id(this._ref._id.toString());
12700
12889
  }
12701
12890
  getPosition() {
@@ -12709,15 +12898,31 @@
12709
12898
  }
12710
12899
  setWidth(w) {
12711
12900
  this._ref.width(w);
12901
+ const rightLowerPoint = {
12902
+ x: this._ref.x() + w,
12903
+ y: this._ref.y() + this._ref.height()
12904
+ };
12905
+ const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
12906
+ this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
12712
12907
  }
12713
12908
  setHeight(h) {
12714
12909
  this._ref.height(h);
12910
+ const rightLowerPoint = {
12911
+ x: this._ref.x() + this._ref.width(),
12912
+ y: this._ref.y() + h
12913
+ };
12914
+ const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
12915
+ this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
12715
12916
  }
12716
12917
  setPosition(x, y) {
12717
12918
  this._ref.setPosition({
12718
12919
  x: x,
12719
12920
  y: y
12720
12921
  });
12922
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
12923
+ x: x,
12924
+ y: y
12925
+ }));
12721
12926
  }
12722
12927
  ref() {
12723
12928
  return this._ref;
@@ -12759,13 +12964,49 @@
12759
12964
  getLineWidth() {
12760
12965
  return this._ref.strokeWidth();
12761
12966
  }
12967
+ updateScreenCoordinates() {
12968
+ let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
12969
+ let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
12970
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
12971
+ invert = invert.invert();
12972
+ const positionStart = invert.point(screenPositionStart);
12973
+ const positionEnd = invert.point(screenPositionEnd);
12974
+ this._ref.position({
12975
+ x: positionStart.x,
12976
+ y: positionStart.y
12977
+ });
12978
+ this._ref.width(Math.abs(positionEnd.x - positionStart.x));
12979
+ this._ref.height(Math.abs(positionEnd.y - positionStart.y));
12980
+ }
12762
12981
  }
12763
12982
 
12764
12983
  class KonvaEllipse {
12765
- constructor(params, ref = null) {
12984
+ constructor(params, ref = null, worldTransformer = new WorldTransform) {
12766
12985
  var _a, _b;
12986
+ this._worldTransformer = worldTransformer;
12767
12987
  if (ref) {
12768
12988
  this._ref = ref;
12989
+ const wcsPosition = this._ref.getAttr("wcsPosition");
12990
+ const radiusX = this._ref.getAttr("wcsRadiusX");
12991
+ const radiusY = this._ref.getAttr("wcsRadiusY");
12992
+ if (!wcsPosition) {
12993
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({
12994
+ x: ref.x(),
12995
+ y: ref.y()
12996
+ }));
12997
+ }
12998
+ if (!radiusX) {
12999
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({
13000
+ x: ref.x() + ref.radiusX(),
13001
+ y: ref.y()
13002
+ }));
13003
+ }
13004
+ if (!radiusY) {
13005
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({
13006
+ x: ref.x(),
13007
+ y: ref.y() + ref.radiusY()
13008
+ }));
13009
+ }
12769
13010
  return;
12770
13011
  }
12771
13012
  if (!params) params = {};
@@ -12778,8 +13019,8 @@
12778
13019
  y: 25
12779
13020
  };
12780
13021
  this._ref = new Konva.Ellipse({
12781
- stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12782
- strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
13022
+ stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
13023
+ strokeWidth: (_b = params.lineWidth) !== null && _b !== undefined ? _b : 4,
12783
13024
  globalCompositeOperation: "source-over",
12784
13025
  lineCap: "round",
12785
13026
  lineJoin: "round",
@@ -12790,6 +13031,18 @@
12790
13031
  draggable: true,
12791
13032
  strokeScaleEnabled: false
12792
13033
  });
13034
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({
13035
+ x: params.position.x,
13036
+ y: params.position.y
13037
+ }));
13038
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({
13039
+ x: this._ref.x() + params.radius.x,
13040
+ y: this._ref.y()
13041
+ }));
13042
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({
13043
+ x: this._ref.x(),
13044
+ y: this._ref.y() + params.radius.y
13045
+ }));
12793
13046
  this._ref.on("transform", (e => {
12794
13047
  const attrs = e.target.attrs;
12795
13048
  if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
@@ -12826,6 +13079,42 @@
12826
13079
  y: 1
12827
13080
  });
12828
13081
  }));
13082
+ this._ref.on("transformend", (e => {
13083
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13084
+ const position = absoluteTransform.point({
13085
+ x: this._ref.x(),
13086
+ y: this._ref.y()
13087
+ });
13088
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld(position));
13089
+ const radiusX = absoluteTransform.point({
13090
+ x: this._ref.x() + this._ref.radiusX(),
13091
+ y: this._ref.y()
13092
+ });
13093
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld(radiusX));
13094
+ const radiusY = absoluteTransform.point({
13095
+ x: this._ref.x(),
13096
+ y: this._ref.y() + this._ref.radiusY()
13097
+ });
13098
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld(radiusY));
13099
+ }));
13100
+ this._ref.on("dragend", (e => {
13101
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13102
+ const position = absoluteTransform.point({
13103
+ x: this._ref.x(),
13104
+ y: this._ref.y()
13105
+ });
13106
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld(position));
13107
+ const radiusX = absoluteTransform.point({
13108
+ x: this._ref.x() + this._ref.radiusX(),
13109
+ y: this._ref.y()
13110
+ });
13111
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld(radiusX));
13112
+ const radiusY = absoluteTransform.point({
13113
+ x: this._ref.x(),
13114
+ y: this._ref.y() + this._ref.radiusY()
13115
+ });
13116
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld(radiusY));
13117
+ }));
12829
13118
  this._ref.id(this._ref._id.toString());
12830
13119
  }
12831
13120
  getPosition() {
@@ -12836,18 +13125,30 @@
12836
13125
  x: x,
12837
13126
  y: y
12838
13127
  });
13128
+ this._ref.setAttr("wcsPosition", this._worldTransformer.screenToWorld({
13129
+ x: x,
13130
+ y: y
13131
+ }));
12839
13132
  }
12840
13133
  getRadiusX() {
12841
13134
  return this._ref.radiusX();
12842
13135
  }
12843
13136
  setRadiusX(r) {
12844
13137
  this._ref.radiusX(r);
13138
+ this._ref.setAttr("wcsRadiusX", this._worldTransformer.screenToWorld({
13139
+ x: this._ref.x() + r,
13140
+ y: this._ref.y()
13141
+ }));
12845
13142
  }
12846
13143
  getRadiusY() {
12847
13144
  return this._ref.radiusY();
12848
13145
  }
12849
13146
  setRadiusY(r) {
12850
13147
  this._ref.radiusY(r);
13148
+ this._ref.setAttr("wcsRadiusY", this._worldTransformer.screenToWorld({
13149
+ x: this._ref.x(),
13150
+ y: this._ref.y() + r
13151
+ }));
12851
13152
  }
12852
13153
  getLineWidth() {
12853
13154
  return this._ref.strokeWidth();
@@ -12889,13 +13190,43 @@
12889
13190
  this._ref.destroy();
12890
13191
  this._ref = null;
12891
13192
  }
13193
+ updateScreenCoordinates() {
13194
+ let screenPosition = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsPosition"));
13195
+ let radiusX = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusX"));
13196
+ let radiusY = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusY"));
13197
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
13198
+ invert = invert.invert();
13199
+ const position = invert.point({
13200
+ x: screenPosition.x,
13201
+ y: screenPosition.y
13202
+ });
13203
+ this._ref.position({
13204
+ x: position.x,
13205
+ y: position.y
13206
+ });
13207
+ this._ref.radius({
13208
+ x: Math.abs(invert.point(radiusX).x - position.x),
13209
+ y: Math.abs(invert.point(radiusY).y - position.y)
13210
+ });
13211
+ }
12892
13212
  }
12893
13213
 
12894
13214
  class KonvaArrow {
12895
- constructor(params, ref = null) {
13215
+ constructor(params, ref = null, worldTransformer = new WorldTransform) {
12896
13216
  var _a, _b;
13217
+ this._worldTransformer = worldTransformer;
12897
13218
  if (ref) {
12898
13219
  this._ref = ref;
13220
+ const wcsStart = this._ref.getAttr("wcsStart");
13221
+ const wcsEnd = this._ref.getAttr("wcsEnd");
13222
+ if (!wcsStart) this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13223
+ x: ref.points()[0],
13224
+ y: ref.points()[1]
13225
+ }));
13226
+ if (!wcsEnd) this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
13227
+ x: ref.points()[2],
13228
+ y: ref.points()[3]
13229
+ }));
12899
13230
  return;
12900
13231
  }
12901
13232
  if (!params) params = {};
@@ -12908,8 +13239,8 @@
12908
13239
  y: 100
12909
13240
  };
12910
13241
  this._ref = new Konva.Arrow({
12911
- stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12912
- fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
13242
+ stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
13243
+ fill: (_b = params.color) !== null && _b !== undefined ? _b : "#ff0000",
12913
13244
  strokeWidth: 4,
12914
13245
  globalCompositeOperation: "source-over",
12915
13246
  lineCap: "round",
@@ -12918,9 +13249,43 @@
12918
13249
  draggable: true,
12919
13250
  strokeScaleEnabled: false
12920
13251
  });
12921
- this._ref.on("transform", (e => {
13252
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13253
+ x: params.start.x,
13254
+ y: params.start.y
13255
+ }));
13256
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
13257
+ x: params.end.x,
13258
+ y: params.end.y
13259
+ }));
13260
+ this._ref.on("transformend", (e => {
12922
13261
  const attrs = e.target.attrs;
12923
13262
  if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
13263
+ const points = this._ref.points();
13264
+ const absoluteTransform = this._ref.getAbsoluteTransform();
13265
+ const transformStart = absoluteTransform.point({
13266
+ x: points[0],
13267
+ y: points[1]
13268
+ });
13269
+ const transformEnd = absoluteTransform.point({
13270
+ x: points[2],
13271
+ y: points[3]
13272
+ });
13273
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(transformStart));
13274
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld(transformEnd));
13275
+ }));
13276
+ this._ref.on("dragend", (e => {
13277
+ const points = this._ref.points();
13278
+ const absoluteTransform = e.target.getAbsoluteTransform();
13279
+ const transformStart = absoluteTransform.point({
13280
+ x: points[0],
13281
+ y: points[1]
13282
+ });
13283
+ const transformEnd = absoluteTransform.point({
13284
+ x: points[2],
13285
+ y: points[3]
13286
+ });
13287
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(transformStart));
13288
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld(transformEnd));
12924
13289
  }));
12925
13290
  this._ref.id(this._ref._id.toString());
12926
13291
  }
@@ -12971,6 +13336,14 @@
12971
13336
  }
12972
13337
  setPoints(points) {
12973
13338
  if (points.length === 2) {
13339
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13340
+ x: points[0].x,
13341
+ y: points[0].y
13342
+ }));
13343
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
13344
+ x: points[1].x,
13345
+ y: points[1].y
13346
+ }));
12974
13347
  this._ref.points([ points[0].x, points[0].y, points[1].x, points[1].y ]);
12975
13348
  }
12976
13349
  }
@@ -12984,6 +13357,10 @@
12984
13357
  setStartPoint(x, y) {
12985
13358
  const points = this._ref.points();
12986
13359
  this._ref.points([ x, y, points[2], points[3] ]);
13360
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13361
+ x: x,
13362
+ y: y
13363
+ }));
12987
13364
  }
12988
13365
  getEndPoint() {
12989
13366
  const points = this._ref.points();
@@ -12995,16 +13372,36 @@
12995
13372
  setEndPoint(x, y) {
12996
13373
  const points = this._ref.points();
12997
13374
  this._ref.points([ points[0], points[1], x, y ]);
13375
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
13376
+ x: x,
13377
+ y: y
13378
+ }));
13379
+ }
13380
+ updateScreenCoordinates() {
13381
+ let screenStartPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
13382
+ let screenEndPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
13383
+ let invert = this._ref.getAbsoluteTransform().copy();
13384
+ invert = invert.invert();
13385
+ const startPoint = invert.point({
13386
+ x: screenStartPoint.x,
13387
+ y: screenStartPoint.y
13388
+ });
13389
+ const endPoint = invert.point({
13390
+ x: screenEndPoint.x,
13391
+ y: screenEndPoint.y
13392
+ });
13393
+ this._ref.points([ startPoint.x, startPoint.y, endPoint.x, endPoint.y ]);
12998
13394
  }
12999
13395
  }
13000
13396
 
13001
13397
  class KonvaImage {
13002
- constructor(params, ref = null) {
13398
+ constructor(params, ref = null, worldTransformer = new WorldTransform) {
13003
13399
  var _a, _b;
13004
13400
  this._ratio = 1;
13005
13401
  this.EPSILON = 1e-5;
13006
13402
  this.BASE64_HEADER_START = "data:image/";
13007
13403
  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=";
13404
+ this._worldTransformer = worldTransformer;
13008
13405
  if (ref) {
13009
13406
  if (!ref.src || !ref.src.startsWith(this.BASE64_HEADER_START)) ref.src = this.BASE64_NOT_FOUND;
13010
13407
  if (ref.height() <= this.EPSILON) ref.height(32);
@@ -13012,6 +13409,13 @@
13012
13409
  this._ref = ref;
13013
13410
  this._canvasImage = ref.image();
13014
13411
  this._ratio = this._ref.height() <= this.EPSILON || this._ref.width() <= this.EPSILON ? 1 : this._ref.height() / this._ref.width();
13412
+ const wcsStart = this._ref.getAttr("wcsStart");
13413
+ if (!wcsStart) {
13414
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13415
+ x: ref.x(),
13416
+ y: ref.y()
13417
+ }));
13418
+ }
13015
13419
  return;
13016
13420
  }
13017
13421
  if (!params) params = {};
@@ -13049,10 +13453,14 @@
13049
13453
  x: params.position.x,
13050
13454
  y: params.position.y,
13051
13455
  image: this._canvasImage,
13052
- width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
13053
- height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
13456
+ width: (_a = params.width) !== null && _a !== undefined ? _a : 0,
13457
+ height: (_b = params.height) !== null && _b !== undefined ? _b : 0,
13054
13458
  draggable: true
13055
13459
  });
13460
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13461
+ x: params.position.x,
13462
+ y: params.position.y
13463
+ }));
13056
13464
  this._ref.on("transform", (e => {
13057
13465
  const attrs = e.target.attrs;
13058
13466
  if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
@@ -13083,6 +13491,22 @@
13083
13491
  y: 1
13084
13492
  });
13085
13493
  }));
13494
+ this._ref.on("transformend", (e => {
13495
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13496
+ const position = absoluteTransform.point({
13497
+ x: this._ref.x(),
13498
+ y: this._ref.y()
13499
+ });
13500
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
13501
+ }));
13502
+ this._ref.on("dragend", (e => {
13503
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13504
+ const position = absoluteTransform.point({
13505
+ x: this._ref.x(),
13506
+ y: this._ref.y()
13507
+ });
13508
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
13509
+ }));
13086
13510
  this._ref.id(this._ref._id.toString());
13087
13511
  }
13088
13512
  getSrc() {
@@ -13141,14 +13565,47 @@
13141
13565
  x: x,
13142
13566
  y: y
13143
13567
  });
13568
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13569
+ x: x,
13570
+ y: y
13571
+ }));
13572
+ }
13573
+ updateScreenCoordinates() {
13574
+ let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
13575
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
13576
+ invert = invert.invert();
13577
+ const positionStart = invert.point(screenPositionStart);
13578
+ this._ref.position({
13579
+ x: positionStart.x,
13580
+ y: positionStart.y
13581
+ });
13144
13582
  }
13145
13583
  }
13146
13584
 
13147
13585
  class KonvaCloud {
13148
- constructor(params, ref = null) {
13586
+ constructor(params, ref = null, worldTransformer = new WorldTransform) {
13149
13587
  var _a, _b, _c, _d;
13588
+ this._worldTransformer = worldTransformer;
13150
13589
  if (ref) {
13151
13590
  this._ref = ref;
13591
+ const wcsStart = this._ref.getAttr("wcsStart");
13592
+ const wcsEnd = this._ref.getAttr("wcsEnd");
13593
+ if (!wcsStart) {
13594
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13595
+ x: ref.x(),
13596
+ y: ref.y()
13597
+ }));
13598
+ }
13599
+ if (!wcsEnd) {
13600
+ const rightBottomPoint = {
13601
+ x: ref.x() + ref.width(),
13602
+ y: ref.y() + ref.height()
13603
+ };
13604
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
13605
+ x: rightBottomPoint.x,
13606
+ y: rightBottomPoint.y
13607
+ }));
13608
+ }
13152
13609
  return;
13153
13610
  }
13154
13611
  if (!params) params = {};
@@ -13156,14 +13613,32 @@
13156
13613
  x: 0,
13157
13614
  y: 0
13158
13615
  };
13159
- const arcRadius = 16;
13616
+ if (params.position2) {
13617
+ params.width = params.position.x - params.position2.x;
13618
+ params.height = params.position.y - params.position2.y;
13619
+ } else {
13620
+ if (!params.width || !params.height) {
13621
+ params.position2 = {
13622
+ x: 200,
13623
+ y: 200
13624
+ };
13625
+ params.width = 200;
13626
+ params.height = 200;
13627
+ } else {
13628
+ params.position2 = {
13629
+ x: params.position.x + params.width,
13630
+ y: params.position.y + params.height
13631
+ };
13632
+ }
13633
+ }
13634
+ const ARC_RADIUS = 16;
13160
13635
  this._ref = new Konva.Shape({
13161
13636
  x: params.position.x,
13162
13637
  y: params.position.y,
13163
- width: (_a = params.width) !== null && _a !== void 0 ? _a : 200,
13164
- height: (_b = params.height) !== null && _b !== void 0 ? _b : 200,
13165
- stroke: (_c = params.color) !== null && _c !== void 0 ? _c : "#ff0000",
13166
- strokeWidth: (_d = params.lineWidth) !== null && _d !== void 0 ? _d : 4,
13638
+ width: (_a = params.width) !== null && _a !== undefined ? _a : 200,
13639
+ height: (_b = params.height) !== null && _b !== undefined ? _b : 200,
13640
+ stroke: (_c = params.color) !== null && _c !== undefined ? _c : "#ff0000",
13641
+ strokeWidth: (_d = params.lineWidth) !== null && _d !== undefined ? _d : 4,
13167
13642
  draggable: true,
13168
13643
  strokeScaleEnabled: false,
13169
13644
  globalCompositeOperation: "source-over",
@@ -13215,9 +13690,9 @@
13215
13690
  const counterClockwise = pX > midPoint.x && pY > midPoint.y;
13216
13691
  for (let iArc = 0; iArc < arcCount; iArc++) {
13217
13692
  if (counterClockwise) {
13218
- context.arc(pX, pY, arcRadius, endAngle, startAngle);
13693
+ context.arc(pX, pY, ARC_RADIUS, endAngle, startAngle);
13219
13694
  } else {
13220
- context.arc(pX, pY, arcRadius, startAngle, endAngle);
13695
+ context.arc(pX, pY, ARC_RADIUS, startAngle, endAngle);
13221
13696
  }
13222
13697
  pX += dx / arcCount;
13223
13698
  pY += dy / arcCount;
@@ -13228,9 +13703,16 @@
13228
13703
  }
13229
13704
  });
13230
13705
  this._ref.className = "Cloud";
13706
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13707
+ x: params.position.x,
13708
+ y: params.position.y
13709
+ }));
13710
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
13711
+ x: params.position2.x,
13712
+ y: params.position2.y
13713
+ }));
13231
13714
  this._ref.on("transform", (e => {
13232
13715
  const attrs = e.target.attrs;
13233
- if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
13234
13716
  const scaleByX = Math.abs(attrs.scaleX - 1) > 1e-5;
13235
13717
  const scaleByY = Math.abs(attrs.scaleY - 1) > 1e-5;
13236
13718
  let newWidth = this._ref.width();
@@ -13252,11 +13734,37 @@
13252
13734
  y: 1
13253
13735
  });
13254
13736
  }));
13737
+ this._ref.on("transformend", (e => {
13738
+ const attrs = e.target.attrs;
13739
+ if (attrs.rotation !== this._ref.rotation()) this._ref.rotation(attrs.rotation);
13740
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13741
+ const position = absoluteTransform.point({
13742
+ x: this._ref.x(),
13743
+ y: this._ref.y()
13744
+ });
13745
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
13746
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
13747
+ x: position.x + this._ref.width(),
13748
+ y: position.y + this._ref.height()
13749
+ }));
13750
+ }));
13751
+ this._ref.on("dragend", (e => {
13752
+ const absoluteTransform = this._ref.getStage().getAbsoluteTransform();
13753
+ const position = absoluteTransform.point({
13754
+ x: this._ref.x(),
13755
+ y: this._ref.y()
13756
+ });
13757
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld(position));
13758
+ this._ref.setAttr("wcsEnd", this._worldTransformer.screenToWorld({
13759
+ x: position.x + this._ref.width(),
13760
+ y: position.y + this._ref.height()
13761
+ }));
13762
+ }));
13255
13763
  this._ref.getSelfRect = () => ({
13256
- x: 0 - arcRadius,
13257
- y: 0 - arcRadius,
13258
- width: this._ref.width() + 2 * arcRadius,
13259
- height: this._ref.height() + 2 * arcRadius
13764
+ x: 0 - ARC_RADIUS,
13765
+ y: 0 - ARC_RADIUS,
13766
+ width: this._ref.width() + 2 * ARC_RADIUS,
13767
+ height: this._ref.height() + 2 * ARC_RADIUS
13260
13768
  });
13261
13769
  this._ref.id(this._ref._id.toString());
13262
13770
  }
@@ -13302,18 +13810,34 @@
13302
13810
  x: x,
13303
13811
  y: y
13304
13812
  });
13813
+ this._ref.setAttr("wcsStart", this._worldTransformer.screenToWorld({
13814
+ x: x,
13815
+ y: y
13816
+ }));
13305
13817
  }
13306
13818
  getWidth() {
13307
13819
  return this._ref.width();
13308
13820
  }
13309
13821
  setWidth(w) {
13310
13822
  this._ref.width(w);
13823
+ const rightLowerPoint = {
13824
+ x: this._ref.x() + w,
13825
+ y: this._ref.y() + this._ref.height()
13826
+ };
13827
+ const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
13828
+ this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
13311
13829
  }
13312
13830
  getHeigth() {
13313
13831
  return this._ref.height();
13314
13832
  }
13315
13833
  setHeight(h) {
13316
13834
  this._ref.height(h);
13835
+ const rightLowerPoint = {
13836
+ x: this._ref.x() + this._ref.width(),
13837
+ y: this._ref.y() + h
13838
+ };
13839
+ const wcsRightLowerPoint = this._worldTransformer.screenToWorld(rightLowerPoint);
13840
+ this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
13317
13841
  }
13318
13842
  getLineWidth() {
13319
13843
  return this._ref.strokeWidth();
@@ -13321,6 +13845,20 @@
13321
13845
  setLineWidth(size) {
13322
13846
  this._ref.strokeWidth(size);
13323
13847
  }
13848
+ updateScreenCoordinates() {
13849
+ let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
13850
+ let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
13851
+ let invert = this._ref.getStage().getAbsoluteTransform().copy();
13852
+ invert = invert.invert();
13853
+ const positionStart = invert.point(screenPositionStart);
13854
+ const positionEnd = invert.point(screenPositionEnd);
13855
+ this._ref.position({
13856
+ x: positionStart.x,
13857
+ y: positionStart.y
13858
+ });
13859
+ this._ref.width(Math.abs(positionEnd.x - positionStart.x));
13860
+ this._ref.height(Math.abs(positionEnd.y - positionStart.y));
13861
+ }
13324
13862
  }
13325
13863
 
13326
13864
  const MarkupMode2Konva = {
@@ -13330,37 +13868,49 @@
13330
13868
  },
13331
13869
  Line: {
13332
13870
  name: "Line",
13333
- initializer: (ref, params = null) => new KonvaLine(params, ref)
13871
+ initializer: (ref, params = null, ...attr) => new KonvaLine(params, ref, ...attr)
13334
13872
  },
13335
13873
  Text: {
13336
13874
  name: "Text",
13337
- initializer: (ref, params = null) => new KonvaText(params, ref)
13875
+ initializer: (ref, params = null, ...attr) => new KonvaText(params, ref, ...attr)
13338
13876
  },
13339
13877
  Rectangle: {
13340
13878
  name: "Rect",
13341
- initializer: (ref, params = null) => new KonvaRectangle(params, ref)
13879
+ initializer: (ref, params = null, ...attr) => new KonvaRectangle(params, ref, ...attr)
13342
13880
  },
13343
13881
  Ellipse: {
13344
13882
  name: "Ellipse",
13345
- initializer: (ref, params = null) => new KonvaEllipse(params, ref)
13883
+ initializer: (ref, params = null, ...attr) => new KonvaEllipse(params, ref, ...attr)
13346
13884
  },
13347
13885
  Arrow: {
13348
13886
  name: "Arrow",
13349
- initializer: (ref, params = null) => new KonvaArrow(params, ref)
13887
+ initializer: (ref, params = null, ...attr) => new KonvaArrow(params, ref, ...attr)
13350
13888
  },
13351
13889
  Image: {
13352
13890
  name: "Image",
13353
- initializer: (ref, params = null) => new KonvaImage(params, ref)
13891
+ initializer: (ref, params = null, ...attr) => new KonvaImage(params, ref, ...attr)
13354
13892
  },
13355
13893
  Cloud: {
13356
13894
  name: "Cloud",
13357
- initializer: (ref, params = null) => new KonvaCloud(params, ref)
13895
+ initializer: (ref, params = null, ...attr) => new KonvaCloud(params, ref, ...attr)
13358
13896
  }
13359
13897
  };
13360
13898
 
13899
+ function debounce(func, wait) {
13900
+ let timeout = null;
13901
+ return (...args) => {
13902
+ if (timeout) {
13903
+ clearTimeout(timeout);
13904
+ }
13905
+ timeout = setTimeout((() => {
13906
+ timeout = null;
13907
+ func(...args);
13908
+ }), wait);
13909
+ };
13910
+ }
13911
+
13361
13912
  class KonvaMarkup {
13362
13913
  constructor() {
13363
- this._containerEvents = [];
13364
13914
  this._markupIsActive = false;
13365
13915
  this._markupColor = new MarkupColor(255, 0, 0);
13366
13916
  this.lineWidth = 4;
@@ -13379,25 +13929,29 @@
13379
13929
  if (!this._konvaStage) return;
13380
13930
  this._konvaStage.width(width);
13381
13931
  this._konvaStage.height(height);
13932
+ this.getObjects().forEach((markupObject => {
13933
+ markupObject.updateScreenCoordinates();
13934
+ }));
13935
+ };
13936
+ this.resizeViewer = event => {
13937
+ const {width: width, height: height} = event;
13938
+ if (!width || !height) return;
13939
+ if (!this._konvaStage) return;
13940
+ this._konvaStage.width(width);
13941
+ this._konvaStage.height(height);
13942
+ this.getObjects().forEach((markupObject => {
13943
+ markupObject.updateScreenCoordinates();
13944
+ }));
13382
13945
  };
13383
13946
  this.pan = event => {
13384
- const newPos = {
13385
- x: this._konvaStage.x() + event.dX,
13386
- y: this._konvaStage.y() + event.dY
13387
- };
13388
- this._konvaStage.position(newPos);
13947
+ this.getObjects().forEach((markupObject => {
13948
+ markupObject.updateScreenCoordinates();
13949
+ }));
13389
13950
  };
13390
13951
  this.zoomAt = event => {
13391
- const newScale = this._konvaStage.scaleX() * event.data;
13392
- this._konvaStage.scale({
13393
- x: newScale,
13394
- y: newScale
13395
- });
13396
- const newPos = {
13397
- x: event.x - (event.x - this._konvaStage.x()) * event.data,
13398
- y: event.y - (event.y - this._konvaStage.y()) * event.data
13399
- };
13400
- this._konvaStage.position(newPos);
13952
+ this.getObjects().forEach((markupObject => {
13953
+ markupObject.updateScreenCoordinates();
13954
+ }));
13401
13955
  };
13402
13956
  this.redirectToViewer = event => {
13403
13957
  if (this._viewer) this._viewer.emit(event);
@@ -13412,9 +13966,8 @@
13412
13966
  initialize(container, containerEvents, viewer, worldTransformer) {
13413
13967
  if (!Konva) throw new Error('Markup error: Konva is not initialized. Forgot to add <script src="https://unpkg.com/konva@9/konva.min.js"><\/script> to your page?');
13414
13968
  this._viewer = viewer;
13415
- this._worldTransformer = worldTransformer !== null && worldTransformer !== void 0 ? worldTransformer : new WorldTransform;
13969
+ this._worldTransformer = worldTransformer !== null && worldTransformer !== undefined ? worldTransformer : new WorldTransform;
13416
13970
  this._container = container;
13417
- this._containerEvents = containerEvents !== null && containerEvents !== void 0 ? containerEvents : [];
13418
13971
  this._markupContainer = document.createElement("div");
13419
13972
  this._markupContainer.id = "markup-container";
13420
13973
  this._markupContainer.style.position = "absolute";
@@ -13424,8 +13977,7 @@
13424
13977
  this._markupContainer.style.pointerEvents = "none";
13425
13978
  const parentDiv = this._container.parentElement;
13426
13979
  parentDiv.appendChild(this._markupContainer);
13427
- this._resizeObserver = new ResizeObserver(this.resizeContainer);
13428
- this._resizeObserver.observe(parentDiv);
13980
+ if (viewer) this._viewer.addEventListener("resize", this.resizeViewer); else this._resizeObserver = new ResizeObserver(debounce(this.resizeContainer, 100));
13429
13981
  this._markupColor.setColor(255, 0, 0);
13430
13982
  this.initializeKonva();
13431
13983
  if (this._viewer) {
@@ -13442,9 +13994,9 @@
13442
13994
  this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
13443
13995
  }
13444
13996
  this.destroyKonva();
13445
- (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
13997
+ (_a = this._resizeObserver) === null || _a === undefined ? undefined : _a.disconnect();
13446
13998
  this._resizeObserver = undefined;
13447
- (_b = this._markupContainer) === null || _b === void 0 ? void 0 : _b.remove();
13999
+ (_b = this._markupContainer) === null || _b === undefined ? undefined : _b.remove();
13448
14000
  this._markupContainer = undefined;
13449
14001
  this._container = undefined;
13450
14002
  this._viewer = undefined;
@@ -13476,14 +14028,14 @@
13476
14028
  const hexColor = new MarkupColor(r, g, b).asHex();
13477
14029
  this.getObjects().filter((obj => {
13478
14030
  var _a;
13479
- return (_a = obj.setColor) === null || _a === void 0 ? void 0 : _a.call(obj, hexColor);
14031
+ return (_a = obj.setColor) === null || _a === undefined ? undefined : _a.call(obj, hexColor);
13480
14032
  }));
13481
14033
  }
13482
14034
  colorizeSelectedMarkups(r, g, b) {
13483
14035
  const hexColor = new MarkupColor(r, g, b).asHex();
13484
14036
  this.getSelectedObjects().filter((obj => {
13485
14037
  var _a;
13486
- return (_a = obj.setColor) === null || _a === void 0 ? void 0 : _a.call(obj, hexColor);
14038
+ return (_a = obj.setColor) === null || _a === undefined ? undefined : _a.call(obj, hexColor);
13487
14039
  }));
13488
14040
  }
13489
14041
  setViewpoint(viewpoint) {
@@ -13499,13 +14051,13 @@
13499
14051
  x: 0,
13500
14052
  y: 0
13501
14053
  });
13502
- const markupColor = ((_a = viewpoint.custom_fields) === null || _a === void 0 ? void 0 : _a.markup_color) || {
14054
+ const markupColor = ((_a = viewpoint.custom_fields) === null || _a === undefined ? undefined : _a.markup_color) || {
13503
14055
  r: 255,
13504
14056
  g: 0,
13505
14057
  b: 0
13506
14058
  };
13507
14059
  this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
13508
- (_b = viewpoint.lines) === null || _b === void 0 ? void 0 : _b.forEach((line => {
14060
+ (_b = viewpoint.lines) === null || _b === undefined ? undefined : _b.forEach((line => {
13509
14061
  const linePoints = [];
13510
14062
  line.points.forEach((point => {
13511
14063
  const screenPoint = this._worldTransformer.worldToScreen(point);
@@ -13514,28 +14066,28 @@
13514
14066
  }));
13515
14067
  this.addLine(linePoints, line.color, line.type, line.width, line.id);
13516
14068
  }));
13517
- (_c = viewpoint.texts) === null || _c === void 0 ? void 0 : _c.forEach((text => {
14069
+ (_c = viewpoint.texts) === null || _c === undefined ? undefined : _c.forEach((text => {
13518
14070
  const screenPoint = this._worldTransformer.worldToScreen(text.position);
13519
14071
  this.addText(text.text, screenPoint, text.angle, text.color, text.text_size, text.font_size, text.id);
13520
14072
  }));
13521
- (_d = viewpoint.rectangles) === null || _d === void 0 ? void 0 : _d.forEach((rect => {
14073
+ (_d = viewpoint.rectangles) === null || _d === undefined ? undefined : _d.forEach((rect => {
13522
14074
  const screenPoint = this._worldTransformer.worldToScreen(rect.position);
13523
- this.addRectangle(screenPoint, rect.width, rect.height, rect.line_width, rect.color, rect.id);
14075
+ this.addRectangle(screenPoint, null, rect.width, rect.height, rect.line_width, rect.color, rect.id);
13524
14076
  }));
13525
- (_e = viewpoint.ellipses) === null || _e === void 0 ? void 0 : _e.forEach((ellipse => {
14077
+ (_e = viewpoint.ellipses) === null || _e === undefined ? undefined : _e.forEach((ellipse => {
13526
14078
  const screenPoint = this._worldTransformer.worldToScreen(ellipse.position);
13527
14079
  this.addEllipse(screenPoint, ellipse.radius, ellipse.line_width, ellipse.color, ellipse.id);
13528
14080
  }));
13529
- (_f = viewpoint.arrows) === null || _f === void 0 ? void 0 : _f.forEach((arrow => {
14081
+ (_f = viewpoint.arrows) === null || _f === undefined ? undefined : _f.forEach((arrow => {
13530
14082
  const startPoint = this._worldTransformer.worldToScreen(arrow.start);
13531
14083
  const endPoint = this._worldTransformer.worldToScreen(arrow.end);
13532
14084
  this.addArrow(startPoint, endPoint, arrow.color, arrow.id);
13533
14085
  }));
13534
- (_g = viewpoint.clouds) === null || _g === void 0 ? void 0 : _g.forEach((cloud => {
14086
+ (_g = viewpoint.clouds) === null || _g === undefined ? undefined : _g.forEach((cloud => {
13535
14087
  const screenPoint = this._worldTransformer.worldToScreen(cloud.position);
13536
- this.addCloud(screenPoint, cloud.width, cloud.height, cloud.line_width, cloud.color, cloud.id);
14088
+ this.addCloud(screenPoint, null, cloud.width, cloud.height, cloud.line_width, cloud.color, cloud.id);
13537
14089
  }));
13538
- (_h = viewpoint.images) === null || _h === void 0 ? void 0 : _h.forEach((image => {
14090
+ (_h = viewpoint.images) === null || _h === undefined ? undefined : _h.forEach((image => {
13539
14091
  const screenPoint = this._worldTransformer.worldToScreen(image.position);
13540
14092
  this.addImage(screenPoint, image.src, image.width, image.height, image.id);
13541
14093
  }));
@@ -13574,7 +14126,7 @@
13574
14126
  createObject(type, params) {
13575
14127
  const konvaShape = MarkupMode2Konva[type];
13576
14128
  if (!konvaShape || !konvaShape.initializer) throw new Error(`Markup CreateObject - unsupported markup type ${type}`);
13577
- const object = konvaShape.initializer(null, params);
14129
+ const object = konvaShape.initializer(null, params, this._worldTransformer);
13578
14130
  this.addObject(object);
13579
14131
  return object;
13580
14132
  }
@@ -13582,7 +14134,7 @@
13582
14134
  const objects = [];
13583
14135
  Object.keys(MarkupMode2Konva).forEach((type => {
13584
14136
  const konvaShape = MarkupMode2Konva[type];
13585
- this.konvaLayerFind(type).forEach((ref => objects.push(konvaShape.initializer(ref))));
14137
+ this.konvaLayerFind(type).forEach((ref => objects.push(konvaShape.initializer(ref, null, this._worldTransformer))));
13586
14138
  }));
13587
14139
  return objects;
13588
14140
  }
@@ -13591,7 +14143,7 @@
13591
14143
  return this._konvaTransformer.nodes().map((ref => {
13592
14144
  const name = ref.className;
13593
14145
  const konvaShape = Object.values(MarkupMode2Konva).find((shape => shape.name === name));
13594
- return konvaShape ? konvaShape.initializer(ref) : null;
14146
+ return konvaShape ? konvaShape.initializer(ref, null, this._worldTransformer) : null;
13595
14147
  })).filter((x => x));
13596
14148
  }
13597
14149
  selectObjects(objects) {
@@ -13667,7 +14219,7 @@
13667
14219
  this.addRectangle({
13668
14220
  x: startX,
13669
14221
  y: startY
13670
- }, dX, dY);
14222
+ }, null, dX, dY);
13671
14223
  } else if (this._markupMode === "Ellipse") {
13672
14224
  this.addEllipse({
13673
14225
  x: startX,
@@ -13688,7 +14240,7 @@
13688
14240
  this.addCloud({
13689
14241
  x: startX,
13690
14242
  y: startY
13691
- }, Math.max(100, dX), Math.max(100, dY));
14243
+ }, null, Math.max(100, dX), Math.max(100, dY));
13692
14244
  }
13693
14245
  }
13694
14246
  }
@@ -13727,7 +14279,7 @@
13727
14279
  } else lastObj = this.addRectangle({
13728
14280
  x: startX,
13729
14281
  y: startY
13730
- }, dX, dY);
14282
+ }, null, dX, dY);
13731
14283
  } else if (this._markupMode === "Ellipse") {
13732
14284
  if (lastObj) {
13733
14285
  lastObj.setPosition(startX, startY);
@@ -13748,7 +14300,7 @@
13748
14300
  } else lastObj = this.addCloud({
13749
14301
  x: startX,
13750
14302
  y: startY
13751
- }, dX, dY);
14303
+ }, null, dX, dY);
13752
14304
  }
13753
14305
  }));
13754
14306
  stage.on("click tap", (e => {
@@ -13829,7 +14381,7 @@
13829
14381
  this.removeTextInput();
13830
14382
  this.removeImageInput();
13831
14383
  this.clearOverlay();
13832
- (_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.destroy();
14384
+ (_a = this._konvaStage) === null || _a === undefined ? undefined : _a.destroy();
13833
14385
  this._groupImages = undefined;
13834
14386
  this._groupGeometry = undefined;
13835
14387
  this._groupTexts = undefined;
@@ -13840,22 +14392,12 @@
13840
14392
  getMarkupLines() {
13841
14393
  const lines = [];
13842
14394
  this.konvaLayerFind("Line").forEach((ref => {
13843
- const linePoints = ref.points();
13844
- if (!linePoints) return;
13845
- const worldPoints = [];
13846
- const absoluteTransform = ref.getAbsoluteTransform();
13847
- for (let i = 0; i < linePoints.length; i += 2) {
13848
- const atPoint = absoluteTransform.point({
13849
- x: linePoints[i],
13850
- y: linePoints[i + 1]
13851
- });
13852
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13853
- worldPoints.push(worldPoint);
13854
- }
13855
- const konvaLine = new KonvaLine(null, ref);
14395
+ const wcsPoints = ref.getAttr("wcsPoints");
14396
+ if (!wcsPoints) return;
14397
+ const konvaLine = new KonvaLine(null, ref, this._worldTransformer);
13856
14398
  const line = {
13857
14399
  id: konvaLine.id(),
13858
- points: worldPoints,
14400
+ points: wcsPoints,
13859
14401
  color: konvaLine.getColor() || "#ff0000",
13860
14402
  type: konvaLine.getLineType() || this.lineType,
13861
14403
  width: konvaLine.getLineWidth() || this.lineWidth
@@ -13869,17 +14411,12 @@
13869
14411
  this.konvaLayerFind("Text").forEach((ref => {
13870
14412
  const textSize = .02;
13871
14413
  const textScale = this._worldTransformer.getScale();
13872
- const position = ref.position();
14414
+ const wcsPosition = ref.getAttr("wcsStart");
13873
14415
  const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13874
- const atPoint = stageAbsoluteTransform.point({
13875
- x: position.x,
13876
- y: position.y
13877
- });
13878
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13879
- const shape = new KonvaText(null, ref);
14416
+ const shape = new KonvaText(null, ref, this._worldTransformer);
13880
14417
  const text = {
13881
14418
  id: shape.id(),
13882
- position: worldPoint,
14419
+ position: wcsPosition,
13883
14420
  text: shape.getText(),
13884
14421
  text_size: textSize * textScale.y,
13885
14422
  angle: shape.getRotation(),
@@ -13893,20 +14430,16 @@
13893
14430
  getMarkupRectangles() {
13894
14431
  const rectangles = [];
13895
14432
  this.konvaLayerFind("Rectangle").forEach((ref => {
13896
- const position = ref.position();
13897
- const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13898
- const atPoint = stageAbsoluteTransform.point({
13899
- x: position.x,
13900
- y: position.y
13901
- });
13902
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13903
- const scale = stageAbsoluteTransform.getMatrix()[0];
13904
- const shape = new KonvaRectangle(null, ref);
14433
+ const wcsStart = ref.getAttr("wcsStart");
14434
+ const wcsEnd = ref.getAttr("wcsEnd");
14435
+ const screenStart = this._worldTransformer.worldToScreen(wcsStart);
14436
+ const screenEnd = this._worldTransformer.worldToScreen(wcsEnd);
14437
+ const shape = new KonvaRectangle(null, ref, this._worldTransformer);
13905
14438
  const rectangle = {
13906
14439
  id: shape.id(),
13907
- position: worldPoint,
13908
- width: shape.getWidth() * scale,
13909
- height: shape.getHeigth() * scale,
14440
+ position: wcsStart,
14441
+ width: Math.abs(screenStart.x - screenEnd.x),
14442
+ height: Math.abs(screenStart.y - screenEnd.y),
13910
14443
  line_width: shape.getLineWidth(),
13911
14444
  color: shape.getColor()
13912
14445
  };
@@ -13917,18 +14450,13 @@
13917
14450
  getMarkupEllipses() {
13918
14451
  const ellipses = [];
13919
14452
  this.konvaLayerFind("Ellipse").forEach((ref => {
13920
- const position = ref.position();
14453
+ const wcsPosition = ref.getAttr("wcsPosition");
13921
14454
  const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13922
- const atPoint = stageAbsoluteTransform.point({
13923
- x: position.x,
13924
- y: position.y
13925
- });
13926
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13927
14455
  const scale = stageAbsoluteTransform.getMatrix()[0];
13928
- const shape = new KonvaEllipse(null, ref);
14456
+ const shape = new KonvaEllipse(null, ref, this._worldTransformer);
13929
14457
  const ellipse = {
13930
14458
  id: shape.id(),
13931
- position: worldPoint,
14459
+ position: wcsPosition,
13932
14460
  radius: {
13933
14461
  x: ref.getRadiusX() * scale,
13934
14462
  y: ref.getRadiusY() * scale
@@ -13943,22 +14471,13 @@
13943
14471
  getMarkupArrows() {
13944
14472
  const arrows = [];
13945
14473
  this.konvaLayerFind("Arrow").forEach((ref => {
13946
- const absoluteTransform = ref.getAbsoluteTransform();
13947
- const atStartPoint = absoluteTransform.point({
13948
- x: ref.points()[0],
13949
- y: ref.points()[1]
13950
- });
13951
- const worldStartPoint = this._worldTransformer.screenToWorld(atStartPoint);
13952
- const atEndPoint = absoluteTransform.point({
13953
- x: ref.points()[2],
13954
- y: ref.points()[3]
13955
- });
13956
- const worldEndPoint = this._worldTransformer.screenToWorld(atEndPoint);
13957
- const shape = new KonvaArrow(null, ref);
14474
+ const wcsStart = ref.getAttr("wcsStart");
14475
+ const wcsEnd = ref.getAttr("wcsEnd");
14476
+ const shape = new KonvaArrow(null, ref, this._worldTransformer);
13958
14477
  const arrow = {
13959
14478
  id: shape.id(),
13960
- start: worldStartPoint,
13961
- end: worldEndPoint,
14479
+ start: wcsStart,
14480
+ end: wcsEnd,
13962
14481
  color: shape.getColor()
13963
14482
  };
13964
14483
  arrows.push(arrow);
@@ -13968,18 +14487,13 @@
13968
14487
  getMarkupImages() {
13969
14488
  const images = [];
13970
14489
  this.konvaLayerFind("Image").forEach((ref => {
13971
- const position = ref.position();
14490
+ const wcsStart = ref.getAttr("wcsStart");
13972
14491
  const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13973
- const atPoint = stageAbsoluteTransform.point({
13974
- x: position.x,
13975
- y: position.y
13976
- });
13977
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
13978
14492
  const scale = stageAbsoluteTransform.getMatrix()[0];
13979
- const shape = new KonvaImage(null, ref);
14493
+ const shape = new KonvaImage(null, ref, this._worldTransformer);
13980
14494
  const image = {
13981
14495
  id: shape.id(),
13982
- position: worldPoint,
14496
+ position: wcsStart,
13983
14497
  src: shape.getSrc(),
13984
14498
  width: shape.getWidth() * scale,
13985
14499
  height: shape.getHeight() * scale
@@ -13991,20 +14505,16 @@
13991
14505
  getMarkupClouds() {
13992
14506
  const clouds = [];
13993
14507
  this.konvaLayerFind("Cloud").forEach((ref => {
13994
- const position = ref.position();
13995
- const stageAbsoluteTransform = this._konvaStage.getAbsoluteTransform();
13996
- const atPoint = stageAbsoluteTransform.point({
13997
- x: position.x,
13998
- y: position.y
13999
- });
14000
- const worldPoint = this._worldTransformer.screenToWorld(atPoint);
14001
- const scale = stageAbsoluteTransform.getMatrix()[0];
14002
- const shape = new KonvaCloud(null, ref);
14508
+ const wcsStart = ref.getAttr("wcsStart");
14509
+ const wcsEnd = ref.getAttr("wcsEnd");
14510
+ const screenStart = this._worldTransformer.worldToScreen(wcsStart);
14511
+ const screenEnd = this._worldTransformer.worldToScreen(wcsEnd);
14512
+ const shape = new KonvaCloud(null, ref, this._worldTransformer);
14003
14513
  const cloud = {
14004
14514
  id: shape.id(),
14005
- position: worldPoint,
14006
- width: shape.getWidth() * scale,
14007
- height: shape.getHeigth() * scale,
14515
+ position: wcsStart,
14516
+ width: Math.abs(screenStart.x - screenEnd.x),
14517
+ height: Math.abs(screenStart.y - screenEnd.y),
14008
14518
  line_width: shape.getLineWidth(),
14009
14519
  color: shape.getColor()
14010
14520
  };
@@ -14041,7 +14551,7 @@
14041
14551
  width: width || this.lineWidth,
14042
14552
  color: color || this._markupColor.asHex(),
14043
14553
  id: id
14044
- });
14554
+ }, null, this._worldTransformer);
14045
14555
  this.addObject(konvaLine);
14046
14556
  return konvaLine;
14047
14557
  }
@@ -14079,7 +14589,7 @@
14079
14589
  }
14080
14590
  removeTextInput() {
14081
14591
  var _a;
14082
- (_a = this._textInputRef) === null || _a === void 0 ? void 0 : _a.remove();
14592
+ (_a = this._textInputRef) === null || _a === undefined ? undefined : _a.remove();
14083
14593
  this._textInputRef = null;
14084
14594
  this._textInputPos = null;
14085
14595
  this._textInputAngle = 0;
@@ -14122,14 +14632,14 @@
14122
14632
  }
14123
14633
  removeImageInput() {
14124
14634
  var _a;
14125
- (_a = this._imageInputRef) === null || _a === void 0 ? void 0 : _a.remove();
14635
+ (_a = this._imageInputRef) === null || _a === undefined ? undefined : _a.remove();
14126
14636
  this._imageInputRef = null;
14127
14637
  this._imageInputPos = null;
14128
14638
  }
14129
14639
  addText(text, position, angle, color, textSize, fontSize, id) {
14130
14640
  var _a;
14131
14641
  if (!text) return;
14132
- (_a = this.getSelectedObjects().at(0)) === null || _a === void 0 ? void 0 : _a.delete();
14642
+ (_a = this.getSelectedObjects().at(0)) === null || _a === undefined ? undefined : _a.delete();
14133
14643
  this.clearSelected();
14134
14644
  this.removeTextInput();
14135
14645
  const tolerance = 1e-6;
@@ -14148,20 +14658,21 @@
14148
14658
  fontSize: fontSize || this.fontSize,
14149
14659
  color: color || this._markupColor.asHex(),
14150
14660
  id: id
14151
- });
14661
+ }, null, this._worldTransformer);
14152
14662
  this.addObject(konvaText);
14153
14663
  return konvaText;
14154
14664
  }
14155
- addRectangle(position, width, height, lineWidth, color, id) {
14665
+ addRectangle(position, position2, width, height, lineWidth, color, id) {
14156
14666
  if (!position) return;
14157
14667
  const konvaRectangle = new KonvaRectangle({
14158
14668
  position: position,
14669
+ position2: position2,
14159
14670
  width: width,
14160
14671
  height: height,
14161
14672
  lineWidth: lineWidth || this.lineWidth,
14162
14673
  color: color || this._markupColor.asHex(),
14163
14674
  id: id
14164
- });
14675
+ }, null, this._worldTransformer);
14165
14676
  this.addObject(konvaRectangle);
14166
14677
  return konvaRectangle;
14167
14678
  }
@@ -14173,7 +14684,7 @@
14173
14684
  lineWidth: lineWidth,
14174
14685
  color: color || this._markupColor.asHex(),
14175
14686
  id: id
14176
- });
14687
+ }, null, this._worldTransformer);
14177
14688
  this.addObject(konvaEllipse);
14178
14689
  return konvaEllipse;
14179
14690
  }
@@ -14184,27 +14695,28 @@
14184
14695
  end: end,
14185
14696
  color: color || this._markupColor.asHex(),
14186
14697
  id: id
14187
- });
14698
+ }, null, this._worldTransformer);
14188
14699
  this.addObject(konvaArrow);
14189
14700
  return konvaArrow;
14190
14701
  }
14191
- addCloud(position, width, height, lineWidth, color, id) {
14702
+ addCloud(position, position2, width, height, lineWidth, color, id) {
14192
14703
  if (!position || !width || !height) return;
14193
14704
  const konvaCloud = new KonvaCloud({
14194
14705
  position: position,
14706
+ position2: position2,
14195
14707
  width: width,
14196
14708
  height: height,
14197
14709
  color: color || this._markupColor.asHex(),
14198
14710
  lineWidth: lineWidth || this.lineWidth,
14199
14711
  id: id
14200
- });
14712
+ }, null, this._worldTransformer);
14201
14713
  this.addObject(konvaCloud);
14202
14714
  return konvaCloud;
14203
14715
  }
14204
14716
  addImage(position, src, width, height, id) {
14205
14717
  var _a;
14206
14718
  if (!position || !src) return;
14207
- (_a = this.getSelectedObjects().at(0)) === null || _a === void 0 ? void 0 : _a.delete();
14719
+ (_a = this.getSelectedObjects().at(0)) === null || _a === undefined ? undefined : _a.delete();
14208
14720
  this.clearSelected();
14209
14721
  this.removeImageInput();
14210
14722
  const konvaImage = new KonvaImage({
@@ -14215,7 +14727,7 @@
14215
14727
  maxWidth: this._konvaStage.width() - position.x,
14216
14728
  maxHeight: this._konvaStage.height() - position.y,
14217
14729
  id: id
14218
- });
14730
+ }, null, this._worldTransformer);
14219
14731
  this.addObject(konvaImage);
14220
14732
  return konvaImage;
14221
14733
  }
@@ -57010,7 +57522,7 @@ void main() {
57010
57522
  // acknowledge and accept the above terms.
57011
57523
  ///////////////////////////////////////////////////////////////////////////////
57012
57524
  function getModels(viewer) {
57013
- return viewer.models.map((model) => { var _a; return ((_a = model.userData) === null || _a === void 0 ? void 0 : _a.handle) || ""; }).filter((handle) => handle);
57525
+ return viewer.models.map((model) => { var _a; return ((_a = model.userData) === null || _a === undefined ? undefined : _a.handle) || ""; }).filter((handle) => handle);
57014
57526
  }
57015
57527
 
57016
57528
  ///////////////////////////////////////////////////////////////////////////////
@@ -57036,7 +57548,7 @@ void main() {
57036
57548
  // acknowledge and accept the above terms.
57037
57549
  ///////////////////////////////////////////////////////////////////////////////
57038
57550
  function getSelected(viewer) {
57039
- return viewer.selected.map((object) => { var _a; return (_a = object.userData) === null || _a === void 0 ? void 0 : _a.handle; }).filter((handle) => handle);
57551
+ return viewer.selected.map((object) => { var _a; return (_a = object.userData) === null || _a === undefined ? undefined : _a.handle; }).filter((handle) => handle);
57040
57552
  }
57041
57553
 
57042
57554
  ///////////////////////////////////////////////////////////////////////////////
@@ -57382,7 +57894,7 @@ void main() {
57382
57894
  const objects = [];
57383
57895
  viewer.scene.traverseVisible((child) => {
57384
57896
  var _a;
57385
- if (handleSet.has((_a = child.userData) === null || _a === void 0 ? void 0 : _a.handle))
57897
+ if (handleSet.has((_a = child.userData) === null || _a === undefined ? undefined : _a.handle))
57386
57898
  objects.push(child);
57387
57899
  });
57388
57900
  const selection = viewer.getComponent("SelectionComponent");
@@ -57475,7 +57987,7 @@ void main() {
57475
57987
  const objects = [];
57476
57988
  viewer.scene.traverseVisible((child) => {
57477
57989
  var _a;
57478
- if (handleSet.has((_a = child.userData) === null || _a === void 0 ? void 0 : _a.handle))
57990
+ if (handleSet.has((_a = child.userData) === null || _a === undefined ? undefined : _a.handle))
57479
57991
  objects.push(child);
57480
57992
  });
57481
57993
  const extents = objects.reduce((result, object) => result.expandByObject(object), new Box3());
@@ -63021,7 +63533,7 @@ void main() {
63021
63533
  .replace(this.resourcePath, "")
63022
63534
  .replace(/^(\.?\/)/, "");
63023
63535
  const dataURL = this.dataURLs.get(key);
63024
- return dataURL !== null && dataURL !== void 0 ? dataURL : url;
63536
+ return dataURL !== null && dataURL !== undefined ? dataURL : url;
63025
63537
  });
63026
63538
  }
63027
63539
  dispose() {
@@ -63202,7 +63714,7 @@ void main() {
63202
63714
  this.renderer.autoClear = false;
63203
63715
  this.renderer.render(this.helpers, this.camera);
63204
63716
  this.renderer.clippingPlanes = clippingPlanes;
63205
- (_b = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
63717
+ (_b = (_a = this._activeDragger) === null || _a === undefined ? undefined : _a.updatePreview) === null || _b === undefined ? undefined : _b.call(_a);
63206
63718
  const deltaTime = (time - this.renderTime) / 1000;
63207
63719
  this.renderTime = time;
63208
63720
  this.emitEvent({ type: "render", time, deltaTime });
@@ -63470,7 +63982,7 @@ void main() {
63470
63982
  newDragger = draggers.createDragger(name, this);
63471
63983
  if (newDragger) {
63472
63984
  this._activeDragger = newDragger;
63473
- (_b = (_a = this._activeDragger).initialize) === null || _b === void 0 ? void 0 : _b.call(_a);
63985
+ (_b = (_a = this._activeDragger).initialize) === null || _b === undefined ? undefined : _b.call(_a);
63474
63986
  }
63475
63987
  }
63476
63988
  const canvas = this.canvas;
@@ -63567,7 +64079,7 @@ void main() {
63567
64079
  }
63568
64080
  };
63569
64081
  const setClippingPlanes = (clipping_planes) => {
63570
- clipping_planes === null || clipping_planes === void 0 ? void 0 : clipping_planes.forEach((clipping_plane) => {
64082
+ clipping_planes === null || clipping_planes === undefined ? undefined : clipping_planes.forEach((clipping_plane) => {
63571
64083
  const plane = new Plane();
63572
64084
  plane.setFromNormalAndCoplanarPoint(getVector3FromPoint3d(clipping_plane.direction), getVector3FromPoint3d(clipping_plane.location));
63573
64085
  this.renderer.clippingPlanes.push(plane);
@@ -63577,7 +64089,7 @@ void main() {
63577
64089
  if (selection)
63578
64090
  this.setSelected(selection.map((component) => component.handle));
63579
64091
  };
63580
- const draggerName = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.name;
64092
+ const draggerName = (_a = this._activeDragger) === null || _a === undefined ? undefined : _a.name;
63581
64093
  this.setActiveDragger();
63582
64094
  this.clearSlices();
63583
64095
  this.clearOverlay();
@@ -63589,7 +64101,7 @@ void main() {
63589
64101
  setClippingPlanes(viewpoint.clipping_planes);
63590
64102
  setSelection(viewpoint.selection);
63591
64103
  this._markup.setViewpoint(viewpoint);
63592
- this.target = getVector3FromPoint3d((_c = (_b = viewpoint.custom_fields) === null || _b === void 0 ? void 0 : _b.camera_target) !== null && _c !== void 0 ? _c : this.target);
64104
+ this.target = getVector3FromPoint3d((_c = (_b = viewpoint.custom_fields) === null || _b === undefined ? undefined : _b.camera_target) !== null && _c !== undefined ? _c : this.target);
63593
64105
  this.setActiveDragger(draggerName);
63594
64106
  this.emitEvent({ type: "drawviewpoint", data: viewpoint });
63595
64107
  this.update();