@visactor/vrender 1.0.41-alpha.1 → 1.0.41-alpha.3

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/cjs/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@visactor/vrender-core';
2
- export declare const version = "1.0.41-alpha.1";
2
+ export declare const version = "1.0.41-alpha.3";
3
3
  export * from '@visactor/vrender-core';
4
4
  export * from '@visactor/vrender-kits';
5
5
  export * from '@visactor/vrender-animate';
package/cjs/index.js CHANGED
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", {
21
21
 
22
22
  const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits"), vrender_animate_1 = require("@visactor/vrender-animate");
23
23
 
24
- exports.version = "1.0.41-alpha.1", (0, vrender_core_1.preLoadAllModule)(), (0,
24
+ exports.version = "1.0.41-alpha.3", (0, vrender_core_1.preLoadAllModule)(), (0,
25
25
  vrender_core_1.isBrowserEnv)() ? (0, vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0,
26
26
  vrender_core_1.isNodeEnv)() && (0, vrender_kits_1.loadNodeEnv)(vrender_core_1.container),
27
27
  (0, vrender_kits_2.registerArc)(), (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,2BAAY,GAAE,CAAC;AAEf,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AAEtB,IAAA,uCAAqB,GAAE,CAAC;AACxB,IAAA,iCAAe,GAAE,CAAC;AAElB,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAG7C,6DAAkD;AAAzC,wGAAA,KAAK,OAAA;AACd,uDAAmD;AAA1C,yGAAA,SAAS,OAAA","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv, registerStar } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\nimport { registerCustomAnimate, registerAnimate } from '@visactor/vrender-animate';\n// 导出版本号\nexport const version = \"1.0.41-alpha.1\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\nregisterStar();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\n\nregisterCustomAnimate();\nregisterAnimate();\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction } from '@visactor/vrender-core';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,2BAAY,GAAE,CAAC;AAEf,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AAEtB,IAAA,uCAAqB,GAAE,CAAC;AACxB,IAAA,iCAAe,GAAE,CAAC;AAElB,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAG7C,6DAAkD;AAAzC,wGAAA,KAAK,OAAA;AACd,uDAAmD;AAA1C,yGAAA,SAAS,OAAA","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv, registerStar } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\nimport { registerCustomAnimate, registerAnimate } from '@visactor/vrender-animate';\n// 导出版本号\nexport const version = \"1.0.41-alpha.3\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\nregisterStar();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\n\nregisterCustomAnimate();\nregisterAnimate();\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction } from '@visactor/vrender-core';\n"]}
package/dist/index.es.js CHANGED
@@ -631,28 +631,59 @@ class EventListenerManager {
631
631
  }
632
632
  addEventListener(type, listener, options) {
633
633
  if (!listener) return;
634
+ const capture = this._resolveCapture(options),
635
+ once = this._resolveOnce(options),
636
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
637
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
638
+ if (wrappedMap.has(capture)) return;
634
639
  const wrappedListener = event => {
635
640
  const transformedEvent = this._eventListenerTransformer(event);
636
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
641
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
637
642
  };
638
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
643
+ wrappedMap.set(capture, {
644
+ wrappedListener: wrappedListener,
645
+ options: options
646
+ }), this._nativeAddEventListener(type, wrappedListener, options);
639
647
  }
640
648
  removeEventListener(type, listener, options) {
641
- var _a;
649
+ var _a, _b;
642
650
  if (!listener) return;
643
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
644
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
651
+ const capture = this._resolveCapture(options),
652
+ wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
653
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
645
654
  }
646
655
  dispatchEvent(event) {
647
656
  return this._nativeDispatchEvent(event);
648
657
  }
649
658
  clearAllEventListeners() {
650
- this._listenerMap.forEach((listenersMap, type) => {
651
- listenersMap.forEach((wrappedListener, originalListener) => {
652
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
659
+ this._listenerMap.forEach((listenerMap, type) => {
660
+ listenerMap.forEach(wrappedMap => {
661
+ wrappedMap.forEach((wrappedRecord, capture) => {
662
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
663
+ });
653
664
  });
654
665
  }), this._listenerMap.clear();
655
666
  }
667
+ _resolveCapture(options) {
668
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
669
+ }
670
+ _resolveOnce(options) {
671
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
672
+ }
673
+ _getOrCreateListenerTypeMap(type) {
674
+ let listenerTypeMap = this._listenerMap.get(type);
675
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
676
+ }
677
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
678
+ let wrappedMap = listenerTypeMap.get(listener);
679
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
680
+ }
681
+ _deleteListenerRecord(type, listener, capture) {
682
+ const listenerTypeMap = this._listenerMap.get(type);
683
+ if (!listenerTypeMap) return;
684
+ const wrappedMap = listenerTypeMap.get(listener);
685
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
686
+ }
656
687
  _nativeAddEventListener(type, listener, options) {
657
688
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
658
689
  }
@@ -7460,7 +7491,9 @@ class EventManager {
7460
7491
  var _a;
7461
7492
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
7462
7493
  const constructor = event.constructor;
7463
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7494
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
7495
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
7496
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7464
7497
  }
7465
7498
  notifyListeners(e, type) {
7466
7499
  const listeners = e.currentTarget._events[type];
@@ -10264,7 +10297,7 @@ class Graphic extends Node {
10264
10297
  });
10265
10298
  }
10266
10299
  release() {
10267
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
10300
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
10268
10301
  }
10269
10302
  _emitCustomEvent(type, context) {
10270
10303
  var _a, _b;
@@ -18263,12 +18296,12 @@ class Stage extends Group {
18263
18296
  throw new Error("暂不支持");
18264
18297
  }
18265
18298
  release() {
18266
- var _a, _b;
18299
+ var _a, _b, _d;
18267
18300
  super.release(), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(layer => {
18268
18301
  layer.release();
18269
18302
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
18270
18303
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
18271
- }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.renderService.renderTreeRoots = [];
18304
+ }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.params.ticker || null === (_d = this._ticker) || void 0 === _d || _d.release(), this.renderService.renderTreeRoots = [];
18272
18305
  }
18273
18306
  setStage(stage) {}
18274
18307
  dirty(b, matrix) {
@@ -31702,6 +31735,8 @@ class DefaultTicker extends EventEmitter {
31702
31735
  this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
31703
31736
  timeline.tick(delta);
31704
31737
  }), this.emit("tick", delta));
31738
+ }, this._handleGraphTick = () => {
31739
+ this.initHandler(!1);
31705
31740
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
31706
31741
  }
31707
31742
  bindStage(stage) {
@@ -31711,9 +31746,7 @@ class DefaultTicker extends EventEmitter {
31711
31746
  this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
31712
31747
  }
31713
31748
  init() {
31714
- this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
31715
- this.initHandler(!1);
31716
- }), application.global.env && this.initHandler(!1);
31749
+ this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
31717
31750
  }
31718
31751
  addTimeline(timeline) {
31719
31752
  this.timelines.push(timeline);
@@ -31789,7 +31822,7 @@ class DefaultTicker extends EventEmitter {
31789
31822
  }
31790
31823
  release() {
31791
31824
  var _a;
31792
- this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
31825
+ this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1, application.global.hooks.onSetEnv.unTap("graph-ticker", this._handleGraphTick);
31793
31826
  }
31794
31827
  checkSkip(delta) {
31795
31828
  var _a, _b, _c;
@@ -37695,7 +37728,7 @@ class ScrollBar extends AbstractComponent {
37695
37728
  this._sliderRenderBounds = null, this._sliderLimitRange = null;
37696
37729
  }
37697
37730
  release(all) {
37698
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
37731
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
37699
37732
  passive: !1
37700
37733
  }), this._clearDragEvents();
37701
37734
  }
@@ -45633,7 +45666,7 @@ class DataZoomInteraction extends EventEmitter {
45633
45666
  });
