@visactor/vrender-components 0.17.1 → 0.17.2-alpha.0

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 (61) hide show
  1. package/cjs/brush/brush.d.ts +3 -12
  2. package/cjs/brush/brush.js +29 -28
  3. package/cjs/brush/brush.js.map +1 -1
  4. package/cjs/checkbox/checkbox.js +4 -8
  5. package/cjs/checkbox/checkbox.js.map +1 -1
  6. package/cjs/core/base.d.ts +2 -0
  7. package/cjs/core/base.js +6 -0
  8. package/cjs/core/base.js.map +1 -1
  9. package/cjs/data-zoom/data-zoom.d.ts +0 -3
  10. package/cjs/data-zoom/data-zoom.js +20 -27
  11. package/cjs/data-zoom/data-zoom.js.map +1 -1
  12. package/cjs/index.d.ts +1 -1
  13. package/cjs/index.js +1 -1
  14. package/cjs/index.js.map +1 -1
  15. package/cjs/legend/discrete/discrete.d.ts +1 -1
  16. package/cjs/legend/discrete/discrete.js +10 -12
  17. package/cjs/legend/discrete/discrete.js.map +1 -1
  18. package/cjs/pager/pager.js +4 -9
  19. package/cjs/pager/pager.js.map +1 -1
  20. package/cjs/player/base-player.js +2 -5
  21. package/cjs/player/base-player.js.map +1 -1
  22. package/cjs/player/controller/controller.d.ts +0 -1
  23. package/cjs/player/controller/controller.js +5 -16
  24. package/cjs/player/controller/controller.js.map +1 -1
  25. package/cjs/scrollbar/scrollbar.d.ts +0 -1
  26. package/cjs/scrollbar/scrollbar.js +2 -8
  27. package/cjs/scrollbar/scrollbar.js.map +1 -1
  28. package/cjs/slider/slider.js +2 -4
  29. package/cjs/slider/slider.js.map +1 -1
  30. package/dist/index.js +89 -123
  31. package/dist/index.min.js +1 -1
  32. package/es/brush/brush.d.ts +3 -12
  33. package/es/brush/brush.js +31 -30
  34. package/es/brush/brush.js.map +1 -1
  35. package/es/checkbox/checkbox.js +5 -9
  36. package/es/checkbox/checkbox.js.map +1 -1
  37. package/es/core/base.d.ts +2 -0
  38. package/es/core/base.js +7 -1
  39. package/es/core/base.js.map +1 -1
  40. package/es/data-zoom/data-zoom.d.ts +0 -3
  41. package/es/data-zoom/data-zoom.js +21 -27
  42. package/es/data-zoom/data-zoom.js.map +1 -1
  43. package/es/index.d.ts +1 -1
  44. package/es/index.js +1 -1
  45. package/es/index.js.map +1 -1
  46. package/es/legend/discrete/discrete.d.ts +1 -1
  47. package/es/legend/discrete/discrete.js +11 -13
  48. package/es/legend/discrete/discrete.js.map +1 -1
  49. package/es/pager/pager.js +5 -10
  50. package/es/pager/pager.js.map +1 -1
  51. package/es/player/base-player.js +1 -6
  52. package/es/player/base-player.js.map +1 -1
  53. package/es/player/controller/controller.d.ts +0 -1
  54. package/es/player/controller/controller.js +5 -18
  55. package/es/player/controller/controller.js.map +1 -1
  56. package/es/scrollbar/scrollbar.d.ts +0 -1
  57. package/es/scrollbar/scrollbar.js +3 -9
  58. package/es/scrollbar/scrollbar.js.map +1 -1
  59. package/es/slider/slider.js +3 -5
  60. package/es/slider/slider.js.map +1 -1
  61. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -19215,6 +19215,12 @@
19215
19215
  _getNodeId(id) {
19216
19216
  return `${this.id}-${this.name}-${id}`;
19217
19217
  }
19218
+ _dispatchEvent(eventName, details) {
19219
+ var _a;
19220
+ const changeEvent = new CustomEvent(eventName, details);
19221
+ changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
19222
+ this.dispatchEvent(changeEvent);
19223
+ }
19218
19224
  }
19219
19225
 
