@visactor/vchart 2.0.13-alpha.4 → 2.0.13-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +24 -85
  3. package/build/index.js +24 -85
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/compile/compiler.d.ts +0 -1
  7. package/cjs/compile/compiler.js +0 -3
  8. package/cjs/compile/compiler.js.map +1 -1
  9. package/cjs/compile/interface/compilable-item.d.ts +1 -2
  10. package/cjs/compile/interface/compilable-item.js.map +1 -1
  11. package/cjs/component/brush/brush.d.ts +1 -6
  12. package/cjs/component/brush/brush.js +18 -40
  13. package/cjs/component/brush/brush.js.map +1 -1
  14. package/cjs/component/brush/interface.d.ts +1 -3
  15. package/cjs/component/brush/interface.js.map +1 -1
  16. package/cjs/component/crosshair/interface/spec.d.ts +0 -1
  17. package/cjs/component/crosshair/interface/spec.js.map +1 -1
  18. package/cjs/component/tooltip/utils/show-tooltip.js +2 -10
  19. package/cjs/component/tooltip/utils/show-tooltip.js.map +1 -1
  20. package/cjs/core/interface.d.ts +1 -6
  21. package/cjs/core/interface.js.map +1 -1
  22. package/cjs/core/vchart.js.map +1 -1
  23. package/cjs/event/event.js +1 -1
  24. package/cjs/event/event.js.map +1 -1
  25. package/cjs/event/events/dimension/dimension-hover.d.ts +0 -2
  26. package/cjs/event/events/dimension/dimension-hover.js +3 -6
  27. package/cjs/event/events/dimension/dimension-hover.js.map +1 -1
  28. package/esm/compile/compiler.d.ts +0 -1
  29. package/esm/compile/compiler.js +0 -3
  30. package/esm/compile/compiler.js.map +1 -1
  31. package/esm/compile/interface/compilable-item.d.ts +1 -2
  32. package/esm/compile/interface/compilable-item.js.map +1 -1
  33. package/esm/component/brush/brush.d.ts +1 -6
  34. package/esm/component/brush/brush.js +17 -41
  35. package/esm/component/brush/brush.js.map +1 -1
  36. package/esm/component/brush/interface.d.ts +1 -3
  37. package/esm/component/brush/interface.js.map +1 -1
  38. package/esm/component/crosshair/interface/spec.d.ts +0 -1
  39. package/esm/component/crosshair/interface/spec.js.map +1 -1
  40. package/esm/component/tooltip/utils/show-tooltip.js +2 -10
  41. package/esm/component/tooltip/utils/show-tooltip.js.map +1 -1
  42. package/esm/core/interface.d.ts +1 -6
  43. package/esm/core/interface.js.map +1 -1
  44. package/esm/core/vchart.js.map +1 -1
  45. package/esm/event/event.js +1 -1
  46. package/esm/event/event.js.map +1 -1
  47. package/esm/event/events/dimension/dimension-hover.d.ts +0 -2
  48. package/esm/event/events/dimension/dimension-hover.js +2 -7
  49. package/esm/event/events/dimension/dimension-hover.js.map +1 -1
  50. package/package.json +9 -9
package/build/index.es.js CHANGED
@@ -51096,8 +51096,6 @@ loadBrushComponent();
51096
51096
  let Brush$1 = class Brush extends AbstractComponent {
51097
51097
  constructor(attributes, options) {
51098
51098
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeBrushState = !1, this._activeDrawState = !1, this._cacheDrawPoints = [], this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0, this._operatingMaskMoveRangeX = [-1 / 0, 1 / 0], this._operatingMaskMoveRangeY = [-1 / 0, 1 / 0], this._brushMaskAABBBoundsDict = {}, this._firstUpdate = !0, this._onBrushStart = e => {
51099
- if (!1 === this.attribute.interactive) return;
51100
- if (!1 === this._beforeBrushEvent(e)) return;
51101
51099
  const {
51102
51100
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
51103
51101
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -51105,11 +51103,11 @@ let Brush$1 = class Brush extends AbstractComponent {
51105
51103
  } = this.attribute;
51106
51104
  array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd)), e.stopPropagation(), this._firstUpdate = !0, this._activeMoveState = brushMoved && this._isPosInBrushMask(e), this._activeDrawState = !this._activeMoveState, this._startPos = this.eventPosToStagePos(e), this._cacheDrawPoints = [this._startPos];
51107
51105
  }, this._onBrushing = e => {
51108
- !1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e))));
51106
+ this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e)));
51109
51107
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
51110
- !1 !== this.attribute.interactive && (this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1);
51108
+ this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1;
51111
51109
  }, this._onBrushClear = e => {
51112
- !1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1);
51110
+ e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1;
51113
51111
  };