45634
45667
  }
45635
45668
  clearVGlobalEvents() {
45636
- ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
45669
+ ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
45637
45670
  passive: !1
45638
45671
  });
45639
45672
  }
@@ -49134,7 +49167,28 @@ class Slider extends AbstractComponent {
49134
49167
  return graphicCreator.symbol(style);
49135
49168
  }
49136
49169
  _renderHandlerText(value, position) {
49137
- var _a, _b, _c;
49170
+ return graphicCreator.text(this._getHandlerTextAttributes(value, position));
49171
+ }
49172
+ _getHandlerTextStyle(value, position) {
49173
+ const {
49174
+ align: align,
49175
+ handlerSize = 14,
49176
+ handlerText = {},
49177
+ railHeight: railHeight,
49178
+ railWidth: railWidth,
49179
+ slidable: slidable
49180
+ } = this.attribute;
49181
+ return isFunction$1(handlerText.style) ? handlerText.style(value, position, {
49182
+ layout: this.attribute.layout,
49183
+ align: align,
49184
+ railWidth: railWidth,
49185
+ railHeight: railHeight,
49186
+ handlerSize: handlerSize,
49187
+ slidable: slidable
49188
+ }) : handlerText.style;
49189
+ }
49190
+ _getHandlerTextAttributes(value, position) {
49191
+ var _a, _b;
49138
49192
  const {
49139
49193
  align: align,
49140
49194
  handlerSize = 14,
@@ -49146,13 +49200,13 @@ class Slider extends AbstractComponent {
49146
49200
  isHorizontal = this._isHorizontal,
49147
49201
  pos = this.calculatePosByValue(value, position),
49148
49202
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
49203
+ handlerTextStyle = this._getHandlerTextStyle(value, position),
49149
49204
  textStyle = {
49150
49205
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
49151
- lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
49206
+ lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
49152
49207
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
49153
49208
  };
49154
- isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos);
49155
- return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
49209
+ return isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos), Object.assign(Object.assign({}, textStyle), handlerTextStyle);
49156
49210
  }