19220
19226
  const delayMap$2 = {
@@ -19295,7 +19301,7 @@
19295
19301
  const [currentPos, currentScrollValue] = this._computeScrollValue(e);
19296
19302
  const range = [preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue];
19297
19303
  if (!realTime) {
19298
- this._onChange({
19304
+ this._dispatchEvent('scroll', {
19299
19305
  pre: preRange,
19300
19306
  value: vutils.clampRange(range, limitRange[0], limitRange[1])
19301
19307
  });
@@ -19331,7 +19337,7 @@
19331
19337
  }
19332
19338
  this.attribute.range = currScrollRange;
19333
19339
  if (realTime) {
19334
- this._onChange({
19340
+ this._dispatchEvent('scroll', {
19335
19341
  pre: preRange,
19336
19342
  value: currScrollRange
19337
19343
  });
@@ -19434,12 +19440,6 @@
19434
19440
  ? vutils.clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
19435
19441
  : vutils.clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
19436
19442
  }
19437
- _onChange(detail) {
19438
- var _a;
19439
- const changeEvent = new CustomEvent('scroll', detail);
19440
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
19441
- this.dispatchEvent(changeEvent);
19442
- }
19443
19443
  _reset() {
19444
19444
  this._sliderRenderBounds = null;
19445
19445
  this._sliderLimitRange = null;
@@ -25268,7 +25268,6 @@
25268
25268
  this._activeCache.lastPos = this.eventPosToStagePos(e);
25269
25269
  };
25270
25270
  this._onHandlerPointerMove = (e) => {
25271
- var _a;
25272
25271
  e.stopPropagation();
25273
25272
  const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
25274
25273
  const pos = this.eventPosToStagePos(e);
@@ -25306,8 +25305,11 @@
25306
25305
  end = Math.min(Math.max(end, 0), 1);
25307
25306
  if (startAttr !== start || endAttr !== end) {
25308
25307
  this.setStateAttr(start, end, true);
25309
- realTime && ((_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag));
25310
- this._dispatchChangeEvent(start, end);
25308
+ this._dispatchEvent('change', {
25309
+ start,
25310
+ end,
25311
+ tag: this._activeTag
25312
+ });
25311
25313
  }
25312
25314
  };
25313
25315
  const { start, end, size, orient, showDetail, position, previewData, previewPointsX, previewPointsY, previewPointsX1, previewPointsY1, updateStateCallback } = this.attribute;
@@ -25332,7 +25334,6 @@
25332
25334
  vutils.isFunction(previewPointsY) && (this._previewPointsY = previewPointsY);
25333
25335
  vutils.isFunction(previewPointsX1) && (this._previewPointsX1 = previewPointsX1);
25334
25336
  vutils.isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
25335
- vutils.isFunction(updateStateCallback) && (this._updateStateCallback = updateStateCallback);
25336
25337
  }
25337
25338
  bindEvents() {
25338
25339
  if (this.attribute.disableTriggerEvent) {
@@ -25403,15 +25404,14 @@
25403
25404
  shouldRender && this.setAttributes({ start, end });
25404
25405
  }
25405
25406
  eventPosToStagePos(e) {
25406
- var _a, _b, _c;
25407
- const stagePosition = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.window.getBoundingClientRect();
25407
+ var _a, _b;
25408
+ const { x, y } = vglobal.mapToCanvasPoint(e);
25408
25409
  return {
25409
- x: e.clientX - ((stagePosition === null || stagePosition === void 0 ? void 0 : stagePosition.left) || 0) - (((_b = this.stage) === null || _b === void 0 ? void 0 : _b.x) || 0),
25410
- y: e.clientY - ((stagePosition === null || stagePosition === void 0 ? void 0 : stagePosition.top) || 0) - (((_c = this.stage) === null || _c === void 0 ? void 0 : _c.y) || 0)
25410
+ x: x - (((_a = this.stage) === null || _a === void 0 ? void 0 : _a.x) || 0),
25411
+ y: y - (((_b = this.stage) === null || _b === void 0 ? void 0 : _b.y) || 0)
25411
25412
  };
25412
25413
  }
25413
25414
  _onHandlerPointerUp(e) {
25414
- var _a;
25415
25415
  e.preventDefault();
25416
25416
  const { start, end, brushSelect, realTime = true } = this.attribute;
25417
25417
  if (this._activeState) {
@@ -25424,8 +25424,11 @@
25424
25424
  brushSelect && this.renderDragMask();
25425
25425
  if (!realTime || start !== this.state.start || end !== this.state.end) {
25426
25426
  this.setStateAttr(this.state.start, this.state.end, true);
25427
- (_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, this.state.start, this.state.end, this._activeTag);
25428
- this._dispatchChangeEvent(this.state.start, this.state.end);
25427
+ this._dispatchEvent('change', {
25428
+ start: this.state.start,
25429
+ end: this.state.end,
25430
+ tag: this._activeTag
25431
+ });
25429
25432
  }
25430
25433
  }
25431
25434
  _onHandlerPointerEnter(e) {
@@ -25787,25 +25790,18 @@
25787
25790
  container.add(labelShape);
25788
25791
  return labelShape;
25789
25792
  }
25790
- _dispatchChangeEvent(start, end) {
25791
- var _a;
25792
- const changeEvent = new CustomEvent('change', {
25793
- start,
25794
- end
25795
- });
25796
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
25797
- this.dispatchEvent(changeEvent);
25798
- }
25799
25793
  setStartAndEnd(start, end) {
25800
- var _a;
25801
25794
  const { start: startAttr, end: endAttr } = this.attribute;
25802
25795
  if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
25803
25796
  this.state.start = start;
25804
25797
  this.state.end = end;
25805
25798
  if (startAttr !== this.state.start || endAttr !== this.state.end) {
25806
25799
  this.setStateAttr(start, end, true);
25807
- (_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag);
25808
- this._dispatchChangeEvent(start, end);
25800
+ this._dispatchEvent('change', {
25801
+ start,
25802
+ end,
25803
+ tag: this._activeTag
25804
+ });
25809
25805
  }
25810
25806
  }
25811
25807
  }
@@ -25833,9 +25829,6 @@
25833
25829
  const middleHandlerSymbolSize = (_d = (_c = middleHandlerStyle === null || middleHandlerStyle === void 0 ? void 0 : middleHandlerStyle.icon) === null || _c === void 0 ? void 0 : _c.size) !== null && _d !== void 0 ? _d : 10;
25834
25830
  return Math.max(middleHandlerRectSize, ...vutils.array(middleHandlerSymbolSize));
25835
25831
  }
25836
- setUpdateStateCallback(callback) {
25837
- vutils.isFunction(callback) && (this._updateStateCallback = callback);
25838
- }
25839
25832
  setPreviewPointsX(callback) {
25840
25833
  vutils.isFunction(callback) && (this._previewPointsX = callback);
25841
25834
  }
@@ -26627,7 +26620,6 @@
26627
26620
  target.removeState('hover');
26628
26621
  };
26629
26622
  this._onClick = (e) => {
26630
- var _a, _b;
26631
26623
  const target = e.target;
26632
26624
  if (target.name === 'preHandler') {
26633
26625
  if (this._current === 1) {
@@ -26640,14 +26632,12 @@
26640
26632
  else {
26641
26633
  target.removeState('disable');
26642
26634
  }
26643
- const changeEvent = new CustomEvent('toPrev', {
26635
+ this._dispatchEvent('toPrev', {
26644
26636
  current: this._current,
26645
26637
  total: this._total,
26646
26638
  direction: 'pre',
26647
26639
  event: e
26648
26640
  });
26649
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
26650
- this.dispatchEvent(changeEvent);
26651
26641
  }
26652
26642
  if (target.name === 'nextHandler') {
26653
26643
  if (this._current === this._total) {
@@ -26660,14 +26650,12 @@
26660
26650
  else {
26661
26651
  target.removeState('disable');
26662
26652
  }
26663
- const changeEvent = new CustomEvent('toNext', {
26653
+ this._dispatchEvent('toNext', {
26664
26654
  current: this._current,
26665
26655
  total: this._total,
26666
26656
  direction: 'next',
26667
26657
  event: e
26668
26658
  });
26669
- changeEvent.manager = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.eventSystem.manager;
26670
- this.dispatchEvent(changeEvent);
26671
26659
  }
26672
26660
  if (this._current > 1) {
26673
26661
  this.preHandler.removeState('disable');
@@ -26944,7 +26932,7 @@
26944
26932
  const currentSelectedItems = this._getSelectedLegends();
26945
26933
  if (selectMode === 'multiple') {
26946
26934
  if (allowAllCanceled === false && isSelected && currentSelectedItems.length === 1) {
26947
- this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem, e);
26935
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemClick, legendItem, e);
26948
26936
  return;
26949
26937
  }
26950
26938
  if (isSelected) {
@@ -26967,7 +26955,7 @@
26967
26955
  });
26968
26956
  }
26969
26957
  }
26970
- this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem, e);
26958
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemClick, legendItem, e);
26971
26959
  }
26972
26960
  };
26973
26961
  }
@@ -27389,7 +27377,7 @@
27389
27377
  if (focusButton) {
27390
27378
  focusButton.setAttribute('visible', true);
27391
27379
  }
27392
- this._dispatchEvent(exports.LegendEvent.legendItemHover, legendItem, e);
27380
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemHover, legendItem, e);
27393
27381
  }