51114
51112
  }
51115
51113
  _bindBrushEvents() {
@@ -51121,7 +51119,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51121
51119
  array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart)), array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
51122
51120
  }
51123
51121
  _initDraw(e) {
51124
- if (!1 === this.attribute.interactive) return;
51125
51122
  const {
51126
51123
  brushMode: brushMode
51127
51124
  } = this.attribute,
@@ -51130,7 +51127,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51130
51127
  }
51131
51128
  _initMove(e) {
51132
51129
  var _a, _b;
51133
- if (!1 === this.attribute.interactive) return;
51134
51130
  this._cacheMovePoint = this.eventPosToStagePos(e), this._operatingMaskMoveDx = null !== (_a = this._operatingMask.attribute.dx) && void 0 !== _a ? _a : 0, this._operatingMaskMoveDy = null !== (_b = this._operatingMask.attribute.dy) && void 0 !== _b ? _b : 0;
51135
51131
  const {
51136
51132
  interactiveRange: interactiveRange
@@ -51155,7 +51151,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51155
51151
  }
51156
51152
  _drawing(e) {
51157
51153
  var _a;
51158
- if (!1 === this.attribute.interactive) return;
51159
51154
  const pos = this.eventPosToStagePos(e),
51160
51155
  {
51161
51156
  brushType: brushType,
@@ -51180,7 +51175,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51180
51175
  (Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold) && (1 !== Object.keys(this._brushMaskAABBBoundsDict).length || this._activeBrushState ? this._dispatchBrushEvent(IOperateType.drawing, e) : (this._activeBrushState = !0, this._dispatchBrushEvent(IOperateType.brushActive, e)));
51181
51176
  }
51182
51177
  _moving(e) {
51183
- if (!1 === this.attribute.interactive) return;
51184
51178
  const startPos = this._cacheMovePoint,
51185
51179
  pos = this.eventPosToStagePos(e);
51186
51180
  if (pos.x === (null == startPos ? void 0 : startPos.x) && pos.y === (null == startPos ? void 0 : startPos.y)) return;
@@ -51194,7 +51188,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51194
51188
  }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchBrushEvent(IOperateType.moving, e);
51195
51189
  }
51196
51190
  _drawEnd(e) {
51197
- if (!1 === this.attribute.interactive) return;
51198
51191
  const {
51199
51192
  removeOnClick = !0,
51200
51193
  sizeThreshold = DEFAULT_SIZE_THRESHOLD
@@ -51212,7 +51205,7 @@ let Brush$1 = class Brush extends AbstractComponent {
51212
51205
  }
51213
51206
  }
51214
51207
  _moveEnd(e) {
51215
- !1 !== this.attribute.interactive && (this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e));
51208
+ this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e);
51216
51209
  }
51217
51210
  render() {
51218
51211
  this._bindBrushEvents();
@@ -51319,10 +51312,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51319
51312
  pos = this.eventPosToStagePos(e);
51320
51313
  return pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY;
51321
51314
  }