49157
49211
  _renderTooltip() {
49158
49212
  var _a;
@@ -49280,31 +49334,19 @@ class Slider extends AbstractComponent {
49280
49334
  }
49281
49335
  }
49282
49336
  _updateHandler(handler, position, value) {
49283
- var _a;
49284
49337
  const isHorizontal = this._isHorizontal;
49285
49338
  handler.setAttribute(isHorizontal ? "x" : "y", position);
49286
49339
  const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
49287
49340
  if (updateHandlerText) {
49288
- const {
49289
- handlerText = {}
49290
- } = this.attribute;
49291
- updateHandlerText.setAttributes({
49292
- text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
49293
- [isHorizontal ? "x" : "y"]: position
49294
- });
49341
+ const handlerPosition = handler.name === SLIDER_ELEMENT_NAME.startHandler ? "start" : "end";
49342
+ updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49295
49343
  }
49296
49344
  handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
49297
49345
  }
49298
49346
  _updateHandlerText(handlerText, position, value) {
49299
- var _a;
49300
49347
  const isHorizontal = this._isHorizontal,
49301
- {
49302
- handlerText: handlerTextAttr = {}
49303
- } = this.attribute;
49304
- handlerText.setAttributes({
49305
- [isHorizontal ? "x" : "y"]: position,
49306
- text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
49307
- });
49348
+ handlerPosition = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? "start" : "end";
49349
+ handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49308
49350
  const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
49309
49351
  updateHandler && updateHandler.setAttributes({
49310
49352
  [isHorizontal ? "x" : "y"]: position
@@ -49340,7 +49382,7 @@ class Slider extends AbstractComponent {
49340
49382
  };
49341
49383
  }
49342
49384
  release(all) {
49343
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
49385
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
49344
49386
  passive: !1
49345
49387
  }), this._clearAllDragEvents();
49346
49388
  }
@@ -50478,6 +50520,9 @@ class BasePlayer extends AbstractComponent {
50478
50520
  value: this._data[dataIndex]
50479
50521
  });
50480
50522
  }
50523
+ release(all) {
50524
+ this._sliderVisible || this._slider.release(all), super.release(all);
50525
+ }
50481
50526
  }
