@inweb/viewer-visualize 26.1.0 → 26.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.16',
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]) {
@@ -710,7 +710,7 @@
710
710
  }
711
711
  }
712
712
  exports.Transform = Transform;
713
- let OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH = '#', EMPTY_STRING = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {
713
+ const OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH = '#', EMPTY_STRING = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {
714
714
  aliceblue: [240, 248, 255],
715
715
  antiquewhite: [250, 235, 215],
716
716
  aqua: [0, 255, 255],
@@ -860,7 +860,8 @@
860
860
  whitesmoke: [245, 245, 245],
861
861
  yellow: [255, 255, 0],
862
862
  yellowgreen: [154, 205, 5],
863
- }, RGB_REGEX = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/, animQueue = [];
863
+ }, RGB_REGEX = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;
864
+ let animQueue = [];
864
865
  const req = (typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame) ||
865
866
  function (f) {
866
867
  setTimeout(f, 60);
@@ -1257,19 +1258,19 @@
1257
1258
  return pc;
1258
1259
  },
1259
1260
  _prepareArrayForTween(startArray, endArray, isClosed) {
1260
- let n, start = [], end = [];
1261
+ const start = [], end = [];
1261
1262
  if (startArray.length > endArray.length) {
1262
1263
  const temp = endArray;
1263
1264
  endArray = startArray;
1264
1265
  startArray = temp;
1265
1266
  }
1266
- for (n = 0; n < startArray.length; n += 2) {
1267
+ for (let n = 0; n < startArray.length; n += 2) {
1267
1268
  start.push({
1268
1269
  x: startArray[n],
1269
1270
  y: startArray[n + 1],
1270
1271
  });
1271
1272
  }
1272
- for (n = 0; n < endArray.length; n += 2) {
1273
+ for (let n = 0; n < endArray.length; n += 2) {
1273
1274
  end.push({
1274
1275
  x: endArray[n],
1275
1276
  y: endArray[n + 1],
@@ -1438,8 +1439,8 @@
1438
1439
  function getNumberOrArrayOfNumbersValidator(noOfElements) {
1439
1440
  if (Global_1.Konva.isUnminified) {
1440
1441
  return function (val, attr) {
1441
- const isNumber = Util_1.Util._isNumber(val);
1442
- const isValidArray = Util_1.Util._isArray(val) && val.length == noOfElements;
1442
+ let isNumber = Util_1.Util._isNumber(val);
1443
+ let isValidArray = Util_1.Util._isArray(val) && val.length == noOfElements;
1443
1444
  if (!isNumber && !isValidArray) {
1444
1445
  Util_1.Util.warn(_formatValue(val) +
1445
1446
  ' is a not valid value for "' +
@@ -1455,8 +1456,8 @@
1455
1456
  function getNumberOrAutoValidator() {
1456
1457
  if (Global_1.Konva.isUnminified) {
1457
1458
  return function (val, attr) {
1458
- const isNumber = Util_1.Util._isNumber(val);
1459
- const isAuto = val === 'auto';
1459
+ var isNumber = Util_1.Util._isNumber(val);
1460
+ var isAuto = val === 'auto';
1460
1461
  if (!(isNumber || isAuto)) {
1461
1462
  Util_1.Util.warn(_formatValue(val) +
1462
1463
  ' is a not valid value for "' +
@@ -1485,7 +1486,7 @@
1485
1486
  return function (val, attr) {
1486
1487
  const isString = Util_1.Util._isString(val);
1487
1488
  const isGradient = Object.prototype.toString.call(val) === '[object CanvasGradient]' ||
1488
- (val && val.addColorStop);
1489
+ (val && val['addColorStop']);
1489
1490
  if (!(isString || isGradient)) {
1490
1491
  Util_1.Util.warn(_formatValue(val) +
1491
1492
  ' is a not valid value for "' +
@@ -1540,7 +1541,7 @@
1540
1541
  function getBooleanValidator() {
1541
1542
  if (Global_1.Konva.isUnminified) {
1542
1543
  return function (val, attr) {
1543
- const isBool = val === true || val === false;
1544
+ var isBool = val === true || val === false;
1544
1545
  if (!isBool) {
1545
1546
  Util_1.Util.warn(_formatValue(val) +
1546
1547
  ' is a not valid value for "' +
@@ -1578,10 +1579,11 @@
1578
1579
  hasRequiredFactory = 1;
1579
1580
  (function (exports) {
1580
1581
  Object.defineProperty(exports, "__esModule", { value: true });
1581
- exports.Factory = void 0;
1582
+ exports.Factory = undefined;
1582
1583
  const Util_1 = requireUtil();
1583
1584
  const Validators_1 = requireValidators();
1584
- const GET = 'get', SET = 'set';
1585
+ const GET = 'get';
1586
+ const SET = 'set';
1585
1587
  exports.Factory = {
1586
1588
  addGetterSetter(constructor, attr, def, validator, after) {
1587
1589
  exports.Factory.addGetter(constructor, attr, def);
@@ -1589,7 +1591,7 @@
1589
1591
  exports.Factory.addOverloadedGetterSetter(constructor, attr);
1590
1592
  },
1591
1593
  addGetter(constructor, attr, def) {
1592
- const method = GET + Util_1.Util._capitalize(attr);
1594
+ var method = GET + Util_1.Util._capitalize(attr);
1593
1595
  constructor.prototype[method] =
1594
1596
  constructor.prototype[method] ||
1595
1597
  function () {
@@ -1598,13 +1600,13 @@
1598
1600
  };
1599
1601
  },
1600
1602
  addSetter(constructor, attr, validator, after) {
1601
- const method = SET + Util_1.Util._capitalize(attr);
1603
+ var method = SET + Util_1.Util._capitalize(attr);
1602
1604
  if (!constructor.prototype[method]) {
1603
1605
  exports.Factory.overWriteSetter(constructor, attr, validator, after);
1604
1606
  }
1605
1607
  },
1606
1608
  overWriteSetter(constructor, attr, validator, after) {
1607
- const method = SET + Util_1.Util._capitalize(attr);
1609
+ var method = SET + Util_1.Util._capitalize(attr);
1608
1610
  constructor.prototype[method] = function (val) {
1609
1611
  if (validator && val !== undefined && val !== null) {
1610
1612
  val = validator.call(this, val, attr);
@@ -1617,25 +1619,25 @@
1617
1619
  };
1618
1620
  },
1619
1621
  addComponentsGetterSetter(constructor, attr, components, validator, after) {
1620
- let len = components.length, capitalize = Util_1.Util._capitalize, getter = GET + capitalize(attr), setter = SET + capitalize(attr), n, component;
1622
+ const len = components.length, capitalize = Util_1.Util._capitalize, getter = GET + capitalize(attr), setter = SET + capitalize(attr);
1621
1623
  constructor.prototype[getter] = function () {
1622
1624
  const ret = {};
1623
- for (n = 0; n < len; n++) {
1624
- component = components[n];
1625
+ for (let n = 0; n < len; n++) {
1626
+ const component = components[n];
1625
1627
  ret[component] = this.getAttr(attr + capitalize(component));
1626
1628
  }
1627
1629
  return ret;
1628
1630
  };
1629
1631
  const basicValidator = (0, Validators_1.getComponentValidator)(components);
1630
1632
  constructor.prototype[setter] = function (val) {
1631
- let oldVal = this.attrs[attr], key;
1633
+ const oldVal = this.attrs[attr];
1632
1634
  if (validator) {
1633
- val = validator.call(this, val);
1635
+ val = validator.call(this, val, attr);
1634
1636
  }
1635
1637
  if (basicValidator) {
1636
1638
  basicValidator.call(this, val, attr);
1637
1639
  }
1638
- for (key in val) {
1640
+ for (const key in val) {
1639
1641
  if (!val.hasOwnProperty(key)) {
1640
1642
  continue;
1641
1643
  }
@@ -1655,7 +1657,7 @@
1655
1657
  exports.Factory.addOverloadedGetterSetter(constructor, attr);
1656
1658
  },
1657
1659
  addOverloadedGetterSetter(constructor, attr) {
1658
- const capitalizedAttr = Util_1.Util._capitalize(attr), setter = SET + capitalizedAttr, getter = GET + capitalizedAttr;
1660
+ var capitalizedAttr = Util_1.Util._capitalize(attr), setter = SET + capitalizedAttr, getter = GET + capitalizedAttr;
1659
1661
  constructor.prototype[attr] = function () {
1660
1662
  if (arguments.length) {
1661
1663
  this[setter](arguments[0]);
@@ -1715,13 +1717,13 @@
1715
1717
  if (hasRequiredContext) return Context;
1716
1718
  hasRequiredContext = 1;
1717
1719
  Object.defineProperty(Context, "__esModule", { value: true });
1718
- Context.HitContext = Context.SceneContext = Context.Context = void 0;
1720
+ Context.HitContext = Context.SceneContext = Context.Context = undefined;
1719
1721
  const Util_1 = requireUtil();
1720
1722
  const Global_1 = requireGlobal();
1721
1723
  function simplifyArray(arr) {
1722
- let retArr = [], len = arr.length, util = Util_1.Util, n, val;
1723
- for (n = 0; n < len; n++) {
1724
- val = arr[n];
1724
+ const retArr = [], len = arr.length, util = Util_1.Util;
1725
+ for (let n = 0; n < len; n++) {
1726
+ let val = arr[n];
1725
1727
  if (util._isNumber(val)) {
1726
1728
  val = Math.round(val * 1000) / 1000;
1727
1729
  }
@@ -2204,7 +2206,7 @@
2204
2206
  }
2205
2207
  _applyShadow(shape) {
2206
2208
  var _a, _b, _c;
2207
- 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 : {
2208
2210
  x: 0,
2209
2211
  y: 0,
2210
2212
  }, scale = shape.getAbsoluteScale(), ratio = this.canvas.getPixelRatio(), scaleX = scale.x * ratio, scaleY = scale.y * ratio;
@@ -2263,7 +2265,7 @@
2263
2265
  if (hasRequiredCanvas) return Canvas;
2264
2266
  hasRequiredCanvas = 1;
2265
2267
  Object.defineProperty(Canvas, "__esModule", { value: true });
2266
- Canvas.HitCanvas = Canvas.SceneCanvas = Canvas.Canvas = void 0;
2268
+ Canvas.HitCanvas = Canvas.SceneCanvas = Canvas.Canvas = undefined;
2267
2269
  const Util_1 = requireUtil();
2268
2270
  const Context_1 = requireContext();
2269
2271
  const Global_1 = requireGlobal();
@@ -2389,7 +2391,7 @@
2389
2391
  hasRequiredDragAndDrop = 1;
2390
2392
  (function (exports) {
2391
2393
  Object.defineProperty(exports, "__esModule", { value: true });
2392
- exports.DD = void 0;
2394
+ exports.DD = undefined;
2393
2395
  const Global_1 = requireGlobal();
2394
2396
  const Util_1 = requireUtil();
2395
2397
  exports.DD = {
@@ -2510,7 +2512,7 @@
2510
2512
  if (hasRequiredNode) return Node;
2511
2513
  hasRequiredNode = 1;
2512
2514
  Object.defineProperty(Node, "__esModule", { value: true });
2513
- Node.Node = void 0;
2515
+ Node.Node = undefined;
2514
2516
  const Util_1 = requireUtil();
2515
2517
  const Factory_1 = requireFactory();
2516
2518
  const Canvas_1 = requireCanvas();
@@ -3415,7 +3417,7 @@
3415
3417
  var _a, _b;
3416
3418
  const m = this._cache.get(TRANSFORM) || new Util_1.Transform();
3417
3419
  m.reset();
3418
- 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;
3419
3421
  if (x !== 0 || y !== 0) {
3420
3422
  m.translate(x, y);
3421
3423
  }
@@ -3617,7 +3619,7 @@
3617
3619
  _requestDraw() {
3618
3620
  if (Global_1.Konva.autoDrawEnabled) {
3619
3621
  const drawNode = this.getLayer() || this.getStage();
3620
- drawNode === null || drawNode === void 0 ? void 0 : drawNode.batchDraw();
3622
+ drawNode === null || drawNode === undefined ? undefined : drawNode.batchDraw();
3621
3623
  }
3622
3624
  }
3623
3625
  _setAttr(key, val) {
@@ -3678,13 +3680,13 @@
3678
3680
  }
3679
3681
  _getProtoListeners(eventType) {
3680
3682
  var _a, _b, _c;
3681
- const allListeners = (_a = this._cache.get(ALL_LISTENERS)) !== null && _a !== void 0 ? _a : {};
3682
- 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];
3683
3685
  if (events === undefined) {
3684
3686
  events = [];
3685
3687
  let obj = Object.getPrototypeOf(this);
3686
3688
  while (obj) {
3687
- 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 : [];
3688
3690
  events.push(...hierarchyEvents);
3689
3691
  obj = Object.getPrototypeOf(obj);
3690
3692
  }
@@ -3920,12 +3922,12 @@
3920
3922
  Factory_1.Factory.addComponentsGetterSetter(Node$1, 'offset', ['x', 'y']);
3921
3923
  addGetterSetter(Node$1, 'offsetX', 0, (0, Validators_1.getNumberValidator)());
3922
3924
  addGetterSetter(Node$1, 'offsetY', 0, (0, Validators_1.getNumberValidator)());
3923
- addGetterSetter(Node$1, 'dragDistance', null, (0, Validators_1.getNumberValidator)());
3925
+ addGetterSetter(Node$1, 'dragDistance', undefined, (0, Validators_1.getNumberValidator)());
3924
3926
  addGetterSetter(Node$1, 'width', 0, (0, Validators_1.getNumberValidator)());
3925
3927
  addGetterSetter(Node$1, 'height', 0, (0, Validators_1.getNumberValidator)());
3926
3928
  addGetterSetter(Node$1, 'listening', true, (0, Validators_1.getBooleanValidator)());
3927
3929
  addGetterSetter(Node$1, 'preventDefault', true, (0, Validators_1.getBooleanValidator)());
3928
- addGetterSetter(Node$1, 'filters', null, function (val) {
3930
+ addGetterSetter(Node$1, 'filters', undefined, function (val) {
3929
3931
  this._filterUpToDate = false;
3930
3932
  return val;
3931
3933
  });
@@ -3950,7 +3952,7 @@
3950
3952
  if (hasRequiredContainer) return Container;
3951
3953
  hasRequiredContainer = 1;
3952
3954
  Object.defineProperty(Container, "__esModule", { value: true });
3953
- Container.Container = void 0;
3955
+ Container.Container = undefined;
3954
3956
  const Factory_1 = requireFactory();
3955
3957
  const Node_1 = requireNode();
3956
3958
  const Validators_1 = requireValidators();
@@ -4107,13 +4109,13 @@
4107
4109
  if (this.isCached()) {
4108
4110
  return;
4109
4111
  }
4110
- (_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) {
4111
4113
  node._clearSelfAndDescendantCache(attr);
4112
4114
  });
4113
4115
  }
4114
4116
  _setChildrenIndices() {
4115
4117
  var _a;
4116
- (_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) {
4117
4119
  child.index = n;
4118
4120
  });
4119
4121
  this._requestDraw();
@@ -4184,7 +4186,7 @@
4184
4186
  context.save();
4185
4187
  context._applyGlobalCompositeOperation(this);
4186
4188
  }
4187
- (_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) {
4188
4190
  child[drawMethod](canvas, top, bufferCanvas);
4189
4191
  });
4190
4192
  if (hasComposition) {
@@ -4206,7 +4208,7 @@
4206
4208
  height: 0,
4207
4209
  };
4208
4210
  const that = this;
4209
- (_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) {
4210
4212
  if (!child.visible()) {
4211
4213
  return;
4212
4214
  }
@@ -4338,7 +4340,7 @@
4338
4340
  hasRequiredStage = 1;
4339
4341
  (function (exports) {
4340
4342
  Object.defineProperty(exports, "__esModule", { value: true });
4341
- exports.Stage = exports.stages = void 0;
4343
+ exports.Stage = exports.stages = undefined;
4342
4344
  const Util_1 = requireUtil();
4343
4345
  const Factory_1 = requireFactory();
4344
4346
  const Container_1 = requireContainer();
@@ -4496,8 +4498,8 @@
4496
4498
  return true;
4497
4499
  }
4498
4500
  clear() {
4499
- let layers = this.children, len = layers.length, n;
4500
- for (n = 0; n < len; n++) {
4501
+ const layers = this.children, len = layers.length;
4502
+ for (let n = 0; n < len; n++) {
4501
4503
  layers[n].clear();
4502
4504
  }
4503
4505
  return this;
@@ -4575,8 +4577,8 @@
4575
4577
  if (!pos) {
4576
4578
  return null;
4577
4579
  }
4578
- let layers = this.children, len = layers.length, end = len - 1, n;
4579
- for (n = end; n >= 0; n--) {
4580
+ const layers = this.children, len = layers.length, end = len - 1;
4581
+ for (let n = end; n >= 0; n--) {
4580
4582
  const shape = layers[n].getIntersection(pos);
4581
4583
  if (shape) {
4582
4584
  return shape;
@@ -4889,7 +4891,7 @@
4889
4891
  });
4890
4892
  }
4891
4893
  Global_1.Konva['_' + eventType + 'ListenClick'] = false;
4892
- if (evt.cancelable && eventType !== 'touch') {
4894
+ if (evt.cancelable && eventType !== 'touch' && eventType !== 'pointer') {
4893
4895
  evt.preventDefault();
4894
4896
  }
4895
4897
  }
@@ -4934,7 +4936,8 @@
4934
4936
  PointerEvents.releaseCapture(evt.pointerId);
4935
4937
  }
4936
4938
  setPointersPositions(evt) {
4937
- let contentPosition = this._getContentPosition(), x = null, y = null;
4939
+ const contentPosition = this._getContentPosition();
4940
+ let x = null, y = null;
4938
4941
  evt = evt ? evt : window.event;
4939
4942
  if (evt.touches !== undefined) {
4940
4943
  this._pointerPositions = [];
@@ -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
  }
@@ -5456,16 +5459,16 @@
5456
5459
  return this;
5457
5460
  }
5458
5461
  drawHitFromCache(alphaThreshold = 0) {
5459
- let cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(), hitImageData, hitData, len, rgbColorKey, i, alpha;
5462
+ const cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight();
5460
5463
  hitContext.clear();
5461
5464
  hitContext.drawImage(sceneCanvas._canvas, 0, 0, hitWidth, hitHeight);
5462
5465
  try {
5463
- hitImageData = hitContext.getImageData(0, 0, hitWidth, hitHeight);
5464
- hitData = hitImageData.data;
5465
- len = hitData.length;
5466
- rgbColorKey = Util_1.Util._hexToRgb(this.colorKey);
5467
- for (i = 0; i < len; i += 4) {
5468
- alpha = hitData[i + 3];
5466
+ const hitImageData = hitContext.getImageData(0, 0, hitWidth, hitHeight);
5467
+ const hitData = hitImageData.data;
5468
+ const len = hitData.length;
5469
+ const rgbColorKey = Util_1.Util._hexToRgb(this.colorKey);
5470
+ for (let i = 0; i < len; i += 4) {
5471
+ const alpha = hitData[i + 3];
5469
5472
  if (alpha > alphaThreshold) {
5470
5473
  hitData[i] = rgbColorKey.r;
5471
5474
  hitData[i + 1] = rgbColorKey.g;
@@ -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;
5951
5954
  hasRequiredGroup = 1;
5952
5955
  Object.defineProperty(Group, "__esModule", { value: true });
5953
- Group.Group = void 0;
5956
+ Group.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,18 +6135,19 @@
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();
6139
6142
  const Global_1 = requireGlobal();
6140
- let blacklist = {
6143
+ const blacklist = {
6141
6144
  node: 1,
6142
6145
  duration: 1,
6143
6146
  easing: 1,
6144
6147
  onFinish: 1,
6145
6148
  yoyo: 1,
6146
- }, PAUSED = 1, PLAYING = 2, REVERSING = 3, idCounter = 0, colorAttrs = ['fill', 'stroke', 'shadowColor'];
6149
+ }, PAUSED = 1, PLAYING = 2, REVERSING = 3, colorAttrs = ['fill', 'stroke', 'shadowColor'];
6150
+ let idCounter = 0;
6147
6151
  class TweenEngine {
6148
6152
  constructor(prop, propFunc, func, begin, finish, duration, yoyo) {
6149
6153
  this.prop = prop;
@@ -6260,7 +6264,8 @@
6260
6264
  }
6261
6265
  class Tween {
6262
6266
  constructor(config) {
6263
- let that = this, node = config.node, nodeId = node._id, duration, easing = config.easing || exports.Easings.Linear, yoyo = !!config.yoyo, key;
6267
+ const that = this, node = config.node, nodeId = node._id, easing = config.easing || exports.Easings.Linear, yoyo = !!config.yoyo;
6268
+ let duration, key;
6264
6269
  if (typeof config.duration === 'undefined') {
6265
6270
  duration = 0.3;
6266
6271
  }
@@ -6304,12 +6309,13 @@
6304
6309
  this.onUpdate = config.onUpdate;
6305
6310
  }
6306
6311
  _addAttr(key, end) {
6307
- let node = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA;
6308
- tweenId = Tween.tweens[nodeId][key];
6312
+ const node = this.node, nodeId = node._id;
6313
+ let diff, len, trueEnd, trueStart, endRGBA;
6314
+ const tweenId = Tween.tweens[nodeId][key];
6309
6315
  if (tweenId) {
6310
6316
  delete Tween.attrs[nodeId][tweenId][key];
6311
6317
  }
6312
- start = node.getAttr(key);
6318
+ let start = node.getAttr(key);
6313
6319
  if (Util_1.Util._isArray(end)) {
6314
6320
  diff = [];
6315
6321
  len = Math.max(end.length, start.length);
@@ -6324,7 +6330,7 @@
6324
6330
  }
6325
6331
  }
6326
6332
  if (key.indexOf('fill') === 0) {
6327
- for (n = 0; n < len; n++) {
6333
+ for (let n = 0; n < len; n++) {
6328
6334
  if (n % 2 === 0) {
6329
6335
  diff.push(end[n] - start[n]);
6330
6336
  }
@@ -6342,7 +6348,7 @@
6342
6348
  }
6343
6349
  }
6344
6350
  else {
6345
- for (n = 0; n < len; n++) {
6351
+ for (let n = 0; n < len; n++) {
6346
6352
  diff.push(end[n] - start[n]);
6347
6353
  }
6348
6354
  }
@@ -6370,7 +6376,8 @@
6370
6376
  Tween.tweens[nodeId][key] = this._id;
6371
6377
  }
6372
6378
  _tweenFunc(i) {
6373
- let node = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end;
6379
+ const node = this.node, attrs = Tween.attrs[node._id][this._id];
6380
+ let key, attr, start, diff, newVal, n, len, end;
6374
6381
  for (key in attrs) {
6375
6382
  attr = attrs[key];
6376
6383
  start = attr.start;
@@ -6482,9 +6489,9 @@
6482
6489
  return this;
6483
6490
  }
6484
6491
  destroy() {
6485
- let nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key;
6492
+ const nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId];
6486
6493
  this.pause();
6487
- for (key in attrs) {
6494
+ for (const key in attrs) {
6488
6495
  delete Tween.tweens[nodeId][key];
6489
6496
  }
6490
6497
  delete Tween.attrs[nodeId][thisId];
@@ -6661,7 +6668,7 @@
6661
6668
  hasRequired_CoreInternals = 1;
6662
6669
  (function (exports) {
6663
6670
  Object.defineProperty(exports, "__esModule", { value: true });
6664
- exports.Konva = void 0;
6671
+ exports.Konva = undefined;
6665
6672
  const Global_1 = requireGlobal();
6666
6673
  const Util_1 = requireUtil();
6667
6674
  const Node_1 = requireNode();
@@ -6708,7 +6715,7 @@
6708
6715
  if (hasRequiredArc) return Arc;
6709
6716
  hasRequiredArc = 1;
6710
6717
  Object.defineProperty(Arc, "__esModule", { value: true });
6711
- Arc.Arc = void 0;
6718
+ Arc.Arc = undefined;
6712
6719
  const Factory_1 = requireFactory();
6713
6720
  const Shape_1 = requireShape();
6714
6721
  const Global_1 = requireGlobal();
@@ -6778,7 +6785,7 @@
6778
6785
  if (hasRequiredLine) return Line;
6779
6786
  hasRequiredLine = 1;
6780
6787
  Object.defineProperty(Line, "__esModule", { value: true });
6781
- Line.Line = void 0;
6788
+ Line.Line = undefined;
6782
6789
  const Factory_1 = requireFactory();
6783
6790
  const Global_1 = requireGlobal();
6784
6791
  const Shape_1 = requireShape();
@@ -6949,342 +6956,342 @@
6949
6956
  hasRequiredBezierFunctions = 1;
6950
6957
  (function (exports) {
6951
6958
  Object.defineProperty(exports, "__esModule", { value: true });
6952
- 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;
6953
6960
  exports.tValues = [
6954
6961
  [],
6955
6962
  [],
6956
6963
  [
6957
- -0.5773502691896257645091487805019574556476,
6964
+ -0.5773502691896257,
6958
6965
  0.5773502691896257645091487805019574556476,
6959
6966
  ],
6960
6967
  [
6961
- 0, -0.7745966692414833770358530799564799221665,
6968
+ 0, -0.7745966692414834,
6962
6969
  0.7745966692414833770358530799564799221665,
6963
6970
  ],
6964
6971
  [
6965
- -0.3399810435848562648026657591032446872005,
6972
+ -0.33998104358485626,
6966
6973
  0.3399810435848562648026657591032446872005,
6967
- -0.8611363115940525752239464888928095050957,
6974
+ -0.8611363115940526,
6968
6975
  0.8611363115940525752239464888928095050957,
6969
6976
  ],
6970
6977
  [
6971
- 0, -0.5384693101056830910363144207002088049672,
6978
+ 0, -0.5384693101056831,
6972
6979
  0.5384693101056830910363144207002088049672,
6973
- -0.9061798459386639927976268782993929651256,
6980
+ -0.906179845938664,
6974
6981
  0.9061798459386639927976268782993929651256,
6975
6982
  ],
6976
6983
  [
6977
6984
  0.6612093864662645136613995950199053470064,
6978
- -0.6612093864662645136613995950199053470064,
6979
- -0.2386191860831969086305017216807119354186,
6985
+ -0.6612093864662645,
6986
+ -0.2386191860831969,
6980
6987
  0.2386191860831969086305017216807119354186,
6981
- -0.9324695142031520278123015544939946091347,
6988
+ -0.932469514203152,
6982
6989
  0.9324695142031520278123015544939946091347,
6983
6990
  ],
6984
6991
  [
6985
6992
  0, 0.4058451513773971669066064120769614633473,
6986
- -0.4058451513773971669066064120769614633473,
6987
- -0.7415311855993944398638647732807884070741,
6993
+ -0.4058451513773972,
6994
+ -0.7415311855993945,
6988
6995
  0.7415311855993944398638647732807884070741,
6989
- -0.9491079123427585245261896840478512624007,
6996
+ -0.9491079123427585,
6990
6997
  0.9491079123427585245261896840478512624007,
6991
6998
  ],
6992
6999
  [
6993
- -0.1834346424956498049394761423601839806667,
7000
+ -0.1834346424956498,
6994
7001
  0.1834346424956498049394761423601839806667,
6995
- -0.5255324099163289858177390491892463490419,
7002
+ -0.525532409916329,
6996
7003
  0.5255324099163289858177390491892463490419,
6997
- -0.7966664774136267395915539364758304368371,
7004
+ -0.7966664774136267,
6998
7005
  0.7966664774136267395915539364758304368371,
6999
- -0.9602898564975362316835608685694729904282,
7006
+ -0.9602898564975363,
7000
7007
  0.9602898564975362316835608685694729904282,
7001
7008
  ],
7002
7009
  [
7003
- 0, -0.8360311073266357942994297880697348765441,
7010
+ 0, -0.8360311073266358,
7004
7011
  0.8360311073266357942994297880697348765441,
7005
- -0.9681602395076260898355762029036728700494,
7012
+ -0.9681602395076261,
7006
7013
  0.9681602395076260898355762029036728700494,
7007
- -0.3242534234038089290385380146433366085719,
7014
+ -0.3242534234038089,
7008
7015
  0.3242534234038089290385380146433366085719,
7009
- -0.6133714327005903973087020393414741847857,
7016
+ -0.6133714327005904,
7010
7017
  0.6133714327005903973087020393414741847857,
7011
7018
  ],
7012
7019
  [
7013
- -0.1488743389816312108848260011297199846175,
7020
+ -0.14887433898163122,
7014
7021
  0.1488743389816312108848260011297199846175,
7015
- -0.4333953941292471907992659431657841622,
7022
+ -0.4333953941292472,
7016
7023
  0.4333953941292471907992659431657841622,
7017
- -0.6794095682990244062343273651148735757692,
7024
+ -0.6794095682990244,
7018
7025
  0.6794095682990244062343273651148735757692,
7019
- -0.8650633666889845107320966884234930485275,
7026
+ -0.8650633666889845,
7020
7027
  0.8650633666889845107320966884234930485275,
7021
- -0.9739065285171717200779640120844520534282,
7028
+ -0.9739065285171717,
7022
7029
  0.9739065285171717200779640120844520534282,
7023
7030
  ],
7024
7031
  [
7025
- 0, -0.2695431559523449723315319854008615246796,
7032
+ 0, -0.26954315595234496,
7026
7033
  0.2695431559523449723315319854008615246796,
7027
- -0.5190961292068118159257256694586095544802,
7034
+ -0.5190961292068118,
7028
7035
  0.5190961292068118159257256694586095544802,
7029
- -0.7301520055740493240934162520311534580496,
7036
+ -0.7301520055740494,
7030
7037
  0.7301520055740493240934162520311534580496,
7031
- -0.8870625997680952990751577693039272666316,
7038
+ -0.8870625997680953,
7032
7039
  0.8870625997680952990751577693039272666316,
7033
- -0.9782286581460569928039380011228573907714,
7040
+ -0.978228658146057,
7034
7041
  0.9782286581460569928039380011228573907714,
7035
7042
  ],
7036
7043
  [
7037
- -0.1252334085114689154724413694638531299833,
7044
+ -0.1252334085114689,
7038
7045
  0.1252334085114689154724413694638531299833,
7039
- -0.3678314989981801937526915366437175612563,
7046
+ -0.3678314989981802,
7040
7047
  0.3678314989981801937526915366437175612563,
7041
- -0.587317954286617447296702418940534280369,
7048
+ -0.5873179542866175,
7042
7049
  0.587317954286617447296702418940534280369,
7043
- -0.7699026741943046870368938332128180759849,
7050
+ -0.7699026741943047,
7044
7051
  0.7699026741943046870368938332128180759849,
7045
- -0.9041172563704748566784658661190961925375,
7052
+ -0.9041172563704749,
7046
7053
  0.9041172563704748566784658661190961925375,
7047
- -0.9815606342467192506905490901492808229601,
7054
+ -0.9815606342467192,
7048
7055
  0.9815606342467192506905490901492808229601,
7049
7056
  ],
7050
7057
  [
7051
- 0, -0.2304583159551347940655281210979888352115,
7058
+ 0, -0.2304583159551348,
7052
7059
  0.2304583159551347940655281210979888352115,
7053
- -0.4484927510364468528779128521276398678019,
7060
+ -0.44849275103644687,
7054
7061
  0.4484927510364468528779128521276398678019,
7055
- -0.6423493394403402206439846069955156500716,
7062
+ -0.6423493394403402,
7056
7063
  0.6423493394403402206439846069955156500716,
7057
- -0.8015780907333099127942064895828598903056,
7064
+ -0.8015780907333099,
7058
7065
  0.8015780907333099127942064895828598903056,
7059
- -0.9175983992229779652065478365007195123904,
7066
+ -0.9175983992229779,
7060
7067
  0.9175983992229779652065478365007195123904,
7061
- -0.9841830547185881494728294488071096110649,
7068
+ -0.9841830547185881,
7062
7069
  0.9841830547185881494728294488071096110649,
7063
7070
  ],
7064
7071
  [
7065
- -0.1080549487073436620662446502198347476119,
7072
+ -0.10805494870734367,
7066
7073
  0.1080549487073436620662446502198347476119,
7067
- -0.3191123689278897604356718241684754668342,
7074
+ -0.31911236892788974,
7068
7075
  0.3191123689278897604356718241684754668342,
7069
- -0.5152486363581540919652907185511886623088,
7076
+ -0.5152486363581541,
7070
7077
  0.5152486363581540919652907185511886623088,
7071
- -0.6872929048116854701480198030193341375384,
7078
+ -0.6872929048116855,
7072
7079
  0.6872929048116854701480198030193341375384,
7073
- -0.8272013150697649931897947426503949610397,
7080
+ -0.827201315069765,
7074
7081
  0.8272013150697649931897947426503949610397,
7075
- -0.928434883663573517336391139377874264477,
7082
+ -0.9284348836635735,
7076
7083
  0.928434883663573517336391139377874264477,
7077
- -0.986283808696812338841597266704052801676,
7084
+ -0.9862838086968123,
7078
7085
  0.986283808696812338841597266704052801676,
7079
7086
  ],
7080
7087
  [
7081
- 0, -0.2011940939974345223006283033945962078128,
7088
+ 0, -0.20119409399743451,
7082
7089
  0.2011940939974345223006283033945962078128,
7083
- -0.3941513470775633698972073709810454683627,
7090
+ -0.3941513470775634,
7084
7091
  0.3941513470775633698972073709810454683627,
7085
- -0.5709721726085388475372267372539106412383,
7092
+ -0.5709721726085388,
7086
7093
  0.5709721726085388475372267372539106412383,
7087
- -0.7244177313601700474161860546139380096308,
7094
+ -0.7244177313601701,
7088
7095
  0.7244177313601700474161860546139380096308,
7089
- -0.8482065834104272162006483207742168513662,
7096
+ -0.8482065834104272,
7090
7097
  0.8482065834104272162006483207742168513662,
7091
- -0.9372733924007059043077589477102094712439,
7098
+ -0.937273392400706,
7092
7099
  0.9372733924007059043077589477102094712439,
7093
- -0.9879925180204854284895657185866125811469,
7100
+ -0.9879925180204854,
7094
7101
  0.9879925180204854284895657185866125811469,
7095
7102
  ],
7096
7103
  [
7097
- -0.0950125098376374401853193354249580631303,
7104
+ -0.09501250983763744,
7098
7105
  0.0950125098376374401853193354249580631303,
7099
- -0.281603550779258913230460501460496106486,
7106
+ -0.2816035507792589,
7100
7107
  0.281603550779258913230460501460496106486,
7101
- -0.45801677765722738634241944298357757354,
7108
+ -0.45801677765722737,
7102
7109
  0.45801677765722738634241944298357757354,
7103
- -0.6178762444026437484466717640487910189918,
7110
+ -0.6178762444026438,
7104
7111
  0.6178762444026437484466717640487910189918,
7105
- -0.7554044083550030338951011948474422683538,
7112
+ -0.755404408355003,
7106
7113
  0.7554044083550030338951011948474422683538,
7107
- -0.8656312023878317438804678977123931323873,
7114
+ -0.8656312023878318,
7108
7115
  0.8656312023878317438804678977123931323873,
7109
- -0.9445750230732325760779884155346083450911,
7116
+ -0.9445750230732326,
7110
7117
  0.9445750230732325760779884155346083450911,
7111
- -0.9894009349916499325961541734503326274262,
7118
+ -0.9894009349916499,
7112
7119
  0.9894009349916499325961541734503326274262,
7113
7120
  ],
7114
7121
  [
7115
- 0, -0.1784841814958478558506774936540655574754,
7122
+ 0, -0.17848418149584785,
7116
7123
  0.1784841814958478558506774936540655574754,
7117
- -0.3512317634538763152971855170953460050405,
7124
+ -0.3512317634538763,
7118
7125
  0.3512317634538763152971855170953460050405,
7119
- -0.5126905370864769678862465686295518745829,
7126
+ -0.5126905370864769,
7120
7127
  0.5126905370864769678862465686295518745829,
7121
- -0.6576711592166907658503022166430023351478,
7128
+ -0.6576711592166907,
7122
7129
  0.6576711592166907658503022166430023351478,
7123
- -0.7815140038968014069252300555204760502239,
7130
+ -0.7815140038968014,
7124
7131
  0.7815140038968014069252300555204760502239,
7125
- -0.8802391537269859021229556944881556926234,
7132
+ -0.8802391537269859,
7126
7133
  0.8802391537269859021229556944881556926234,
7127
- -0.9506755217687677612227169578958030214433,
7134
+ -0.9506755217687678,
7128
7135
  0.9506755217687677612227169578958030214433,
7129
- -0.9905754753144173356754340199406652765077,
7136
+ -0.9905754753144174,
7130
7137
  0.9905754753144173356754340199406652765077,
7131
7138
  ],
7132
7139
  [
7133
- -0.0847750130417353012422618529357838117333,
7140
+ -0.0847750130417353,
7134
7141
  0.0847750130417353012422618529357838117333,
7135
- -0.2518862256915055095889728548779112301628,
7142
+ -0.2518862256915055,
7136
7143
  0.2518862256915055095889728548779112301628,
7137
- -0.4117511614628426460359317938330516370789,
7144
+ -0.41175116146284263,
7138
7145
  0.4117511614628426460359317938330516370789,
7139
- -0.5597708310739475346078715485253291369276,
7146
+ -0.5597708310739475,
7140
7147
  0.5597708310739475346078715485253291369276,
7141
- -0.6916870430603532078748910812888483894522,
7148
+ -0.6916870430603532,
7142
7149
  0.6916870430603532078748910812888483894522,
7143
- -0.8037049589725231156824174550145907971032,
7150
+ -0.8037049589725231,
7144
7151
  0.8037049589725231156824174550145907971032,
7145
- -0.8926024664975557392060605911271455154078,
7152
+ -0.8926024664975557,
7146
7153
  0.8926024664975557392060605911271455154078,
7147
- -0.9558239495713977551811958929297763099728,
7154
+ -0.9558239495713977,
7148
7155
  0.9558239495713977551811958929297763099728,
7149
- -0.9915651684209309467300160047061507702525,
7156
+ -0.9915651684209309,
7150
7157
  0.9915651684209309467300160047061507702525,
7151
7158
  ],
7152
7159
  [
7153
- 0, -0.1603586456402253758680961157407435495048,
7160
+ 0, -0.16035864564022537,
7154
7161
  0.1603586456402253758680961157407435495048,
7155
- -0.3165640999636298319901173288498449178922,
7162
+ -0.31656409996362983,
7156
7163
  0.3165640999636298319901173288498449178922,
7157
- -0.4645707413759609457172671481041023679762,
7164
+ -0.46457074137596094,
7158
7165
  0.4645707413759609457172671481041023679762,
7159
- -0.6005453046616810234696381649462392798683,
7166
+ -0.600545304661681,
7160
7167
  0.6005453046616810234696381649462392798683,
7161
- -0.7209661773352293786170958608237816296571,
7168
+ -0.7209661773352294,
7162
7169
  0.7209661773352293786170958608237816296571,
7163
- -0.8227146565371428249789224867127139017745,
7170
+ -0.8227146565371428,
7164
7171
  0.8227146565371428249789224867127139017745,
7165
- -0.9031559036148179016426609285323124878093,
7172
+ -0.9031559036148179,
7166
7173
  0.9031559036148179016426609285323124878093,
7167
- -0.960208152134830030852778840687651526615,
7174
+ -0.96020815213483,
7168
7175
  0.960208152134830030852778840687651526615,
7169
- -0.9924068438435844031890176702532604935893,
7176
+ -0.9924068438435844,
7170
7177
  0.9924068438435844031890176702532604935893,
7171
7178
  ],
7172
7179
  [
7173
- -0.0765265211334973337546404093988382110047,
7180
+ -0.07652652113349734,
7174
7181
  0.0765265211334973337546404093988382110047,
7175
- -0.227785851141645078080496195368574624743,
7182
+ -0.22778585114164507,
7176
7183
  0.227785851141645078080496195368574624743,
7177
- -0.3737060887154195606725481770249272373957,
7184
+ -0.37370608871541955,
7178
7185
  0.3737060887154195606725481770249272373957,
7179
- -0.5108670019508270980043640509552509984254,
7186
+ -0.5108670019508271,
7180
7187
  0.5108670019508270980043640509552509984254,
7181
- -0.6360536807265150254528366962262859367433,
7188
+ -0.636053680726515,
7182
7189
  0.6360536807265150254528366962262859367433,
7183
- -0.7463319064601507926143050703556415903107,
7190
+ -0.7463319064601508,
7184
7191
  0.7463319064601507926143050703556415903107,
7185
- -0.8391169718222188233945290617015206853296,
7192
+ -0.8391169718222188,
7186
7193
  0.8391169718222188233945290617015206853296,
7187
- -0.9122344282513259058677524412032981130491,
7194
+ -0.912234428251326,
7188
7195
  0.9122344282513259058677524412032981130491,
7189
- -0.963971927277913791267666131197277221912,
7196
+ -0.9639719272779138,
7190
7197
  0.963971927277913791267666131197277221912,
7191
- -0.9931285991850949247861223884713202782226,
7198
+ -0.9931285991850949,
7192
7199
  0.9931285991850949247861223884713202782226,
7193
7200
  ],
7194
7201
  [
7195
- 0, -0.1455618541608950909370309823386863301163,
7202
+ 0, -0.1455618541608951,
7196
7203
  0.1455618541608950909370309823386863301163,
7197
- -0.288021316802401096600792516064600319909,
7204
+ -0.2880213168024011,
7198
7205
  0.288021316802401096600792516064600319909,
7199
- -0.4243421202074387835736688885437880520964,
7206
+ -0.4243421202074388,
7200
7207
  0.4243421202074387835736688885437880520964,
7201
- -0.551618835887219807059018796724313286622,
7208
+ -0.5516188358872198,
7202
7209
  0.551618835887219807059018796724313286622,
7203
- -0.667138804197412319305966669990339162597,
7210
+ -0.6671388041974123,
7204
7211
  0.667138804197412319305966669990339162597,
7205
- -0.7684399634756779086158778513062280348209,
7212
+ -0.7684399634756779,
7206
7213
  0.7684399634756779086158778513062280348209,
7207
- -0.8533633645833172836472506385875676702761,
7214
+ -0.8533633645833173,
7208
7215
  0.8533633645833172836472506385875676702761,
7209
- -0.9200993341504008287901871337149688941591,
7216
+ -0.9200993341504008,
7210
7217
  0.9200993341504008287901871337149688941591,
7211
- -0.9672268385663062943166222149076951614246,
7218
+ -0.9672268385663063,
7212
7219
  0.9672268385663062943166222149076951614246,
7213
- -0.9937521706203895002602420359379409291933,
7220
+ -0.9937521706203895,
7214
7221
  0.9937521706203895002602420359379409291933,
7215
7222
  ],
7216
7223
  [
7217
- -0.0697392733197222212138417961186280818222,
7224
+ -0.06973927331972223,
7218
7225
  0.0697392733197222212138417961186280818222,
7219
- -0.2078604266882212854788465339195457342156,
7226
+ -0.20786042668822127,
7220
7227
  0.2078604266882212854788465339195457342156,
7221
- -0.3419358208920842251581474204273796195591,
7228
+ -0.34193582089208424,
7222
7229
  0.3419358208920842251581474204273796195591,
7223
- -0.4693558379867570264063307109664063460953,
7230
+ -0.469355837986757,
7224
7231
  0.4693558379867570264063307109664063460953,
7225
- -0.5876404035069115929588769276386473488776,
7232
+ -0.5876404035069116,
7226
7233
  0.5876404035069115929588769276386473488776,
7227
- -0.6944872631866827800506898357622567712673,
7234
+ -0.6944872631866827,
7228
7235
  0.6944872631866827800506898357622567712673,
7229
- -0.7878168059792081620042779554083515213881,
7236
+ -0.7878168059792081,
7230
7237
  0.7878168059792081620042779554083515213881,
7231
- -0.8658125777203001365364256370193787290847,
7238
+ -0.8658125777203002,
7232
7239
  0.8658125777203001365364256370193787290847,
7233
- -0.9269567721871740005206929392590531966353,
7240
+ -0.926956772187174,
7234
7241
  0.9269567721871740005206929392590531966353,
7235
- -0.9700604978354287271239509867652687108059,
7242
+ -0.9700604978354287,
7236
7243
  0.9700604978354287271239509867652687108059,
7237
- -0.994294585482399292073031421161298980393,
7244
+ -0.9942945854823992,
7238
7245
  0.994294585482399292073031421161298980393,
7239
7246
  ],
7240
7247
  [
7241
- 0, -0.1332568242984661109317426822417661370104,
7248
+ 0, -0.1332568242984661,
7242
7249
  0.1332568242984661109317426822417661370104,
7243
- -0.264135680970344930533869538283309602979,
7250
+ -0.26413568097034495,
7244
7251
  0.264135680970344930533869538283309602979,
7245
- -0.390301038030290831421488872880605458578,
7252
+ -0.3903010380302908,
7246
7253
  0.390301038030290831421488872880605458578,
7247
- -0.5095014778460075496897930478668464305448,
7254
+ -0.5095014778460075,
7248
7255
  0.5095014778460075496897930478668464305448,
7249
- -0.6196098757636461563850973116495956533871,
7256
+ -0.6196098757636461,
7250
7257
  0.6196098757636461563850973116495956533871,
7251
- -0.7186613631319501944616244837486188483299,
7258
+ -0.7186613631319502,
7252
7259
  0.7186613631319501944616244837486188483299,
7253
- -0.8048884016188398921511184069967785579414,
7260
+ -0.8048884016188399,
7254
7261
  0.8048884016188398921511184069967785579414,
7255
- -0.8767523582704416673781568859341456716389,
7262
+ -0.8767523582704416,
7256
7263
  0.8767523582704416673781568859341456716389,
7257
- -0.9329710868260161023491969890384229782357,
7264
+ -0.9329710868260161,
7258
7265
  0.9329710868260161023491969890384229782357,
7259
- -0.9725424712181152319560240768207773751816,
7266
+ -0.9725424712181152,
7260
7267
  0.9725424712181152319560240768207773751816,
7261
- -0.9947693349975521235239257154455743605736,
7268
+ -0.9947693349975522,
7262
7269
  0.9947693349975521235239257154455743605736,
7263
7270
  ],
7264
7271
  [
7265
- -0.0640568928626056260850430826247450385909,
7272
+ -0.06405689286260563,
7266
7273
  0.0640568928626056260850430826247450385909,
7267
- -0.1911188674736163091586398207570696318404,
7274
+ -0.1911188674736163,
7268
7275
  0.1911188674736163091586398207570696318404,
7269
- -0.3150426796961633743867932913198102407864,
7276
+ -0.3150426796961634,
7270
7277
  0.3150426796961633743867932913198102407864,
7271
- -0.4337935076260451384870842319133497124524,
7278
+ -0.4337935076260451,
7272
7279
  0.4337935076260451384870842319133497124524,
7273
- -0.5454214713888395356583756172183723700107,
7280
+ -0.5454214713888396,
7274
7281
  0.5454214713888395356583756172183723700107,
7275
- -0.6480936519369755692524957869107476266696,
7282
+ -0.6480936519369755,
7276
7283
  0.6480936519369755692524957869107476266696,
7277
- -0.7401241915785543642438281030999784255232,
7284
+ -0.7401241915785544,
7278
7285
  0.7401241915785543642438281030999784255232,
7279
- -0.8200019859739029219539498726697452080761,
7286
+ -0.820001985973903,
7280
7287
  0.8200019859739029219539498726697452080761,
7281
- -0.8864155270044010342131543419821967550873,
7288
+ -0.8864155270044011,
7282
7289
  0.8864155270044010342131543419821967550873,
7283
- -0.9382745520027327585236490017087214496548,
7290
+ -0.9382745520027328,
7284
7291
  0.9382745520027327585236490017087214496548,
7285
- -0.9747285559713094981983919930081690617411,
7292
+ -0.9747285559713095,
7286
7293
  0.9747285559713094981983919930081690617411,
7287
- -0.9951872199970213601799974097007368118745,
7294
+ -0.9951872199970213,
7288
7295
  0.9951872199970213601799974097007368118745,
7289
7296
  ],
7290
7297
  ];
@@ -7747,7 +7754,7 @@
7747
7754
  if (hasRequiredPath) return Path;
7748
7755
  hasRequiredPath = 1;
7749
7756
  Object.defineProperty(Path, "__esModule", { value: true });
7750
- Path.Path = void 0;
7757
+ Path.Path = undefined;
7751
7758
  const Factory_1 = requireFactory();
7752
7759
  const Shape_1 = requireShape();
7753
7760
  const Global_1 = requireGlobal();
@@ -7930,8 +7937,8 @@
7930
7937
  return null;
7931
7938
  }
7932
7939
  static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX, fromY) {
7933
- fromX = fromX !== null && fromX !== void 0 ? fromX : P1x;
7934
- fromY = fromY !== null && fromY !== void 0 ? fromY : P1y;
7940
+ fromX = fromX !== null && fromX !== undefined ? fromX : P1x;
7941
+ fromY = fromY !== null && fromY !== undefined ? fromY : P1y;
7935
7942
  const len = this.getLineLength(P1x, P1y, P2x, P2y);
7936
7943
  if (len < 1e-10) {
7937
7944
  return { x: P1x, y: P1y };
@@ -8360,7 +8367,7 @@
8360
8367
  if (hasRequiredArrow) return Arrow;
8361
8368
  hasRequiredArrow = 1;
8362
8369
  Object.defineProperty(Arrow, "__esModule", { value: true });
8363
- Arrow.Arrow = void 0;
8370
+ Arrow.Arrow = undefined;
8364
8371
  const Factory_1 = requireFactory();
8365
8372
  const Line_1 = requireLine();
8366
8373
  const Validators_1 = requireValidators();
@@ -8447,9 +8454,9 @@
8447
8454
  const lineRect = super.getSelfRect();
8448
8455
  const offset = this.pointerWidth() / 2;
8449
8456
  return {
8450
- x: lineRect.x - offset,
8457
+ x: lineRect.x,
8451
8458
  y: lineRect.y - offset,
8452
- width: lineRect.width + offset * 2,
8459
+ width: lineRect.width,
8453
8460
  height: lineRect.height + offset * 2,
8454
8461
  };
8455
8462
  }
@@ -8472,7 +8479,7 @@
8472
8479
  if (hasRequiredCircle) return Circle;
8473
8480
  hasRequiredCircle = 1;
8474
8481
  Object.defineProperty(Circle, "__esModule", { value: true });
8475
- Circle.Circle = void 0;
8482
+ Circle.Circle = undefined;
8476
8483
  const Factory_1 = requireFactory();
8477
8484
  const Shape_1 = requireShape();
8478
8485
  const Validators_1 = requireValidators();
@@ -8518,7 +8525,7 @@
8518
8525
  if (hasRequiredEllipse) return Ellipse;
8519
8526
  hasRequiredEllipse = 1;
8520
8527
  Object.defineProperty(Ellipse, "__esModule", { value: true });
8521
- Ellipse.Ellipse = void 0;
8528
+ Ellipse.Ellipse = undefined;
8522
8529
  const Factory_1 = requireFactory();
8523
8530
  const Shape_1 = requireShape();
8524
8531
  const Validators_1 = requireValidators();
@@ -8568,7 +8575,7 @@
8568
8575
  if (hasRequiredImage) return Image$1;
8569
8576
  hasRequiredImage = 1;
8570
8577
  Object.defineProperty(Image$1, "__esModule", { value: true });
8571
- Image$1.Image = void 0;
8578
+ Image$1.Image = undefined;
8572
8579
  const Util_1 = requireUtil();
8573
8580
  const Factory_1 = requireFactory();
8574
8581
  const Shape_1 = requireShape();
@@ -8659,11 +8666,11 @@
8659
8666
  }
8660
8667
  getWidth() {
8661
8668
  var _a, _b;
8662
- 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;
8663
8670
  }
8664
8671
  getHeight() {
8665
8672
  var _a, _b;
8666
- 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;
8667
8674
  }
8668
8675
  static fromURL(url, callback, onError = null) {
8669
8676
  const img = Util_1.Util.createImageElement();
@@ -8699,7 +8706,7 @@
8699
8706
  if (hasRequiredLabel) return Label;
8700
8707
  hasRequiredLabel = 1;
8701
8708
  Object.defineProperty(Label, "__esModule", { value: true });
8702
- Label.Tag = Label.Label = void 0;
8709
+ Label.Tag = Label.Label = undefined;
8703
8710
  const Factory_1 = requireFactory();
8704
8711
  const Shape_1 = requireShape();
8705
8712
  const Group_1 = requireGroup();
@@ -8886,7 +8893,7 @@
8886
8893
  if (hasRequiredRect) return Rect;
8887
8894
  hasRequiredRect = 1;
8888
8895
  Object.defineProperty(Rect, "__esModule", { value: true });
8889
- Rect.Rect = void 0;
8896
+ Rect.Rect = undefined;
8890
8897
  const Factory_1 = requireFactory();
8891
8898
  const Shape_1 = requireShape();
8892
8899
  const Global_1 = requireGlobal();
@@ -8921,7 +8928,7 @@
8921
8928
  if (hasRequiredRegularPolygon) return RegularPolygon;
8922
8929
  hasRequiredRegularPolygon = 1;
8923
8930
  Object.defineProperty(RegularPolygon, "__esModule", { value: true });
8924
- RegularPolygon.RegularPolygon = void 0;
8931
+ RegularPolygon.RegularPolygon = undefined;
8925
8932
  const Factory_1 = requireFactory();
8926
8933
  const Shape_1 = requireShape();
8927
8934
  const Validators_1 = requireValidators();
@@ -8999,7 +9006,7 @@
8999
9006
  if (hasRequiredRing) return Ring;
9000
9007
  hasRequiredRing = 1;
9001
9008
  Object.defineProperty(Ring, "__esModule", { value: true });
9002
- Ring.Ring = void 0;
9009
+ Ring.Ring = undefined;
9003
9010
  const Factory_1 = requireFactory();
9004
9011
  const Shape_1 = requireShape();
9005
9012
  const Validators_1 = requireValidators();
@@ -9045,7 +9052,7 @@
9045
9052
  if (hasRequiredSprite) return Sprite;
9046
9053
  hasRequiredSprite = 1;
9047
9054
  Object.defineProperty(Sprite, "__esModule", { value: true });
9048
- Sprite.Sprite = void 0;
9055
+ Sprite.Sprite = undefined;
9049
9056
  const Factory_1 = requireFactory();
9050
9057
  const Shape_1 = requireShape();
9051
9058
  const Animation_1 = requireAnimation();
@@ -9166,7 +9173,7 @@
9166
9173
  if (hasRequiredStar) return Star;
9167
9174
  hasRequiredStar = 1;
9168
9175
  Object.defineProperty(Star, "__esModule", { value: true });
9169
- Star.Star = void 0;
9176
+ Star.Star = undefined;
9170
9177
  const Factory_1 = requireFactory();
9171
9178
  const Shape_1 = requireShape();
9172
9179
  const Validators_1 = requireValidators();
@@ -9217,7 +9224,7 @@
9217
9224
  if (hasRequiredText) return Text;
9218
9225
  hasRequiredText = 1;
9219
9226
  Object.defineProperty(Text, "__esModule", { value: true });
9220
- Text.Text = void 0;
9227
+ Text.Text = undefined;
9221
9228
  Text.stringToArray = stringToArray;
9222
9229
  const Util_1 = requireUtil();
9223
9230
  const Factory_1 = requireFactory();
@@ -9227,8 +9234,15 @@
9227
9234
  const Global_2 = requireGlobal();
9228
9235
  function stringToArray(string) {
9229
9236
  return [...string].reduce((acc, char, index, array) => {
9230
- if (/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?(?:\u200D\p{Emoji_Presentation})+/u.test(char)) {
9231
- acc.push(char);
9237
+ if (/\p{Emoji}/u.test(char)) {
9238
+ const nextChar = array[index + 1];
9239
+ if (nextChar && /\p{Emoji_Modifier}|\u200D/u.test(nextChar)) {
9240
+ acc.push(char + nextChar);
9241
+ array[index + 1] = '';
9242
+ }
9243
+ else {
9244
+ acc.push(char);
9245
+ }
9232
9246
  }
9233
9247
  else if (/\p{Regional_Indicator}{2}/u.test(char + (array[index + 1] || ''))) {
9234
9248
  acc.push(char + array[index + 1]);
@@ -9236,7 +9250,7 @@
9236
9250
  else if (index > 0 && /\p{Mn}|\p{Me}|\p{Mc}/u.test(char)) {
9237
9251
  acc[acc.length - 1] += char;
9238
9252
  }
9239
- else {
9253
+ else if (char) {
9240
9254
  acc.push(char);
9241
9255
  }
9242
9256
  return acc;
@@ -9341,7 +9355,7 @@
9341
9355
  for (n = 0; n < textArrLen; n++) {
9342
9356
  var lineTranslateX = 0;
9343
9357
  var lineTranslateY = 0;
9344
- var obj = textArr[n], text = obj.text, width = obj.width, lastLine = obj.lastInParagraph, spacesNumber, oneWord, lineWidth;
9358
+ var obj = textArr[n], text = obj.text, width = obj.width, lastLine = obj.lastInParagraph, spacesNumber, lineWidth;
9345
9359
  context.save();
9346
9360
  if (align === RIGHT) {
9347
9361
  lineTranslateX += totalWidth - width - padding * 2;
@@ -9359,7 +9373,6 @@
9359
9373
  const y = translateY + lineTranslateY + yOffset;
9360
9374
  context.moveTo(x, y);
9361
9375
  spacesNumber = text.split(' ').length - 1;
9362
- oneWord = spacesNumber === 0;
9363
9376
  lineWidth =
9364
9377
  align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width;
9365
9378
  context.lineTo(x + Math.round(lineWidth), y);
@@ -9375,11 +9388,8 @@
9375
9388
  const yOffset = Global_1.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0;
9376
9389
  context.moveTo(lineTranslateX, translateY + lineTranslateY + yOffset);
9377
9390
  spacesNumber = text.split(' ').length - 1;
9378
- oneWord = spacesNumber === 0;
9379
9391
  lineWidth =
9380
- align === JUSTIFY && lastLine && !oneWord
9381
- ? totalWidth - padding * 2
9382
- : width;
9392
+ align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width;
9383
9393
  context.lineTo(lineTranslateX + Math.round(lineWidth), translateY + lineTranslateY + yOffset);
9384
9394
  context.lineWidth = fontSize / 15;
9385
9395
  const gradient = this._getLinearGradient();
@@ -9460,17 +9470,17 @@
9460
9470
  _context.restore();
9461
9471
  const scaleFactor = fontSize / 100;
9462
9472
  return {
9463
- actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !== void 0 ? _a : 71.58203125 * scaleFactor,
9464
- actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !== void 0 ? _b : 0,
9465
- actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !== void 0 ? _c : -7.421875 * scaleFactor,
9466
- actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !== void 0 ? _d : 75.732421875 * scaleFactor,
9467
- alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !== void 0 ? _e : 0,
9468
- emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !== void 0 ? _f : 100 * scaleFactor,
9469
- emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !== void 0 ? _g : -20 * scaleFactor,
9470
- fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !== void 0 ? _h : 91 * scaleFactor,
9471
- fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !== void 0 ? _j : 21 * scaleFactor,
9472
- hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !== void 0 ? _k : 72.80000305175781 * scaleFactor,
9473
- 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,
9474
9484
  width: metrics.width,
9475
9485
  height: fontSize,
9476
9486
  };
@@ -9498,22 +9508,23 @@
9498
9508
  _getTextWidth(text) {
9499
9509
  const letterSpacing = this.letterSpacing();
9500
9510
  const length = text.length;
9501
- return (getDummyContext().measureText(text).width +
9502
- (length ? letterSpacing * (length - 1) : 0));
9511
+ return getDummyContext().measureText(text).width + letterSpacing * length;
9503
9512
  }
9504
9513
  _setTextData() {
9505
9514
  let lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis();
9506
9515
  this.textArr = [];
9507
9516
  getDummyContext().font = this._getContextFont();
9508
- const additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0;
9517
+ const additionalWidth = shouldAddEllipsis
9518
+ ? this._getTextWidth(ELLIPSIS)
9519
+ : 0;
9509
9520
  for (let i = 0, max = lines.length; i < max; ++i) {
9510
9521
  let line = lines[i];
9511
9522
  let lineWidth = this._getTextWidth(line);
9512
9523
  if (fixedWidth && lineWidth > maxWidth) {
9513
9524
  while (line.length > 0) {
9514
- let low = 0, high = line.length, match = '', matchWidth = 0;
9525
+ let low = 0, high = stringToArray(line).length, match = '', matchWidth = 0;
9515
9526
  while (low < high) {
9516
- const mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;
9527
+ const mid = (low + high) >>> 1, lineArray = stringToArray(line), substr = lineArray.slice(0, mid + 1).join(''), substrWidth = this._getTextWidth(substr) + additionalWidth;
9517
9528
  if (substrWidth <= maxWidth) {
9518
9529
  low = mid + 1;
9519
9530
  match = substr;
@@ -9525,20 +9536,22 @@
9525
9536
  }
9526
9537
  if (match) {
9527
9538
  if (wrapAtWord) {
9528
- var wrapIndex;
9529
- const nextChar = line[match.length];
9539
+ const lineArray = stringToArray(line);
9540
+ const matchArray = stringToArray(match);
9541
+ const nextChar = lineArray[matchArray.length];
9530
9542
  const nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
9543
+ let wrapIndex;
9531
9544
  if (nextIsSpaceOrDash && matchWidth <= maxWidth) {
9532
- wrapIndex = match.length;
9545
+ wrapIndex = matchArray.length;
9533
9546
  }
9534
9547
  else {
9535
- wrapIndex =
9536
- Math.max(match.lastIndexOf(SPACE), match.lastIndexOf(DASH)) +
9537
- 1;
9548
+ const lastSpaceIndex = matchArray.lastIndexOf(SPACE);
9549
+ const lastDashIndex = matchArray.lastIndexOf(DASH);
9550
+ wrapIndex = Math.max(lastSpaceIndex, lastDashIndex) + 1;
9538
9551
  }
9539
9552
  if (wrapIndex > 0) {
9540
9553
  low = wrapIndex;
9541
- match = match.slice(0, low);
9554
+ match = lineArray.slice(0, low).join('');
9542
9555
  matchWidth = this._getTextWidth(match);
9543
9556
  }
9544
9557
  }
@@ -9551,8 +9564,8 @@
9551
9564
  this._tryToAddEllipsisToLastLine();
9552
9565
  break;
9553
9566
  }
9554
- line = line.slice(low);
9555
- line = line.trimLeft();
9567
+ const lineArray = stringToArray(line);
9568
+ line = lineArray.slice(low).join('').trimLeft();
9556
9569
  if (line.length > 0) {
9557
9570
  lineWidth = this._getTextWidth(line);
9558
9571
  if (lineWidth <= maxWidth) {
@@ -9659,7 +9672,7 @@
9659
9672
  if (hasRequiredTextPath) return TextPath;
9660
9673
  hasRequiredTextPath = 1;
9661
9674
  Object.defineProperty(TextPath, "__esModule", { value: true });
9662
- TextPath.TextPath = void 0;
9675
+ TextPath.TextPath = undefined;
9663
9676
  const Util_1 = requireUtil();
9664
9677
  const Factory_1 = requireFactory();
9665
9678
  const Shape_1 = requireShape();
@@ -9896,8 +9909,8 @@
9896
9909
  Factory_1.Factory.addGetterSetter(TextPath$1, 'textBaseline', 'middle');
9897
9910
  Factory_1.Factory.addGetterSetter(TextPath$1, 'fontVariant', NORMAL);
9898
9911
  Factory_1.Factory.addGetterSetter(TextPath$1, 'text', EMPTY_STRING);
9899
- Factory_1.Factory.addGetterSetter(TextPath$1, 'textDecoration', null);
9900
- Factory_1.Factory.addGetterSetter(TextPath$1, 'kerningFunc', null);
9912
+ Factory_1.Factory.addGetterSetter(TextPath$1, 'textDecoration', '');
9913
+ Factory_1.Factory.addGetterSetter(TextPath$1, 'kerningFunc', undefined);
9901
9914
  return TextPath;
9902
9915
  }
9903
9916
 
@@ -9909,7 +9922,7 @@
9909
9922
  if (hasRequiredTransformer) return Transformer;
9910
9923
  hasRequiredTransformer = 1;
9911
9924
  Object.defineProperty(Transformer, "__esModule", { value: true });
9912
- Transformer.Transformer = void 0;
9925
+ Transformer.Transformer = undefined;
9913
9926
  const Util_1 = requireUtil();
9914
9927
  const Factory_1 = requireFactory();
9915
9928
  const Node_1 = requireNode();
@@ -10009,7 +10022,6 @@
10009
10022
  'bottom-center',
10010
10023
  'bottom-right',
10011
10024
  ];
10012
- const MAX_SAFE_INTEGER = 100000000;
10013
10025
  function getCenter(shape) {
10014
10026
  return {
10015
10027
  x: shape.x +
@@ -10205,8 +10217,8 @@
10205
10217
  const node = this.getNode();
10206
10218
  if (!node) {
10207
10219
  return {
10208
- x: -MAX_SAFE_INTEGER,
10209
- y: -MAX_SAFE_INTEGER,
10220
+ x: -1e8,
10221
+ y: -1e8,
10210
10222
  width: 0,
10211
10223
  height: 0,
10212
10224
  rotation: 0,
@@ -10585,12 +10597,12 @@
10585
10597
  const node = this.getNode();
10586
10598
  activeTransformersCount--;
10587
10599
  this._fire('transformend', { evt: e, target: node });
10588
- (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
10600
+ (_a = this.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
10589
10601
  if (node) {
10590
10602
  this._nodes.forEach((target) => {
10591
10603
  var _a;
10592
10604
  target._fire('transformend', { evt: e, target });
10593
- (_a = target.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
10605
+ (_a = target.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
10594
10606
  });
10595
10607
  }
10596
10608
  this._movingAnchorName = null;
@@ -10703,7 +10715,7 @@
10703
10715
  .multiply(localTransform);
10704
10716
  const attrs = newLocalTransform.decompose();
10705
10717
  node.setAttrs(attrs);
10706
- (_a = node.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
10718
+ (_a = node.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
10707
10719
  });
10708
10720
  this.rotation(Util_1.Util._getRotation(newAttrs.rotation));
10709
10721
  this._nodes.forEach((node) => {
@@ -10818,7 +10830,7 @@
10818
10830
  styleFunc(node);
10819
10831
  });
10820
10832
  }
10821
- (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
10833
+ (_a = this.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
10822
10834
  }
10823
10835
  isTransforming() {
10824
10836
  return this._transforming;
@@ -10902,8 +10914,8 @@
10902
10914
  Factory_1.Factory.addGetterSetter(Transformer$1, 'centeredScaling', false);
10903
10915
  Factory_1.Factory.addGetterSetter(Transformer$1, 'ignoreStroke', false);
10904
10916
  Factory_1.Factory.addGetterSetter(Transformer$1, 'padding', 0, (0, Validators_1.getNumberValidator)());
10905
- Factory_1.Factory.addGetterSetter(Transformer$1, 'node');
10906
10917
  Factory_1.Factory.addGetterSetter(Transformer$1, 'nodes');
10918
+ Factory_1.Factory.addGetterSetter(Transformer$1, 'node');
10907
10919
  Factory_1.Factory.addGetterSetter(Transformer$1, 'boundBoxFunc');
10908
10920
  Factory_1.Factory.addGetterSetter(Transformer$1, 'anchorDragBoundFunc');
10909
10921
  Factory_1.Factory.addGetterSetter(Transformer$1, 'anchorStyleFunc');
@@ -10925,7 +10937,7 @@
10925
10937
  if (hasRequiredWedge) return Wedge;
10926
10938
  hasRequiredWedge = 1;
10927
10939
  Object.defineProperty(Wedge, "__esModule", { value: true });
10928
- Wedge.Wedge = void 0;
10940
+ Wedge.Wedge = undefined;
10929
10941
  const Factory_1 = requireFactory();
10930
10942
  const Shape_1 = requireShape();
10931
10943
  const Global_1 = requireGlobal();
@@ -10976,7 +10988,7 @@
10976
10988
  if (hasRequiredBlur) return Blur;
10977
10989
  hasRequiredBlur = 1;
10978
10990
  Object.defineProperty(Blur, "__esModule", { value: true });
10979
- Blur.Blur = void 0;
10991
+ Blur.Blur = undefined;
10980
10992
  const Factory_1 = requireFactory();
10981
10993
  const Node_1 = requireNode();
10982
10994
  const Validators_1 = requireValidators();
@@ -11025,7 +11037,8 @@
11025
11037
  function filterGaussBlurRGBA(imageData, radius) {
11026
11038
  const pixels = imageData.data, width = imageData.width, height = imageData.height;
11027
11039
  let x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
11028
- let div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), stackEnd = null, stack = stackStart, stackIn = null, stackOut = null, mul_sum = mul_table[radius], shg_sum = shg_table[radius];
11040
+ const div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), mul_sum = mul_table[radius], shg_sum = shg_table[radius];
11041
+ let stackEnd = null, stack = stackStart, stackIn = null, stackOut = null;
11029
11042
  for (i = 1; i < div; i++) {
11030
11043
  stack = stack.next = new BlurStack();
11031
11044
  if (i === radiusPlus1) {
@@ -11223,13 +11236,13 @@
11223
11236
  if (hasRequiredBrighten) return Brighten;
11224
11237
  hasRequiredBrighten = 1;
11225
11238
  Object.defineProperty(Brighten, "__esModule", { value: true });
11226
- Brighten.Brighten = void 0;
11239
+ Brighten.Brighten = undefined;
11227
11240
  const Factory_1 = requireFactory();
11228
11241
  const Node_1 = requireNode();
11229
11242
  const Validators_1 = requireValidators();
11230
11243
  const Brighten$1 = function (imageData) {
11231
- let brightness = this.brightness() * 255, data = imageData.data, len = data.length, i;
11232
- for (i = 0; i < len; i += 4) {
11244
+ const brightness = this.brightness() * 255, data = imageData.data, len = data.length;
11245
+ for (let i = 0; i < len; i += 4) {
11233
11246
  data[i] += brightness;
11234
11247
  data[i + 1] += brightness;
11235
11248
  data[i + 2] += brightness;
@@ -11248,14 +11261,15 @@
11248
11261
  if (hasRequiredContrast) return Contrast;
11249
11262
  hasRequiredContrast = 1;
11250
11263
  Object.defineProperty(Contrast, "__esModule", { value: true });
11251
- Contrast.Contrast = void 0;
11264
+ Contrast.Contrast = undefined;
11252
11265
  const Factory_1 = requireFactory();
11253
11266
  const Node_1 = requireNode();
11254
11267
  const Validators_1 = requireValidators();
11255
11268
  const Contrast$1 = function (imageData) {
11256
11269
  const adjust = Math.pow((this.contrast() + 100) / 100, 2);
11257
- let data = imageData.data, nPixels = data.length, red = 150, green = 150, blue = 150, i;
11258
- for (i = 0; i < nPixels; i += 4) {
11270
+ const data = imageData.data, nPixels = data.length;
11271
+ let red = 150, green = 150, blue = 150;
11272
+ for (let i = 0; i < nPixels; i += 4) {
11259
11273
  red = data[i];
11260
11274
  green = data[i + 1];
11261
11275
  blue = data[i + 2];
@@ -11295,13 +11309,14 @@
11295
11309
  if (hasRequiredEmboss) return Emboss;
11296
11310
  hasRequiredEmboss = 1;
11297
11311
  Object.defineProperty(Emboss, "__esModule", { value: true });
11298
- Emboss.Emboss = void 0;
11312
+ Emboss.Emboss = undefined;
11299
11313
  const Factory_1 = requireFactory();
11300
11314
  const Node_1 = requireNode();
11301
11315
  const Util_1 = requireUtil();
11302
11316
  const Validators_1 = requireValidators();
11303
11317
  const Emboss$1 = function (imageData) {
11304
- let strength = this.embossStrength() * 10, greyLevel = this.embossWhiteLevel() * 255, direction = this.embossDirection(), blend = this.embossBlend(), dirY = 0, dirX = 0, data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
11318
+ const strength = this.embossStrength() * 10, greyLevel = this.embossWhiteLevel() * 255, direction = this.embossDirection(), blend = this.embossBlend(), data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4;
11319
+ let dirY = 0, dirX = 0, y = h;
11305
11320
  switch (direction) {
11306
11321
  case 'top-left':
11307
11322
  dirY = -1;
@@ -11397,8 +11412,8 @@
11397
11412
  Emboss.Emboss = Emboss$1;
11398
11413
  Factory_1.Factory.addGetterSetter(Node_1.Node, 'embossStrength', 0.5, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
11399
11414
  Factory_1.Factory.addGetterSetter(Node_1.Node, 'embossWhiteLevel', 0.5, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
11400
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'embossDirection', 'top-left', null, Factory_1.Factory.afterSetFilter);
11401
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'embossBlend', false, null, Factory_1.Factory.afterSetFilter);
11415
+ Factory_1.Factory.addGetterSetter(Node_1.Node, 'embossDirection', 'top-left', undefined, Factory_1.Factory.afterSetFilter);
11416
+ Factory_1.Factory.addGetterSetter(Node_1.Node, 'embossBlend', false, undefined, Factory_1.Factory.afterSetFilter);
11402
11417
  return Emboss;
11403
11418
  }
11404
11419
 
@@ -11410,29 +11425,30 @@
11410
11425
  if (hasRequiredEnhance) return Enhance;
11411
11426
  hasRequiredEnhance = 1;
11412
11427
  Object.defineProperty(Enhance, "__esModule", { value: true });
11413
- Enhance.Enhance = void 0;
11428
+ Enhance.Enhance = undefined;
11414
11429
  const Factory_1 = requireFactory();
11415
11430
  const Node_1 = requireNode();
11416
11431
  const Validators_1 = requireValidators();
11417
11432
  function remap(fromValue, fromMin, fromMax, toMin, toMax) {
11418
- let fromRange = fromMax - fromMin, toRange = toMax - toMin, toValue;
11433
+ const fromRange = fromMax - fromMin, toRange = toMax - toMin;
11419
11434
  if (fromRange === 0) {
11420
11435
  return toMin + toRange / 2;
11421
11436
  }
11422
11437
  if (toRange === 0) {
11423
11438
  return toMin;
11424
11439
  }
11425
- toValue = (fromValue - fromMin) / fromRange;
11440
+ let toValue = (fromValue - fromMin) / fromRange;
11426
11441
  toValue = toRange * toValue + toMin;
11427
11442
  return toValue;
11428
11443
  }
11429
11444
  const Enhance$1 = function (imageData) {
11430
- let data = imageData.data, nSubPixels = data.length, rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b, i;
11445
+ const data = imageData.data, nSubPixels = data.length;
11446
+ let rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b;
11431
11447
  const enhanceAmount = this.enhance();
11432
11448
  if (enhanceAmount === 0) {
11433
11449
  return;
11434
11450
  }
11435
- for (i = 0; i < nSubPixels; i += 4) {
11451
+ for (let i = 0; i < nSubPixels; i += 4) {
11436
11452
  r = data[i + 0];
11437
11453
  if (r < rMin) {
11438
11454
  rMin = r;
@@ -11487,7 +11503,7 @@
11487
11503
  bGoalMax = bMax + enhanceAmount * (bMax - bMid);
11488
11504
  bGoalMin = bMin + enhanceAmount * (bMin - bMid);
11489
11505
  }
11490
- for (i = 0; i < nSubPixels; i += 4) {
11506
+ for (let i = 0; i < nSubPixels; i += 4) {
11491
11507
  data[i + 0] = remap(data[i + 0], rMin, rMax, rGoalMin, rGoalMax);
11492
11508
  data[i + 1] = remap(data[i + 1], gMin, gMax, gGoalMin, gGoalMax);
11493
11509
  data[i + 2] = remap(data[i + 2], bMin, bMax, bGoalMin, bGoalMax);
@@ -11506,11 +11522,11 @@
11506
11522
  if (hasRequiredGrayscale) return Grayscale;
11507
11523
  hasRequiredGrayscale = 1;
11508
11524
  Object.defineProperty(Grayscale, "__esModule", { value: true });
11509
- Grayscale.Grayscale = void 0;
11525
+ Grayscale.Grayscale = undefined;
11510
11526
  const Grayscale$1 = function (imageData) {
11511
- let data = imageData.data, len = data.length, i, brightness;
11512
- for (i = 0; i < len; i += 4) {
11513
- brightness = 0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2];
11527
+ const data = imageData.data, len = data.length;
11528
+ for (let i = 0; i < len; i += 4) {
11529
+ const brightness = 0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2];
11514
11530
  data[i] = brightness;
11515
11531
  data[i + 1] = brightness;
11516
11532
  data[i + 2] = brightness;
@@ -11528,7 +11544,7 @@
11528
11544
  if (hasRequiredHSL) return HSL;
11529
11545
  hasRequiredHSL = 1;
11530
11546
  Object.defineProperty(HSL, "__esModule", { value: true });
11531
- HSL.HSL = void 0;
11547
+ HSL.HSL = undefined;
11532
11548
  const Factory_1 = requireFactory();
11533
11549
  const Node_1 = requireNode();
11534
11550
  const Validators_1 = requireValidators();
@@ -11536,13 +11552,13 @@
11536
11552
  Factory_1.Factory.addGetterSetter(Node_1.Node, 'saturation', 0, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
11537
11553
  Factory_1.Factory.addGetterSetter(Node_1.Node, 'luminance', 0, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
11538
11554
  const HSL$1 = function (imageData) {
11539
- let data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, l = this.luminance() * 127, i;
11555
+ const data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, l = this.luminance() * 127;
11540
11556
  const vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
11541
11557
  const rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
11542
11558
  const gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
11543
11559
  const br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
11544
11560
  let r, g, b, a;
11545
- for (i = 0; i < nPixels; i += 4) {
11561
+ for (let i = 0; i < nPixels; i += 4) {
11546
11562
  r = data[i + 0];
11547
11563
  g = data[i + 1];
11548
11564
  b = data[i + 2];
@@ -11565,7 +11581,7 @@
11565
11581
  if (hasRequiredHSV) return HSV;
11566
11582
  hasRequiredHSV = 1;
11567
11583
  Object.defineProperty(HSV, "__esModule", { value: true });
11568
- HSV.HSV = void 0;
11584
+ HSV.HSV = undefined;
11569
11585
  const Factory_1 = requireFactory();
11570
11586
  const Node_1 = requireNode();
11571
11587
  const Validators_1 = requireValidators();
@@ -11602,10 +11618,10 @@
11602
11618
  if (hasRequiredInvert) return Invert;
11603
11619
  hasRequiredInvert = 1;
11604
11620
  Object.defineProperty(Invert, "__esModule", { value: true });
11605
- Invert.Invert = void 0;
11621
+ Invert.Invert = undefined;
11606
11622
  const Invert$1 = function (imageData) {
11607
- let data = imageData.data, len = data.length, i;
11608
- for (i = 0; i < len; i += 4) {
11623
+ const data = imageData.data, len = data.length;
11624
+ for (let i = 0; i < len; i += 4) {
11609
11625
  data[i] = 255 - data[i];
11610
11626
  data[i + 1] = 255 - data[i + 1];
11611
11627
  data[i + 2] = 255 - data[i + 2];
@@ -11623,31 +11639,31 @@
11623
11639
  if (hasRequiredKaleidoscope) return Kaleidoscope;
11624
11640
  hasRequiredKaleidoscope = 1;
11625
11641
  Object.defineProperty(Kaleidoscope, "__esModule", { value: true });
11626
- Kaleidoscope.Kaleidoscope = void 0;
11642
+ Kaleidoscope.Kaleidoscope = undefined;
11627
11643
  const Factory_1 = requireFactory();
11628
11644
  const Node_1 = requireNode();
11629
11645
  const Util_1 = requireUtil();
11630
11646
  const Validators_1 = requireValidators();
11631
11647
  const ToPolar = function (src, dst, opt) {
11632
- let srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, r = 0, g = 0, b = 0, a = 0;
11633
- let rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
11634
- x = xSize - xMid;
11635
- y = ySize - yMid;
11636
- rad = Math.sqrt(x * x + y * y);
11648
+ const srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2;
11649
+ let rMax = Math.sqrt(xMid * xMid + yMid * yMid);
11650
+ let x = xSize - xMid;
11651
+ let y = ySize - yMid;
11652
+ const rad = Math.sqrt(x * x + y * y);
11637
11653
  rMax = rad > rMax ? rad : rMax;
11638
- let rSize = ySize, tSize = xSize, radius, theta;
11639
- let conversion = ((360 / tSize) * Math.PI) / 180, sin, cos;
11640
- for (theta = 0; theta < tSize; theta += 1) {
11641
- sin = Math.sin(theta * conversion);
11642
- cos = Math.cos(theta * conversion);
11643
- for (radius = 0; radius < rSize; radius += 1) {
11654
+ const rSize = ySize, tSize = xSize;
11655
+ const conversion = ((360 / tSize) * Math.PI) / 180;
11656
+ for (let theta = 0; theta < tSize; theta += 1) {
11657
+ const sin = Math.sin(theta * conversion);
11658
+ const cos = Math.cos(theta * conversion);
11659
+ for (let radius = 0; radius < rSize; radius += 1) {
11644
11660
  x = Math.floor(xMid + ((rMax * radius) / rSize) * cos);
11645
11661
  y = Math.floor(yMid + ((rMax * radius) / rSize) * sin);
11646
- i = (y * xSize + x) * 4;
11647
- r = srcPixels[i + 0];
11648
- g = srcPixels[i + 1];
11649
- b = srcPixels[i + 2];
11650
- a = srcPixels[i + 3];
11662
+ let i = (y * xSize + x) * 4;
11663
+ const r = srcPixels[i + 0];
11664
+ const g = srcPixels[i + 1];
11665
+ const b = srcPixels[i + 2];
11666
+ const a = srcPixels[i + 3];
11651
11667
  i = (theta + radius * xSize) * 4;
11652
11668
  dstPixels[i + 0] = r;
11653
11669
  dstPixels[i + 1] = g;
@@ -11657,28 +11673,28 @@
11657
11673
  }
11658
11674
  };
11659
11675
  const FromPolar = function (src, dst, opt) {
11660
- let srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, dx, dy, r = 0, g = 0, b = 0, a = 0;
11661
- let rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
11662
- x = xSize - xMid;
11663
- y = ySize - yMid;
11664
- rad = Math.sqrt(x * x + y * y);
11676
+ const srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2;
11677
+ let rMax = Math.sqrt(xMid * xMid + yMid * yMid);
11678
+ let x = xSize - xMid;
11679
+ let y = ySize - yMid;
11680
+ const rad = Math.sqrt(x * x + y * y);
11665
11681
  rMax = rad > rMax ? rad : rMax;
11666
- let rSize = ySize, tSize = xSize, radius, theta, phaseShift = 0;
11682
+ const rSize = ySize, tSize = xSize, phaseShift = 0;
11667
11683
  let x1, y1;
11668
11684
  for (x = 0; x < xSize; x += 1) {
11669
11685
  for (y = 0; y < ySize; y += 1) {
11670
- dx = x - xMid;
11671
- dy = y - yMid;
11672
- radius = (Math.sqrt(dx * dx + dy * dy) * rSize) / rMax;
11673
- theta = ((Math.atan2(dy, dx) * 180) / Math.PI + 360 + phaseShift) % 360;
11686
+ const dx = x - xMid;
11687
+ const dy = y - yMid;
11688
+ const radius = (Math.sqrt(dx * dx + dy * dy) * rSize) / rMax;
11689
+ let theta = ((Math.atan2(dy, dx) * 180) / Math.PI + 360 + phaseShift) % 360;
11674
11690
  theta = (theta * tSize) / 360;
11675
11691
  x1 = Math.floor(theta);
11676
11692
  y1 = Math.floor(radius);
11677
- i = (y1 * xSize + x1) * 4;
11678
- r = srcPixels[i + 0];
11679
- g = srcPixels[i + 1];
11680
- b = srcPixels[i + 2];
11681
- a = srcPixels[i + 3];
11693
+ let i = (y1 * xSize + x1) * 4;
11694
+ const r = srcPixels[i + 0];
11695
+ const g = srcPixels[i + 1];
11696
+ const b = srcPixels[i + 2];
11697
+ const a = srcPixels[i + 3];
11682
11698
  i = (y * xSize + x) * 4;
11683
11699
  dstPixels[i + 0] = r;
11684
11700
  dstPixels[i + 1] = g;
@@ -11753,7 +11769,7 @@
11753
11769
  sectionSize *= 2;
11754
11770
  }
11755
11771
  }
11756
- FromPolar(scratchData, imageData, { polarRotation: 0 });
11772
+ FromPolar(scratchData, imageData, { });
11757
11773
  };
11758
11774
  Kaleidoscope.Kaleidoscope = Kaleidoscope$1;
11759
11775
  Factory_1.Factory.addGetterSetter(Node_1.Node, 'kaleidoscopePower', 2, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
@@ -11769,7 +11785,7 @@
11769
11785
  if (hasRequiredMask) return Mask;
11770
11786
  hasRequiredMask = 1;
11771
11787
  Object.defineProperty(Mask, "__esModule", { value: true });
11772
- Mask.Mask = void 0;
11788
+ Mask.Mask = undefined;
11773
11789
  const Factory_1 = requireFactory();
11774
11790
  const Node_1 = requireNode();
11775
11791
  const Validators_1 = requireValidators();
@@ -11900,7 +11916,8 @@
11900
11916
  return maskResult;
11901
11917
  }
11902
11918
  const Mask$1 = function (imageData) {
11903
- let threshold = this.threshold(), mask = backgroundMask(imageData, threshold);
11919
+ const threshold = this.threshold();
11920
+ let mask = backgroundMask(imageData, threshold);
11904
11921
  if (mask) {
11905
11922
  mask = erodeMask(mask, imageData.width, imageData.height);
11906
11923
  mask = dilateMask(mask, imageData.width, imageData.height);
@@ -11922,7 +11939,7 @@
11922
11939
  if (hasRequiredNoise) return Noise;
11923
11940
  hasRequiredNoise = 1;
11924
11941
  Object.defineProperty(Noise, "__esModule", { value: true });
11925
- Noise.Noise = void 0;
11942
+ Noise.Noise = undefined;
11926
11943
  const Factory_1 = requireFactory();
11927
11944
  const Node_1 = requireNode();
11928
11945
  const Validators_1 = requireValidators();
@@ -11947,7 +11964,7 @@
11947
11964
  if (hasRequiredPixelate) return Pixelate;
11948
11965
  hasRequiredPixelate = 1;
11949
11966
  Object.defineProperty(Pixelate, "__esModule", { value: true });
11950
- Pixelate.Pixelate = void 0;
11967
+ Pixelate.Pixelate = undefined;
11951
11968
  const Factory_1 = requireFactory();
11952
11969
  const Util_1 = requireUtil();
11953
11970
  const Node_1 = requireNode();
@@ -12020,13 +12037,13 @@
12020
12037
  if (hasRequiredPosterize) return Posterize;
12021
12038
  hasRequiredPosterize = 1;
12022
12039
  Object.defineProperty(Posterize, "__esModule", { value: true });
12023
- Posterize.Posterize = void 0;
12040
+ Posterize.Posterize = undefined;
12024
12041
  const Factory_1 = requireFactory();
12025
12042
  const Node_1 = requireNode();
12026
12043
  const Validators_1 = requireValidators();
12027
12044
  const Posterize$1 = function (imageData) {
12028
- let levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels, i;
12029
- for (i = 0; i < len; i += 1) {
12045
+ const levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels;
12046
+ for (let i = 0; i < len; i += 1) {
12030
12047
  data[i] = Math.floor(data[i] / scale) * scale;
12031
12048
  }
12032
12049
  };
@@ -12043,15 +12060,14 @@
12043
12060
  if (hasRequiredRGB) return RGB;
12044
12061
  hasRequiredRGB = 1;
12045
12062
  Object.defineProperty(RGB, "__esModule", { value: true });
12046
- RGB.RGB = void 0;
12063
+ RGB.RGB = undefined;
12047
12064
  const Factory_1 = requireFactory();
12048
12065
  const Node_1 = requireNode();
12049
12066
  const Validators_1 = requireValidators();
12050
12067
  const RGB$1 = function (imageData) {
12051
- let data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), i, brightness;
12052
- for (i = 0; i < nPixels; i += 4) {
12053
- brightness =
12054
- (0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2]) / 255;
12068
+ const data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue();
12069
+ for (let i = 0; i < nPixels; i += 4) {
12070
+ const brightness = (0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2]) / 255;
12055
12071
  data[i] = brightness * red;
12056
12072
  data[i + 1] = brightness * green;
12057
12073
  data[i + 2] = brightness * blue;
@@ -12095,7 +12111,7 @@
12095
12111
  if (hasRequiredRGBA) return RGBA;
12096
12112
  hasRequiredRGBA = 1;
12097
12113
  Object.defineProperty(RGBA, "__esModule", { value: true });
12098
- RGBA.RGBA = void 0;
12114
+ RGBA.RGBA = undefined;
12099
12115
  const Factory_1 = requireFactory();
12100
12116
  const Node_1 = requireNode();
12101
12117
  const Validators_1 = requireValidators();
@@ -12157,13 +12173,13 @@
12157
12173
  if (hasRequiredSepia) return Sepia;
12158
12174
  hasRequiredSepia = 1;
12159
12175
  Object.defineProperty(Sepia, "__esModule", { value: true });
12160
- Sepia.Sepia = void 0;
12176
+ Sepia.Sepia = undefined;
12161
12177
  const Sepia$1 = function (imageData) {
12162
- let data = imageData.data, nPixels = data.length, i, r, g, b;
12163
- for (i = 0; i < nPixels; i += 4) {
12164
- r = data[i + 0];
12165
- g = data[i + 1];
12166
- b = data[i + 2];
12178
+ const data = imageData.data, nPixels = data.length;
12179
+ for (let i = 0; i < nPixels; i += 4) {
12180
+ const r = data[i + 0];
12181
+ const g = data[i + 1];
12182
+ const b = data[i + 2];
12167
12183
  data[i + 0] = Math.min(255, r * 0.393 + g * 0.769 + b * 0.189);
12168
12184
  data[i + 1] = Math.min(255, r * 0.349 + g * 0.686 + b * 0.168);
12169
12185
  data[i + 2] = Math.min(255, r * 0.272 + g * 0.534 + b * 0.131);
@@ -12181,7 +12197,7 @@
12181
12197
  if (hasRequiredSolarize) return Solarize;
12182
12198
  hasRequiredSolarize = 1;
12183
12199
  Object.defineProperty(Solarize, "__esModule", { value: true });
12184
- Solarize.Solarize = void 0;
12200
+ Solarize.Solarize = undefined;
12185
12201
  const Solarize$1 = function (imageData) {
12186
12202
  const data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4;
12187
12203
  let y = h;
@@ -12220,7 +12236,7 @@
12220
12236
  if (hasRequiredThreshold) return Threshold;
12221
12237
  hasRequiredThreshold = 1;
12222
12238
  Object.defineProperty(Threshold, "__esModule", { value: true });
12223
- Threshold.Threshold = void 0;
12239
+ Threshold.Threshold = undefined;
12224
12240
  const Factory_1 = requireFactory();
12225
12241
  const Node_1 = requireNode();
12226
12242
  const Validators_1 = requireValidators();
@@ -12241,7 +12257,7 @@
12241
12257
  if (hasRequired_FullInternals) return _FullInternals;
12242
12258
  hasRequired_FullInternals = 1;
12243
12259
  Object.defineProperty(_FullInternals, "__esModule", { value: true });
12244
- _FullInternals.Konva = void 0;
12260
+ _FullInternals.Konva = undefined;
12245
12261
  const _CoreInternals_1 = require_CoreInternals();
12246
12262
  const Arc_1 = requireArc();
12247
12263
  const Arrow_1 = requireArrow();
@@ -12411,8 +12427,8 @@
12411
12427
  const konvaPoints = [];
12412
12428
  params.points.forEach((point => konvaPoints.push(point.x, point.y)));
12413
12429
  this._ref = new Konva.Line({
12414
- stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12415
- strokeWidth: (_b = params.width) !== null && _b !== void 0 ? _b : 4,
12430
+ stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
12431
+ strokeWidth: (_b = params.width) !== null && _b !== undefined ? _b : 4,
12416
12432
  globalCompositeOperation: "source-over",
12417
12433
  lineCap: "round",
12418
12434
  lineJoin: "round",
@@ -12519,12 +12535,12 @@
12519
12535
  x: params.position.x,
12520
12536
  y: params.position.y,
12521
12537
  text: params.text,
12522
- fontSize: (_a = params.fontSize) !== null && _a !== void 0 ? _a : 34,
12538
+ fontSize: (_a = params.fontSize) !== null && _a !== undefined ? _a : 34,
12523
12539
  fontFamily: this.TEXT_FONT_FAMILY,
12524
- fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
12540
+ fill: (_b = params.color) !== null && _b !== undefined ? _b : "#ff0000",
12525
12541
  align: "left",
12526
12542
  draggable: true,
12527
- rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0
12543
+ rotation: (_c = params.rotation) !== null && _c !== undefined ? _c : 0
12528
12544
  });
12529
12545
  this._ref.width(this._ref.getTextWidth());
12530
12546
  this._ref.on("transform", (e => {
@@ -12622,15 +12638,15 @@
12622
12638
  y: 100
12623
12639
  };
12624
12640
  this._ref = new Konva.Rect({
12625
- stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12626
- strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
12641
+ stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
12642
+ strokeWidth: (_b = params.lineWidth) !== null && _b !== undefined ? _b : 4,
12627
12643
  globalCompositeOperation: "source-over",
12628
12644
  lineCap: "round",
12629
12645
  lineJoin: "round",
12630
12646
  x: params.position.x,
12631
12647
  y: params.position.y,
12632
- width: (_c = params.width) !== null && _c !== void 0 ? _c : 200,
12633
- height: (_d = params.height) !== null && _d !== void 0 ? _d : 200,
12648
+ width: (_c = params.width) !== null && _c !== undefined ? _c : 200,
12649
+ height: (_d = params.height) !== null && _d !== undefined ? _d : 200,
12634
12650
  draggable: true,
12635
12651
  strokeScaleEnabled: false
12636
12652
  });
@@ -12740,8 +12756,8 @@
12740
12756
  y: 25
12741
12757
  };
12742
12758
  this._ref = new Konva.Ellipse({
12743
- stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12744
- strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
12759
+ stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
12760
+ strokeWidth: (_b = params.lineWidth) !== null && _b !== undefined ? _b : 4,
12745
12761
  globalCompositeOperation: "source-over",
12746
12762
  lineCap: "round",
12747
12763
  lineJoin: "round",
@@ -12870,8 +12886,8 @@
12870
12886
  y: 100
12871
12887
  };
12872
12888
  this._ref = new Konva.Arrow({
12873
- stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
12874
- fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
12889
+ stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
12890
+ fill: (_b = params.color) !== null && _b !== undefined ? _b : "#ff0000",
12875
12891
  strokeWidth: 4,
12876
12892
  globalCompositeOperation: "source-over",
12877
12893
  lineCap: "round",
@@ -13011,8 +13027,8 @@
13011
13027
  x: params.position.x,
13012
13028
  y: params.position.y,
13013
13029
  image: this._canvasImage,
13014
- width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
13015
- height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
13030
+ width: (_a = params.width) !== null && _a !== undefined ? _a : 0,
13031
+ height: (_b = params.height) !== null && _b !== undefined ? _b : 0,
13016
13032
  draggable: true
13017
13033
  });
13018
13034
  this._ref.on("transform", (e => {
@@ -13122,10 +13138,10 @@
13122
13138
  this._ref = new Konva.Shape({
13123
13139
  x: params.position.x,
13124
13140
  y: params.position.y,
13125
- width: (_a = params.width) !== null && _a !== void 0 ? _a : 200,
13126
- height: (_b = params.height) !== null && _b !== void 0 ? _b : 200,
13127
- stroke: (_c = params.color) !== null && _c !== void 0 ? _c : "#ff0000",
13128
- strokeWidth: (_d = params.lineWidth) !== null && _d !== void 0 ? _d : 4,
13141
+ width: (_a = params.width) !== null && _a !== undefined ? _a : 200,
13142
+ height: (_b = params.height) !== null && _b !== undefined ? _b : 200,
13143
+ stroke: (_c = params.color) !== null && _c !== undefined ? _c : "#ff0000",
13144
+ strokeWidth: (_d = params.lineWidth) !== null && _d !== undefined ? _d : 4,
13129
13145
  draggable: true,
13130
13146
  strokeScaleEnabled: false,
13131
13147
  globalCompositeOperation: "source-over",
@@ -13374,9 +13390,9 @@
13374
13390
  initialize(container, containerEvents, viewer, worldTransformer) {
13375
13391
  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?');
13376
13392
  this._viewer = viewer;
13377
- this._worldTransformer = worldTransformer !== null && worldTransformer !== void 0 ? worldTransformer : new WorldTransform;
13393
+ this._worldTransformer = worldTransformer !== null && worldTransformer !== undefined ? worldTransformer : new WorldTransform;
13378
13394
  this._container = container;
13379
- this._containerEvents = containerEvents !== null && containerEvents !== void 0 ? containerEvents : [];
13395
+ this._containerEvents = containerEvents !== null && containerEvents !== undefined ? containerEvents : [];
13380
13396
  this._markupContainer = document.createElement("div");
13381
13397
  this._markupContainer.id = "markup-container";
13382
13398
  this._markupContainer.style.position = "absolute";
@@ -13404,9 +13420,9 @@
13404
13420
  this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
13405
13421
  }
13406
13422
  this.destroyKonva();
13407
- (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
13423
+ (_a = this._resizeObserver) === null || _a === undefined ? undefined : _a.disconnect();
13408
13424
  this._resizeObserver = undefined;
13409
- (_b = this._markupContainer) === null || _b === void 0 ? void 0 : _b.remove();
13425
+ (_b = this._markupContainer) === null || _b === undefined ? undefined : _b.remove();
13410
13426
  this._markupContainer = undefined;
13411
13427
  this._container = undefined;
13412
13428
  this._viewer = undefined;
@@ -13438,14 +13454,14 @@
13438
13454
  const hexColor = new MarkupColor(r, g, b).asHex();
13439
13455
  this.getObjects().filter((obj => {
13440
13456
  var _a;
13441
- return (_a = obj.setColor) === null || _a === void 0 ? void 0 : _a.call(obj, hexColor);
13457
+ return (_a = obj.setColor) === null || _a === undefined ? undefined : _a.call(obj, hexColor);
13442
13458
  }));
13443
13459
  }
13444
13460
  colorizeSelectedMarkups(r, g, b) {
13445
13461
  const hexColor = new MarkupColor(r, g, b).asHex();
13446
13462
  this.getSelectedObjects().filter((obj => {
13447
13463
  var _a;
13448
- return (_a = obj.setColor) === null || _a === void 0 ? void 0 : _a.call(obj, hexColor);
13464
+ return (_a = obj.setColor) === null || _a === undefined ? undefined : _a.call(obj, hexColor);
13449
13465
  }));
13450
13466
  }
13451
13467
  setViewpoint(viewpoint) {
@@ -13461,13 +13477,13 @@
13461
13477
  x: 0,
13462
13478
  y: 0
13463
13479
  });
13464
- const markupColor = ((_a = viewpoint.custom_fields) === null || _a === void 0 ? void 0 : _a.markup_color) || {
13480
+ const markupColor = ((_a = viewpoint.custom_fields) === null || _a === undefined ? undefined : _a.markup_color) || {
13465
13481
  r: 255,
13466
13482
  g: 0,
13467
13483
  b: 0
13468
13484
  };
13469
13485
  this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
13470
- (_b = viewpoint.lines) === null || _b === void 0 ? void 0 : _b.forEach((line => {
13486
+ (_b = viewpoint.lines) === null || _b === undefined ? undefined : _b.forEach((line => {
13471
13487
  const linePoints = [];
13472
13488
  line.points.forEach((point => {
13473
13489
  const screenPoint = this._worldTransformer.worldToScreen(point);
@@ -13476,28 +13492,28 @@
13476
13492
  }));
13477
13493
  this.addLine(linePoints, line.color, line.type, line.width, line.id);
13478
13494
  }));
13479
- (_c = viewpoint.texts) === null || _c === void 0 ? void 0 : _c.forEach((text => {
13495
+ (_c = viewpoint.texts) === null || _c === undefined ? undefined : _c.forEach((text => {
13480
13496
  const screenPoint = this._worldTransformer.worldToScreen(text.position);
13481
13497
  this.addText(text.text, screenPoint, text.angle, text.color, text.text_size, text.font_size, text.id);
13482
13498
  }));
13483
- (_d = viewpoint.rectangles) === null || _d === void 0 ? void 0 : _d.forEach((rect => {
13499
+ (_d = viewpoint.rectangles) === null || _d === undefined ? undefined : _d.forEach((rect => {
13484
13500
  const screenPoint = this._worldTransformer.worldToScreen(rect.position);
13485
13501
  this.addRectangle(screenPoint, rect.width, rect.height, rect.line_width, rect.color, rect.id);
13486
13502
  }));
13487
- (_e = viewpoint.ellipses) === null || _e === void 0 ? void 0 : _e.forEach((ellipse => {
13503
+ (_e = viewpoint.ellipses) === null || _e === undefined ? undefined : _e.forEach((ellipse => {
13488
13504
  const screenPoint = this._worldTransformer.worldToScreen(ellipse.position);
13489
13505
  this.addEllipse(screenPoint, ellipse.radius, ellipse.line_width, ellipse.color, ellipse.id);
13490
13506
  }));
13491
- (_f = viewpoint.arrows) === null || _f === void 0 ? void 0 : _f.forEach((arrow => {
13507
+ (_f = viewpoint.arrows) === null || _f === undefined ? undefined : _f.forEach((arrow => {
13492
13508
  const startPoint = this._worldTransformer.worldToScreen(arrow.start);
13493
13509
  const endPoint = this._worldTransformer.worldToScreen(arrow.end);
13494
13510
  this.addArrow(startPoint, endPoint, arrow.color, arrow.id);
13495
13511
  }));
13496
- (_g = viewpoint.clouds) === null || _g === void 0 ? void 0 : _g.forEach((cloud => {
13512
+ (_g = viewpoint.clouds) === null || _g === undefined ? undefined : _g.forEach((cloud => {
13497
13513
  const screenPoint = this._worldTransformer.worldToScreen(cloud.position);
13498
13514
  this.addCloud(screenPoint, cloud.width, cloud.height, cloud.line_width, cloud.color, cloud.id);
13499
13515
  }));
13500
- (_h = viewpoint.images) === null || _h === void 0 ? void 0 : _h.forEach((image => {
13516
+ (_h = viewpoint.images) === null || _h === undefined ? undefined : _h.forEach((image => {
13501
13517
  const screenPoint = this._worldTransformer.worldToScreen(image.position);
13502
13518
  this.addImage(screenPoint, image.src, image.width, image.height, image.id);
13503
13519
  }));
@@ -13791,7 +13807,7 @@
13791
13807
  this.removeTextInput();
13792
13808
  this.removeImageInput();
13793
13809
  this.clearOverlay();
13794
- (_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.destroy();
13810
+ (_a = this._konvaStage) === null || _a === undefined ? undefined : _a.destroy();
13795
13811
  this._groupImages = undefined;
13796
13812
  this._groupGeometry = undefined;
13797
13813
  this._groupTexts = undefined;
@@ -14041,7 +14057,7 @@
14041
14057
  }
14042
14058
  removeTextInput() {
14043
14059
  var _a;
14044
- (_a = this._textInputRef) === null || _a === void 0 ? void 0 : _a.remove();
14060
+ (_a = this._textInputRef) === null || _a === undefined ? undefined : _a.remove();
14045
14061
  this._textInputRef = null;
14046
14062
  this._textInputPos = null;
14047
14063
  this._textInputAngle = 0;
@@ -14084,14 +14100,14 @@
14084
14100
  }
14085
14101
  removeImageInput() {
14086
14102
  var _a;
14087
- (_a = this._imageInputRef) === null || _a === void 0 ? void 0 : _a.remove();
14103
+ (_a = this._imageInputRef) === null || _a === undefined ? undefined : _a.remove();
14088
14104
  this._imageInputRef = null;
14089
14105
  this._imageInputPos = null;
14090
14106
  }
14091
14107
  addText(text, position, angle, color, textSize, fontSize, id) {
14092
14108
  var _a;
14093
14109
  if (!text) return;
14094
- (_a = this.getSelectedObjects().at(0)) === null || _a === void 0 ? void 0 : _a.delete();
14110
+ (_a = this.getSelectedObjects().at(0)) === null || _a === undefined ? undefined : _a.delete();
14095
14111
  this.clearSelected();
14096
14112
  this.removeTextInput();
14097
14113
  const tolerance = 1e-6;
@@ -14166,7 +14182,7 @@
14166
14182
  addImage(position, src, width, height, id) {
14167
14183
  var _a;
14168
14184
  if (!position || !src) return;
14169
- (_a = this.getSelectedObjects().at(0)) === null || _a === void 0 ? void 0 : _a.delete();
14185
+ (_a = this.getSelectedObjects().at(0)) === null || _a === undefined ? undefined : _a.delete();
14170
14186
  this.clearSelected();
14171
14187
  this.removeImageInput();
14172
14188
  const konvaImage = new KonvaImage({
@@ -14189,7 +14205,7 @@
14189
14205
  var _a;
14190
14206
  const extView = this.m_module.getViewer().getActiveTvExtendedView();
14191
14207
  extView.setView(params.position, params.target, params.upVector, params.viewFieldWidth, params.viewFieldHeight, params.perspective);
14192
- (_a = extView.delete) === null || _a === void 0 ? void 0 : _a.call(extView);
14208
+ (_a = extView.delete) === null || _a === undefined ? undefined : _a.call(extView);
14193
14209
  };
14194
14210
  this.getViewParams = () => {
14195
14211
  var _a;
@@ -14202,7 +14218,7 @@
14202
14218
  viewFieldHeight: view.viewFieldHeight,
14203
14219
  perspective: view.perspective,
14204
14220
  };
14205
- (_a = view.delete) === null || _a === void 0 ? void 0 : _a.call(view);
14221
+ (_a = view.delete) === null || _a === undefined ? undefined : _a.call(view);
14206
14222
  return obj;
14207
14223
  };
14208
14224
  this.m_module = module;
@@ -14435,7 +14451,7 @@
14435
14451
  deleteAll(objects) {
14436
14452
  var _a;
14437
14453
  for (const obj of objects) {
14438
- (_a = obj === null || obj === void 0 ? void 0 : obj.delete) === null || _a === void 0 ? void 0 : _a.call(obj);
14454
+ (_a = obj === null || obj === undefined ? undefined : obj.delete) === null || _a === undefined ? undefined : _a.call(obj);
14439
14455
  }
14440
14456
  }
14441
14457
  updatePreview() { }
@@ -14803,7 +14819,7 @@
14803
14819
  };
14804
14820
  this.items = [];
14805
14821
  this.canvasEvents.push("resize");
14806
- this.oldRulerUnit = (_a = subject.options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
14822
+ this.oldRulerUnit = (_a = subject.options.rulerUnit) !== null && _a !== undefined ? _a : "Default";
14807
14823
  this.optionsChange = this.optionsChange.bind(this);
14808
14824
  }
14809
14825
  initialize() {
@@ -14917,7 +14933,7 @@
14917
14933
  optionsChange(event) {
14918
14934
  var _a;
14919
14935
  const options = event.data;
14920
- const toUnitName = (_a = options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
14936
+ const toUnitName = (_a = options.rulerUnit) !== null && _a !== undefined ? _a : "Default";
14921
14937
  if (this.oldRulerUnit === toUnitName)
14922
14938
  return;
14923
14939
  this.oldRulerUnit = toUnitName;
@@ -15037,7 +15053,7 @@
15037
15053
  const model = this.viewer.getActiveModel();
15038
15054
  model.removeEntity(this.cameraId);
15039
15055
  model.delete();
15040
- (_a = this.cameraWalker) === null || _a === void 0 ? void 0 : _a.delete();
15056
+ (_a = this.cameraWalker) === null || _a === undefined ? undefined : _a.delete();
15041
15057
  }
15042
15058
  if (this.viewParams) {
15043
15059
  this.setViewParams(this.viewParams);
@@ -15435,7 +15451,7 @@
15435
15451
  const extView = this.getViewer().getActiveTvExtendedView();
15436
15452
  extView.setView(viewParams.position, viewParams.target, viewParams.upVector, viewParams.viewFieldWidth, viewParams.viewFieldHeight, viewParams.perspective);
15437
15453
  extView.delete();
15438
- (_b = (_a = this._subject.activeDragger()) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
15454
+ (_b = (_a = this._subject.activeDragger()) === null || _a === undefined ? undefined : _a.updatePreview) === null || _b === undefined ? undefined : _b.call(_a);
15439
15455
  }
15440
15456
  endAction() {
15441
15457
  this._endInteractivity();
@@ -15544,7 +15560,7 @@
15544
15560
  deleteAll(objects) {
15545
15561
  var _a;
15546
15562
  for (const obj of objects) {
15547
- (_a = obj === null || obj === void 0 ? void 0 : obj.delete) === null || _a === void 0 ? void 0 : _a.call(obj);
15563
+ (_a = obj === null || obj === undefined ? undefined : obj.delete) === null || _a === undefined ? undefined : _a.call(obj);
15548
15564
  }
15549
15565
  }
15550
15566
  }
@@ -15630,7 +15646,7 @@
15630
15646
  targetWithDelta.delete();
15631
15647
  position.delete();
15632
15648
  positionWithDelta.delete();
15633
- (_b = (_a = this._subject.activeDragger()) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
15649
+ (_b = (_a = this._subject.activeDragger()) === null || _a === undefined ? undefined : _a.updatePreview) === null || _b === undefined ? undefined : _b.call(_a);
15634
15650
  this._subject.emitEvent({
15635
15651
  type: "pan",
15636
15652
  x: absoluteX,
@@ -15702,7 +15718,7 @@
15702
15718
  const viewer = this._m_module.getViewer();
15703
15719
  viewer.zoomAt(zoomFactor, x, y);
15704
15720
  this._subject.deviceAutoRegeneration();
15705
- (_b = (_a = this._subject.activeDragger()) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
15721
+ (_b = (_a = this._subject.activeDragger()) === null || _a === undefined ? undefined : _a.updatePreview) === null || _b === undefined ? undefined : _b.call(_a);
15706
15722
  this._subject.emitEvent({
15707
15723
  type: "zoomat",
15708
15724
  data: zoomFactor,
@@ -16115,35 +16131,41 @@
16115
16131
  *
16116
16132
  * 1. Define a dragger class implements {@link IDragger}.
16117
16133
  * 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.
16118
- * 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove`
16119
- * event and zoom in/out when the left mouse button is pressed.
16134
+ * 3. Define the dragger logic in the event listeners. For example, listen for the `mousemove` event and
16135
+ * zoom in/out when the left mouse button is pressed.
16120
16136
  * 4. Override {@link IDragger.dispose} and remove mouse event listeners from the viewer.
16121
16137
  * 5. Register dragger provider in the draggers registry by calling the {@link draggers.registerDragger}.
16122
16138
  *
16123
- * @example <caption>Implementing a custom dragger.</caption>
16124
- * import { IDragger, draggers, Viewer } from "@inweb/viewer-visualize";
16139
+ * @example Implementing a custom dragger.
16125
16140
  *
16126
- * class MyDragger implements IDragger {
16127
- * protected viewer: Viewer;
16141
+ * ```javascript
16142
+ * import { IDragger, draggers, Viewer } from "@inweb/viewer-visualize";
16128
16143
  *
16129
- * constructor(viewer: Viewer) {
16130
- * this.viewer = viewer;
16131
- * this.viewer.addEventListener("pointermove", this.onPointerMove);
16132
- * }
16144
+ * class MyDragger implements IDragger {
16145
+ * protected viewer: Viewer;
16133
16146
  *
16134
- * override dispose() {
16135
- * this.viewer.removeEventListener("pointermove", this.onPointerMove);
16136
- * }
16147
+ * constructor(viewer: Viewer) {
16148
+ * this.viewer = viewer;
16149
+ * this.viewer.addEventListener("pointermove", this.onPointerMove);
16150
+ * }
16137
16151
  *
16138
- * onPointerMove = (event: PointerEvent) => {
16139
- * // place custom logic here
16140
- * };
16152
+ * override dispose() {
16153
+ * this.viewer.removeEventListener("pointermove", this.onPointerMove);
16141
16154
  * }
16142
16155
  *
16143
- * draggers.registerDragger("MyDragger", (viewer): IDragger => new MyDragger(viewer));
16156
+ * onPointerMove = (event: PointerEvent) => {
16157
+ * // place custom logic here
16158
+ * };
16159
+ * }
16160
+ *
16161
+ * draggers.registerDragger("MyDragger", (viewer): IDragger => new MyDragger(viewer));
16162
+ * ```
16144
16163
  *
16145
- * @example <caption>Activating a custom dragger.</caption>
16146
- * viewer.setActiveDragger("MyDragger");
16164
+ * @example Activating a custom dragger.
16165
+ *
16166
+ * ```javascript
16167
+ * viewer.setActiveDragger("MyDragger");
16168
+ * ```
16147
16169
  */
16148
16170
  const draggers = draggersRegistry("visualizejs");
16149
16171
  // build-in draggers
@@ -16211,7 +16233,7 @@
16211
16233
  }
16212
16234
  }
16213
16235
  modelItr.delete();
16214
- (_a = visViewer.clearViewExtentsCache) === null || _a === void 0 ? void 0 : _a.call(visViewer);
16236
+ (_a = visViewer.clearViewExtentsCache) === null || _a === undefined ? undefined : _a.call(visViewer);
16215
16237
  viewer.update();
16216
16238
  }
16217
16239
 
@@ -16324,7 +16346,7 @@
16324
16346
  var _a;
16325
16347
  if (!viewer.visualizeJs)
16326
16348
  return "";
16327
- return ((_a = viewer.canvas) === null || _a === void 0 ? void 0 : _a.toDataURL(type, encoderOptions)) || "";
16349
+ return ((_a = viewer.canvas) === null || _a === undefined ? undefined : _a.toDataURL(type, encoderOptions)) || "";
16328
16350
  }
16329
16351
 
16330
16352
  ///////////////////////////////////////////////////////////////////////////////
@@ -16764,7 +16786,7 @@
16764
16786
  const visLib = viewer.visLib();
16765
16787
  const visViewer = visLib.getViewer();
16766
16788
  const selectionSet = new visLib.OdTvSelectionSet();
16767
- handles === null || handles === void 0 ? void 0 : handles.forEach((handle) => {
16789
+ handles === null || handles === undefined ? undefined : handles.forEach((handle) => {
16768
16790
  const entityId = visViewer.getEntityByOriginalHandle(handle + "");
16769
16791
  if (!entityId.isNull())
16770
16792
  selectionSet.appendEntity(entityId);
@@ -16876,7 +16898,7 @@
16876
16898
  if (!entityId.isNull())
16877
16899
  selectionSet.appendEntity(entityId);
16878
16900
  });
16879
- (_a = visViewer.zoomToObjects) === null || _a === void 0 ? void 0 : _a.call(visViewer, selectionSet);
16901
+ (_a = visViewer.zoomToObjects) === null || _a === undefined ? undefined : _a.call(visViewer, selectionSet);
16880
16902
  viewer.deviceAutoRegeneration();
16881
16903
  viewer.update();
16882
16904
  viewer.emitEvent({ type: "zoom" });
@@ -16911,7 +16933,7 @@
16911
16933
  return;
16912
16934
  const visViewer = viewer.visViewer();
16913
16935
  const selectionSet = visViewer.getSelected();
16914
- (_a = visViewer.zoomToObjects) === null || _a === void 0 ? void 0 : _a.call(visViewer, selectionSet);
16936
+ (_a = visViewer.zoomToObjects) === null || _a === undefined ? undefined : _a.call(visViewer, selectionSet);
16915
16937
  viewer.deviceAutoRegeneration();
16916
16938
  viewer.update();
16917
16939
  viewer.emitEvent({ type: "zoom" });
@@ -16992,7 +17014,7 @@
16992
17014
  modelPtr.delete();
16993
17015
  }
16994
17016
  modelItr.delete();
16995
- (_a = visViewer.clearViewExtentsCache) === null || _a === void 0 ? void 0 : _a.call(visViewer);
17017
+ (_a = visViewer.clearViewExtentsCache) === null || _a === undefined ? undefined : _a.call(visViewer);
16996
17018
  viewer.update();
16997
17019
  }
16998
17020
 
@@ -17026,17 +17048,23 @@
17026
17048
  * 1. Define a command handler with a first `viewer` parameter.
17027
17049
  * 2. Register command handler in the commands registry by calling the {@link commands.registerCommand}.
17028
17050
  *
17029
- * @example <caption>Implementing a custom command.</caption>
17030
- * import { commands, Viewer } from "@inweb/viewer-visualize";
17051
+ * @example Implementing a custom command.
17031
17052
  *
17032
- * function commandHandler(viewer: Viewer, name = "world"): void {
17033
- * console.log(`Hello ${name}!!!`);
17034
- * }
17053
+ * ```javascript
17054
+ * import { commands, Viewer } from "@inweb/viewer-visualize";
17055
+ *
17056
+ * function commandHandler(viewer: Viewer, name = "world"): void {
17057
+ * console.log(`Hello ${name}!!!`);
17058
+ * }
17059
+ *
17060
+ * commands.registerCommand("sayHello", commandHandler);
17061
+ * ```
17035
17062
  *
17036
- * commands.registerCommand("sayHello", commandHandler);
17063
+ * @example Calling a custom command.
17037
17064
  *
17038
- * @example <caption>Calling a custom command.</caption>
17039
- * viewer.executeCommand("sayHello", "user");
17065
+ * ```javascript
17066
+ * viewer.executeCommand("sayHello", "user");
17067
+ * ```
17040
17068
  */
17041
17069
  const commands = commandsRegistry("visualizejs");
17042
17070
  // build-in commands
@@ -17448,36 +17476,36 @@
17448
17476
  *
17449
17477
  * 1. Define a component class implements {@link IComponent}.
17450
17478
  * 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.
17451
- * 3. Define the component logic in the event listeners. For example, listen for the `mousedown`
17452
- * event and select objects when the left mouse button is pressed.
17479
+ * 3. Define the component logic in the event listeners. For example, listen for the `mousedown` event and
17480
+ * select objects when the left mouse button is pressed.
17453
17481
  * 4. Override {@link IComponent.dispose} and remove mouse event listeners from the viewer.
17454
17482
  * 5. Register component provider in the components registry by calling the
17455
17483
  * {@link components.registerComponent}.
17456
17484
  *
17457
- * @example <caption>Implementing a custom component.</caption>
17458
- * import { IComponent, components, Viewer } from "@inweb/viewer-visualize";
17485
+ * @example Implementing a custom component.
17459
17486
  *
17460
- * class MyComponent implements IComponent {
17461
- * protected viewer: Viewer;
17487
+ * ```javascript
17488
+ * import { IComponent, components, Viewer } from "@inweb/viewer-visualize";
17462
17489
  *
17463
- * constructor(viewer: Viewer) {
17464
- * this.viewer = viewer;
17465
- * this.viewer.addEventListener("mousedown", this.onMouseDown);
17466
- * }
17490
+ * class MyComponent implements IComponent {
17491
+ * protected viewer: Viewer;
17467
17492
  *
17468
- * override dispose() {
17469
- * this.viewer.removeEventListener("mousedown", this.onMouseDown);
17470
- * }
17493
+ * constructor(viewer: Viewer) {
17494
+ * this.viewer = viewer;
17495
+ * this.viewer.addEventListener("mousedown", this.onMouseDown);
17496
+ * }
17471
17497
  *
17472
- * onMouseDown = (event: PointerEvent) => {
17473
- * // place custom logic here
17474
- * };
17498
+ * override dispose() {
17499
+ * this.viewer.removeEventListener("mousedown", this.onMouseDown);
17475
17500
  * }
17476
17501
  *
17477
- * components.registerComponent(
17478
- * "MyComponent",
17479
- * (viewer): IComponent => new MyComponent(viewer)
17480
- * );
17502
+ * onMouseDown = (event: PointerEvent) => {
17503
+ * // place custom logic here
17504
+ * };
17505
+ * }
17506
+ *
17507
+ * components.registerComponent( "MyComponent", (viewer): IComponent => new MyComponent(viewer));
17508
+ * ```
17481
17509
  */
17482
17510
  const components = componentsRegistry("visualizejs");
17483
17511
  // build-in components
@@ -18118,7 +18146,7 @@
18118
18146
  dispose() {
18119
18147
  var _a;
18120
18148
  super.dispose();
18121
- (_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
18149
+ (_a = this.textRef) === null || _a === undefined ? undefined : _a.remove();
18122
18150
  this.textRef = null;
18123
18151
  }
18124
18152
  _finishInput() {
@@ -18126,7 +18154,7 @@
18126
18154
  if (this.textRef && this.textRef.value.trimLeft()) {
18127
18155
  this._updateFrame();
18128
18156
  }
18129
- (_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
18157
+ (_a = this.textRef) === null || _a === undefined ? undefined : _a.remove();
18130
18158
  this.textRef = null;
18131
18159
  }
18132
18160
  start(x, y, absoluteX, absoluteY) {
@@ -18171,7 +18199,7 @@
18171
18199
  const projMtrx = view.projectionMatrix;
18172
18200
  const mtrxNumber = projMtrx.get(1, 1);
18173
18201
  const tol = 1.0e-6;
18174
- if (!(mtrxNumber < tol && mtrxNumber > -tol)) {
18202
+ if (!(mtrxNumber < tol && mtrxNumber > -1e-6)) {
18175
18203
  textScale = 1 / mtrxNumber;
18176
18204
  }
18177
18205
  const geomData = entityPtr.appendText(this.toGePoint(this.m_center), this.textRef.value.trimLeft());
@@ -18421,23 +18449,23 @@
18421
18449
  const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
18422
18450
  const isExist = (value) => value !== undefined && value !== null;
18423
18451
  /**
18424
- * 3D viewer powered by
18425
- * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS} library.
18452
+ * 3D viewer powered by {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS}
18453
+ * library.
18426
18454
  */
18427
18455
  class Viewer extends EventEmitter2 {
18428
18456
  /**
18429
- * @param client - The `Client` instance that is used to load model reference files from the
18430
- * Open Cloud Server. Do not specify `Client` if you need a standalone viewer instance to
18431
- * view `VSFX` files from the web or from local computer.
18457
+ * @param client - The `Client` instance that is used to load model reference files from the Open Cloud
18458
+ * Server. Do not specify `Client` if you need a standalone viewer instance to view `VSFX` files from
18459
+ * the web or from local computer.
18432
18460
  * @param params - An object containing viewer configuration parameters.
18433
- * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
18434
- * library instance, or specify `undefined` or blank to use the default URL defined by
18435
- * `Viewer.visualize` library you are using.
18436
- * @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If
18437
- * the auto-update is disabled, you need to register an `update` event handler and update
18438
- * the `VisualizeJS` viewer and active dragger manually. Default is `true`.
18439
- * @param params.markupType - The type of the markup core: `Visualize` (deprecated) or
18440
- * `Konva`. Default is `Konva`.
18461
+ * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own library
18462
+ * instance, or specify `undefined` or blank to use the default URL defined by `Viewer.visualize`
18463
+ * library you are using.
18464
+ * @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If the
18465
+ * auto-update is disabled, you need to register an `update` event handler and update the
18466
+ * `VisualizeJS` viewer and active dragger manually. Default is `true`.
18467
+ * @param params.markupType - The type of the markup core: `Visualize` (deprecated) or `Konva`. Default
18468
+ * is `Konva`.
18441
18469
  */
18442
18470
  constructor(client, params = {}) {
18443
18471
  var _a;
@@ -18451,7 +18479,7 @@
18451
18479
  this._renderTime = 0;
18452
18480
  this.canvasEvents = CANVAS_EVENTS.slice();
18453
18481
  this.canvaseventlistener = (event) => this.emit(event);
18454
- this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== void 0 ? _a : true;
18482
+ this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== undefined ? _a : true;
18455
18483
  this._isNeedRender = false;
18456
18484
  this._isRunAsyncUpdate = false;
18457
18485
  this.render = this.render.bind(this);
@@ -18484,9 +18512,9 @@
18484
18512
  * Changes the viewer parameters.
18485
18513
  *
18486
18514
  * @param params - An object containing new parameters.
18487
- * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
18488
- * library instance or specify `undefined` or blank to use the default URL defined by
18489
- * `Viewer.visualize` library you are using.
18515
+ * @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own library
18516
+ * instance or specify `undefined` or blank to use the default URL defined by `Viewer.visualize`
18517
+ * library you are using.
18490
18518
  */
18491
18519
  configure(params) {
18492
18520
  this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
@@ -18502,10 +18530,10 @@
18502
18530
  * - {@link InitializeProgressEvent | initializeprogress}
18503
18531
  *
18504
18532
  * @param canvas -
18505
- * {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement}
18506
- * for `VisualizeJS`.
18507
- * @param onProgress - A callback function that handles events measuring progress of loading
18508
- * of the `VisualizeJS` library.
18533
+ * {@link https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement | HTMLCanvasElement} for
18534
+ * `VisualizeJS`.
18535
+ * @param onProgress - A callback function that handles events measuring progress of loading of the
18536
+ * `VisualizeJS` library.
18509
18537
  */
18510
18538
  async initialize(canvas, onProgress) {
18511
18539
  this.addEventListener("optionschange", (event) => this.syncOptions(event.data));
@@ -18534,7 +18562,7 @@
18534
18562
  this.canvas = canvas;
18535
18563
  this.canvasEvents.forEach((x) => canvas.addEventListener(x, this.canvaseventlistener));
18536
18564
  this._markup.initialize(this.canvas, this.canvasEvents, this, this);
18537
- for (let name of components.getComponents().keys()) {
18565
+ for (const name of components.getComponents().keys()) {
18538
18566
  this._components.push(components.createComponent(name, this));
18539
18567
  }
18540
18568
  this.syncOpenCloudVisualStyle(true);
@@ -18579,7 +18607,7 @@
18579
18607
  const visViewer = this.visualizeJs.getViewer();
18580
18608
  if (visViewer.isRunningAnimation() || this._isNeedRender) {
18581
18609
  visViewer.update();
18582
- (_b = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
18610
+ (_b = (_a = this._activeDragger) === null || _a === undefined ? undefined : _a.updatePreview) === null || _b === undefined ? undefined : _b.call(_a);
18583
18611
  this._isNeedRender = !visViewer.getActiveDevice().isValid();
18584
18612
  const deltaTime = (time - this._renderTime) / 1000;
18585
18613
  this._renderTime = time;
@@ -18603,22 +18631,22 @@
18603
18631
  /**
18604
18632
  * Updates the viewer.
18605
18633
  *
18606
- * Do nothing if the auto-update mode is disabled in the constructor. In this case, register
18607
- * an `update` event handler and update the `Visualize` viewer and active dragger manually.
18634
+ * Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
18635
+ * `update` event handler and update the `Visualize` viewer and active dragger manually.
18608
18636
  *
18609
18637
  * Fires:
18610
18638
  *
18611
18639
  * - {@link UpdateEvent | update}
18612
18640
  *
18613
- * @param force - If `true` updates the viewer immidietly. Otherwise updates on next
18614
- * animation frame. Default is `false`.
18641
+ * @param force - If `true` updates the viewer immidietly. Otherwise updates on next animation frame.
18642
+ * Default is `false`.
18615
18643
  */
18616
18644
  update(force = false) {
18617
18645
  var _a, _b, _c;
18618
18646
  if (this._enableAutoUpdate) {
18619
18647
  if (force) {
18620
- (_a = this.visViewer()) === null || _a === void 0 ? void 0 : _a.update();
18621
- (_c = (_b = this._activeDragger) === null || _b === void 0 ? void 0 : _b.updatePreview) === null || _c === void 0 ? void 0 : _c.call(_b);
18648
+ (_a = this.visViewer()) === null || _a === undefined ? undefined : _a.update();
18649
+ (_c = (_b = this._activeDragger) === null || _b === undefined ? undefined : _b.updatePreview) === null || _c === undefined ? undefined : _c.call(_b);
18622
18650
  }
18623
18651
  else {
18624
18652
  this._isNeedRender = true;
@@ -18646,11 +18674,11 @@
18646
18674
  });
18647
18675
  }
18648
18676
  /**
18649
- * Updates the viewer asynchronously without locking the user interface. Used to update the
18650
- * viewer after changes that require a long rendering time.
18677
+ * Updates the viewer asynchronously without locking the user interface. Used to update the viewer
18678
+ * after changes that require a long rendering time.
18651
18679
  *
18652
- * Do nothing if the auto-update mode is disabled in the constructor. In this case, register
18653
- * an `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
18680
+ * Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
18681
+ * `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
18654
18682
  *
18655
18683
  * Fires:
18656
18684
  *
@@ -18676,26 +18704,26 @@
18676
18704
  }
18677
18705
  }
18678
18706
  /**
18679
- * Returns `VisualizeJS`
18680
- * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
18707
+ * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
18708
+ * instance.
18681
18709
  */
18682
18710
  get visualizeJs() {
18683
18711
  return this._visualizeJs;
18684
18712
  }
18685
18713
  /**
18686
- * Returns `VisualizeJS`
18687
- * {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module} instance.
18714
+ * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
18715
+ * instance.
18688
18716
  */
18689
18717
  visLib() {
18690
18718
  return this.visualizeJs;
18691
18719
  }
18692
18720
  /**
18693
- * Returns `VisualizeJS`
18694
- * {@link https://cloud.opendesign.com/docs/index.html#/vis/Viewer | Viewer} instance.
18721
+ * Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/vis/Viewer | Viewer}
18722
+ * instance.
18695
18723
  */
18696
18724
  visViewer() {
18697
18725
  var _a;
18698
- return (_a = this.visualizeJs) === null || _a === void 0 ? void 0 : _a.getViewer();
18726
+ return (_a = this.visualizeJs) === null || _a === undefined ? undefined : _a.getViewer();
18699
18727
  }
18700
18728
  // update the VisualizeJS options
18701
18729
  syncOpenCloudVisualStyle(isInitializing) {
@@ -18857,7 +18885,7 @@
18857
18885
  newDragger = draggers.createDragger(name, this);
18858
18886
  if (newDragger) {
18859
18887
  this._activeDragger = newDragger;
18860
- (_b = (_a = this._activeDragger).initialize) === null || _b === void 0 ? void 0 : _b.call(_a);
18888
+ (_b = (_a = this._activeDragger).initialize) === null || _b === undefined ? undefined : _b.call(_a);
18861
18889
  }
18862
18890
  }
18863
18891
  const canvas = this.canvas;
@@ -18956,13 +18984,13 @@
18956
18984
  const projMatrix = this.visViewer().activeView.projectionMatrix;
18957
18985
  const tolerance = 1.0e-6;
18958
18986
  const x = projMatrix.get(0, 0);
18959
- if (x > tolerance || x < -tolerance)
18987
+ if (x > tolerance || x < -1e-6)
18960
18988
  result.x = 1 / x;
18961
18989
  const y = projMatrix.get(1, 1);
18962
- if (y > tolerance || y < -tolerance)
18990
+ if (y > tolerance || y < -1e-6)
18963
18991
  result.y = 1 / y;
18964
18992
  const z = projMatrix.get(2, 2);
18965
- if (z > tolerance || z < -tolerance)
18993
+ if (z > tolerance || z < -1e-6)
18966
18994
  result.z = 1 / z;
18967
18995
  return result;
18968
18996
  }
@@ -18998,7 +19026,7 @@
18998
19026
  if (!this.client)
18999
19027
  return this;
19000
19028
  const abortController = new AbortController();
19001
- (_a = this._abortControllerForReferences) === null || _a === void 0 ? void 0 : _a.abort();
19029
+ (_a = this._abortControllerForReferences) === null || _a === undefined ? undefined : _a.abort();
19002
19030
  this._abortControllerForReferences = abortController;
19003
19031
  let references = [];
19004
19032
  await model
@@ -19008,7 +19036,7 @@
19008
19036
  for (const file of references) {
19009
19037
  await this.client
19010
19038
  .downloadFile(file.id, undefined, abortController.signal)
19011
- .then((arrayBuffer) => { var _a; return (_a = this.visualizeJs) === null || _a === void 0 ? void 0 : _a.getViewer().addEmbeddedFile(file.name, new Uint8Array(arrayBuffer)); })
19039
+ .then((arrayBuffer) => { var _a; return (_a = this.visualizeJs) === null || _a === undefined ? undefined : _a.getViewer().addEmbeddedFile(file.name, new Uint8Array(arrayBuffer)); })
19012
19040
  .catch((e) => console.error(`Cannot load reference file ${file.name}.`, e));
19013
19041
  }
19014
19042
  return this;
@@ -19036,15 +19064,15 @@
19036
19064
  *
19037
19065
  * The file geometry data on the server must be converted to `VSFX` format.
19038
19066
  *
19039
- * To open a large file, enable {@link IOptions.enablePartialMode | partial streaming} mode
19040
- * before opening (see example below).
19067
+ * To open a large file, enable {@link IOptions.enablePartialMode | partial streaming} mode before
19068
+ * opening (see example below).
19041
19069
  *
19042
- * This method requires a `Client` instance to be specified when creating the viewer to load
19043
- * model reference files from the Open Cloud Server. For a standalone viewer instance use
19070
+ * This method requires a `Client` instance to be specified when creating the viewer to load model
19071
+ * reference files from the Open Cloud Server. For a standalone viewer instance use
19044
19072
  * {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
19045
19073
  *
19046
- * If there was an active dragger before opening the file, it will be deactivated. After
19047
- * opening the file, you must manually activate the required dragger.
19074
+ * If there was an active dragger before opening the file, it will be deactivated. After opening the
19075
+ * file, you must manually activate the required dragger.
19048
19076
  *
19049
19077
  * Fires:
19050
19078
  *
@@ -19056,14 +19084,17 @@
19056
19084
  * - {@link GeometryEndEvent | geometryend}
19057
19085
  * - {@link GeometryErrorEvent | geometryerror}
19058
19086
  *
19059
- * @example <caption>Using partial streaming mode to open a large file from a server.</caption>
19060
- * viewer.options.enableStreamingMode = true;
19061
- * viewer.options.enablePartialMode = true;
19062
- * await viewer.open(file);
19087
+ * @example Using partial streaming mode to open a large file from a server.
19088
+ *
19089
+ * ```javascript
19090
+ * viewer.options.enableStreamingMode = true;
19091
+ * viewer.options.enablePartialMode = true;
19092
+ * await viewer.open(file);
19093
+ * ```
19063
19094
  *
19064
- * @param file - File, assembly or specific model to load. If a `File` instance with multiple
19065
- * models is specified, the default model will be loaded. If there is no default model,
19066
- * first availiable model will be loaded.
19095
+ * @param file - File, assembly or specific model to load. If a `File` instance with multiple models is
19096
+ * specified, the default model will be loaded. If there is no default model, first availiable model
19097
+ * will be loaded.
19067
19098
  */
19068
19099
  async open(file) {
19069
19100
  if (!this.visualizeJs)
@@ -19101,8 +19132,8 @@
19101
19132
  * This method does not support {@link IOptions.enableStreamingMode | streaming} or
19102
19133
  * {@link IOptions.enablePartialMode | partial streaming} mode.
19103
19134
  *
19104
- * If there was an active dragger before opening the file, it will be deactivated. After
19105
- * opening the file, you must manually activate the required dragger.
19135
+ * If there was an active dragger before opening the file, it will be deactivated. After opening the
19136
+ * file, you must manually activate the required dragger.
19106
19137
  *
19107
19138
  * Fires:
19108
19139
  *
@@ -19147,8 +19178,8 @@
19147
19178
  * This method does not support {@link IOptions.enableStreamingMode | streaming} or
19148
19179
  * {@link IOptions.enablePartialMode | partial streaming} mode.
19149
19180
  *
19150
- * If there was an active dragger before opening the file, it will be deactivated. After
19151
- * opening the file, you must manually activate the required dragger.
19181
+ * If there was an active dragger before opening the file, it will be deactivated. After opening the
19182
+ * file, you must manually activate the required dragger.
19152
19183
  *
19153
19184
  * Fires:
19154
19185
  *
@@ -19189,11 +19220,11 @@
19189
19220
  }
19190
19221
  cancel() {
19191
19222
  var _a, _b, _c;
19192
- (_a = this._abortControllerForReferences) === null || _a === void 0 ? void 0 : _a.abort();
19223
+ (_a = this._abortControllerForReferences) === null || _a === undefined ? undefined : _a.abort();
19193
19224
  this._abortControllerForReferences = undefined;
19194
- (_b = this._abortController) === null || _b === void 0 ? void 0 : _b.abort();
19225
+ (_b = this._abortController) === null || _b === undefined ? undefined : _b.abort();
19195
19226
  this._abortController = undefined;
19196
- (_c = this._abortControllerForRequestMap) === null || _c === void 0 ? void 0 : _c.forEach((controller) => controller.abort());
19227
+ (_c = this._abortControllerForRequestMap) === null || _c === undefined ? undefined : _c.forEach((controller) => controller.abort());
19197
19228
  this._abortControllerForRequestMap = undefined;
19198
19229
  this.emitEvent({ type: "cancel" });
19199
19230
  return this;
@@ -19266,7 +19297,7 @@
19266
19297
  var _a;
19267
19298
  if (!this.visualizeJs)
19268
19299
  return;
19269
- const draggerName = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.name;
19300
+ const draggerName = (_a = this._activeDragger) === null || _a === undefined ? undefined : _a.name;
19270
19301
  this.setActiveDragger();
19271
19302
  this.clearSlices();
19272
19303
  this.clearOverlay();
@@ -19308,6 +19339,7 @@
19308
19339
  up_vector: this.getPoint3dFromArray(activeView.upVector),
19309
19340
  field_width: activeView.viewFieldWidth,
19310
19341
  field_height: activeView.viewFieldHeight,
19342
+ view_to_world_scale: 1,
19311
19343
  };
19312
19344
  }
19313
19345
  setOrthogonalCameraSettings(settings) {
@@ -19348,11 +19380,11 @@
19348
19380
  return this.getSelected().map((handle) => ({ handle }));
19349
19381
  }
19350
19382
  setSelection(selection) {
19351
- this.setSelected(selection === null || selection === void 0 ? void 0 : selection.map((component) => component.handle));
19383
+ this.setSelected(selection === null || selection === undefined ? undefined : selection.map((component) => component.handle));
19352
19384
  }
19353
19385
  /**
19354
- * Executes the command denoted by the given command. If the command is not found, tries to
19355
- * set active dragger with the specified name.
19386
+ * Executes the command denoted by the given command. If the command is not found, tries to set active
19387
+ * dragger with the specified name.
19356
19388
  *
19357
19389
  * The following commands are available by default:
19358
19390
  *
@@ -19384,8 +19416,8 @@
19384
19416
  *
19385
19417
  * @param id - Command ID or dragger name.
19386
19418
  * @param args - Parameters passed to the command handler function.
19387
- * @returns Returns the result of the command handler function or new active dragger
19388
- * instance. Returns `undefined` if neither the command nor the dragger exists.
19419
+ * @returns Returns the result of the command handler function or new active dragger instance. Returns
19420
+ * `undefined` if neither the command nor the dragger exists.
19389
19421
  */
19390
19422
  executeCommand(id, ...args) {
19391
19423
  return commands.executeCommand(id, this, ...args);