51322
- _beforeBrushEvent(e) {
51323
- var _a, _b;
51324
- return null === (_b = (_a = this.attribute).beforeBrushChange) || void 0 === _b ? void 0 : _b.call(_a, e);
51325
- }
51326
51315
  _dispatchBrushEvent(operateType, e) {
51327
51316
  this._dispatchEvent(operateType, {
51328
51317
  operateMask: this._operatingMask,
@@ -53868,7 +53857,7 @@ let Event$1 = class Event {
53868
53857
  if (ComposedEventCtor) {
53869
53858
  const composedEvent = new ComposedEventCtor(this._eventDispatcher, this._mode);
53870
53859
  composedEvent.register(eType, handler);
53871
- this._composedEventMap.set(handler.callback, {
53860
+ this._composedEventMap.set(callback, {
53872
53861
  eventType: eType,
53873
53862
  event: composedEvent
53874
53863
  });
@@ -54905,9 +54894,6 @@ class Compiler {
54905
54894
  getRootGroup() {
54906
54895
  return this._rootGroup;
54907
54896
  }
54908
- getOption() {
54909
- return this._option;
54910
- }
54911
54897
  constructor(container, option) {
54912
54898
  this._count = 0;
54913
54899
  this._rootMarks = [];
@@ -60528,7 +60514,7 @@ class VChart {
60528
60514
  this._compiler.updateLayoutTag();
60529
60515
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
60530
60516
  this._initDataSet(this._option.dataSet);
60531
- this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
60517
+ this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
60532
60518
  this._bindResizeEvent();
60533
60519
  this._bindViewEvent();
60534
60520
  this._initChartPlugin();
@@ -61181,7 +61167,7 @@ class VChart {
61181
61167
  resize = true;
61182
61168
  }
61183
61169
  const lasAutoSize = this._autoSize;
61184
- this._autoSize = isTrueBrowser(this._option.mode) ? ((_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true) : false;
61170
+ this._autoSize = isTrueBrowser(this._option.mode) ? (_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true : false;
61185
61171
  if (this._autoSize !== lasAutoSize) {
61186
61172
  resize = true;
61187
61173
  }
@@ -64442,7 +64428,7 @@ class DimensionHoverEvent extends DimensionEvent {
64442
64428
  super(...arguments);
64443
64429
  this._cacheDimensionInfo = null;
64444
64430
  this.onMouseMove = (params) => {
64445
- if (!params || DimensionHoverEvent._disableDimensionEvent) {
64431
+ if (!params) {
64446
64432
  return;
64447
64433
  }
64448
64434
  const x = params.event.viewX;
@@ -64464,16 +64450,13 @@ class DimensionHoverEvent extends DimensionEvent {
64464
64450
  }
64465
64451
  };
64466
64452
  this.onMouseOut = (params) => {
64467
- if (!params || DimensionHoverEvent._disableDimensionEvent) {
64453
+ if (!params) {
64468
64454
  return;
64469
64455
  }
64470
64456
  this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
64471
64457
  this._cacheDimensionInfo = null;
64472
64458
  };
64473
64459
  }
64474
- static disableDimensionEvent(value) {
64475
- this._disableDimensionEvent = value;
64476
- }
64477
64460
  register(eType, handler) {
64478
64461
  this._callback = handler.callback;
64479
64462
  this._eventDispatcher.register('pointermove', {
@@ -64504,7 +64487,6 @@ class DimensionHoverEvent extends DimensionEvent {
64504
64487
  }
64505
64488
  }
64506
64489
  }
64507
- DimensionHoverEvent._disableDimensionEvent = false;
64508
64490
 
64509
64491
  var DimensionEventEnum;
64510
64492
  (function (DimensionEventEnum) {
@@ -95677,15 +95659,11 @@ function showTooltip(datum, options, component) {
95677
95659
  });
95678
95660
  return originDatum;
95679
95661
  };
95680
- const transform = region.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse();
95681
95662
  const getMockEvent = (originPos) => {
95682
95663
  var _a, _b;
95683
95664
  const pos = bound(originPos);
95684
- const tempX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95685
- const tempY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95686
- const canvasPoint = { x: 0, y: 0 };
95687
- transform.transformPoint({ x: tempX, y: tempY }, canvasPoint);
95688
- const { x: canvasX, y: canvasY } = canvasPoint;
95665
+ const canvasX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95666
+ const canvasY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95689
95667
  return {
95690
95668
  canvasX,
95691
95669
  canvasY,
@@ -103218,9 +103196,6 @@ class Brush extends BaseComponent {
103218
103196
  this._initMarkBrushState(componentIndex, '');
103219
103197
  brushComponent.children[0].removeAllChild();
103220
103198
  }
103221
- _shouldEnableInteractive() {
103222
- return this.getOption().getCompiler().getOption().interactive !== false;
103223
- }
103224
103199
  _createBrushComponent(region, componentIndex) {
103225
103200
  var _a, _b;
103226
103201
  const interactiveAttr = this._getBrushInteractiveAttr(region);
@@ -103231,43 +103206,33 @@ class Brush extends BaseComponent {
103231
103206
  this._cacheInteractiveRangeAttrs.push(interactiveAttr);
103232
103207
  brush.addEventListener(IOperateType.brushActive, (e) => {
103233
103208
  this._initMarkBrushState(componentIndex, OUT_BRUSH_STATE);
103234
- this._emitEvent(ChartEvent.brushActive, region, e);
103209
+ this._emitEvent(ChartEvent.brushActive, region);
103235
103210
  });
103236
103211
  brush.addEventListener(IOperateType.drawStart, (e) => {
103237
- if (this._spec.disableDimensionHoverWhenBrushing) {
103238
- this.disableDimensionHover();
103239
- }
103240
103212
  this._setRegionMarkPickable(region, true);
103241
- this._emitEvent(ChartEvent.brushStart, region, e);
103213
+ this._emitEvent(ChartEvent.brushStart, region);
103242
103214
  });
103243
103215
  brush.addEventListener(IOperateType.moveStart, (e) => {
103244
- if (this._spec.disableDimensionHoverWhenBrushing) {
103245
- this.disableDimensionHover();
103246
- }
103247
103216
  this._setRegionMarkPickable(region, true);
103248
- this._emitEvent(ChartEvent.brushStart, region, e);
103217
+ this._emitEvent(ChartEvent.brushStart, region);
103249
103218
  });
103250
103219
  brush.addEventListener(IOperateType.drawing, (e) => {
103251
103220
  this._setRegionMarkPickable(region, false);
103252
103221
  this._handleBrushChange(region, e);
103253
- this._emitEvent(ChartEvent.brushChange, region, e);
103222
+ this._emitEvent(ChartEvent.brushChange, region);
103254
103223
  });
103255
103224
  brush.addEventListener(IOperateType.moving, (e) => {
103256
103225
  this._setRegionMarkPickable(region, false);
103257
103226
  this._handleBrushChange(region, e);
103258
- this._emitEvent(ChartEvent.brushChange, region, e);
103227
+ this._emitEvent(ChartEvent.brushChange, region);
103259
103228
  });
103260
103229
  brush.addEventListener(IOperateType.brushClear, (e) => {
103261
- if (this._spec.disableDimensionHoverWhenBrushing) {
103262
- this.enableDimensionHover();
103263
- }
103264
103230
  this._setRegionMarkPickable(region, true);
103265
103231
  this._initMarkBrushState(componentIndex, '');
103266
- this._emitEvent(ChartEvent.brushClear, region, e);
103232
+ this._emitEvent(ChartEvent.brushClear, region);
103267
103233
  });
103268
103234
  brush.addEventListener(IOperateType.drawEnd, (e) => {
103269
103235
  var _a;
103270
- this.enableDimensionHover();
103271
103236
  this._setRegionMarkPickable(region, true);
103272
103237
  const { operateMask } = e.detail;
103273
103238
  const { updateElementsState = true } = this._spec;
@@ -103275,11 +103240,11 @@ class Brush extends BaseComponent {
103275
103240
  if (this._spec.onBrushEnd(e) === true) {
103276
103241
  this.clearGraphic();
103277
103242
  this._initMarkBrushState(componentIndex, '');
103278
- this._emitEvent(ChartEvent.brushClear, region, e);
103243
+ this._emitEvent(ChartEvent.brushClear, region);
103279
103244
  }
103280
103245
  else {
103281
103246
  this._spec.onBrushEnd(e);
103282
- this._emitEvent(ChartEvent.brushEnd, region, e);
103247
+ this._emitEvent(ChartEvent.brushEnd, region);
103283
103248
  }
103284
103249
  }
103285
103250
  else {
@@ -103287,11 +103252,10 @@ class Brush extends BaseComponent {
103287
103252
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || !updateElementsState) {
103288
103253
  this._setAxisAndDataZoom(operateMask, region);
103289
103254
  }
103290
- this._emitEvent(ChartEvent.brushEnd, region, e);
103255
+ this._emitEvent(ChartEvent.brushEnd, region);
103291
103256
  }
103292
103257
  });
103293
103258
  brush.addEventListener(IOperateType.moveEnd, (e) => {
103294
- this.enableDimensionHover();
103295
103259
  this._setRegionMarkPickable(region, true);
103296
103260
  const { operateMask } = e.detail;
103297
103261
  const { updateElementsState = true } = this._spec;
@@ -103299,7 +103263,7 @@ class Brush extends BaseComponent {
103299
103263
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || updateElementsState) {
103300
103264
  this._setAxisAndDataZoom(operateMask, region);
103301
103265
  }
103302
- this._emitEvent(ChartEvent.brushEnd, region, e);
103266
+ this._emitEvent(ChartEvent.brushEnd, region);
103303
103267
  });
103304
103268
  }
103305
103269
  _getBrushInteractiveAttr(region) {
@@ -103317,8 +103281,7 @@ class Brush extends BaseComponent {
103317
103281
  maxX: seriesRegionEndX
103318
103282
  },
103319
103283
  xRange: [seriesRegionStartX, seriesRegionEndX],
103320
- yRange: [seriesRegionStartY, seriesRegionEndY],
103321
- interactive: this._shouldEnableInteractive()
103284
+ yRange: [seriesRegionStartY, seriesRegionEndY]
103322
103285
  };
103323
103286
  }
103324
103287
  _transformBrushedMarkAttr(brushedStyle) {
@@ -103339,7 +103302,6 @@ class Brush extends BaseComponent {
103339
103302
  }
103340
103303
  _handleBrushChange(region, e) {
103341
103304
  const { operateMask } = e.detail;
103342
- this._operateMask = operateMask;
103343
103305
  const { updateElementsState = true } = this._spec;
103344
103306
  if (updateElementsState) {
103345
103307
  this._reconfigItem(operateMask, region);
@@ -103364,7 +103326,7 @@ class Brush extends BaseComponent {
103364
103326
  }
103365
103327
  return data;
103366
103328
  }
103367
- _emitEvent(eventType, region, e) {
103329
+ _emitEvent(eventType, region) {
103368
103330
  var _a;
103369
103331
  this.event.emit(eventType, {
103370
103332
  model: this,
@@ -103381,8 +103343,7 @@ class Brush extends BaseComponent {
103381
103343
  linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap,
103382
103344
  zoomRecord: this._zoomRecord
103383
103345
  },
103384
- vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance,
103385
- event: e
103346
+ vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance
103386
103347
  });
103387
103348
  }
103388
103349
  _reconfigItem(operateMask, region) {
@@ -103637,28 +103598,6 @@ class Brush extends BaseComponent {
103637
103598
  this._brushComponents = null;
103638
103599
  }
103639
103600
  }
103640
- disableDimensionHover() {
103641
- DimensionHoverEvent.disableDimensionEvent(true);
103642
- this._option
103643
- .getChart()
103644
- .getComponentsByKey('crosshair')
103645
- .forEach(crosshair => (crosshair.enable = false));
103646
- this._option.globalInstance.setTooltipHandler((() => { }));
103647
- }
103648
- enableDimensionHover() {
103649
- DimensionHoverEvent.disableDimensionEvent(false);
103650
- this._option
103651
- .getChart()
103652
- .getComponentsByKey('crosshair')
103653
- .forEach(crosshair => (crosshair.enable = true));
103654
- this._option.globalInstance.setTooltipHandler(undefined);
103655
- }
103656
- clearBrushStateAndMask() {
103657
- this._relativeRegions.forEach((region, componentIndex) => {
103658
- this._initMarkBrushState(componentIndex, '');
103659
- this._brushComponents[componentIndex].children[0].removeAllChild();
103660
- });
103661
- }
103662
103601
  }
103663
103602
  Brush.type = ComponentTypeEnum.brush;
103664
103603
  Brush.builtInTheme = {
package/build/index.js CHANGED
@@ -51102,8 +51102,6 @@
51102
51102
  let Brush$1 = class Brush extends AbstractComponent {
51103
51103
  constructor(attributes, options) {
51104
51104
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeBrushState = !1, this._activeDrawState = !1, this._cacheDrawPoints = [], this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0, this._operatingMaskMoveRangeX = [-1 / 0, 1 / 0], this._operatingMaskMoveRangeY = [-1 / 0, 1 / 0], this._brushMaskAABBBoundsDict = {}, this._firstUpdate = !0, this._onBrushStart = e => {
51105
- if (!1 === this.attribute.interactive) return;
51106
- if (!1 === this._beforeBrushEvent(e)) return;
51107
51105
  const {
51108
51106
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
51109
51107
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -51111,11 +51109,11 @@
51111
51109
  } = this.attribute;
51112
51110
  array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd)), e.stopPropagation(), this._firstUpdate = !0, this._activeMoveState = brushMoved && this._isPosInBrushMask(e), this._activeDrawState = !this._activeMoveState, this._startPos = this.eventPosToStagePos(e), this._cacheDrawPoints = [this._startPos];
51113
51111
  }, this._onBrushing = e => {
51114
- !1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e))));
51112
+ this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e)));
51115
51113
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
51116
- !1 !== this.attribute.interactive && (this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1);
51114
+ this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1;
51117
51115
  }, this._onBrushClear = e => {
51118
- !1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1);
51116
+ e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1;
51119
51117
  };
51120
51118
  }
51121
51119
  _bindBrushEvents() {
@@ -51127,7 +51125,6 @@
51127
51125
  array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart)), array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
51128
51126
  }
51129
51127
  _initDraw(e) {
51130
- if (!1 === this.attribute.interactive) return;
51131
51128
  const {
51132
51129
  brushMode: brushMode
51133
51130
  } = this.attribute,
@@ -51136,7 +51133,6 @@
51136
51133
  }
51137
51134
  _initMove(e) {
51138
51135
  var _a, _b;
51139
- if (!1 === this.attribute.interactive) return;
51140
51136
  this._cacheMovePoint = this.eventPosToStagePos(e), this._operatingMaskMoveDx = null !== (_a = this._operatingMask.attribute.dx) && void 0 !== _a ? _a : 0, this._operatingMaskMoveDy = null !== (_b = this._operatingMask.attribute.dy) && void 0 !== _b ? _b : 0;
51141
51137
  const {
51142
51138
  interactiveRange: interactiveRange
@@ -51161,7 +51157,6 @@
51161
51157
  }
51162
51158
  _drawing(e) {
51163
51159
  var _a;
51164
- if (!1 === this.attribute.interactive) return;
51165
51160
  const pos = this.eventPosToStagePos(e),
51166
51161
  {
51167
51162
  brushType: brushType,
@@ -51186,7 +51181,6 @@
51186
51181
  (Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold) && (1 !== Object.keys(this._brushMaskAABBBoundsDict).length || this._activeBrushState ? this._dispatchBrushEvent(IOperateType.drawing, e) : (this._activeBrushState = !0, this._dispatchBrushEvent(IOperateType.brushActive, e)));
51187
51182
  }
51188
51183
  _moving(e) {
51189
- if (!1 === this.attribute.interactive) return;
51190
51184
  const startPos = this._cacheMovePoint,
51191
51185
  pos = this.eventPosToStagePos(e);
51192
51186
  if (pos.x === (null == startPos ? void 0 : startPos.x) && pos.y === (null == startPos ? void 0 : startPos.y)) return;
@@ -51200,7 +51194,6 @@
51200
51194
  }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchBrushEvent(IOperateType.moving, e);
51201
51195
  }
51202
51196
  _drawEnd(e) {
51203
- if (!1 === this.attribute.interactive) return;
51204
51197
  const {
51205
51198
  removeOnClick = !0,
51206
51199
  sizeThreshold = DEFAULT_SIZE_THRESHOLD
@@ -51218,7 +51211,7 @@
51218
51211
  }
51219
51212
  }
51220
51213
  _moveEnd(e) {
51221
- !1 !== this.attribute.interactive && (this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e));
51214
+ this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e);
51222
51215
  }
51223
51216
  render() {
51224
51217
  this._bindBrushEvents();
@@ -51325,10 +51318,6 @@
51325
51318
  pos = this.eventPosToStagePos(e);
51326
51319
  return pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY;
51327
51320
  }
51328
- _beforeBrushEvent(e) {
51329
- var _a, _b;
51330
- return null === (_b = (_a = this.attribute).beforeBrushChange) || void 0 === _b ? void 0 : _b.call(_a, e);
51331
- }
51332
51321
  _dispatchBrushEvent(operateType, e) {
51333
51322
  this._dispatchEvent(operateType, {
51334
51323
  operateMask: this._operatingMask,
@@ -53874,7 +53863,7 @@
53874
53863
  if (ComposedEventCtor) {
53875
53864
  const composedEvent = new ComposedEventCtor(this._eventDispatcher, this._mode);
53876
53865
  composedEvent.register(eType, handler);
53877
- this._composedEventMap.set(handler.callback, {
53866
+ this._composedEventMap.set(callback, {
53878
53867
  eventType: eType,
53879
53868
  event: composedEvent
53880
53869
  });
@@ -54911,9 +54900,6 @@
54911
54900
  getRootGroup() {
54912
54901
  return this._rootGroup;
54913
54902
  }
54914
- getOption() {
54915
- return this._option;
54916
- }
54917
54903
  constructor(container, option) {
54918
54904
  this._count = 0;
54919
54905
  this._rootMarks = [];
@@ -60534,7 +60520,7 @@
60534
60520
  this._compiler.updateLayoutTag();
60535
60521
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
60536
60522
  this._initDataSet(this._option.dataSet);
60537
- this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
60523
+ this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
60538
60524
  this._bindResizeEvent();
60539
60525
  this._bindViewEvent();
60540
60526
  this._initChartPlugin();
@@ -61187,7 +61173,7 @@
61187
61173
  resize = true;
61188
61174
  }
61189
61175
  const lasAutoSize = this._autoSize;
61190
- this._autoSize = isTrueBrowser(this._option.mode) ? ((_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true) : false;
61176
+ this._autoSize = isTrueBrowser(this._option.mode) ? (_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true : false;
61191
61177
  if (this._autoSize !== lasAutoSize) {
61192
61178
  resize = true;
61193
61179
  }
@@ -64448,7 +64434,7 @@
64448
64434
  super(...arguments);
64449
64435
  this._cacheDimensionInfo = null;
64450
64436
  this.onMouseMove = (params) => {
64451
- if (!params || DimensionHoverEvent._disableDimensionEvent) {
64437
+ if (!params) {
64452
64438
  return;
64453
64439
  }
64454
64440
  const x = params.event.viewX;
@@ -64470,16 +64456,13 @@
64470
64456
  }
64471
64457
  };
64472
64458
  this.onMouseOut = (params) => {
64473
- if (!params || DimensionHoverEvent._disableDimensionEvent) {
64459
+ if (!params) {
64474
64460
  return;
64475
64461
  }
64476
64462
  this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
64477
64463
  this._cacheDimensionInfo = null;
64478
64464
  };
64479
64465
  }
64480
- static disableDimensionEvent(value) {
64481
- this._disableDimensionEvent = value;
64482
- }
64483
64466
  register(eType, handler) {
64484
64467
  this._callback = handler.callback;
64485
64468
  this._eventDispatcher.register('pointermove', {
@@ -64510,7 +64493,6 @@
64510
64493
  }
64511
64494
  }
64512
64495
  }
64513
- DimensionHoverEvent._disableDimensionEvent = false;
64514
64496
 
64515
64497
  exports.DimensionEventEnum = void 0;
64516
64498
  (function (DimensionEventEnum) {
@@ -95683,15 +95665,11 @@
95683
95665
  });
95684
95666
  return originDatum;
95685
95667
  };
95686
- const transform = region.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse();
95687
95668
  const getMockEvent = (originPos) => {
95688
95669
  var _a, _b;
95689
95670
  const pos = bound(originPos);
95690
- const tempX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95691
- const tempY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95692
- const canvasPoint = { x: 0, y: 0 };
95693
- transform.transformPoint({ x: tempX, y: tempY }, canvasPoint);
95694
- const { x: canvasX, y: canvasY } = canvasPoint;
95671
+ const canvasX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95672
+ const canvasY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95695
95673
  return {
95696
95674
  canvasX,
95697
95675
  canvasY,
@@ -103224,9 +103202,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103224
103202
  this._initMarkBrushState(componentIndex, '');
103225
103203
  brushComponent.children[0].removeAllChild();
103226
103204
  }
103227
- _shouldEnableInteractive() {
103228
- return this.getOption().getCompiler().getOption().interactive !== false;
103229
- }
103230
103205
  _createBrushComponent(region, componentIndex) {
103231
103206
  var _a, _b;
103232
103207
  const interactiveAttr = this._getBrushInteractiveAttr(region);
@@ -103237,43 +103212,33 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103237
103212
  this._cacheInteractiveRangeAttrs.push(interactiveAttr);
103238
103213
  brush.addEventListener(IOperateType.brushActive, (e) => {
103239
103214
  this._initMarkBrushState(componentIndex, OUT_BRUSH_STATE);
103240
- this._emitEvent(exports.ChartEvent.brushActive, region, e);
103215
+ this._emitEvent(exports.ChartEvent.brushActive, region);
103241
103216
  });
103242
103217
  brush.addEventListener(IOperateType.drawStart, (e) => {
103243
- if (this._spec.disableDimensionHoverWhenBrushing) {
103244
- this.disableDimensionHover();
103245
- }
103246
103218
  this._setRegionMarkPickable(region, true);
103247
- this._emitEvent(exports.ChartEvent.brushStart, region, e);
103219
+ this._emitEvent(exports.ChartEvent.brushStart, region);
103248
103220
  });
103249
103221
  brush.addEventListener(IOperateType.moveStart, (e) => {
103250
- if (this._spec.disableDimensionHoverWhenBrushing) {
103251
- this.disableDimensionHover();
103252
- }
103253
103222
  this._setRegionMarkPickable(region, true);
103254
- this._emitEvent(exports.ChartEvent.brushStart, region, e);
103223
+ this._emitEvent(exports.ChartEvent.brushStart, region);
103255
103224
  });
103256
103225
  brush.addEventListener(IOperateType.drawing, (e) => {
103257
103226
  this._setRegionMarkPickable(region, false);
103258
103227
  this._handleBrushChange(region, e);
103259
- this._emitEvent(exports.ChartEvent.brushChange, region, e);
103228
+ this._emitEvent(exports.ChartEvent.brushChange, region);
103260
103229
  });
103261
103230
  brush.addEventListener(IOperateType.moving, (e) => {
103262
103231
  this._setRegionMarkPickable(region, false);
103263
103232
  this._handleBrushChange(region, e);
103264
- this._emitEvent(exports.ChartEvent.brushChange, region, e);
103233
+ this._emitEvent(exports.ChartEvent.brushChange, region);
103265
103234
  });
103266
103235
  brush.addEventListener(IOperateType.brushClear, (e) => {
103267
- if (this._spec.disableDimensionHoverWhenBrushing) {
103268
- this.enableDimensionHover();
103269
- }
103270
103236
  this._setRegionMarkPickable(region, true);
103271
103237
  this._initMarkBrushState(componentIndex, '');
103272
- this._emitEvent(exports.ChartEvent.brushClear, region, e);
103238
+ this._emitEvent(exports.ChartEvent.brushClear, region);
103273
103239
  });
103274
103240
  brush.addEventListener(IOperateType.drawEnd, (e) => {
103275
103241
  var _a;
103276
- this.enableDimensionHover();
103277
103242
  this._setRegionMarkPickable(region, true);
103278
103243
  const { operateMask } = e.detail;
103279
103244
  const { updateElementsState = true } = this._spec;
@@ -103281,11 +103246,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103281
103246
  if (this._spec.onBrushEnd(e) === true) {
103282
103247
  this.clearGraphic();
103283
103248
  this._initMarkBrushState(componentIndex, '');
103284
- this._emitEvent(exports.ChartEvent.brushClear, region, e);
103249
+ this._emitEvent(exports.ChartEvent.brushClear, region);
103285
103250
  }
103286
103251
  else {
103287
103252
  this._spec.onBrushEnd(e);
103288
- this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103253
+ this._emitEvent(exports.ChartEvent.brushEnd, region);
103289
103254
  }
103290
103255
  }
103291
103256
  else {
@@ -103293,11 +103258,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103293
103258
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || !updateElementsState) {
103294
103259
  this._setAxisAndDataZoom(operateMask, region);
103295
103260
  }
103296
- this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103261
+ this._emitEvent(exports.ChartEvent.brushEnd, region);
103297
103262
  }
103298
103263
  });
103299
103264
  brush.addEventListener(IOperateType.moveEnd, (e) => {
103300
- this.enableDimensionHover();
103301
103265
  this._setRegionMarkPickable(region, true);
103302
103266
  const { operateMask } = e.detail;
103303
103267
  const { updateElementsState = true } = this._spec;
@@ -103305,7 +103269,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103305
103269
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || updateElementsState) {
103306
103270
  this._setAxisAndDataZoom(operateMask, region);
103307
103271
  }
103308
- this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103272
+ this._emitEvent(exports.ChartEvent.brushEnd, region);
103309
103273
  });
103310
103274
  }
103311
103275
  _getBrushInteractiveAttr(region) {
@@ -103323,8 +103287,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103323
103287
  maxX: seriesRegionEndX
103324
103288
  },
103325
103289
  xRange: [seriesRegionStartX, seriesRegionEndX],
103326
- yRange: [seriesRegionStartY, seriesRegionEndY],
103327
- interactive: this._shouldEnableInteractive()
103290
+ yRange: [seriesRegionStartY, seriesRegionEndY]
103328
103291
  };
103329
103292
  }
103330
103293
  _transformBrushedMarkAttr(brushedStyle) {
@@ -103345,7 +103308,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103345
103308
  }
103346
103309
  _handleBrushChange(region, e) {
103347
103310
  const { operateMask } = e.detail;
103348
- this._operateMask = operateMask;
103349
103311
  const { updateElementsState = true } = this._spec;
103350
103312
  if (updateElementsState) {
103351
103313
  this._reconfigItem(operateMask, region);
@@ -103370,7 +103332,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103370
103332
  }
103371
103333
  return data;
103372
103334
  }
103373
- _emitEvent(eventType, region, e) {
103335
+ _emitEvent(eventType, region) {
103374
103336
  var _a;
103375
103337
  this.event.emit(eventType, {
103376
103338
  model: this,
@@ -103387,8 +103349,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103387
103349
  linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap,
103388
103350
  zoomRecord: this._zoomRecord
103389
103351
  },
103390
- vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance,
103391
- event: e
103352
+ vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance
103392
103353
  });
103393
103354
  }
103394
103355
  _reconfigItem(operateMask, region) {
@@ -103643,28 +103604,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103643
103604
  this._brushComponents = null;
103644
103605
  }
103645
103606
  }
103646
- disableDimensionHover() {
103647
- DimensionHoverEvent.disableDimensionEvent(true);
103648
- this._option
103649
- .getChart()
103650
- .getComponentsByKey('crosshair')
103651
- .forEach(crosshair => (crosshair.enable = false));
103652
- this._option.globalInstance.setTooltipHandler((() => { }));
103653
- }
103654
- enableDimensionHover() {
103655
- DimensionHoverEvent.disableDimensionEvent(false);
103656
- this._option
103657
- .getChart()
103658
- .getComponentsByKey('crosshair')
103659
- .forEach(crosshair => (crosshair.enable = true));
103660
- this._option.globalInstance.setTooltipHandler(undefined);
103661
- }
103662
- clearBrushStateAndMask() {
103663
- this._relativeRegions.forEach((region, componentIndex) => {
103664
- this._initMarkBrushState(componentIndex, '');
103665
- this._brushComponents[componentIndex].children[0].removeAllChild();
103666
- });
103667
- }
103668
103607
  }
103669
103608
  Brush.type = ComponentTypeEnum.brush;
103670
103609
  Brush.builtInTheme = {