27394
27382
  _unHover(legendItem, e) {
27395
27383
  let attributeUpdate = false;
@@ -27414,9 +27402,9 @@
27414
27402
  focusButton.setAttribute('visible', false);
27415
27403
  }
27416
27404
  if (attributeUpdate) {
27417
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
27405
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
27418
27406
  }
27419
- this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
27407
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
27420
27408
  }
27421
27409
  _setLegendItemState(legendItem, stateName, e) {
27422
27410
  const keepCurrentStates = true;
@@ -27437,7 +27425,7 @@
27437
27425
  }
27438
27426
  });
27439
27427
  if (attributeUpdate) {
27440
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
27428
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
27441
27429
  }
27442
27430
  }
27443
27431
  _removeLegendItemState(legendItem, stateNames, e) {
@@ -27462,7 +27450,7 @@
27462
27450
  }
27463
27451
  });
27464
27452
  if (attributeUpdate) {
27465
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
27453
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
27466
27454
  }
27467
27455
  }
27468
27456
  _getSelectedLegends() {
@@ -27481,12 +27469,11 @@
27481
27469
  shape.delegate = delegateShape;
27482
27470
  shape.states = vutils.merge({}, DEFAULT_STATES, states);
27483
27471
  }
27484
- _dispatchEvent(eventName, legendItem, event) {
27485
- var _a;
27472
+ _dispatchLegendEvent(eventName, legendItem, event) {
27486
27473
  const currentSelectedItems = this._getSelectedLegends();
27487
27474
  currentSelectedItems.sort((pre, next) => pre.index - next.index);
27488
27475
  const currentSelected = currentSelectedItems.map((obj) => obj.label);
27489
- const changeEvent = new CustomEvent(eventName, {
27476
+ this._dispatchEvent(eventName, {
27490
27477
  item: legendItem,
27491
27478
  data: legendItem.data,
27492
27479
  selected: legendItem.hasState(exports.LegendStateValue.selected),
@@ -27494,8 +27481,6 @@
27494
27481
  currentSelected,
27495
27482
  event
27496
27483
  });
27497
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
27498
- this.dispatchEvent(changeEvent);
27499
27484
  }
27500
27485
  _handleStyle(config, item, isSelected, index, items) {
27501
27486
  const newConfig = vutils.merge({}, config);
@@ -28169,10 +28154,9 @@
28169
28154
  }
28170
28155
  }
28171
28156
  _dispatchChangeEvent() {
28172
- var _a;
28173
28157
  const isRange = !!this.attribute.range;
28174
28158
  const currentValue = this._currentValue;
28175
- const changeEvent = new CustomEvent('change', {
28159
+ this._dispatchEvent('change', {
28176
28160
  value: isRange
28177
28161
  ? [
28178
28162
  Math.min(currentValue.endValue, currentValue.startValue),
@@ -28186,8 +28170,6 @@
28186
28170
  ]
28187
28171
  : currentValue.startPos
28188
28172
  });
28189
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
28190
- this.dispatchEvent(changeEvent);
28191
28173
  }
28192
28174
  _getHandlers() {
28193
28175
  let startHandler = this._startHandler;
@@ -29083,12 +29065,6 @@
29083
29065
  this.forward();
29084
29066
  });
29085
29067
  };
29086
- this._createCustomEvent = (eventType) => {
29087
- var _a;
29088
- const customEvent = new CustomEvent(eventType, { eventType });
29089
- customEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
29090
- return customEvent;
29091
- };
29092
29068
  this.renderPlay = () => {
29093
29069
  if (this._isPaused) {
29094
29070
  this._playController.setAttributes(Object.assign({ symbolType: this._playController.getComputedAttribute('symbolType') }, this._startAttr.style));
@@ -29104,20 +29080,16 @@
29104
29080
  this._forwardController.setAttributes(this._forwardAttr.style);
29105
29081
  };
29106
29082
  this.play = () => {
29107
- const onPlayEvent = this._createCustomEvent(ControllerEventEnum.OnPlay);
29108
- this.dispatchEvent(onPlayEvent);
29083
+ this._dispatchEvent('ControllerEventEnum.OnPlay');
29109
29084
  };
29110
29085
  this.pause = () => {
29111
- const onPauseEvent = this._createCustomEvent(ControllerEventEnum.OnPause);
29112
- this.dispatchEvent(onPauseEvent);
29086
+ this._dispatchEvent('ControllerEventEnum.OnPause');
29113
29087
  };
29114
29088
  this.forward = () => {
29115
- const onPlayEvent = this._createCustomEvent(ControllerEventEnum.OnForward);
29116
- this.dispatchEvent(onPlayEvent);
29089
+ this._dispatchEvent('ControllerEventEnum.OnForward');
29117
29090
  };
29118
29091
  this.backward = () => {
29119
- const onPlayEvent = this._createCustomEvent(ControllerEventEnum.OnBackward);
29120
- this.dispatchEvent(onPlayEvent);
29092
+ this._dispatchEvent('ControllerEventEnum.OnBackward');
29121
29093
  };
29122
29094
  this.togglePlay = () => {
29123
29095
  this._playController.setAttributes(this._startAttr.style);
@@ -29392,14 +29364,11 @@
29392
29364
  this._controller.setAttributes(attrs);
29393
29365
  }
29394
29366
  dispatchCustomEvent(eventType, dataIndex) {
29395
- var _a;
29396
- const changeEvent = new CustomEvent(eventType, {
29367
+ this._dispatchEvent(eventType, {
29397
29368
  eventType,
29398
29369
  index: dataIndex,
29399
29370
  value: this._data[dataIndex]
29400
29371
  });
29401
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
29402
- this.dispatchEvent(changeEvent);
29403
29372
  }
29404
29373
  }
29405
29374
  BasePlayer.defaultAttributes = {
@@ -29813,20 +29782,27 @@
29813
29782
  if (this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick) {
29814
29783
  this._container.incrementalClearChild();
29815
29784
  this._brushMaskAABBBoundsDict = {};
29816
- this._updateDragMaskCallback &&
29817
- this._updateDragMaskCallback({
29818
- operateType: exports.IOperateType.brushClear,
29819
- operateMask: this._operatingMask,
29820
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29821
- });
29785
+ this._dispatchEvent(exports.IOperateType.brushClear, {
29786
+ operateMask: this._operatingMask,
29787
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29788
+ event: e
29789
+ });
29822
29790
  }
29823
29791
  else if (!this._outOfInteractiveRange(e)) {
29824
- this._updateDragMaskCallback &&
29825
- this._updateDragMaskCallback({
29826
- operateType: this._activeDrawState ? exports.IOperateType.drawEnd : exports.IOperateType.moveEnd,
29792
+ if (this._activeDrawState) {
29793
+ this._dispatchEvent(exports.IOperateType.drawEnd, {
29827
29794
  operateMask: this._operatingMask,
29828
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29795
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29796
+ event: e
29829
29797
  });
29798
+ }
29799
+ if (this._activeMoveState) {
29800
+ this._dispatchEvent(exports.IOperateType.moveEnd, {
29801
+ operateMask: this._operatingMask,
29802
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29803
+ event: e
29804
+ });
29805
+ }
29830
29806
  }
29831
29807
  this._activeDrawState = false;
29832
29808
  this._activeMoveState = false;
@@ -29834,7 +29810,7 @@
29834
29810
  (_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a.setAttribute('pickable', false);
29835
29811
  };
29836
29812
  }
29837
- bindBrushEvents() {
29813
+ _bindBrushEvents() {
29838
29814
  if (this.attribute.disableTriggerEvent) {
29839
29815
  return;
29840
29816
  }
@@ -29872,12 +29848,11 @@
29872
29848
  this._container.incrementalClearChild();
29873
29849
  }
29874
29850
  this._addBrushMask();
29875
- this._updateDragMaskCallback &&
29876
- this._updateDragMaskCallback({
29877
- operateType: exports.IOperateType.drawStart,
29878
- operateMask: this._operatingMask,
29879
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29880
- });
29851
+ this._dispatchEvent(exports.IOperateType.drawStart, {
29852
+ operateMask: this._operatingMask,
29853
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29854
+ event: e
29855
+ });
29881
29856
  }
29882
29857
  _initMove(e) {
29883
29858
  var _a, _b;
@@ -29894,12 +29869,11 @@
29894
29869
  this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];
29895
29870
  this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];
29896
29871
  this._operatingMask.setAttribute('pickable', true);
29897
- this._updateDragMaskCallback &&
29898
- this._updateDragMaskCallback({
29899
- operateType: exports.IOperateType.moveStart,
29900
- operateMask: this._operatingMask,
29901
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29902
- });
29872
+ this._dispatchEvent(exports.IOperateType.moveStart, {
29873
+ operateMask: this._operatingMask,
29874
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29875
+ event: e
29876
+ });
29903
29877
  }
29904
29878
  _drawing(e) {
29905
29879
  var _a;
@@ -29923,12 +29897,11 @@
29923
29897
  const maskPoints = this._computeMaskPoints();
29924
29898
  this._operatingMask.setAttribute('points', maskPoints);
29925
29899
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
29926
- this._updateDragMaskCallback &&
29927
- this._updateDragMaskCallback({
29928
- operateType: exports.IOperateType.drawing,
29929
- operateMask: this._operatingMask,
29930
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29931
- });
29900
+ this._dispatchEvent(exports.IOperateType.drawing, {
29901
+ operateMask: this._operatingMask,
29902
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29903
+ event: e
29904
+ });
29932
29905
  }
29933
29906
  _moving(e) {
29934
29907
  const startPos = this._cacheMovePoint;
@@ -29947,12 +29920,11 @@
29947
29920
  dy: moveY
29948
29921
  });
29949
29922
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
29950
- this._updateDragMaskCallback &&
29951
- this._updateDragMaskCallback({
29952
- operateType: exports.IOperateType.moving,
29953
- operateMask: this._operatingMask,
29954
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29955
- });
29923
+ this._dispatchEvent(exports.IOperateType.moving, {
29924
+ operateMask: this._operatingMask,
29925
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29926
+ event: e
29927
+ });
29956
29928
  }
29957
29929
  _computeMaskPoints() {
29958
29930
  const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute;
@@ -30037,21 +30009,18 @@
30037
30009
  return false;
30038
30010
  }
30039
30011
  eventPosToStagePos(e) {
30040
- var _a, _b, _c;
30041
- const stagePosition = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.window.getBoundingClientRect();
30012
+ var _a, _b;
30013
+ const { x, y } = vglobal.mapToCanvasPoint(e);
30042
30014
  return {
30043
- x: e.clientX - ((stagePosition === null || stagePosition === void 0 ? void 0 : stagePosition.left) || 0) - (((_b = this.stage) === null || _b === void 0 ? void 0 : _b.x) || 0),
30044
- y: e.clientY - ((stagePosition === null || stagePosition === void 0 ? void 0 : stagePosition.top) || 0) - (((_c = this.stage) === null || _c === void 0 ? void 0 : _c.y) || 0)
30015
+ x: x - (((_a = this.stage) === null || _a === void 0 ? void 0 : _a.x) || 0),
30016
+ y: y - (((_b = this.stage) === null || _b === void 0 ? void 0 : _b.y) || 0)
30045
30017
  };
30046
30018
  }
30047
30019
  render() {
30048
- this.bindBrushEvents();
30020
+ this._bindBrushEvents();
30049
30021
  const group = this.createOrUpdateChild('brush-container', {}, 'group');
30050
30022
  this._container = group;
30051
30023
  }
30052
- setUpdateDragMaskCallback(callback) {
30053
- vutils.isFunction(callback) && (this._updateDragMaskCallback = callback);
30054
- }
30055
30024
  releaseBrushEvents() {
30056
30025
  const { delayType = 'throttle', delayTime = 0, trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
30057
30026
  this.stage.removeEventListener(trigger, this._onBrushStart);
@@ -30607,7 +30576,6 @@
30607
30576
  });
30608
30577
  }
30609
30578
  handleClick() {
30610
- var _a;
30611
30579
  if (this.attribute.disabled) {
30612
30580
  return;
30613
30581
  }
@@ -30619,12 +30587,10 @@
30619
30587
  this.setAttribute('checked', true);
30620
30588
  this.setAttribute('indeterminate', false);
30621
30589
  }
30622
- const changeEvent = new CustomEvent('checkbox_state_change', {
30590
+ this._dispatchEvent('checkbox_state_change', {
30623
30591
  eventType: 'checkbox_state_change',
30624
30592
  checked: this.attribute.checked
30625
30593
  });
30626
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
30627
- this.dispatchEvent(changeEvent);
30628
30594
  }
30629
30595
  }
30630
30596
  CheckBox.defaultAttributes = {
@@ -30665,7 +30631,7 @@
30665
30631
  }
30666
30632
  };
30667
30633
 
30668
- const version = "0.17.1";
30634
+ const version = "0.17.2-alpha.0";
30669
30635
 
30670
30636
  exports.AbstractComponent = AbstractComponent;
30671
30637
  exports.ArcInfo = ArcInfo;