50482
50527
  BasePlayer.defaultAttributes = {
50483
50528
  visible: !0,
@@ -53077,7 +53122,7 @@ TableSeriesNumber.defaultAttributes = {
53077
53122
  select: !0
53078
53123
  };
53079
53124
 
53080
- const version = "1.0.41-alpha.1";
53125
+ const version = "1.0.41-alpha.3";
53081
53126
  preLoadAllModule();
53082
53127
  if (isBrowserEnv()) {
53083
53128
  loadBrowserEnv(container);
package/dist/index.js CHANGED
@@ -637,28 +637,59 @@
637
637
  }
638
638
  addEventListener(type, listener, options) {
639
639
  if (!listener) return;
640
+ const capture = this._resolveCapture(options),
641
+ once = this._resolveOnce(options),
642
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
643
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
644
+ if (wrappedMap.has(capture)) return;
640
645
  const wrappedListener = event => {
641
646
  const transformedEvent = this._eventListenerTransformer(event);
642
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
647
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
643
648
  };
644
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
649
+ wrappedMap.set(capture, {
650
+ wrappedListener: wrappedListener,
651
+ options: options
652
+ }), this._nativeAddEventListener(type, wrappedListener, options);
645
653
  }
646
654
  removeEventListener(type, listener, options) {
647
- var _a;
655
+ var _a, _b;
648
656
  if (!listener) return;
649
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
650
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
657
+ const capture = this._resolveCapture(options),
658
+ wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
659
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
651
660
  }
652
661
  dispatchEvent(event) {
653
662
  return this._nativeDispatchEvent(event);
654
663
  }
655
664
  clearAllEventListeners() {
656
- this._listenerMap.forEach((listenersMap, type) => {
657
- listenersMap.forEach((wrappedListener, originalListener) => {
658
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
665
+ this._listenerMap.forEach((listenerMap, type) => {
666
+ listenerMap.forEach(wrappedMap => {
667
+ wrappedMap.forEach((wrappedRecord, capture) => {
668
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
669
+ });
659
670
  });
660
671
  }), this._listenerMap.clear();
661
672
  }
673
+ _resolveCapture(options) {
674
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
675
+ }
676
+ _resolveOnce(options) {
677
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
678
+ }
679
+ _getOrCreateListenerTypeMap(type) {
680
+ let listenerTypeMap = this._listenerMap.get(type);
681
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
682
+ }
683
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
684
+ let wrappedMap = listenerTypeMap.get(listener);
685
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
686
+ }
687
+ _deleteListenerRecord(type, listener, capture) {
688
+ const listenerTypeMap = this._listenerMap.get(type);
689
+ if (!listenerTypeMap) return;
690
+ const wrappedMap = listenerTypeMap.get(listener);
691
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
692
+ }
662
693
  _nativeAddEventListener(type, listener, options) {
663
694
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
664
695
  }
@@ -7466,7 +7497,9 @@
7466
7497
  var _a;
7467
7498
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
7468
7499
  const constructor = event.constructor;
7469
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7500
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
7501
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
7502
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7470
7503
  }
7471
7504
  notifyListeners(e, type) {
7472
7505
  const listeners = e.currentTarget._events[type];
@@ -10270,7 +10303,7 @@
10270
10303
  });
10271
10304
  }
10272
10305
  release() {
10273
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
10306
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
10274
10307
  }
10275
10308
  _emitCustomEvent(type, context) {
10276
10309
  var _a, _b;
@@ -18269,12 +18302,12 @@
18269
18302
  throw new Error("暂不支持");
18270
18303
  }
18271
18304
  release() {
18272
- var _a, _b;
18305
+ var _a, _b, _d;
18273
18306
  super.release(), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(layer => {
18274
18307
  layer.release();
18275
18308
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
18276
18309
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
18277
- }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.renderService.renderTreeRoots = [];
18310
+ }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.params.ticker || null === (_d = this._ticker) || void 0 === _d || _d.release(), this.renderService.renderTreeRoots = [];
18278
18311
  }
18279
18312
  setStage(stage) {}
18280
18313
  dirty(b, matrix) {
@@ -31708,6 +31741,8 @@
31708
31741
  this.status === exports.STATUS.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
31709
31742
  timeline.tick(delta);
31710
31743
  }), this.emit("tick", delta));
31744
+ }, this._handleGraphTick = () => {
31745
+ this.initHandler(!1);
31711
31746
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
31712
31747
  }
31713
31748
  bindStage(stage) {
@@ -31717,9 +31752,7 @@
31717
31752
  this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
31718
31753
  }
31719
31754
  init() {
31720
- this.interval = 16, this.status = exports.STATUS.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
31721
- this.initHandler(!1);
31722
- }), application.global.env && this.initHandler(!1);
31755
+ this.interval = 16, this.status = exports.STATUS.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
31723
31756
  }
31724
31757
  addTimeline(timeline) {
31725
31758
  this.timelines.push(timeline);
@@ -31795,7 +31828,7 @@
31795
31828
  }
31796
31829
  release() {
31797
31830
  var _a;
31798
- this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
31831
+ this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1, application.global.hooks.onSetEnv.unTap("graph-ticker", this._handleGraphTick);
31799
31832
  }
31800
31833
  checkSkip(delta) {
31801
31834
  var _a, _b, _c;
@@ -37701,7 +37734,7 @@
37701
37734
  this._sliderRenderBounds = null, this._sliderLimitRange = null;
37702
37735
  }
37703
37736
  release(all) {
37704
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
37737
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
37705
37738
  passive: !1
37706
37739
  }), this._clearDragEvents();
37707
37740
  }
@@ -45639,7 +45672,7 @@
45639
45672
  });
45640
45673
  }
45641
45674
  clearVGlobalEvents() {
45642
- ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
45675
+ ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
45643
45676
  passive: !1
45644
45677
  });
45645
45678
  }
