@visactor/vrender 1.0.0-alpha.17 → 1.0.0-alpha.19

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.
package/dist/index.js CHANGED
@@ -492,11 +492,14 @@
492
492
  const ContributionProvider = Symbol("ContributionProvider");
493
493
  class ContributionProviderCache {
494
494
  constructor(serviceIdentifier, container) {
495
- this.serviceIdentifier = serviceIdentifier, this.container = container;
495
+ this.serviceIdentifier = serviceIdentifier, this.container = container, ContributionStore.setStore(this.serviceIdentifier, this);
496
496
  }
497
497
  getContributions() {
498
498
  return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
499
499
  }
500
+ refresh() {
501
+ this.caches && (this.caches.length = 0, this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier)));
502
+ }
500
503
  }
501
504
  function bindContributionProvider(bind, id) {
502
505
  bind(ContributionProvider).toDynamicValue(_ref => {
@@ -514,6 +517,20 @@
514
517
  return new ContributionProviderCache(id, container);
515
518
  }).whenTargetNamed(id);
516
519
  }
520
+ class ContributionStore {
521
+ static getStore(id) {
522
+ return this.store.get(id);
523
+ }
524
+ static setStore(id, cache) {
525
+ this.store.set(id, cache);
526
+ }
527
+ static refreshAllContributions() {
528
+ this.store.forEach(cache => {
529
+ cache.refresh();
530
+ });
531
+ }
532
+ }
533
+ ContributionStore.store = new Map();
517
534
 
518
535
  class Hook {
519
536
  constructor(args, name) {
@@ -595,10 +612,52 @@
595
612
  };
596
613
  }
597
614
  addAnimationFrameCb(callback) {
598
- return this.nextAnimationFrameCbs.push(callback), this.tryRunAnimationFrameNextFrame(), this.nextAnimationFrameCbs.length - 1;
615
+ return this.nextAnimationFrameCbs.push(callback), this.tryRunAnimationFrameNextFrame(), this.nextAnimationFrameCbs.length;
599
616
  }
600
617
  removeAnimationFrameCb(index) {
601
- return index >= 0 && index < this.nextAnimationFrameCbs.length && (this.nextAnimationFrameCbs[index] = null, !0);
618
+ return index > 0 && index <= this.nextAnimationFrameCbs.length && (this.nextAnimationFrameCbs[index - 1] = null, !0);
619
+ }
620
+ }
621
+
622
+ class EventListenerManager {
623
+ constructor() {
624
+ this._listenerMap = new Map(), this._eventListenerTransformer = event => event;
625
+ }
626
+ setEventListenerTransformer(transformer) {
627
+ this._eventListenerTransformer = transformer || (event => event);
628
+ }
629
+ addEventListener(type, listener, options) {
630
+ if (!listener) return;
631
+ const wrappedListener = event => {
632
+ const transformedEvent = this._eventListenerTransformer(event);
633
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
634
+ };
635
+ this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
636
+ }
637
+ removeEventListener(type, listener, options) {
638
+ var _a;
639
+ if (!listener) return;
640
+ const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
641
+ wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
642
+ }
643
+ dispatchEvent(event) {
644
+ return this._nativeDispatchEvent(event);
645
+ }
646
+ clearAllEventListeners() {
647
+ this._listenerMap.forEach((listenersMap, type) => {
648
+ listenersMap.forEach((wrappedListener, originalListener) => {
649
+ this._nativeRemoveEventListener(type, wrappedListener, void 0);
650
+ });
651
+ }), this._listenerMap.clear();
652
+ }
653
+ _nativeAddEventListener(type, listener, options) {
654
+ throw new Error("_nativeAddEventListener must be implemented by derived classes");
655
+ }
656
+ _nativeRemoveEventListener(type, listener, options) {
657
+ throw new Error("_nativeRemoveEventListener must be implemented by derived classes");
658
+ }
659
+ _nativeDispatchEvent(event) {
660
+ throw new Error("_nativeDispatchEvent must be implemented by derived classes");
602
661
  }
603
662
  }
604
663
 
@@ -642,7 +701,7 @@
642
701
  step((generator = generator.apply(thisArg, _arguments || [])).next());
643
702
  });
644
703
  };