@@ -49140,7 +49173,28 @@
49140
49173
  return graphicCreator.symbol(style);
49141
49174
  }
49142
49175
  _renderHandlerText(value, position) {
49143
- var _a, _b, _c;
49176
+ return graphicCreator.text(this._getHandlerTextAttributes(value, position));
49177
+ }
49178
+ _getHandlerTextStyle(value, position) {
49179
+ const {
49180
+ align: align,
49181
+ handlerSize = 14,
49182
+ handlerText = {},
49183
+ railHeight: railHeight,
49184
+ railWidth: railWidth,
49185
+ slidable: slidable
49186
+ } = this.attribute;
49187
+ return isFunction$1(handlerText.style) ? handlerText.style(value, position, {
49188
+ layout: this.attribute.layout,
49189
+ align: align,
49190
+ railWidth: railWidth,
49191
+ railHeight: railHeight,
49192
+ handlerSize: handlerSize,
49193
+ slidable: slidable
49194
+ }) : handlerText.style;
49195
+ }
49196
+ _getHandlerTextAttributes(value, position) {
49197
+ var _a, _b;
49144
49198
  const {
49145
49199
  align: align,
49146
49200
  handlerSize = 14,
@@ -49152,13 +49206,13 @@
49152
49206
  isHorizontal = this._isHorizontal,
49153
49207
  pos = this.calculatePosByValue(value, position),
49154
49208
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
49209
+ handlerTextStyle = this._getHandlerTextStyle(value, position),
49155
49210
  textStyle = {
49156
49211
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
49157
- lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
49212
+ lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
49158
49213
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
49159
49214
  };
49160
- isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos);
49161
- return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
49215
+ return isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos), Object.assign(Object.assign({}, textStyle), handlerTextStyle);
49162
49216
  }
49163
49217
  _renderTooltip() {
49164
49218
  var _a;
@@ -49286,31 +49340,19 @@
49286
49340
  }
49287
49341
  }
49288
49342
  _updateHandler(handler, position, value) {
49289
- var _a;
49290
49343
  const isHorizontal = this._isHorizontal;
49291
49344
  handler.setAttribute(isHorizontal ? "x" : "y", position);
49292
49345
  const updateHandlerText = handler.name === exports.SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
49293
49346
  if (updateHandlerText) {
49294
- const {
49295
- handlerText = {}
49296
- } = this.attribute;
49297
- updateHandlerText.setAttributes({
49298
- text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
49299
- [isHorizontal ? "x" : "y"]: position
49300
- });
49347
+ const handlerPosition = handler.name === exports.SLIDER_ELEMENT_NAME.startHandler ? "start" : "end";
49348
+ updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49301
49349
  }
49302
49350
  handler.name === exports.SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
49303
49351
  }
49304
49352
  _updateHandlerText(handlerText, position, value) {
49305
- var _a;
49306
49353
  const isHorizontal = this._isHorizontal,
49307
- {
49308
- handlerText: handlerTextAttr = {}
49309
- } = this.attribute;
49310
- handlerText.setAttributes({
49311
- [isHorizontal ? "x" : "y"]: position,
49312
- text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
49313
- });
49354
+ handlerPosition = handlerText.name === exports.SLIDER_ELEMENT_NAME.startHandlerText ? "start" : "end";
49355
+ handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49314
49356
  const updateHandler = handlerText.name === exports.SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
49315
49357
  updateHandler && updateHandler.setAttributes({
49316
49358
  [isHorizontal ? "x" : "y"]: position
@@ -49346,7 +49388,7 @@
49346
49388
  };
49347
49389
  }
49348
49390
  release(all) {
49349
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
49391
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
49350
49392
  passive: !1
49351
49393
  }), this._clearAllDragEvents();
49352
49394
  }
@@ -50484,6 +50526,9 @@
50484
50526
  value: this._data[dataIndex]
50485
50527
  });
50486
50528
  }
50529
+ release(all) {
50530
+ this._sliderVisible || this._slider.release(all), super.release(all);
50531
+ }
50487
50532
  }
50488
50533
  BasePlayer.defaultAttributes = {
50489
50534
  visible: !0,
@@ -53083,7 +53128,7 @@
53083
53128
  select: !0
53084
53129
  };
53085
53130
 
53086
- const version = "1.0.41-alpha.1";
53131
+ const version = "1.0.41-alpha.3";
53087
53132
  preLoadAllModule();
53088
53133
  if (isBrowserEnv()) {
53089
53134
  loadBrowserEnv(container);