645
- exports.DefaultGlobal = class DefaultGlobal {
704
+ exports.DefaultGlobal = class DefaultGlobal extends EventListenerManager {
646
705
  get env() {
647
706
  return this._env;
648
707
  }
@@ -686,10 +745,19 @@
686
745
  this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
687
746
  }
688
747
  constructor(contributions) {
689
- this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.id = Generator.GenAutoIncrementId(), this.hooks = {
748
+ super(), this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.eventListenerTransformer = event => event, this.id = Generator.GenAutoIncrementId(), this.hooks = {
690
749
  onSetEnv: new SyncHook(["lastEnv", "env", "global"])
691
750
  }, this.measureTextMethod = "native", this.optimizeVisible = !1;
692
751
  }
752
+ _nativeAddEventListener(type, listener, options) {
753
+ return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
754
+ }
755
+ _nativeRemoveEventListener(type, listener, options) {
756
+ return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
757
+ }
758
+ _nativeDispatchEvent(event) {
759
+ return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
760
+ }
693
761
  bindContribution(params) {
694
762
  const promiseArr = [];
695
763
  if (this.contributions.getContributions().forEach(contribution => {
@@ -730,15 +798,6 @@
730
798
  releaseCanvas(canvas) {
731
799
  return this._env || this.setEnv("browser"), this.envContribution.releaseCanvas(canvas);
732
800
  }
733
- addEventListener(type, listener, options) {
734
- return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
735
- }
736
- removeEventListener(type, listener, options) {
737
- return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
738
- }
739
- dispatchEvent(event) {
740
- return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
741
- }
742
801
  getRequestAnimationFrame() {
743
802
  return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
744
803
  }
@@ -1229,14 +1288,14 @@
1229
1288
  };
1230
1289
  var isArrayLike$1 = isArrayLike;
1231
1290
 
1232
- const isNumber = function (value) {
1291
+ const isNumber$1 = function (value) {
1233
1292
  let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1234
1293
  const type = typeof value;
1235
1294
  return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
1236
1295
  };
1237
- var isNumber$1 = isNumber;
1296
+ var isNumber$2 = isNumber$1;
1238
1297
 
1239
- const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
1298
+ const isValidNumber = value => isNumber$2(value) && Number.isFinite(value);
1240
1299
  var isValidNumber$1 = isValidNumber;
1241
1300
 
1242
1301
  const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
@@ -1377,7 +1436,7 @@
1377
1436
  }(LoggerLevel || (LoggerLevel = {}));
1378
1437
  class Logger {
1379
1438
  static getInstance(level, method) {
1380
- return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
1439
+ return Logger._instance && isNumber$2(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
1381
1440
  }
1382
1441
  static setInstance(logger) {
1383
1442
  return Logger._instance = logger;
@@ -1516,10 +1575,10 @@
1516
1575
  return this.x = x, this.y = y, this;
1517
1576
  }
1518
1577
  add(point) {
1519
- return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1578
+ return isNumber$2(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1520
1579
  }
1521
1580
  sub(point) {
1522
- return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1581
+ return isNumber$2(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1523
1582
  }
1524
1583
  multi(point) {
1525
1584
  throw new Error("暂不支持");
@@ -2577,10 +2636,10 @@
2577
2636
  return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
2578
2637
  }
2579
2638
  function rgb(value) {
2580
- return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2639
+ return isNumber$2(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2581
2640
  }
2582
2641
  function rgba(value) {
2583
- return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2642
+ return isNumber$2(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2584
2643
  }
2585
2644
  function SRGBToLinear(c) {
2586
2645
  return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
@@ -5363,6 +5422,9 @@
5363
5422
  function isNotAroundZero(val) {
5364
5423
  return val > EPSILON || val < -EPSILON;
5365
5424
  }
5425
+ function isNumber(data) {
5426
+ return "number" == typeof data && Number.isFinite(data);
5427
+ }
5366
5428
  const _v0 = [0, 0],
5367
5429
  _v1 = [0, 0],
5368
5430
  _v2 = [0, 0];
@@ -5767,7 +5829,7 @@
5767
5829
  };
5768
5830
  const VWindow = Symbol.for("VWindow");
5769
5831
  const WindowHandlerContribution = Symbol.for("WindowHandlerContribution");
5770
- exports.DefaultWindow = class DefaultWindow {
5832
+ exports.DefaultWindow = class DefaultWindow extends EventListenerManager {
5771
5833
  get width() {
5772
5834
  if (this._handler) {
5773
5835
  const wh = this._handler.getWH();
@@ -5786,7 +5848,7 @@
5786
5848
  return this._handler.getDpr();
5787
5849
  }
5788
5850
  constructor() {
5789
- this.hooks = {
5851
+ super(), this.hooks = {
5790
5852
  onChange: new SyncHook(["x", "y", "width", "height"])
5791
5853
  }, this.active = () => {
5792
5854
  const global = this.global;
@@ -5794,6 +5856,15 @@
5794
5856
  container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
5795
5857
  }, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
5796
5858
  }
5859
+ _nativeAddEventListener(type, listener, options) {
5860
+ return this._handler.addEventListener(type, listener, options);
5861
+ }
5862
+ _nativeRemoveEventListener(type, listener, options) {
5863
+ return this._handler.removeEventListener(type, listener, options);
5864
+ }
5865
+ _nativeDispatchEvent(event) {
5866
+ return this._handler.dispatchEvent(event);
5867
+ }
5797
5868
  postInit() {
5798
5869
  this.global.hooks.onSetEnv.tap("window", this.active), this.active();
5799
5870
  }
@@ -5833,7 +5904,7 @@
5833
5904
  throw new Error("暂不支持");
5834
5905
  }
5835
5906
  release() {
5836
- return this.global.hooks.onSetEnv.unTap("window", this.active), this._handler.releaseWindow();
5907
+ return this.global.hooks.onSetEnv.unTap("window", this.active), this.clearAllEventListeners(), this._handler.releaseWindow();
5837
5908
  }
5838
5909
  getContext() {
5839
5910
  return this._handler.getContext();
@@ -5844,15 +5915,6 @@
5844
5915
  getImageBuffer(type) {
5845
5916
  return this._handler.getImageBuffer ? this._handler.getImageBuffer(type) : null;
5846
5917
  }
5847
- addEventListener(type, listener, options) {
5848
- return this._handler.addEventListener(type, listener, options);
5849
- }
5850
- removeEventListener(type, listener, options) {
5851
- return this._handler.removeEventListener(type, listener, options);
5852
- }
5853
- dispatchEvent(event) {
5854
- return this._handler.dispatchEvent(event);
5855
- }
5856
5918
  getBoundingClientRect() {
5857
5919
  return this._handler.getBoundingClientRect();
5858
5920
  }
@@ -7061,19 +7123,17 @@
7061
7123
  globalObj: globalObj,
7062
7124
  domElement: domElement
7063
7125
  } = this;
7064
- this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.getDocument().addEventListener("pointermove", this.onPointerMove, !0), globalObj.getDocument().addEventListener("pointerup", this.onPointerUp, !0)) : (domElement.addEventListener("pointermove", this.onPointerMove, !0), domElement.addEventListener("pointerup", this.onPointerUp, !0)), domElement.addEventListener("pointerdown", this.onPointerDown, !0), domElement.addEventListener("pointerleave", this.onPointerOverOut, !0), domElement.addEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.getDocument().addEventListener("mousemove", this.onPointerMove, !0), globalObj.getDocument().addEventListener("mouseup", this.onPointerUp, !0)) : (domElement.addEventListener("mousemove", this.onPointerMove, !0), domElement.addEventListener("mouseup", this.onPointerUp, !0)), domElement.addEventListener("mousedown", this.onPointerDown, !0), domElement.addEventListener("mouseout", this.onPointerOverOut, !0), domElement.addEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.addEventListener("touchstart", this.onPointerDown, !0), domElement.addEventListener("touchend", this.onPointerUp, !0), domElement.addEventListener("touchmove", this.onPointerMove, !0)), domElement.addEventListener("wheel", this.onWheel, {
7126
+ this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.addEventListener("pointermove", this.onPointerMove, !0), globalObj.addEventListener("pointerup", this.onPointerUp, !0)) : (domElement.addEventListener("pointermove", this.onPointerMove, !0), domElement.addEventListener("pointerup", this.onPointerUp, !0)), domElement.addEventListener("pointerdown", this.onPointerDown, !0), domElement.addEventListener("pointerleave", this.onPointerOverOut, !0), domElement.addEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.addEventListener("mousemove", this.onPointerMove, !0), globalObj.addEventListener("mouseup", this.onPointerUp, !0)) : (domElement.addEventListener("mousemove", this.onPointerMove, !0), domElement.addEventListener("mouseup", this.onPointerUp, !0)), domElement.addEventListener("mousedown", this.onPointerDown, !0), domElement.addEventListener("mouseout", this.onPointerOverOut, !0), domElement.addEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.addEventListener("touchstart", this.onPointerDown, !0), domElement.addEventListener("touchend", this.onPointerUp, !0), domElement.addEventListener("touchmove", this.onPointerMove, !0)), domElement.addEventListener("wheel", this.onWheel, {
7065
7127
  capture: !0
7066
7128
  }), this.eventsAdded = !0;
7067
7129
  }
7068
7130
  removeEvents() {
7069
- var _a;
7070
7131
  if (!this.eventsAdded || !this.domElement) return;
7071
7132
  const {
7072
- globalObj: globalObj,
7073
- domElement: domElement
7074
- } = this,
7075
- globalDocument = null !== (_a = globalObj.getDocument()) && void 0 !== _a ? _a : domElement;
7076
- this.supportsPointerEvents ? (globalDocument.removeEventListener("pointermove", this.onPointerMove, !0), globalDocument.removeEventListener("pointerup", this.onPointerUp, !0), domElement.removeEventListener("pointerdown", this.onPointerDown, !0), domElement.removeEventListener("pointerleave", this.onPointerOverOut, !0), domElement.removeEventListener("pointerover", this.onPointerOverOut, !0)) : (globalDocument.removeEventListener("mousemove", this.onPointerMove, !0), globalDocument.removeEventListener("mouseup", this.onPointerUp, !0), domElement.removeEventListener("mousedown", this.onPointerDown, !0), domElement.removeEventListener("mouseout", this.onPointerOverOut, !0), domElement.removeEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.removeEventListener("touchstart", this.onPointerDown, !0), domElement.removeEventListener("touchend", this.onPointerUp, !0), domElement.removeEventListener("touchmove", this.onPointerMove, !0)), domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this.eventsAdded = !1;
7133
+ globalObj: globalObj,
7134
+ domElement: domElement
7135
+ } = this;
7136
+ this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.removeEventListener("pointermove", this.onPointerMove, !0), globalObj.removeEventListener("pointerup", this.onPointerUp, !0)) : (domElement.removeEventListener("pointermove", this.onPointerMove, !0), domElement.removeEventListener("pointerup", this.onPointerUp, !0)), domElement.removeEventListener("pointerdown", this.onPointerDown, !0), domElement.removeEventListener("pointerleave", this.onPointerOverOut, !0), domElement.removeEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.removeEventListener("mousemove", this.onPointerMove, !0), globalObj.removeEventListener("mouseup", this.onPointerUp, !0)) : (domElement.removeEventListener("mousemove", this.onPointerMove, !0), domElement.removeEventListener("mouseup", this.onPointerUp, !0)), domElement.removeEventListener("mousedown", this.onPointerDown, !0), domElement.removeEventListener("mouseout", this.onPointerOverOut, !0), domElement.removeEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.removeEventListener("touchstart", this.onPointerDown, !0), domElement.removeEventListener("touchend", this.onPointerUp, !0), domElement.removeEventListener("touchmove", this.onPointerMove, !0)), domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this.eventsAdded = !1;
7077
7137
  }
7078
7138
  mapToViewportPoint(event) {
7079
7139
  return this.domElement.pointTransform ? this.domElement.pointTransform(event.x, event.y) : event;
@@ -7390,13 +7450,13 @@
7390
7450
 
7391
7451
  class BaseSymbol {
7392
7452
  bounds(size, bounds) {
7393
- if (isNumber$1(size)) {
7453
+ if (isNumber$2(size)) {
7394
7454
  const halfS = size / 2;
7395
7455
  bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
7396
7456
  } else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
7397
7457
  }
7398
7458
  parseSize(size) {
7399
- return isNumber$1(size) ? size : Math.min(size[0], size[1]);
7459
+ return isNumber$2(size) ? size : Math.min(size[0], size[1]);
7400
7460
  }
7401
7461
  }
7402
7462
 
@@ -7815,10 +7875,10 @@
7815
7875
  super(...arguments), this.type = "rect", this.pathStr = "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z";
7816
7876
  }
7817
7877
  draw(ctx, size, x, y) {
7818
- return isNumber$1(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
7878
+ return isNumber$2(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
7819
7879
  }
7820
7880
  drawWithClipRange(ctx, size, x, y, clipRange, z, cb) {
7821
- isNumber$1(size) && (size = [size, size / 2]);
7881
+ isNumber$2(size) && (size = [size, size / 2]);
7822
7882
  const drawLength = 2 * (size[0] + size[1]) * clipRange,
7823
7883
  points = [{
7824
7884
  x: x + size[0] / 2,
@@ -7850,7 +7910,7 @@
7850
7910
  return !1;
7851
7911
  }
7852
7912
  drawOffset(ctx, size, x, y, offset) {
7853
- return isNumber$1(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
7913
+ return isNumber$2(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
7854
7914
  }
7855
7915
  }
7856
7916
  var rect = new RectSymbol();
@@ -7870,7 +7930,7 @@
7870
7930
  return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
7871
7931
  }
7872
7932
  parseSize(size) {
7873
- return isNumber$1(size) ? size : Math.min(size[0], size[1]);
7933
+ return isNumber$2(size) ? size : Math.min(size[0], size[1]);
7874
7934
  }
7875
7935
  drawWithClipRange(ctx, size, x, y, clipRange, z, cb) {
7876
7936
  return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
@@ -8839,10 +8899,10 @@
8839
8899
 
8840
8900
  function colorArrayToString(color) {
8841
8901
  let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
8842
- return Array.isArray(color) && isNumber$1(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
8902
+ return Array.isArray(color) && isNumber$2(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
8843
8903
  }
8844
8904
  function interpolateColor(from, to, ratio, alphaChannel, cb) {
8845
- if (Array.isArray(from) && !isNumber$1(from[0]) || Array.isArray(to) && !isNumber$1(to[0])) {
8905
+ if (Array.isArray(from) && !isNumber$2(from[0]) || Array.isArray(to) && !isNumber$2(to[0])) {
8846
8906
  return new Array(4).fill(0).map((_, index) => {
8847
8907
  var _a, _b;
8848
8908
  return _interpolateColor(isArray$1(from) ? null !== (_a = from[index]) && void 0 !== _a ? _a : from[0] : from, isArray$1(to) ? null !== (_b = to[index]) && void 0 !== _b ? _b : to[0] : to, ratio, alphaChannel);
@@ -10523,12 +10583,12 @@
10523
10583
  textBaseline: textBaseline
10524
10584
  } = attribute;
10525
10585
  if (null != attribute.forceBoundsHeight) {
10526
- const h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
10586
+ const h = isNumber$2(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
10527
10587
  dy = textLayoutOffsetY(textBaseline, h, h);
10528
10588
  aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
10529
10589
  }
10530
10590
  if (null != attribute.forceBoundsWidth) {
10531
- const w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
10591
+ const w = isNumber$2(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
10532
10592
  dx = textDrawOffsetX(textAlign, w);
10533
10593
  aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
10534
10594
  }
@@ -12650,7 +12710,7 @@
12650
12710
  }
12651
12711
  } else {
12652
12712
  const richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
12653
- if (isNumber$1(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
12713
+ if (isNumber$2(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
12654
12714
  const textParts = richTextConfig.text.split("\n");
12655
12715
  for (let j = 0; j < textParts.length; j++) if (0 === j) paragraphs.push(new Paragraph(textParts[j], !1, richTextConfig, ascentDescentMode));else if (textParts[j] || i === textConfig.length - 1) paragraphs.push(new Paragraph(textParts[j], !0, richTextConfig, ascentDescentMode));else {
12656
12716
  const nextRichTextConfig = this.combinedStyleToCharacter(textConfig[i + 1]);
@@ -12939,7 +12999,7 @@
12939
12999
  } = this.attribute;
12940
13000
  if (outerRadius += outerPadding, innerRadius -= innerPadding, 0 === cornerRadius || "0%" === cornerRadius) return 0;
12941
13001
  const deltaRadius = Math.abs(outerRadius - innerRadius),
12942
- parseCR = cornerRadius => Math.min(isNumber$1(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
13002
+ parseCR = cornerRadius => Math.min(isNumber$2(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
12943
13003
  if (isArray$1(cornerRadius)) {
12944
13004
  const crList = cornerRadius.map(cr => parseCR(cr) || 0);
12945
13005
  return 0 === crList.length ? [crList[0], crList[0], crList[0], crList[0]] : 2 === crList.length ? [crList[0], crList[1], crList[0], crList[1]] : (3 === crList.length && crList.push(0), crList);
@@ -13943,7 +14003,7 @@
13943
14003
  let roundCorner = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
13944
14004
  let edgeCb = arguments.length > 7 ? arguments[7] : undefined;
13945
14005
  let cornerRadius;
13946
- if (Array.isArray(roundCorner) && (edgeCb = roundCorner, roundCorner = !0), width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$1(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
14006
+ if (Array.isArray(roundCorner) && (edgeCb = roundCorner, roundCorner = !0), width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$2(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
13947
14007
  const cornerRadiusArr = rectCornerRadius;
13948
14008
  let cr0, cr1;
13949
14009
  switch (cornerRadiusArr.length) {
@@ -14219,6 +14279,9 @@
14219
14279
  init(contributions) {
14220
14280
  contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions || (this.builtinContributions = []), this.builtinContributions.push(defaultBaseClipRenderBeforeContribution), this.builtinContributions.push(defaultBaseClipRenderAfterContribution), this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === exports.BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === exports.BaseRenderContributionTime.afterFillStroke));
14221
14281
  }
14282
+ reInit() {
14283
+ this.init(this.graphicRenderContributions);
14284
+ }
14222
14285
  beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
14223
14286
  this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
14224
14287
  if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
@@ -14388,8 +14451,8 @@
14388
14451
  };
14389
14452
  };
14390
14453
  exports.DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
14391
- constructor(arcRenderContribitions) {
14392
- super(), this.arcRenderContribitions = arcRenderContribitions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(arcRenderContribitions);
14454
+ constructor(graphicRenderContributions) {
14455
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(graphicRenderContributions);
14393
14456
  }
14394
14457
  drawArcTailCapPath(arc, context, cx, cy, outerRadius, innerRadius, _sa, _ea) {
14395
14458
  const capAngle = _ea - _sa,
@@ -14560,8 +14623,8 @@
14560
14623
  };
14561
14624
  };
14562
14625
  exports.DefaultCanvasCircleRender = class DefaultCanvasCircleRender extends BaseRender {
14563
- constructor(circleRenderContribitions) {
14564
- super(), this.circleRenderContribitions = circleRenderContribitions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(circleRenderContribitions);
14626
+ constructor(graphicRenderContributions) {
14627
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
14565
14628
  }
14566
14629
  drawShape(circle, context, x, y, drawContext, params, fillCb, strokeCb) {
14567
14630
  const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle,
@@ -14947,8 +15010,8 @@
14947
15010
  };
14948
15011
  };
14949
15012
  exports.DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
14950
- constructor(areaRenderContribitions) {
14951
- super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
15013
+ constructor(graphicRenderContributions) {
15014
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(graphicRenderContributions);
14952
15015
  }
14953
15016
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
14954
15017
  var _a, _b, _c;
@@ -15191,8 +15254,8 @@
15191
15254
  };
15192
15255
  };
15193
15256
  exports.DefaultCanvasPathRender = class DefaultCanvasPathRender extends BaseRender {
15194
- constructor(pathRenderContribitions) {
15195
- super(), this.pathRenderContribitions = pathRenderContribitions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(pathRenderContribitions);
15257
+ constructor(graphicRenderContributions) {
15258
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(graphicRenderContributions);
15196
15259
  }
15197
15260
  drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
15198
15261
  var _a, _b, _c;
@@ -15247,8 +15310,8 @@
15247
15310
  };
15248
15311
  };
15249
15312
  exports.DefaultCanvasRectRender = class DefaultCanvasRectRender extends BaseRender {
15250
- constructor(rectRenderContribitions) {
15251
- super(), this.rectRenderContribitions = rectRenderContribitions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(rectRenderContribitions);
15313
+ constructor(graphicRenderContributions) {
15314
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(graphicRenderContributions);
15252
15315
  }
15253
15316
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb, rectAttribute) {
15254
15317
  rectAttribute = null != rectAttribute ? rectAttribute : getTheme(rect, null == params ? void 0 : params.theme).rect;
@@ -15317,8 +15380,8 @@
15317
15380
  };
15318
15381
  };
15319
15382
  exports.DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRender {
15320
- constructor(symbolRenderContribitions) {
15321
- super(), this.symbolRenderContribitions = symbolRenderContribitions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(symbolRenderContribitions);
15383
+ constructor(graphicRenderContributions) {
15384
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
15322
15385
  }
15323
15386
  drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb, symbolAttribute) {
15324
15387
  var _a;
@@ -15488,8 +15551,8 @@
15488
15551
  };
15489
15552
  };
15490
15553
  exports.DefaultCanvasTextRender = class DefaultCanvasTextRender extends BaseRender {
15491
- constructor(textRenderContribitions) {
15492
- super(), this.textRenderContribitions = textRenderContribitions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(textRenderContribitions);
15554
+ constructor(graphicRenderContributions) {
15555
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(graphicRenderContributions);
15493
15556
  }
15494
15557
  drawShape(text, context, x, y, drawContext, params, fillCb, strokeCb) {
15495
15558
  var _a, _b, _c;
@@ -15634,8 +15697,10 @@
15634
15697
  exports.AbstractGraphicRender = __decorate$1v([injectable()], exports.AbstractGraphicRender);
15635
15698
 
15636
15699
  function drawPolygon(path, points, x, y) {
15637
- path.moveTo(points[0].x + x, points[0].y + y);
15638
- for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
15700
+ if (points && points.length) {
15701
+ path.moveTo(points[0].x + x, points[0].y + y);
15702
+ for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
15703
+ }
15639
15704
  }
15640
15705
  function drawRoundedPolygon(path, points, x, y, cornerRadius) {
15641
15706
  let closePath = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !0;
@@ -15703,8 +15768,8 @@
15703
15768
  };
15704
15769
  };
15705
15770
  exports.DefaultCanvasPolygonRender = class DefaultCanvasPolygonRender extends BaseRender {
15706
- constructor(polygonRenderContribitions) {
15707
- super(), this.polygonRenderContribitions = polygonRenderContribitions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(polygonRenderContribitions);
15771
+ constructor(graphicRenderContributions) {
15772
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
15708
15773
  }
15709
15774
  drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
15710
15775
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
@@ -15759,6 +15824,9 @@
15759
15824
  constructor(groupRenderContribitions) {
15760
15825
  this.groupRenderContribitions = groupRenderContribitions, this.numberType = GROUP_NUMBER_TYPE;
15761
15826
  }
15827
+ reInit() {
15828
+ this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [], this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);
15829
+ }
15762
15830
  drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb, groupAttribute) {
15763
15831
  const {
15764
15832
  clip: clip,
@@ -15901,8 +15969,8 @@
15901
15969
  };
15902
15970
  const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
15903
15971
  exports.DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender {
15904
- constructor(imageRenderContribitions) {
15905
- super(), this.imageRenderContribitions = imageRenderContribitions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(imageRenderContribitions);
15972
+ constructor(graphicRenderContributions) {
15973
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
15906
15974
  }
15907
15975
  drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
15908
15976
  const imageAttribute = getTheme(image).image,
@@ -16233,6 +16301,9 @@
16233
16301
  afterDraw(params) {
16234
16302
  this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
16235
16303
  }
16304
+ reInit() {
16305
+ this.drawContribution.reInit();
16306
+ }
16236
16307
  render(groups, params) {
16237
16308
  this.renderTreeRoots = groups, this.drawParams = params;
16238
16309
  const updateBounds = params.updateBounds;
@@ -16643,6 +16714,11 @@
16643
16714
  }, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
16644
16715
  }, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, isArray$1(this.contributions) || (this.contributions = [this.contributions]), this.init();
16645
16716
  }
16717
+ reInit() {
16718
+ this.init(), this.contributions.forEach(item => {
16719
+ item.reInit();
16720
+ });
16721
+ }
16646
16722
  init() {
16647
16723
  this.contributions.forEach(item => {
16648
16724
  if (item.style) {
@@ -17786,6 +17862,9 @@
17786
17862
  getPickerService() {
17787
17863
  return this.pickerService || (this.pickerService = container.get(PickerService)), this.pickerService;
17788
17864
  }
17865
+ reInit() {
17866
+ this.renderService.reInit(), this.pickerService.reInit();
17867
+ }
17789
17868
  }
17790
17869
 
17791
17870
  function createStage(params) {
@@ -18064,6 +18143,9 @@
18064
18143
  constructor(pickItemInterceptorContributions, pickServiceInterceptorContributions) {
18065
18144
  this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions, this.type = "default", this.global = application.global;
18066
18145
  }
18146
+ reInit() {
18147
+ this._init();
18148
+ }
18067
18149
  _init() {
18068
18150
  this.InterceptorContributions = this.pickItemInterceptorContributions.getContributions().sort((a, b) => a.order - b.order), this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions.getContributions().sort((a, b) => a.order - b.order);
18069
18151
  }
@@ -18178,6 +18260,7 @@
18178
18260
  this.configure(global, env);
18179
18261
  }), this.configure(this.global, this.global.env);
18180
18262
  }
18263
+ reInit() {}
18181
18264
  configure(global, env) {}
18182
18265
  pick(graphics, point, params) {
18183
18266
  let result = {
@@ -18562,7 +18645,7 @@
18562
18645
  return res;
18563
18646
  };
18564
18647
  const samplingPoints = (points, count) => {
18565
- const validatePoints = points.filter(point => !1 !== point.defined && isNumber$1(point.x) && isNumber$1(point.y));
18648
+ const validatePoints = points.filter(point => !1 !== point.defined && isNumber$2(point.x) && isNumber$2(point.y));
18566
18649
  if (0 === validatePoints.length) return [];
18567
18650
  if (1 === validatePoints.length) return new Array(count).fill(0).map(i => validatePoints[0]);
18568
18651
  const res = [];
@@ -18598,7 +18681,7 @@
18598
18681
  var _a;
18599
18682
  return res.concat(null !== (_a = seg.points) && void 0 !== _a ? _a : []);
18600
18683
  }, []));
18601
- const validatePoints = points.filter(point => !1 !== point.defined && isNumber$1(point.x) && isNumber$1(point.y));
18684
+ const validatePoints = points.filter(point => !1 !== point.defined && isNumber$2(point.x) && isNumber$2(point.y));
18602
18685
  if (!validatePoints.length) return [];
18603
18686
  const allPoints = [];
18604
18687
  validatePoints.forEach(point => {
@@ -18762,6 +18845,80 @@
18762
18845
  return res;
18763
18846
  };
18764
18847
 
18848
+ function isIdentityMatrix(matrix) {
18849
+ return 1 === matrix.a && 0 === matrix.b && 0 === matrix.c && 1 === matrix.d && 0 === matrix.e && 0 === matrix.f;
18850
+ }
18851
+ function createEventTransformer(containerElement, getMatrix, getRect, transformPoint) {
18852
+ return event => {
18853
+ if (!(event instanceof MouseEvent || event instanceof TouchEvent || event instanceof PointerEvent)) return event;
18854
+ const transformMatrix = getMatrix();
18855
+ if (isIdentityMatrix(transformMatrix)) return event;
18856
+ const containerRect = getRect(),
18857
+ transformedEvent = new event.constructor(event.type, event);
18858
+ if (Object.defineProperties(transformedEvent, {
18859
+ target: {
18860
+ value: event.target
18861
+ },
18862
+ currentTarget: {
18863
+ value: event.currentTarget
18864
+ }
18865
+ }), event instanceof MouseEvent || event instanceof PointerEvent) transformPoint(event.clientX, event.clientY, transformMatrix, containerRect, transformedEvent);else if (event instanceof TouchEvent) {
18866
+ if (event.touches.length > 0) {
18867
+ const touch = transformedEvent.touches[0];
18868
+ transformPoint(touch.clientX, touch.clientY, transformMatrix, containerRect, touch);
18869
+ }
18870
+ if (event.changedTouches.length > 0) {
18871
+ const touch = transformedEvent.changedTouches[0];
18872
+ transformPoint(touch.clientX, touch.clientY, transformMatrix, containerRect, touch);
18873
+ }
18874
+ }
18875
+ return transformedEvent;
18876
+ };
18877
+ }
18878
+ function createCanvasEventTransformer(canvasElement, getMatrix, getRect, transformPoint) {
18879
+ return createEventTransformer(canvasElement.parentElement || canvasElement, getMatrix, getRect, transformPoint);
18880
+ }
18881
+ function registerWindowEventTransformer(window, container, getMatrix, getRect, transformPoint) {
18882
+ const transformer = createEventTransformer(container, getMatrix, getRect, transformPoint);
18883
+ window.setEventListenerTransformer(transformer);
18884
+ }
18885
+ function registerGlobalEventTransformer(global, container, getMatrix, getRect, transformPoint) {
18886
+ const transformer = createEventTransformer(container, getMatrix, getRect, transformPoint);
18887
+ global.setEventListenerTransformer(transformer);
18888
+ }
18889
+ function transformPointForCanvas(clientX, clientY, matrix, rect, transformedEvent) {
18890
+ const transformedPoint = {
18891
+ x: clientX,
18892
+ y: clientY
18893
+ };
18894
+ matrix.transformPoint(transformedPoint, transformedPoint), Object.defineProperties(transformedEvent, {
18895
+ _canvasX: {
18896
+ value: transformedPoint.x
18897
+ },
18898
+ _canvasY: {
18899
+ value: transformedPoint.y
18900
+ }
18901
+ });
18902
+ }
18903
+ function mapToCanvasPointForCanvas(nativeEvent) {
18904
+ var _a;
18905
+ if (isNumber(nativeEvent._canvasX) && isNumber(nativeEvent._canvasY)) return {
18906
+ x: nativeEvent._canvasX,
18907
+ y: nativeEvent._canvasY
18908
+ };
18909
+ if (nativeEvent.changedTouches) {
18910
+ const data = null !== (_a = nativeEvent.changedTouches[0]) && void 0 !== _a ? _a : {};
18911
+ return {
18912
+ x: data._canvasX,
18913
+ y: data._canvasY
18914
+ };
18915
+ }
18916
+ return {
18917
+ x: nativeEvent._canvasX || 0,
18918
+ y: nativeEvent._canvasY || 0
18919
+ };
18920
+ }
18921
+
18765
18922
  var __rest$1 = undefined && undefined.__rest || function (s, e) {
18766
18923
  var t = {};
18767
18924
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
@@ -19974,6 +20131,7 @@
19974
20131
  constructor() {
19975
20132
  this.numberType = GLYPH_NUMBER_TYPE;
19976
20133
  }
20134
+ reInit() {}
19977
20135
  drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
19978
20136
  drawContext.drawContribution && glyph.getSubGraphic().forEach(item => {
19979
20137
  const renderer = drawContext.drawContribution.getRenderContribution(item);
@@ -22979,6 +23137,10 @@
22979
23137
  };
22980
23138
  this.canvasRenderer.drawShape(graphic, roughContext, 0, 0, drawContext, params, () => (doRender(), !1), () => (doRender(), !1)), context.restore();
22981
23139
  }
23140
+ reInit() {
23141
+ var _a;
23142
+ null === (_a = this.canvasRenderer) || void 0 === _a || _a.reInit();
23143
+ }
22982
23144
  }
22983
23145
 
22984
23146
  var __decorate$18 = undefined && undefined.__decorate || function (decorators, target, key, desc) {
@@ -25591,7 +25753,7 @@
25591
25753
  x += point.x, y += point.y, pickContext.setTransformForCurrent();
25592
25754
  } else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
25593
25755
  let picked = !0;
25594
- if (!onlyTranslate || rect.shadowRoot || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
25756
+ if (!onlyTranslate || rect.shadowRoot || isNumber$2(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
25595
25757
  if (picked) return !0;
25596
25758
  const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
25597
25759
  pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
@@ -32406,6 +32568,9 @@
32406
32568
  isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
32407
32569
  }
32408
32570
  onUpdate(end, ratio, out) {
32571
+ if (end) return Object.keys(this.to).forEach(k => {
32572
+ this.target.attribute[k] = this.to[k];
32573
+ }), this.target.addUpdatePositionTag(), void this.target.addUpdateShapeAndBoundsTag();
32409
32574
  if (this.points = this.points.map((point, index) => {
32410
32575
  const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
32411
32576
  return newPoint.context = point.context, newPoint;
@@ -32585,7 +32750,7 @@
32585
32750
  growAngleInOverall = (graphic, options, animationParameters) => {
32586
32751
  const attrs = graphic.getFinalAttribute();
32587
32752
  if (options && "anticlockwise" === options.orient) {
32588
- const overallValue = isNumber$1(options.overall) ? options.overall : 2 * Math.PI;
32753
+ const overallValue = isNumber$2(options.overall) ? options.overall : 2 * Math.PI;
32589
32754
  return {
32590
32755
  from: {
32591
32756
  startAngle: overallValue,
@@ -32597,7 +32762,7 @@
32597
32762
  }
32598
32763
  };
32599
32764
  }
32600
- const overallValue = isNumber$1(null == options ? void 0 : options.overall) ? options.overall : 0;
32765
+ const overallValue = isNumber$2(null == options ? void 0 : options.overall) ? options.overall : 0;
32601
32766
  return {
32602
32767
  from: {
32603
32768
  startAngle: overallValue,
@@ -32634,7 +32799,7 @@
32634
32799
  growAngleOutOverall = (graphic, options, animationParameters) => {
32635
32800
  const attrs = graphic.attribute;
32636
32801
  if (options && "anticlockwise" === options.orient) {
32637
- const overallValue = isNumber$1(options.overall) ? options.overall : 2 * Math.PI;
32802
+ const overallValue = isNumber$2(options.overall) ? options.overall : 2 * Math.PI;
32638
32803
  return {
32639
32804
  from: {
32640
32805
  startAngle: attrs.startAngle,
@@ -32646,7 +32811,7 @@
32646
32811
  }
32647
32812
  };
32648
32813
  }
32649
- const overallValue = isNumber$1(null == options ? void 0 : options.overall) ? options.overall : 0;
32814
+ const overallValue = isNumber$2(null == options ? void 0 : options.overall) ? options.overall : 0;
32650
32815
  return {
32651
32816
  from: {
32652
32817
  startAngle: attrs.startAngle,
@@ -32922,7 +33087,7 @@
32922
33087
  y1 = attrs.y1,
32923
33088
  height = attrs.height;
32924
33089
  let overallValue;
32925
- return options && "negative" === options.orient ? isNumber$1(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_c = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : null === (_b = options.layoutRect) || void 0 === _b ? void 0 : _b.height) && void 0 !== _c ? _c : animationParameters.group.getBounds().height(), animationParameters.groupHeight = overallValue) : overallValue = animationParameters.height : overallValue = isNumber$1(null == options ? void 0 : options.overall) ? options.overall : 0, {
33090
+ return options && "negative" === options.orient ? isNumber$2(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_c = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : null === (_b = options.layoutRect) || void 0 === _b ? void 0 : _b.height) && void 0 !== _c ? _c : animationParameters.group.getBounds().height(), animationParameters.groupHeight = overallValue) : overallValue = animationParameters.height : overallValue = isNumber$2(null == options ? void 0 : options.overall) ? options.overall : 0, {
32926
33091
  from: {
32927
33092
  y: overallValue,
32928
33093
  y1: isNil$1(y1) ? void 0 : overallValue,
@@ -32995,7 +33160,7 @@
32995
33160
  y1 = attrs.y1,
32996
33161
  height = attrs.height;
32997
33162
  let overallValue;
32998
- return options && "negative" === options.orient ? isNumber$1(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_c = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : null === (_b = options.layoutRect) || void 0 === _b ? void 0 : _b.height) && void 0 !== _c ? _c : animationParameters.group.getBounds().height(), animationParameters.groupHeight = overallValue) : overallValue = animationParameters.height : overallValue = isNumber$1(null == options ? void 0 : options.overall) ? options.overall : 0, {
33163
+ return options && "negative" === options.orient ? isNumber$2(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_c = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : null === (_b = options.layoutRect) || void 0 === _b ? void 0 : _b.height) && void 0 !== _c ? _c : animationParameters.group.getBounds().height(), animationParameters.groupHeight = overallValue) : overallValue = animationParameters.height : overallValue = isNumber$2(null == options ? void 0 : options.overall) ? options.overall : 0, {
32999
33164
  to: {
33000
33165
  y: overallValue,
33001
33166
  y1: isNil$1(y1) ? void 0 : overallValue,
@@ -33241,7 +33406,7 @@
33241
33406
  },
33242
33407
  growRadiusInOverall = (graphic, options, animationParameters) => {
33243
33408
  const attrs = graphic.getFinalAttribute(),
33244
- overallValue = isNumber$1(null == options ? void 0 : options.overall) ? options.overall : 0;
33409
+ overallValue = isNumber$2(null == options ? void 0 : options.overall) ? options.overall : 0;
33245
33410
  return {
33246
33411
  from: {
33247
33412
  innerRadius: overallValue,
@@ -33277,7 +33442,7 @@
33277
33442
  },
33278
33443
  growRadiusOutOverall = (graphic, options, animationParameters) => {
33279
33444
  const attrs = graphic.getFinalAttribute(),
33280
- overallValue = isNumber$1(null == options ? void 0 : options.overall) ? options.overall : 0;
33445
+ overallValue = isNumber$2(null == options ? void 0 : options.overall) ? options.overall : 0;
33281
33446
  return {
33282
33447
  from: {
33283
33448
  innerRadius: null == attrs ? void 0 : attrs.innerRadius,
@@ -33366,7 +33531,7 @@
33366
33531
  x1 = attrs.x1,
33367
33532
  width = attrs.width;
33368
33533
  let overallValue;
33369
- return options && "negative" === options.orient ? isNumber$1(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(), animationParameters.groupWidth = overallValue) : overallValue = animationParameters.width : overallValue = isNumber$1(null == options ? void 0 : options.overall) ? null == options ? void 0 : options.overall : 0, {
33534
+ return options && "negative" === options.orient ? isNumber$2(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(), animationParameters.groupWidth = overallValue) : overallValue = animationParameters.width : overallValue = isNumber$2(null == options ? void 0 : options.overall) ? null == options ? void 0 : options.overall : 0, {
33370
33535
  from: {
33371
33536
  x: overallValue,
33372
33537
  x1: isNil$1(x1) ? void 0 : overallValue,
@@ -33413,7 +33578,7 @@
33413
33578
  x1 = attrs.x1,
33414
33579
  width = attrs.width;
33415
33580
  let overallValue;
33416
- return options && "negative" === options.orient ? isNumber$1(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(), animationParameters.groupWidth = overallValue) : overallValue = animationParameters.width : overallValue = isNumber$1(null == options ? void 0 : options.overall) ? options.overall : 0, {
33581
+ return options && "negative" === options.orient ? isNumber$2(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(), animationParameters.groupWidth = overallValue) : overallValue = animationParameters.width : overallValue = isNumber$2(null == options ? void 0 : options.overall) ? options.overall : 0, {
33417
33582
  to: {
33418
33583
  x: overallValue,
33419
33584
  x1: isNil$1(x1) ? void 0 : overallValue,
@@ -35222,7 +35387,7 @@
35222
35387
  AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
35223
35388
  };
35224
35389
 
35225
- const version = "1.0.0-alpha.17";
35390
+ const version = "1.0.0-alpha.19";
35226
35391
  preLoadAllModule();
35227
35392
  if (isBrowserEnv()) {
35228
35393
  loadBrowserEnv(container);
@@ -35325,6 +35490,7 @@
35325
35490
  exports.ContainerModule = ContainerModule;
35326
35491
  exports.Context2dFactory = Context2dFactory;
35327
35492
  exports.ContributionProvider = ContributionProvider;
35493
+ exports.ContributionStore = ContributionStore;
35328
35494
  exports.CubicBezierCurve = CubicBezierCurve;
35329
35495
  exports.CurveContext = CurveContext;
35330
35496
  exports.CustomEvent = CustomEvent;
@@ -35655,10 +35821,12 @@
35655
35821
  exports.createArc = createArc;
35656
35822
  exports.createArc3d = createArc3d;
35657
35823
  exports.createArea = createArea;
35824
+ exports.createCanvasEventTransformer = createCanvasEventTransformer;
35658
35825
  exports.createCircle = createCircle;
35659
35826
  exports.createColor = createColor;
35660
35827
  exports.createComponentAnimator = createComponentAnimator;
35661
35828
  exports.createConicalGradient = createConicalGradient;
35829
+ exports.createEventTransformer = createEventTransformer;
35662
35830
  exports.createGifImage = createGifImage;
35663
35831
  exports.createGlyph = createGlyph;
35664
35832
  exports.createGroup = createGroup;
@@ -35818,6 +35986,7 @@
35818
35986
  exports.lottieCanvasPickModule = lottieCanvasPickModule;
35819
35987
  exports.lottieModule = lottieModule;
35820
35988
  exports.lynxEnvModule = lynxEnvModule;
35989
+ exports.mapToCanvasPointForCanvas = mapToCanvasPointForCanvas;
35821
35990
  exports.mat3Tomat4 = mat3Tomat4;
35822
35991
  exports.mat4Allocate = mat4Allocate;
35823
35992
  exports.matrixAllocate = matrixAllocate;
@@ -35879,6 +36048,7 @@
35879
36048
  exports.registerFlexLayoutPlugin = registerFlexLayoutPlugin;
35880
36049
  exports.registerGifGraphic = registerGifGraphic;
35881
36050
  exports.registerGifImage = registerGifImage;
36051
+ exports.registerGlobalEventTransformer = registerGlobalEventTransformer;
35882
36052
  exports.registerGlyph = registerGlyph;
35883
36053
  exports.registerGlyphGraphic = registerGlyphGraphic;
35884
36054
  exports.registerGroup = registerGroup;
@@ -35911,6 +36081,7 @@
35911
36081
  exports.registerText = registerText;
35912
36082
  exports.registerTextGraphic = registerTextGraphic;
35913
36083
  exports.registerViewTransform3dPlugin = registerViewTransform3dPlugin;
36084
+ exports.registerWindowEventTransformer = registerWindowEventTransformer;
35914
36085
  exports.registerWrapText = registerWrapText;
35915
36086
  exports.registerWrapTextGraphic = registerWrapTextGraphic;
35916
36087
  exports.renderCommandList = renderCommandList;
@@ -35960,6 +36131,7 @@
35960
36131
  exports.textMathPickModule = textMathPickModule;
35961
36132
  exports.textModule = textModule;
35962
36133
  exports.transformMat4 = transformMat4;
36134
+ exports.transformPointForCanvas = transformPointForCanvas;
35963
36135
  exports.transformUtil = transformUtil;
35964
36136
  exports.transitionRegistry = transitionRegistry;
35965
36137
  exports.translate = translate;