@visactor/vtable 0.23.1-alpha.2 → 0.23.1

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 (99) hide show
  1. package/cjs/PivotChart.d.ts +0 -1
  2. package/cjs/PivotChart.js +0 -4
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/components/axis/axis.js +2 -3
  5. package/cjs/components/axis/axis.js.map +1 -1
  6. package/cjs/components/legend/discrete-legend/discrete-legend.js +1 -2
  7. package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  8. package/cjs/core/BaseTable.d.ts +0 -3
  9. package/cjs/core/BaseTable.js +22 -39
  10. package/cjs/core/BaseTable.js.map +1 -1
  11. package/cjs/core/FouseInput.d.ts +0 -1
  12. package/cjs/core/FouseInput.js +2 -5
  13. package/cjs/core/FouseInput.js.map +1 -1
  14. package/cjs/event/event.js +1 -1
  15. package/cjs/event/event.js.map +1 -1
  16. package/cjs/event/listener/container-dom.js +1 -1
  17. package/cjs/event/listener/container-dom.js.map +1 -1
  18. package/cjs/event/util.js +2 -2
  19. package/cjs/event/util.js.map +1 -1
  20. package/cjs/index.d.ts +1 -1
  21. package/cjs/index.js +1 -1
  22. package/cjs/index.js.map +1 -1
  23. package/cjs/scenegraph/debug-tool/debug-tool.js +1 -4
  24. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  25. package/cjs/scenegraph/graphic/chart.d.ts +0 -1
  26. package/cjs/scenegraph/graphic/chart.js +20 -34
  27. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  28. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
  29. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  30. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
  31. package/cjs/scenegraph/graphic/contributions/chart-render.js +24 -40
  32. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  33. package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
  34. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  35. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +1 -2
  36. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  37. package/cjs/scenegraph/layout/compute-row-height.js +2 -2
  38. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  39. package/cjs/scenegraph/refresh-node/update-chart.d.ts +0 -1
  40. package/cjs/scenegraph/refresh-node/update-chart.js +2 -9
  41. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  42. package/cjs/scenegraph/scenegraph.js +4 -10
  43. package/cjs/scenegraph/scenegraph.js.map +1 -1
  44. package/cjs/scenegraph/utils/text-icon-layout.js +5 -5
  45. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  46. package/cjs/ts-types/base-table.d.ts +1 -11
  47. package/cjs/ts-types/base-table.js.map +1 -1
  48. package/cjs/vrender.js.map +1 -1
  49. package/dist/vtable.js +564 -960
  50. package/dist/vtable.min.js +2 -2
  51. package/es/PivotChart.d.ts +0 -1
  52. package/es/PivotChart.js +2 -5
  53. package/es/PivotChart.js.map +1 -1
  54. package/es/components/axis/axis.js +1 -3
  55. package/es/components/axis/axis.js.map +1 -1
  56. package/es/components/legend/discrete-legend/discrete-legend.js +1 -2
  57. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  58. package/es/core/BaseTable.d.ts +0 -3
  59. package/es/core/BaseTable.js +21 -38
  60. package/es/core/BaseTable.js.map +1 -1
  61. package/es/core/FouseInput.d.ts +0 -1
  62. package/es/core/FouseInput.js +2 -5
  63. package/es/core/FouseInput.js.map +1 -1
  64. package/es/event/event.js +1 -1
  65. package/es/event/event.js.map +1 -1
  66. package/es/event/listener/container-dom.js +1 -1
  67. package/es/event/listener/container-dom.js.map +1 -1
  68. package/es/event/util.js +2 -2
  69. package/es/event/util.js.map +1 -1
  70. package/es/index.d.ts +1 -1
  71. package/es/index.js +1 -1
  72. package/es/index.js.map +1 -1
  73. package/es/scenegraph/debug-tool/debug-tool.js +1 -4
  74. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  75. package/es/scenegraph/graphic/chart.d.ts +0 -1
  76. package/es/scenegraph/graphic/chart.js +21 -33
  77. package/es/scenegraph/graphic/chart.js.map +1 -1
  78. package/es/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
  79. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  80. package/es/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
  81. package/es/scenegraph/graphic/contributions/chart-render.js +25 -41
  82. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  83. package/es/scenegraph/group-creater/cell-helper.js +1 -1
  84. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  85. package/es/scenegraph/group-creater/cell-type/chart-cell.js +1 -2
  86. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  87. package/es/scenegraph/layout/compute-row-height.js +3 -1
  88. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  89. package/es/scenegraph/refresh-node/update-chart.d.ts +0 -1
  90. package/es/scenegraph/refresh-node/update-chart.js +0 -6
  91. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  92. package/es/scenegraph/scenegraph.js +4 -10
  93. package/es/scenegraph/scenegraph.js.map +1 -1
  94. package/es/scenegraph/utils/text-icon-layout.js +5 -5
  95. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  96. package/es/ts-types/base-table.d.ts +1 -11
  97. package/es/ts-types/base-table.js.map +1 -1
  98. package/es/vrender.js.map +1 -1
  99. package/package.json +8 -8
package/dist/vtable.js CHANGED
@@ -4161,8 +4161,7 @@
4161
4161
  backgroundFit: !0,
4162
4162
  blur: 0,
4163
4163
  cursor: null,
4164
- html: null,
4165
- react: null
4164
+ html: null
4166
4165
  }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
4167
4166
  const DefaultConnectAttribute = {
4168
4167
  connectedType: "none",
@@ -4386,7 +4385,7 @@
4386
4385
  function applyStrokeStyle(ctx, character) {
4387
4386
  const strokeStyle = character && character.stroke || defaultFormatting.stroke;
4388
4387
  if (!strokeStyle) return void (ctx.globalAlpha = 0);
4389
- ctx.globalAlpha = 1, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle;
4388
+ ctx.globalAlpha = 1, ctx.lineWidth = character && "number" == typeof character.lineHeight ? character.lineHeight : 1, ctx.strokeStyle = strokeStyle;
4390
4389
  let fontSize = character.fontSize || 16;
4391
4390
  switch (character.script) {
4392
4391
  case "super":
@@ -4814,37 +4813,28 @@
4814
4813
  constructor() {
4815
4814
  this.hooks = {
4816
4815
  onChange: new SyncHook(["x", "y", "width", "height"])
4817
- }, this.active = () => {
4818
- const global = this.global;
4819
- if (!global.env || this.actived) return;
4820
- container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
4821
4816
  }, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
4822
4817
  }
4823
4818
  postInit() {
4824
- this.global.hooks.onSetEnv.tap("window", this.active), this.active();
4819
+ this.global.hooks.onSetEnv.tap("window", () => {
4820
+ this.active();
4821
+ }), this.active();
4822
+ }
4823
+ active() {
4824
+ const global = this.global;
4825
+ if (!global.env || this.actived) return;
4826
+ container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
4825
4827
  }
4826
4828
  get style() {
4827
- var _a;
4828
- return null !== (_a = this._handler.getStyle()) && void 0 !== _a ? _a : {};
4829
+ return this._handler.getStyle();
4829
4830
  }
4830
4831
  set style(style) {
4831
4832
  this._handler.setStyle(style);
4832
4833
  }
4833
4834
  create(params) {
4834
- var _a, _b;
4835
4835
  this._handler.createWindow(params);
4836
4836
  const windowWH = this._handler.getWH();
4837
- this._width = windowWH.width, this._height = windowWH.height, params.viewBox ? this.setViewBox(params.viewBox) : !1 !== params.canvasControled ? this.setViewBox({
4838
- x1: 0,
4839
- y1: 0,
4840
- x2: this._width,
4841
- y2: this._height
4842
- }) : this.setViewBox({
4843
- x1: 0,
4844
- y1: 0,
4845
- x2: null !== (_a = params.width) && void 0 !== _a ? _a : this._width,
4846
- y2: null !== (_b = params.height) && void 0 !== _b ? _b : this._height
4847
- }), this.title = this._handler.getTitle(), this.resizable = !0;
4837
+ this._width = windowWH.width, this._height = windowWH.height, this.title = this._handler.getTitle(), this.resizable = !0;
4848
4838
  }
4849
4839
  setWindowHandler(handler) {
4850
4840
  this._handler = handler;
@@ -4859,7 +4849,7 @@
4859
4849
  throw new Error("暂不支持");
4860
4850
  }
4861
4851
  release() {
4862
- return this.global.hooks.onSetEnv.unTap("window", this.active), this._handler.releaseWindow();
4852
+ return this._handler.releaseWindow();
4863
4853
  }
4864
4854
  getContext() {
4865
4855
  return this._handler.getContext();
@@ -4885,35 +4875,8 @@
4885
4875
  getContainer() {
4886
4876
  return this._handler.container;
4887
4877
  }
4888
- clearViewBox(color) {
4889
- this._handler.clearViewBox(color);
4890
- }
4891
- setViewBox(viewBox) {
4892
- this._handler.setViewBox(viewBox);
4893
- }
4894
- setViewBoxTransform(a, b, c, d, e, f) {
4895
- this._handler.setViewBoxTransform(a, b, c, d, e, f);
4896
- }
4897
- getViewBox() {
4898
- return this._handler.getViewBox();
4899
- }
4900
- getViewBoxTransform() {
4901
- return this._handler.getViewBoxTransform();
4902
- }
4903
- pointTransform(x, y) {
4904
- const vb = this._handler.getViewBox(),
4905
- nextP = {
4906
- x: x,
4907
- y: y
4908
- };
4909
- return this._handler.getViewBoxTransform().transformPoint({
4910
- x: x,
4911
- y: y
4912
- }, nextP), nextP.x -= vb.x1, nextP.y -= vb.y1, nextP;
4913
- }
4914
- hasSubView() {
4915
- const viewBox = this._handler.getViewBox();
4916
- return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
4878
+ clearViewBox(viewBox, color) {
4879
+ this._handler.clearViewBox(viewBox, color);
4917
4880
  }
4918
4881
  isVisible(bbox) {
4919
4882
  return this._handler.isVisible(bbox);
@@ -4999,16 +4962,8 @@
4999
4962
  const window = container.get(VWindow),
5000
4963
  bounds = graphic.AABBBounds,
5001
4964
  width = bounds.width(),
5002
- height = bounds.height(),
5003
- x1 = -bounds.x1,
5004
- y1 = -bounds.y1;
4965
+ height = bounds.height();
5005
4966
  window.create({
5006
- viewBox: {
5007
- x1: x1,
5008
- y1: y1,
5009
- x2: bounds.x2,
5010
- y2: bounds.y2
5011
- },
5012
4967
  width: width,
5013
4968
  height: height,
5014
4969
  canvas: canvas,
@@ -5017,10 +4972,14 @@
5017
4972
  offscreen: !0,
5018
4973
  title: ""
5019
4974
  });
5020
- const disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
4975
+ const x = -bounds.x1,
4976
+ y = -bounds.y1,
4977
+ disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
5021
4978
  stage.params.optimize.disableCheckGraphicWidthOutRange = !0, stage.defaultLayer.getNativeHandler().drawTo(window, [graphic], {
5022
- transMatrix: window.getViewBoxTransform(),
5023
- viewBox: window.getViewBox(),
4979
+ x: x,
4980
+ y: y,
4981
+ width: width,
4982
+ height: height,
5024
4983
  stage: stage,
5025
4984
  layer: stage.defaultLayer,
5026
4985
  renderService: stage.renderService,
@@ -5844,7 +5803,7 @@
5844
5803
  const mappers = this.mappingTable[e.type];
5845
5804
  let target;
5846
5805
  const cacheKey = `${e.canvasX}-${e.canvasY}`;
5847
- if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.viewX, e.viewY, e), e.pickParams || (this._prePointTargetCache = {
5806
+ if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY, e), e.pickParams || (this._prePointTargetCache = {
5848
5807
  [cacheKey]: target,
5849
5808
  stageRenderCount: null !== (_g = null == target ? void 0 : target.stage.renderCount) && void 0 !== _g ? _g : -1
5850
5809
  })), mappers) for (let i = 0, j = mappers.length; i < j; i++) mappers[i].fn(e, target);else Logger.getInstance().warn(`[EventManager]: Event mapping not defined for ${e.type}`);
@@ -5879,14 +5838,12 @@
5879
5838
  return currentTarget;
5880
5839
  }
5881
5840
  createPointerEvent(from, type, target) {
5882
- var _a, _b;
5883
5841
  const event = this.allocateEvent(FederatedPointerEvent);
5884
- return this.copyPointerData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(null !== (_a = event.viewX) && void 0 !== _a ? _a : event.global.x, null !== (_b = event.viewY) && void 0 !== _b ? _b : event.global.y, event), "string" == typeof type && (event.type = type), event;
5842
+ return this.copyPointerData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(event.global.x, event.global.y, event), "string" == typeof type && (event.type = type), event;
5885
5843
  }
5886
5844
  createWheelEvent(from, target) {
5887
- var _a, _b;
5888
5845
  const event = this.allocateEvent(FederatedWheelEvent);
5889
- return this.copyWheelData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(null !== (_a = event.viewX) && void 0 !== _a ? _a : event.global.x, null !== (_b = event.viewY) && void 0 !== _b ? _b : event.global.y, event), event;
5846
+ return this.copyWheelData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(event.global.x, event.global.y, event), event;
5890
5847
  }
5891
5848
  clonePointerEvent(from, type) {
5892
5849
  const event = this.allocateEvent(FederatedPointerEvent);
@@ -5943,9 +5900,6 @@
5943
5900
  const pickResult = this.rootTarget.pick(x, y);
5944
5901
  return target = pickResult && pickResult.graphic ? pickResult.graphic : pickResult && pickResult.group ? pickResult.group : this.rootTarget.AABBBounds.contains(x, y) ? this.rootTarget : null, e && (e.pickParams = pickResult.params), target;
5945
5902
  }
5946
- release() {
5947
- this.dispatch.removeAllListeners(), this.eventPool.clear(), this.rootTarget = null, this.mappingTable = null, this.mappingState = null, this.cursorTarget = null;
5948
- }
5949
5903
  };
5950
5904
 
5951
5905
  const EventTarget$2 = {
@@ -5993,7 +5947,7 @@
5993
5947
  this.setCursor(this.manager.cursor, this.manager.cursorTarget);
5994
5948
  }, this.onPointerUp = nativeEvent => {
5995
5949
  if (this.supportsTouchEvents && "touch" === nativeEvent.pointerType) return;
5996
- const outside = this.isEventOutsideOfTargetViewPort(nativeEvent) ? "outside" : "",
5950
+ const outside = this.isEventOutsideOfTargetElement(nativeEvent) ? "outside" : "",
5997
5951
  normalizedEvents = this.normalizeToPointerData(nativeEvent);
5998
5952
  for (let i = 0, j = normalizedEvents.length; i < j; i++) {
5999
5953
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
@@ -6017,6 +5971,7 @@
6017
5971
  resolution: resolution,
6018
5972
  rootNode: rootNode,
6019
5973
  global: global,
5974
+ viewport: viewport,
6020
5975
  autoPreventDefault = !1,
6021
5976
  clickInterval: clickInterval,
6022
5977
  supportsTouchEvents = global.supportsTouchEvents,
@@ -6024,13 +5979,13 @@
6024
5979
  } = params;
6025
5980
  this.manager = new EventManager$1(rootNode, {
6026
5981
  clickInterval: clickInterval
6027
- }), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
5982
+ }), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.viewport = viewport, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
6028
5983
  default: "inherit",
6029
5984
  pointer: "pointer"
6030
5985
  }, this.resolution = resolution, this.setTargetElement(targetElement);
6031
5986
  }
6032
5987
  release() {
6033
- this.removeEvents(), this.manager && this.manager.release(), this.domElement = null, this.manager = null, this.globalObj = null;
5988
+ this.setTargetElement(null);
6034
5989
  }
6035
5990
  setCursor(mode, target) {
6036
5991
  if (!target && !this.manager.rootTarget.window._handler.canvas.controled) return;
@@ -6066,19 +6021,25 @@
6066
6021
  this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.getDocument().removeEventListener("pointermove", this.onPointerMove, !0), globalObj.getDocument().removeEventListener("pointerup", this.onPointerUp, !0)) : (domElement.removeEventListener("pointermove", this.onPointerMove, !0), domElement.removeEventListener("pointerup", this.onPointerUp, !0)), domElement.removeEventListener("pointerdown", this.onPointerDown, !0), domElement.removeEventListener("pointerleave", this.onPointerOverOut, !0), domElement.removeEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.getDocument().removeEventListener("mousemove", this.onPointerMove, !0), globalObj.getDocument().removeEventListener("mouseup", this.onPointerUp, !0)) : (domElement.removeEventListener("mousemove", this.onPointerMove, !0), domElement.removeEventListener("mouseup", this.onPointerUp, !0)), domElement.removeEventListener("mousedown", this.onPointerDown, !0), domElement.removeEventListener("mouseout", this.onPointerOverOut, !0), domElement.removeEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.removeEventListener("touchstart", this.onPointerDown, !0), domElement.removeEventListener("touchend", this.onPointerUp, !0), domElement.removeEventListener("touchmove", this.onPointerMove, !0)), domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this.eventsAdded = !1;
6067
6022
  }
6068
6023
  mapToViewportPoint(event) {
6069
- return this.domElement.pointTransform ? this.domElement.pointTransform(event.x, event.y) : event;
6024
+ const viewport = this.viewport,
6025
+ {
6026
+ x: x,
6027
+ y: y
6028
+ } = event;
6029
+ return {
6030
+ x: x - viewport.x,
6031
+ y: y - viewport.y
6032
+ };
6070
6033
  }
6071
6034
  mapToCanvasPoint(nativeEvent) {
6072
- var _a, _b;
6035
+ var _a;
6073
6036
  const point = null === (_a = this.globalObj) || void 0 === _a ? void 0 : _a.mapToCanvasPoint(nativeEvent, this.domElement);
6074
6037
  if (point) return point;
6075
- let x = 0,
6076
- y = 0;
6077
- if (nativeEvent.changedTouches) {
6078
- const data = null !== (_b = nativeEvent.changedTouches[0]) && void 0 !== _b ? _b : {};
6079
- x = data.clientX || 0, y = data.clientY || 0;
6080
- } else x = nativeEvent.clientX || 0, y = nativeEvent.clientY || 0;
6081
- const rect = this.domElement.getBoundingClientRect();
6038
+ const {
6039
+ clientX: x,
6040
+ clientY: y
6041
+ } = nativeEvent,
6042
+ rect = this.domElement.getBoundingClientRect();
6082
6043
  return {
6083
6044
  x: x - rect.left,
6084
6045
  y: y - rect.top
@@ -6125,17 +6086,6 @@
6125
6086
  transferMouseData(event, nativeEvent) {
6126
6087
  event.isTrusted = nativeEvent.isTrusted, event.srcElement = nativeEvent.srcElement, event.timeStamp = clock.now(), event.type = nativeEvent.type, event.altKey = nativeEvent.altKey, event.button = nativeEvent.button, event.buttons = nativeEvent.buttons, event.client.x = nativeEvent.clientX, event.client.y = nativeEvent.clientY, event.ctrlKey = nativeEvent.ctrlKey, event.shiftKey = nativeEvent.shiftKey, event.metaKey = nativeEvent.metaKey, event.movement.x = nativeEvent.movementX, event.movement.y = nativeEvent.movementY, event.page.x = nativeEvent.pageX, event.page.y = nativeEvent.pageY, event.relatedTarget = null;
6127
6088
  }
6128
- isEventOutsideOfTargetViewPort(nativeEvent) {
6129
- if (this.isEventOutsideOfTargetElement(nativeEvent)) return !0;
6130
- if (this.domElement.getViewBox) {
6131
- const p = this.mapToViewportPoint(this.mapToCanvasPoint(nativeEvent)),
6132
- b = this.domElement.getViewBox(),
6133
- w = b.width(),
6134
- h = b.height();
6135
- return !(p.x < w && p.y < h && p.x > 0 && p.y > 0);
6136
- }
6137
- return !1;
6138
- }
6139
6089
  isEventOutsideOfTargetElement(nativeEvent) {
6140
6090
  let target = nativeEvent.target;
6141
6091
  nativeEvent.composedPath && nativeEvent.composedPath().length > 0 && (target = nativeEvent.composedPath()[0]);
@@ -7160,9 +7110,9 @@
7160
7110
  promises.push(end);
7161
7111
  } else data.loadState = "fail", marks.forEach(mark => mark.imageLoadFail(url));
7162
7112
  }), Promise.all(promises).then(() => {
7163
- ResourceLoader.isLoading = !1, this.onLoadSuccessCb.forEach(cb => cb()), ResourceLoader.loading();
7113
+ ResourceLoader.isLoading = !1, ResourceLoader.loading();
7164
7114
  }).catch(error => {
7165
- ResourceLoader.isLoading = !1, this.onLoadSuccessCb.forEach(cb => cb()), ResourceLoader.loading();
7115
+ ResourceLoader.isLoading = !1, ResourceLoader.loading();
7166
7116
  });
7167
7117
  }
7168
7118
  }, 0);
@@ -7182,15 +7132,12 @@
7182
7132
  ResourceLoader.toLoadAueue.unshift(elememt[0]);
7183
7133
  }
7184
7134
  }
7185
- static onLoadSuccess(cb) {
7186
- this.onLoadSuccessCb.push(cb);
7187
- }
7188
7135
  }
7189
7136
  function getIndex(url, arr) {
7190
7137
  for (let i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
7191
7138
  return -1;
7192
7139
  }
7193
- ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [], ResourceLoader.onLoadSuccessCb = [];
7140
+ ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [];
7194
7141
 
7195
7142
  const tempMatrix = new Matrix(),
7196
7143
  tempBounds$1 = new AABBBounds$1();
@@ -7297,7 +7244,7 @@
7297
7244
  }
7298
7245
  tryUpdateGlobalAABBBounds() {
7299
7246
  const b = this.AABBBounds;
7300
- return this._globalAABBBounds ? this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2) : this._globalAABBBounds = b.clone(), this._globalAABBBounds.empty() || this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
7247
+ return this._globalAABBBounds ? this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2) : this._globalAABBBounds = b.clone(), this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
7301
7248
  }
7302
7249
  tryUpdateGlobalTransMatrix() {
7303
7250
  if (this._globalTransMatrix) {
@@ -8374,12 +8321,15 @@
8374
8321
  }
8375
8322
  render(params, userParams) {
8376
8323
  var _a;
8324
+ const stage = this.stage;
8377
8325
  this.layerHandler.render([this], {
8378
8326
  renderService: params.renderService,
8327
+ x: stage.x,
8328
+ y: stage.y,
8329
+ width: this.viewWidth,
8330
+ height: this.viewHeight,
8379
8331
  stage: this.stage,
8380
8332
  layer: this,
8381
- viewBox: params.viewBox,
8382
- transMatrix: params.transMatrix,
8383
8333
  background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8384
8334
  updateBounds: params.updateBounds
8385
8335
  }, userParams), this.afterDrawCbs.forEach(c => c(this)), this.tryRenderSecondaryLayer(params, userParams);
@@ -8403,18 +8353,33 @@
8403
8353
  throw new Error("暂不支持");
8404
8354
  }
8405
8355
  prepare(dirtyBounds, params) {}
8356
+ combineTo(target, params) {
8357
+ var _a, _b, _c;
8358
+ this.offscreen && (this.layerHandler.drawTo(target, [this], Object.assign({
8359
+ background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8360
+ renderService: params.renderService,
8361
+ x: null !== (_b = params.x) && void 0 !== _b ? _b : this.stage.x,
8362
+ y: null !== (_c = params.y) && void 0 !== _c ? _c : this.stage.y,
8363
+ width: this.viewWidth,
8364
+ height: this.viewHeight,
8365
+ stage: this.stage,
8366
+ layer: this
8367
+ }, params)), this.afterDrawCbs.forEach(c => c(this)));
8368
+ }
8406
8369
  release() {
8407
8370
  super.release(), this.layerHandler.release(), this.subLayers && this.subLayers.forEach(l => {
8408
8371
  application.layerService.releaseLayer(this.stage, l.layer);
8409
8372
  });
8410
8373
  }
8411
8374
  drawTo(target, params) {
8412
- var _a;
8375
+ var _a, _b, _c;
8413
8376
  this.layerHandler.drawTo(target, [this], Object.assign({
8414
8377
  background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8415
8378
  renderService: params.renderService,
8416
- viewBox: params.viewBox,
8417
- transMatrix: params.transMatrix,
8379
+ x: null !== (_b = params.x) && void 0 !== _b ? _b : this.stage.x,
8380
+ y: null !== (_c = params.y) && void 0 !== _c ? _c : this.stage.y,
8381
+ width: this.viewWidth,
8382
+ height: this.viewHeight,
8418
8383
  stage: this.stage,
8419
8384
  layer: this
8420
8385
  }, params)), this.afterDrawCbs.forEach(c => c(this));
@@ -8496,9 +8461,6 @@
8496
8461
  restLayerCount(stage) {
8497
8462
  return "browser" === this.global.env ? 10 : 0;
8498
8463
  }
8499
- releaseStage(stage) {
8500
- this.layerMap.delete(stage);
8501
- }
8502
8464
  };
8503
8465
  DefaultLayerService.idprefix = "visactor_layer", DefaultLayerService.prefix_count = 0, DefaultLayerService = DefaultLayerService_1 = __decorate$1a([injectable(), __metadata$T("design:paramtypes", [])], DefaultLayerService);
8504
8466
 
@@ -8535,9 +8497,7 @@
8535
8497
  fillOpacity = themeAttributes.fillOpacity,
8536
8498
  lineWidth = themeAttributes.lineWidth,
8537
8499
  strokeOpacity = themeAttributes.strokeOpacity,
8538
- visible = themeAttributes.visible,
8539
- x: originX = themeAttributes.x,
8540
- y: originY = themeAttributes.y
8500
+ visible = themeAttributes.visible
8541
8501
  } = graphic.attribute,
8542
8502
  fVisible = fillVisible(opacity, fillOpacity, fill),
8543
8503
  sVisible = strokeVisible(opacity, strokeOpacity),
@@ -8548,7 +8508,7 @@
8548
8508
  if (!(fVisible || sVisible || fillCb || strokeCb)) return !0;
8549
8509
  context.beginPath();
8550
8510
  const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
8551
- return renderCommandList(path.commandList, context, x, y), context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes), doStroke && (strokeCb ? strokeCb(context, graphic.attribute, themeAttributes) : sVisible && (context.setStrokeStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes), context.stroke())), doFill && (fillCb ? fillCb(context, graphic.attribute, themeAttributes) : fVisible && (context.setCommonStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes), context.fill())), !0;
8511
+ return renderCommandList(path.commandList, context, x, y), context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes), doStroke && (strokeCb ? strokeCb(context, graphic.attribute, themeAttributes) : sVisible && (context.setStrokeStyle(graphic, graphic.attribute, x, y, themeAttributes), context.stroke())), doFill && (fillCb ? fillCb(context, graphic.attribute, themeAttributes) : fVisible && (context.setCommonStyle(graphic, graphic.attribute, x, y, themeAttributes), context.fill())), !0;
8552
8512
  }
8553
8513
  function intersect$2(x0, y0, x1, y1, x2, y2, x3, y3) {
8554
8514
  const x10 = x1 - x0,
@@ -11037,8 +10997,7 @@
11037
10997
  fontSize: fontSize,
11038
10998
  fontFamily: fontFamily,
11039
10999
  fontStyle: fontStyle,
11040
- fontWeight: fontWeight,
11041
- lineWidth: lineWidth
11000
+ fontWeight: fontWeight
11042
11001
  } = this.attribute;
11043
11002
  return Object.assign({
11044
11003
  fill: fill,
@@ -11046,8 +11005,7 @@
11046
11005
  fontSize: fontSize,
11047
11006
  fontFamily: fontFamily,
11048
11007
  fontStyle: fontStyle,
11049
- fontWeight: fontWeight,
11050
- lineWidth: lineWidth
11008
+ fontWeight: fontWeight
11051
11009
  }, config);
11052
11010
  }
11053
11011
  doUpdateFrameCache() {
@@ -14346,9 +14304,7 @@
14346
14304
  const endSeg = segments[segments.length - 1];
14347
14305
  startP = segments[0].points[0], endP = endSeg.points[endSeg.points.length - 1];
14348
14306
  } else startP = points[0], endP = points[points.length - 1];
14349
- const xTotalLength = abs(endP.x - startP.x),
14350
- yTotalLength = abs(endP.y - startP.y);
14351
- direction = Number.isFinite(xTotalLength + yTotalLength) ? xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN : Direction.ROW, drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
14307
+ direction = abs(endP.x - startP.x) > abs(endP.y - startP.y) ? Direction.ROW : Direction.COLUMN, drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
14352
14308
  offsetX: offsetX,
14353
14309
  offsetY: offsetY,
14354
14310
  offsetZ: offsetZ,
@@ -14726,7 +14682,7 @@
14726
14682
  doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
14727
14683
  context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
14728
14684
  }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
14729
- context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, line.width, textAttribute, context);
14685
+ context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, line.width, textAttribute, context);
14730
14686
  })));
14731
14687
  } else {
14732
14688
  text.tryUpdateAABBBounds();
@@ -14828,6 +14784,7 @@
14828
14784
  drawMultiUnderLine(underline, lineThrough, text, x, y, z, w, textAttribute, context) {
14829
14785
  if (lineThrough + underline <= 0) return;
14830
14786
  const {
14787
+ textAlign = textAttribute.textAlign,
14831
14788
  fontSize = textAttribute.fontSize,
14832
14789
  fill = textAttribute.fill,
14833
14790
  opacity = textAttribute.opacity,
@@ -14835,6 +14792,7 @@
14835
14792
  underlineDash = textAttribute.underlineDash,
14836
14793
  fillOpacity = textAttribute.fillOpacity
14837
14794
  } = text.attribute,
14795
+ offsetX = textDrawOffsetX(textAlign, w),
14838
14796
  offsetY = textLayoutOffsetY("alphabetic", fontSize, fontSize),
14839
14797
  attribute = {
14840
14798
  lineWidth: 0,
@@ -14846,12 +14804,12 @@
14846
14804
  if (underline) {
14847
14805
  attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
14848
14806
  const dy = y + offsetY + fontSize + deltaY + underlineOffset;
14849
- context.moveTo(x + 0, dy, z), context.lineTo(x + 0 + w, dy, z), context.stroke();
14807
+ context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
14850
14808
  }
14851
14809
  if (deltaY = -1, lineThrough) {
14852
14810
  attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
14853
14811
  const dy = y + offsetY + fontSize / 2 + deltaY;
14854
- context.moveTo(x + 0, dy, z), context.lineTo(x + 0 + w, dy, z), context.stroke();
14812
+ context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
14855
14813
  }
14856
14814
  }
14857
14815
  };
@@ -15648,10 +15606,10 @@
15648
15606
  render(group, params) {
15649
15607
  var _a;
15650
15608
  params.renderService.render(group, Object.assign(Object.assign({
15651
- context: this.context,
15652
- viewBox: params.stage.window.getViewBox(),
15653
- transMatrix: params.stage.window.getViewBoxTransform()
15609
+ context: this.context
15654
15610
  }, params), {
15611
+ x: 0,
15612
+ y: 0,
15655
15613
  clear: null !== (_a = params.background) && void 0 !== _a ? _a : "#ffffff"
15656
15614
  }));
15657
15615
  }
@@ -15666,12 +15624,11 @@
15666
15624
  const context = target.getContext(),
15667
15625
  targetDpr = target.dpr,
15668
15626
  {
15669
- viewBox: viewBox
15670
- } = params,
15671
- x = viewBox.x1,
15672
- y = viewBox.y1,
15673
- width = viewBox.width(),
15674
- height = viewBox.height();
15627
+ x = 0,
15628
+ y = 0,
15629
+ width = this.layer.viewWidth,
15630
+ height = this.layer.viewHeight
15631
+ } = params;
15675
15632
  context.nativeContext.save(), context.nativeContext.setTransform(targetDpr, 0, 0, targetDpr, 0, 0), params.clear && context.clearRect(x, y, width, height), context.drawImage(this.canvas.nativeCanvas, 0, 0, this.canvas.width, this.canvas.height, x, y, width, height), context.nativeContext.restore();
15676
15633
  }
15677
15634
  merge(layerHandlers) {}
@@ -15827,22 +15784,32 @@
15827
15784
  const {
15828
15785
  context: context,
15829
15786
  stage: stage,
15830
- viewBox: viewBox,
15831
- transMatrix: transMatrix
15787
+ x = 0,
15788
+ y = 0,
15789
+ width: width,
15790
+ height: height
15832
15791
  } = drawContext;
15833
15792
  if (!context) return;
15834
- const dirtyBounds = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());
15793
+ if (drawContext.keepMatrix) {
15794
+ if (context.nativeContext && context.nativeContext.getTransform) {
15795
+ const t = context.nativeContext.getTransform();
15796
+ context.setTransformFromMatrix(t, !0, 1);
15797
+ }
15798
+ } else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
15799
+ const dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
15835
15800
  if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
15836
15801
  const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
15837
15802
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
15838
15803
  }
15839
15804
  const d = context.dpr % 1;
15840
- (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.inuse = !0, context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f), context.clearMatrix(), context.setTransformForCurrent(!0), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort((a, b) => {
15805
+ (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds);
15806
+ const drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
15807
+ context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort((a, b) => {
15841
15808
  var _a, _b;
15842
15809
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
15843
15810
  }).forEach(group => {
15844
15811
  group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
15845
- }), context.restore(), context.draw(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1;
15812
+ }), context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1);
15846
15813
  }
15847
15814
  doRegister() {
15848
15815
  throw new Error("暂不支持");
@@ -15966,25 +15933,29 @@
15966
15933
  clearScreen(renderService, context, drawContext) {
15967
15934
  var _a, _b;
15968
15935
  const {
15969
- clear: clear,
15970
- viewBox: viewBox
15971
- } = drawContext,
15972
- width = viewBox.width(),
15973
- height = viewBox.height();
15936
+ clear: clear
15937
+ } = drawContext;
15974
15938
  if (clear) {
15975
- context.clearRect(0, 0, width, height);
15939
+ const canvas = context.getCanvas(),
15940
+ {
15941
+ width = canvas.width,
15942
+ height = canvas.height
15943
+ } = drawContext,
15944
+ x = 0,
15945
+ y = 0;
15946
+ context.clearRect(x, y, width, height);
15976
15947
  const stage = null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage;
15977
15948
  if (stage && (context.globalAlpha = null !== (_b = stage.attribute.opacity) && void 0 !== _b ? _b : 1), stage && stage.backgroundImg && stage.resources) {
15978
15949
  const res = stage.resources.get(clear);
15979
- res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
15950
+ res && "success" === res.state && res.data && context.drawImage(res.data, x, y, width, height);
15980
15951
  } else context.fillStyle = createColor(context, clear, {
15981
15952
  AABBBounds: {
15982
- x1: 0,
15983
- y1: 0,
15984
- x2: 0 + width,
15985
- y2: 0 + height
15953
+ x1: x,
15954
+ y1: y,
15955
+ x2: x + width,
15956
+ y2: y + height
15986
15957
  }
15987
- }, 0, 0), context.fillRect(0, 0, width, height);
15958
+ }, 0, 0), context.fillRect(x, y, width, height);
15988
15959
  }
15989
15960
  }
15990
15961
  afterDraw(renderService, drawParams) {}
@@ -16241,16 +16212,25 @@
16241
16212
  this.currentRenderService = renderService;
16242
16213
  const {
16243
16214
  context: context,
16244
- viewBox: viewBox
16215
+ x = 0,
16216
+ y = 0
16245
16217
  } = drawContext;
16246
- context && (context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(viewBox.x1, viewBox.y1, !0), context.save(), renderService.renderTreeRoots.sort((a, b) => {
16247
- var _a, _b;
16248
- return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16249
- }).forEach(group => {
16250
- this.renderGroup(group, drawContext);
16251
- }), this.hooks.completeDraw.tap("top-draw", () => {
16252
- context.restore(), context.restore(), context.draw(), context.inuse = !1, this.rendering = !1;
16253
- }));
16218
+ if (context) {
16219
+ if (drawContext.keepMatrix) {
16220
+ if (context.nativeContext && context.nativeContext.getTransform) {
16221
+ const t = context.nativeContext.getTransform();
16222
+ context.setTransformFromMatrix(t, !0, 1);
16223
+ }
16224
+ } else context.inuse = !0, context.clearMatrix();
16225
+ context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort((a, b) => {
16226
+ var _a, _b;
16227
+ return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16228
+ }).forEach(group => {
16229
+ this.renderGroup(group, drawContext);
16230
+ }), this.hooks.completeDraw.tap("top-draw", () => {
16231
+ context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1), this.rendering = !1;
16232
+ });
16233
+ }
16254
16234
  });
16255
16235
  }
16256
16236
  _increaseRender(group, drawContext) {
@@ -16420,10 +16400,12 @@
16420
16400
  if (!layer || !group.layer.subLayers) return;
16421
16401
  const subLayer = group.layer.subLayers.get(group._uid);
16422
16402
  subLayer && subLayer.drawContribution && subLayer.drawContribution.draw(stage.renderService, Object.assign({
16403
+ x: stage.x,
16404
+ y: stage.y,
16405
+ width: layer.viewWidth,
16406
+ height: layer.viewHeight,
16423
16407
  stage: stage,
16424
16408
  layer: layer,
16425
- viewBox: stage.window.getViewBox(),
16426
- transMatrix: stage.window.getViewBoxTransform(),
16427
16409
  clear: "transparent",
16428
16410
  renderService: stage.renderService,
16429
16411
  updateBounds: !1,
@@ -16436,7 +16418,7 @@
16436
16418
 
16437
16419
  class HtmlAttributePlugin {
16438
16420
  constructor() {
16439
- this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.lastDomContainerSet = new Set(), this.currentDomContainerSet = new Set();
16421
+ this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid;
16440
16422
  }
16441
16423
  activate(context) {
16442
16424
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
@@ -16448,17 +16430,15 @@
16448
16430
  });
16449
16431
  }
16450
16432
  deactivate(context) {
16451
- context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => item.name !== this.key), application.graphicService.hooks.onRemove.unTap(this.key), application.graphicService.hooks.onRelease.unTap(this.key), this.release();
16433
+ context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => item.name !== this.key);
16452
16434
  }
16453
16435
  drawHTML(renderService) {
16454
- "browser" === application.global.env && (renderService.renderTreeRoots.sort((a, b) => {
16436
+ "browser" === application.global.env && renderService.renderTreeRoots.sort((a, b) => {
16455
16437
  var _a, _b;
16456
16438
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16457
16439
  }).forEach(group => {
16458
16440
  this.renderGroupHTML(group);
16459
- }), this.lastDomContainerSet.forEach(item => {
16460
- this.currentDomContainerSet.has(item) || item.parentElement && item.parentElement.removeChild(item);
16461
- }), this.lastDomContainerSet = new Set(this.currentDomContainerSet), this.currentDomContainerSet.clear());
16441
+ });
16462
16442
  }
16463
16443
  renderGroupHTML(group) {
16464
16444
  this.renderGraphicHTML(group), group.forEachChildren(g => {
@@ -16485,8 +16465,7 @@
16485
16465
  width: width,
16486
16466
  height: height,
16487
16467
  style: style,
16488
- anchorType = "boundsLeftTop",
16489
- pointerEvents: pointerEvents
16468
+ anchorType = "boundsLeftTop"
16490
16469
  } = html;
16491
16470
  graphic.bindDom || (graphic.bindDom = new Map());
16492
16471
  const lastDom = graphic.bindDom.get(dom);
@@ -16512,7 +16491,7 @@
16512
16491
  wrapGroup: wrapGroup
16513
16492
  }));
16514
16493
  } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
16515
- wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
16494
+ wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
16516
16495
  let left = 0,
16517
16496
  top = 0;
16518
16497
  const b = graphic.globalAABBBounds;
@@ -16524,15 +16503,7 @@
16524
16503
  windowTL = stage.window.getTopLeft(!1),
16525
16504
  offsetX = left + windowTL.left - containerTL.left,
16526
16505
  offsetTop = top + windowTL.top - containerTL.top;
16527
- wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`, this.currentDomContainerSet.add(wrapGroup);
16528
- }
16529
- release() {
16530
- "browser" === application.global.env && (this.removeAllDom(this.pluginService.stage.defaultLayer), this.lastDomContainerSet.clear(), this.currentDomContainerSet.clear());
16531
- }
16532
- removeAllDom(g) {
16533
- this.removeDom(g), g.forEachChildren(item => {
16534
- item.isContainer && this.removeAllDom(g);
16535
- });
16506
+ wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`;
16536
16507
  }
16537
16508
  }
16538
16509
 
@@ -16979,78 +16950,6 @@
16979
16950
  return env ? "node" === env : !_isBrowserEnv;
16980
16951
  }
16981
16952
 
16982
- class ReactAttributePlugin extends HtmlAttributePlugin {
16983
- constructor() {
16984
- super(...arguments), this.name = "ReactAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid;
16985
- }
16986
- removeDom(graphic) {
16987
- graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(item => {
16988
- item.root && item.root.unmount();
16989
- }), graphic.bindDom.clear());
16990
- }
16991
- renderGraphicHTML(graphic) {
16992
- const {
16993
- react: react
16994
- } = graphic.attribute;
16995
- if (!react) return void (graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(item => {
16996
- item.root && item.root.unmount();
16997
- }), graphic.bindDom.clear()));
16998
- const stage = graphic.stage;
16999
- if (!stage) return;
17000
- const ReactDOM = stage.params.ReactDOM,
17001
- {
17002
- element: element,
17003
- container: container,
17004
- width: width,
17005
- height: height,
17006
- style: style,
17007
- anchorType = "boundsLeftTop",
17008
- pointerEvents: pointerEvents
17009
- } = react;
17010
- if (!(element && ReactDOM && ReactDOM.createRoot)) return;
17011
- graphic.bindDom || (graphic.bindDom = new Map());
17012
- const lastDom = graphic.bindDom.get(element);
17013
- let wrapGroup, nativeContainer;
17014
- if (!lastDom || container && container !== lastDom.container) {
17015
- graphic.bindDom.forEach(_ref => {
17016
- let {
17017
- wrapGroup: wrapGroup
17018
- } = _ref;
17019
- application.global.removeDom(wrapGroup);
17020
- });
17021
- const _container = container;
17022
- if (nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
17023
- tagName: "div",
17024
- width: width,
17025
- height: height,
17026
- style: style,
17027
- parent: nativeContainer
17028
- }), wrapGroup) {
17029
- const root = ReactDOM.createRoot(wrapGroup);
17030
- root.render(element), graphic.bindDom.set(element, {
17031
- dom: element,
17032
- container: container,
17033
- wrapGroup: wrapGroup,
17034
- root: root
17035
- });
17036
- }
17037
- } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
17038
- wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
17039
- let left = 0,
17040
- top = 0;
17041
- const b = graphic.globalAABBBounds;
17042
- if ("position" === anchorType || b.empty()) {
17043
- const matrix = graphic.globalTransMatrix;
17044
- left = matrix.e, top = matrix.f;
17045
- } else left = b.x1, top = b.y1;
17046
- const containerTL = application.global.getElementTopLeft(nativeContainer, !1),
17047
- windowTL = stage.window.getTopLeft(!1),
17048
- offsetX = left + windowTL.left - containerTL.left,
17049
- offsetTop = top + windowTL.top - containerTL.top;
17050
- wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`;
17051
- }
17052
- }
17053
-
17054
16953
  const DefaultConfig$1 = {
17055
16954
  WIDTH: 500,
17056
16955
  HEIGHT: 500,
@@ -17060,24 +16959,22 @@
17060
16959
  };
17061
16960
  class Stage extends Group$2 {
17062
16961
  set viewBox(b) {
17063
- this.window.setViewBox(b);
16962
+ this._viewBox.setValue(b.x1, b.y1, b.x2, b.y2);
17064
16963
  }
17065
16964
  get viewBox() {
17066
- return this.window.getViewBox();
16965
+ return this._viewBox;
17067
16966
  }
17068
16967
  get x() {
17069
- return this.window.getViewBox().x1;
16968
+ return this._viewBox.x1;
17070
16969
  }
17071
16970
  set x(x) {
17072
- const b = this.window.getViewBox();
17073
- b.translate(x - b.x1, 0), this.window.setViewBox(b);
16971
+ this._viewBox.translate(x - this._viewBox.x1, 0);
17074
16972
  }
17075
16973
  get y() {
17076
- return this.window.getViewBox().y1;
16974
+ return this._viewBox.y1;
17077
16975
  }
17078
16976
  set y(y) {
17079
- const b = this.window.getViewBox();
17080
- b.translate(0, y - b.y1), this.window.setViewBox(b);
16977
+ this._viewBox.translate(0, y - this._viewBox.y1);
17081
16978
  }
17082
16979
  get width() {
17083
16980
  return this.window.width;
@@ -17086,13 +16983,13 @@
17086
16983
  this.resize(w, this.height);
17087
16984
  }
17088
16985
  get viewWidth() {
17089
- return this.window.getViewBox().width();
16986
+ return this._viewBox.width();
17090
16987
  }
17091
16988
  set viewWidth(w) {
17092
16989
  this.resizeView(w, this.viewHeight);
17093
16990
  }
17094
16991
  get viewHeight() {
17095
- return this.window.getViewBox().height();
16992
+ return this._viewBox.height();
17096
16993
  }
17097
16994
  set viewHeight(h) {
17098
16995
  this.resizeView(this.viewWidth, h);
@@ -17126,13 +17023,7 @@
17126
17023
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17127
17024
  var _a;
17128
17025
  super({}), this._onVisibleChange = visible => {
17129
- if (!(this._skipRender < 0)) if (visible) {
17130
- if (this.dirtyBounds) {
17131
- const b = this.window.getViewBox();
17132
- this.dirtyBounds.setValue(b.x1, b.y1, b.width(), b.height());
17133
- }
17134
- this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
17135
- } else this._skipRender = 1;
17026
+ this._skipRender < 0 || (visible ? (this.dirtyBounds && this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height()), this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0) : this._skipRender = 1);
17136
17027
  }, this.beforeRender = stage => {
17137
17028
  this._beforeRender && this._beforeRender(stage);
17138
17029
  }, this.afterRender = stage => {
@@ -17143,24 +17034,17 @@
17143
17034
  }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.pluginService.active(this, params), this.window.create({
17144
17035
  width: params.width,
17145
17036
  height: params.height,
17146
- viewBox: params.viewBox,
17147
17037
  container: params.container,
17148
17038
  dpr: params.dpr || this.global.devicePixelRatio,
17149
17039
  canvasControled: !1 !== params.canvasControled,
17150
17040
  title: params.title || "",
17151
17041
  canvas: params.canvas
17152
- }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
17042
+ }), this._viewBox = new AABBBounds$1(), params.viewBox ? this._viewBox.setValue(params.viewBox.x1, params.viewBox.y1, params.viewBox.x2, params.viewBox.y2) : this._viewBox.setValue(0, 0, this.width, this.height), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._subView = !(this._viewBox.width() === this.width && this._viewBox.height() === this.height), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
17153
17043
  main: !0
17154
- })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new DefaultTimeline(), this.ticker.addTimeline(this.timeline), this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize), params.background && isString$4(this._background) && this._background.includes("/") && this.setAttributes({
17044
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new DefaultTimeline(), this.ticker.addTimeline(this.timeline), this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize), params.background && isString$4(this._background) && this._background.includes("/") && this.setAttributes({
17155
17045
  background: this._background
17156
17046
  });
17157
17047
  }
17158
- pauseRender() {
17159
- this._skipRender = -1;
17160
- }
17161
- resumeRender() {
17162
- this._skipRender = 0;
17163
- }
17164
17048
  tryInitEventSystem() {
17165
17049
  this.global.supportEvent && !this._eventSystem && (this._eventSystem = new EventSystem(Object.assign({
17166
17050
  targetElement: this.window,
@@ -17168,7 +17052,22 @@
17168
17052
  rootNode: this,
17169
17053
  global: this.global,
17170
17054
  supportsPointerEvents: this.params.supportsPointerEvents,
17171
- supportsTouchEvents: this.params.supportsTouchEvents
17055
+ supportsTouchEvents: this.params.supportsTouchEvents,
17056
+ viewport: {
17057
+ viewBox: this._viewBox,
17058
+ get x() {
17059
+ return this.viewBox.x1;
17060
+ },
17061
+ get y() {
17062
+ return this.viewBox.y1;
17063
+ },
17064
+ get width() {
17065
+ return this.viewBox.width();
17066
+ },
17067
+ get height() {
17068
+ return this.viewBox.height();
17069
+ }
17070
+ }
17172
17071
  }, this.params.event)));
17173
17072
  }
17174
17073
  preventRender(prevent) {
@@ -17311,19 +17210,11 @@
17311
17210
  this.pluginService.unRegister(plugin);
17312
17211
  }));
17313
17212
  }
17314
- enableReactAttribute(container) {
17315
- this.reactAttribute || (this.reactAttribute = container, this.pluginService.register(new ReactAttributePlugin()));
17316
- }
17317
- disableReactAttribute() {
17318
- this.reactAttribute && (this.reactAttribute = !1, this.pluginService.findPluginsByName("ReactAttributePlugin").forEach(plugin => {
17319
- this.pluginService.unRegister(plugin);
17320
- }));
17321
- }
17322
17213
  getPluginsByName(name) {
17323
17214
  return this.pluginService.findPluginsByName(name);
17324
17215
  }
17325
17216
  tryUpdateAABBBounds() {
17326
- const viewBox = this.window.getViewBox();
17217
+ const viewBox = this._viewBox;
17327
17218
  return this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2), this._AABBBounds;
17328
17219
  }
17329
17220
  combineLayer(ILayer1, ILayer2) {
@@ -17350,12 +17241,12 @@
17350
17241
  this.supportInteractiveLayer && !this.interactiveLayer && (this.interactiveLayer = this.createLayer(), this.interactiveLayer.name = "_builtin_interactive", this.interactiveLayer.attribute.pickable = !1, this.nextFrameRenderLayerSet.add(this.interactiveLayer));
17351
17242
  }
17352
17243
  clearViewBox(color) {
17353
- this.window.clearViewBox(color);
17244
+ this.window.clearViewBox(this._viewBox, color);
17354
17245
  }
17355
17246
  render(layers, params) {
17356
17247
  this.ticker.start(), this.timeline.resume();
17357
17248
  const state = this.state;
17358
- this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
17249
+ this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children, params), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
17359
17250
  }
17360
17251
  combineLayersToWindow() {}
17361
17252
  renderNextFrame(layers, force) {
@@ -17368,7 +17259,7 @@
17368
17259
  _doRenderInThisFrame() {
17369
17260
  this.timeline.resume(), this.ticker.start();
17370
17261
  const state = this.state;
17371
- this.state = "rendering", this.layerService.prepareStageLayer(this), this.nextFrameRenderLayerSet.size && !this._skipRender && (this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {}), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
17262
+ this.state = "rendering", this.layerService.prepareStageLayer(this), this.nextFrameRenderLayerSet.size && !this._skipRender && (this.hooks.beforeRender.call(this), this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {}), this.combineLayersToWindow(), this.hooks.afterRender.call(this), this.nextFrameRenderLayerSet.clear()), this.state = state, this._skipRender && this._skipRender++;
17372
17263
  }
17373
17264
  renderLayerList(layerList, params) {
17374
17265
  const list = [];
@@ -17380,17 +17271,14 @@
17380
17271
  layer.renderCount > this.renderCount || (layer.renderCount = this.renderCount + 1, layer.render({
17381
17272
  renderService: this.renderService,
17382
17273
  background: layer === this.defaultLayer ? this.background : void 0,
17383
- updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty()),
17384
- viewBox: this.window.getViewBox(),
17385
- transMatrix: this.window.getViewBoxTransform()
17274
+ updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17386
17275
  }, Object.assign({
17387
- renderStyle: this.renderStyle
17276
+ renderStyle: this.renderStyle,
17277
+ keepMatrix: this.params.renderKeepMatrix
17388
17278
  }, params)));
17389
17279
  }), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
17390
17280
  renderService: this.renderService,
17391
- updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty()),
17392
- viewBox: this.window.getViewBox(),
17393
- transMatrix: this.window.getViewBoxTransform()
17281
+ updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17394
17282
  }, Object.assign({
17395
17283
  renderStyle: this.renderStyle
17396
17284
  }, params));
@@ -17401,9 +17289,9 @@
17401
17289
  }
17402
17290
  resize(w, h) {
17403
17291
  let rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
17404
- this.window.hasSubView() || this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.window.resize(w, h), this.forEachChildren(c => {
17292
+ this.window.resize(w, h), this.forEachChildren(c => {
17405
17293
  c.resize(w, h);
17406
- }), this.camera && this.option3d && this.set3dOptions(this.option3d), rerender && this.render();
17294
+ }), this._subView || this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.camera && this.option3d && this.set3dOptions(this.option3d), rerender && this.render();
17407
17295
  }
17408
17296
  resizeView(w, h) {
17409
17297
  let rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
@@ -17446,7 +17334,7 @@
17446
17334
  throw new Error("暂不支持");
17447
17335
  }
17448
17336
  release() {
17449
- 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 => {
17337
+ super.release(), this.eventSystem && this.eventSystem.release(), this.pluginService.release(), this.forEach(layer => {
17450
17338
  layer.release();
17451
17339
  }), this.interactiveLayer && this.interactiveLayer.release(), this.window.release();
17452
17340
  }
@@ -17457,41 +17345,47 @@
17457
17345
  getLayer(name) {
17458
17346
  return this.children.filter(layer => layer.name === name)[0];
17459
17347
  }
17460
- renderTo(window) {
17348
+ renderTo(window, params) {
17461
17349
  this.forEachChildren((layer, i) => {
17462
- layer.drawTo(window, {
17350
+ layer.drawTo(window, Object.assign(Object.assign({}, params), {
17463
17351
  renderService: this.renderService,
17464
- viewBox: window.getViewBox(),
17465
- transMatrix: window.getViewBoxTransform(),
17466
17352
  background: layer === this.defaultLayer ? this.background : void 0,
17467
17353
  clear: 0 === i,
17468
17354
  updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17469
- });
17355
+ }));
17470
17356
  });
17471
17357
  }
17472
17358
  renderToNewWindow() {
17359
+ let fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
17473
17360
  let viewBox = arguments.length > 1 ? arguments[1] : undefined;
17474
- const window = container.get(VWindow),
17475
- x1 = viewBox ? -viewBox.x1 : 0,
17476
- y1 = viewBox ? -viewBox.y1 : 0,
17477
- x2 = viewBox ? viewBox.x2 : this.viewWidth,
17478
- y2 = viewBox ? viewBox.y2 : this.viewHeight,
17479
- width = viewBox ? viewBox.width() : this.viewWidth,
17480
- height = viewBox ? viewBox.height() : this.viewHeight;
17481
- return window.create({
17482
- viewBox: {
17483
- x1: x1,
17484
- y1: y1,
17485
- x2: x2,
17486
- y2: y2
17487
- },
17488
- width: width,
17489
- height: height,
17361
+ const window = container.get(VWindow);
17362
+ if (fullImage) window.create({
17363
+ width: this.viewWidth,
17364
+ height: this.viewHeight,
17490
17365
  dpr: this.window.dpr,
17491
17366
  canvasControled: !0,
17492
17367
  offscreen: !0,
17493
17368
  title: ""
17494
- }), this.renderTo(window), window;
17369
+ });else {
17370
+ const width = viewBox ? viewBox.width() : Math.min(this.viewWidth, this.window.width - this.x),
17371
+ height = viewBox ? viewBox.height() : Math.min(this.viewHeight, this.window.height - this.y);
17372
+ window.create({
17373
+ width: width,
17374
+ height: height,
17375
+ dpr: this.window.dpr,
17376
+ canvasControled: !0,
17377
+ offscreen: !0,
17378
+ title: ""
17379
+ });
17380
+ }
17381
+ const x = viewBox ? -viewBox.x1 : 0,
17382
+ y = viewBox ? -viewBox.y1 : 0;
17383
+ return this.renderTo(window, {
17384
+ x: x,
17385
+ y: y,
17386
+ width: viewBox ? viewBox.x2 : window.width,
17387
+ height: viewBox ? viewBox.y2 : window.height
17388
+ }), window;
17495
17389
  }
17496
17390
  toCanvas() {
17497
17391
  let fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
@@ -17705,7 +17599,7 @@
17705
17599
  };
17706
17600
  let BaseWindowHandlerContribution = class {
17707
17601
  constructor() {
17708
- this._uid = Generator.GenAutoIncrementId(), this.viewBox = new AABBBounds$1(), this.modelMatrix = new Matrix(1, 0, 0, 1, 0, 0);
17602
+ this._uid = Generator.GenAutoIncrementId();
17709
17603
  }
17710
17604
  onChange(cb) {
17711
17605
  this._onChangeCb = cb;
@@ -17726,18 +17620,6 @@
17726
17620
  left: 0
17727
17621
  };
17728
17622
  }
17729
- setViewBox(vb) {
17730
- this.viewBox.setValue(vb.x1, vb.y1, vb.x2, vb.y2);
17731
- }
17732
- getViewBox() {
17733
- return this.viewBox;
17734
- }
17735
- setViewBoxTransform(a, b, c, d, e, f) {
17736
- this.modelMatrix.setValue(a, b, c, d, e, f);
17737
- }
17738
- getViewBoxTransform() {
17739
- return this.modelMatrix;
17740
- }
17741
17623
  };
17742
17624
  BaseWindowHandlerContribution = __decorate$K([injectable(), __metadata$x("design:paramtypes", [])], BaseWindowHandlerContribution);
17743
17625
 
@@ -17769,14 +17651,23 @@
17769
17651
  group: null
17770
17652
  };
17771
17653
  params.pickerService = this;
17772
- const w = params.bounds.width(),
17773
- h = params.bounds.height();
17774
- if (!new AABBBounds$1().setValue(0, 0, w, h).containsPoint(point)) return result;
17775
- this.pickContext && (this.pickContext.inuse = !0), params.pickContext = this.pickContext, this.pickContext && this.pickContext.clearMatrix(!0, 1);
17776
- const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);
17654
+ let offsetX = 0,
17655
+ offsetY = 0;
17656
+ if (params && params.bounds) {
17657
+ if (!params.bounds.contains(point.x, point.y)) return result;
17658
+ offsetX = params.bounds.x1, offsetY = params.bounds.y1;
17659
+ }
17660
+ if (this.pickContext) if (params.keepMatrix) {
17661
+ if (this.pickContext.nativeContext && this.pickContext.nativeContext.getTransform) {
17662
+ const t = this.pickContext.nativeContext.getTransform();
17663
+ this.pickContext.setTransformFromMatrix(t, !0, 1);
17664
+ }
17665
+ } else this.pickContext.inuse = !0, this.pickContext.clearMatrix(!0, 1);
17666
+ params.pickContext = this.pickContext;
17667
+ const parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
17777
17668
  let group;
17778
17669
  for (let i = graphics.length - 1; i >= 0 && (result = graphics[i].isContainer ? this.pickGroup(graphics[i], point, parentMatrix, params) : this.pickItem(graphics[i], point, parentMatrix, params), !result.graphic); i--) group || (group = result.group);
17779
- if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1), result.graphic) {
17670
+ if (result.graphic || (result.group = group), this.pickContext && !params.keepMatrix && (this.pickContext.inuse = !1), result.graphic) {
17780
17671
  let g = result.graphic;
17781
17672
  for (; g.parent;) g = g.parent;
17782
17673
  g.shadowHost && (result.params = {
@@ -18837,6 +18728,7 @@
18837
18728
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
18838
18729
  };
18839
18730
  const outP = [0, 0, 0],
18731
+ initMatrix = new Matrix(1, 0, 0, 1, 0, 0),
18840
18732
  addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry, clockwise) => {
18841
18733
  if (clockwise) for (; endAngle > startAngle;) endAngle -= pi2;else for (; endAngle < startAngle;) endAngle += pi2;
18842
18734
  const step = pi / 3 * (endAngle > startAngle ? 1 : -1);
@@ -18967,7 +18859,7 @@
18967
18859
  }), this._clearShadowStyle = !1, this._clearFilterStyle = !1, this._clearGlobalCompositeOperationStyle = !1;
18968
18860
  const context = canvas.nativeCanvas.getContext("2d");
18969
18861
  if (!context) throw new Error("发生错误,获取2d上下文失败");
18970
- this.nativeContext = context, this.canvas = canvas, this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this._clearMatrix = new Matrix(1, 0, 0, 1, 0, 0);
18862
+ this.nativeContext = context, this.canvas = canvas, this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0);
18971
18863
  }
18972
18864
  reset() {
18973
18865
  this.stack.length && Logger.getInstance().warn("可能存在bug,matrix没有清空"), this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0, this.nativeContext.setTransform(1, 0, 0, 1, 0, 0);
@@ -19329,10 +19221,7 @@
19329
19221
  clearMatrix() {
19330
19222
  let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
19331
19223
  let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
19332
- this.setTransformFromMatrix(this._clearMatrix, setTransform, dpr);
19333
- }
19334
- setClearMatrix(a, b, c, d, e, f) {
19335
- this._clearMatrix.setValue(a, b, c, d, e, f);
19224
+ this.setTransformFromMatrix(initMatrix, setTransform, dpr);
19336
19225
  }
19337
19226
  onlyTranslate() {
19338
19227
  let dpr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dpr;
@@ -19563,10 +19452,10 @@
19563
19452
  return `${BrowserWindowHandlerContribution_1.idprefix}_${BrowserWindowHandlerContribution_1.prefix_count++}`;
19564
19453
  }
19565
19454
  constructor() {
19566
- super(), this.type = "browser", this._canvasIsIntersecting = !0, this.global = application.global, this.viewBox = new AABBBounds$1(), this.modelMatrix = new Matrix(1, 0, 0, 1, 0, 0);
19455
+ super(), this.type = "browser", this._canvasIsIntersecting = !0, this.global = application.global;
19567
19456
  }
19568
19457
  getTitle() {
19569
- return this.canvas.id && this.canvas.id.toString();
19458
+ return this.canvas.id.toString();
19570
19459
  }
19571
19460
  getWH() {
19572
19461
  return {
@@ -19673,8 +19562,7 @@
19673
19562
  return this.canvas.nativeCanvas.dispatchEvent(event);
19674
19563
  }
19675
19564
  getStyle() {
19676
- var _a;
19677
- return null !== (_a = this.canvas.nativeCanvas.style) && void 0 !== _a ? _a : {};
19565
+ return this.canvas.nativeCanvas.style;
19678
19566
  }
19679
19567
  setStyle(style) {
19680
19568
  this.canvas.nativeCanvas.style = style;
@@ -19693,9 +19581,8 @@
19693
19581
  bottom: 0
19694
19582
  };
19695
19583
  }
19696
- clearViewBox(color) {
19697
- const vb = this.viewBox,
19698
- context = this.getContext(),
19584
+ clearViewBox(vb, color) {
19585
+ const context = this.getContext(),
19699
19586
  dpr = this.getDpr();
19700
19587
  context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
19701
19588
  }
@@ -19776,20 +19663,14 @@
19776
19663
  this.applyStyles = !0;
19777
19664
  }
19778
19665
  mapToCanvasPoint(nativeEvent, domElement) {
19779
- var _a, _b;
19780
- let clientX = 0,
19781
- clientY = 0,
19782
- offsetX = 0,
19783
- offsetY = 0;
19784
- if (nativeEvent.changedTouches) {
19785
- const data = null !== (_a = nativeEvent.changedTouches[0]) && void 0 !== _a ? _a : {};
19786
- clientX = data.clientX || 0, clientY = data.clientY || 0, offsetX = clientX, offsetY = clientY;
19787
- } else clientX = nativeEvent.clientX || 0, clientY = nativeEvent.clientY || 0, offsetX = nativeEvent.offsetX || 0, offsetY = nativeEvent.offsetY || 0;
19666
+ var _a;
19788
19667
  if (domElement) {
19789
- const x = clientX,
19790
- y = clientY,
19668
+ const {
19669
+ clientX: x,
19670
+ clientY: y
19671
+ } = nativeEvent,
19791
19672
  rect = domElement.getBoundingClientRect(),
19792
- nativeCanvas = null === (_b = domElement.getNativeHandler) || void 0 === _b ? void 0 : _b.call(domElement).nativeCanvas;
19673
+ nativeCanvas = null === (_a = domElement.getNativeHandler) || void 0 === _a ? void 0 : _a.call(domElement).nativeCanvas;
19793
19674
  let scaleX, scaleY;
19794
19675
  return nativeCanvas && (scaleX = rect.width / nativeCanvas.offsetWidth, scaleY = rect.height / nativeCanvas.offsetHeight), {
19795
19676
  x: (x - rect.left) / (isValidNumber$1(scaleX) ? scaleX : 1),
@@ -19797,8 +19678,8 @@
19797
19678
  };
19798
19679
  }
19799
19680
  return {
19800
- x: offsetX,
19801
- y: offsetY
19681
+ x: nativeEvent.offsetX,
19682
+ y: nativeEvent.offsetY
19802
19683
  };
19803
19684
  }
19804
19685
  getNativeAABBBounds(_dom) {
@@ -20071,7 +19952,7 @@
20071
19952
  getBoundingClientRect() {
20072
19953
  return null;
20073
19954
  }
20074
- clearViewBox(color) {}
19955
+ clearViewBox(vb, color) {}
20075
19956
  };
20076
19957
  NodeWindowHandlerContribution.env = "node", NodeWindowHandlerContribution = __decorate$v([injectable(), __param$n(0, inject(VGlobal)), __metadata$n("design:paramtypes", [Object])], NodeWindowHandlerContribution);
20077
19958
  const nodeWindowModule = new ContainerModule(bind => {
@@ -24991,25 +24872,6 @@
24991
24872
  registerGroup(), registerRect();
24992
24873
  }
24993
24874
 
24994
- const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";
24995
- var StateValue;
24996
- !function (StateValue) {
24997
- StateValue.selected = "selected", StateValue.selectedReverse = "selected_reverse", StateValue.hover = "hover", StateValue.hoverReverse = "hover_reverse";
24998
- }(StateValue || (StateValue = {}));
24999
- const DEFAULT_STATES$2 = {
25000
- [StateValue.selectedReverse]: {},
25001
- [StateValue.selected]: {},
25002
- [StateValue.hover]: {},
25003
- [StateValue.hoverReverse]: {}
25004
- };
25005
- const DEFAULT_HTML_TEXT_SPEC = {
25006
- container: "",
25007
- width: 30,
25008
- height: 30,
25009
- style: {}
25010
- };
25011
- const SCROLLBAR_EVENT = "scrollDrag";
25012
-
25013
24875
  const delayMap = {
25014
24876
  debounce: debounce$1,
25015
24877
  throttle: throttle$1
@@ -25049,9 +24911,9 @@
25049
24911
  this._prePos = "horizontal" === direction ? e.clientX : e.clientY, this._dispatchEvent("scrollDown", {
25050
24912
  pos: this._prePos,
25051
24913
  event: e
25052
- }), "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
24914
+ }), "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onSliderPointerMove, {
25053
24915
  capture: !0
25054
- }), vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.addEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
24916
+ }), vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.addEventListener("pointermove", this._onSliderPointerMove, {
25055
24917
  capture: !0
25056
24918
  }), this.stage.addEventListener("pointerup", this._onSliderPointerUp), this.stage.addEventListener("pointerupoutside", this._onSliderPointerUp));
25057
24919
  }, this._computeScrollValue = e => {
@@ -25066,12 +24928,12 @@
25066
24928
  height: height
25067
24929
  } = this._getSliderRenderBounds();
25068
24930
  return "vertical" === direction ? (currentPos = e.clientY, delta = currentPos - this._prePos, currentScrollValue = delta / height) : (currentPos = e.clientX, delta = currentPos - this._prePos, currentScrollValue = delta / width), [currentPos, currentScrollValue];
25069
- }, this._onSliderPointerMove = e => {
24931
+ }, this._onSliderPointerMove = delayMap[this.attribute.delayType](e => {
25070
24932
  e.stopPropagation();
25071
24933
  const preScrollRange = this.getScrollRange(),
25072
24934
  [currentPos, currentScrollValue] = this._computeScrollValue(e);
25073
24935
  this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], !0), this._prePos = currentPos;
25074
- }, this._onSliderPointerMoveWithDelay = 0 === this.attribute.delayTime ? this._onSliderPointerMove : delayMap[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime), this._onSliderPointerUp = e => {
24936
+ }, this.attribute.delayTime), this._onSliderPointerUp = e => {
25075
24937
  e.preventDefault();
25076
24938
  const {
25077
24939
  realTime = !0,
@@ -25084,9 +24946,9 @@
25084
24946
  this._dispatchEvent("scrollUp", {
25085
24947
  pre: preRange,
25086
24948
  value: clampRange$1(range, limitRange[0], limitRange[1])
25087
- }), "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
24949
+ }), "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onSliderPointerMove, {
25088
24950
  capture: !0
25089
- }), vglobal.removeEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
24951
+ }), vglobal.removeEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.removeEventListener("pointermove", this._onSliderPointerMove, {
25090
24952
  capture: !0
25091
24953
  }), this.stage.removeEventListener("pointerup", this._onSliderPointerUp), this.stage.removeEventListener("pointerupoutside", this._onSliderPointerUp));
25092
24954
  };
@@ -25113,7 +24975,7 @@
25113
24975
  }, !0), this.stage && !this.stage.autoRender && this.stage.renderNextFrame();
25114
24976
  }
25115
24977
  }
25116
- this.attribute.range = currScrollRange, realTime && this._dispatchEvent(SCROLLBAR_EVENT, {
24978
+ this.attribute.range = currScrollRange, realTime && this._dispatchEvent("scrollDrag", {
25117
24979
  pre: preRange,
25118
24980
  value: currScrollRange
25119
24981
  });
@@ -25289,22 +25151,41 @@
25289
25151
  return direct ? angleLargeThanPI ? 2 * Math.PI - ang : ang : angleLargeThanPI ? ang : 2 * Math.PI - ang;
25290
25152
  }
25291
25153
 
25154
+ const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";
25155
+ var StateValue;
25156
+ !function (StateValue) {
25157
+ StateValue.selected = "selected", StateValue.selectedReverse = "selected_reverse", StateValue.hover = "hover", StateValue.hoverReverse = "hover_reverse";
25158
+ }(StateValue || (StateValue = {}));
25159
+ const DEFAULT_STATES$2 = {
25160
+ [StateValue.selectedReverse]: {},
25161
+ [StateValue.selected]: {},
25162
+ [StateValue.hover]: {},
25163
+ [StateValue.hoverReverse]: {}
25164
+ };
25165
+ const DEFAULT_HTML_TEXT_SPEC = {
25166
+ container: "",
25167
+ width: 30,
25168
+ height: 30,
25169
+ style: {}
25170
+ };
25171
+
25292
25172
  function measureTextSize(text, textSpec) {
25293
- let defaultTextTheme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25173
+ let fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_TEXT_FONT_FAMILY$1;
25174
+ var _a, _b;
25294
25175
  if (!text) return {
25295
25176
  width: 0,
25296
25177
  height: 0
25297
25178
  };
25298
25179
  const bounds = getTextBounds$1({
25299
25180
  text: text,
25300
- fontFamily: textSpec.fontFamily || defaultTextTheme.fontFamily || DEFAULT_TEXT_FONT_FAMILY$1,
25301
- fontSize: textSpec.fontSize || defaultTextTheme.fontSize || 12,
25302
- fontWeight: textSpec.fontWeight || defaultTextTheme.fontWeight,
25303
- textAlign: textSpec.textAlign || "center",
25181
+ fontFamily: null !== (_a = textSpec.fontFamily) && void 0 !== _a ? _a : fontFamily,
25182
+ fontSize: textSpec.fontSize || 12,
25183
+ fontWeight: textSpec.fontWeight,
25184
+ textAlign: null !== (_b = textSpec.textAlign) && void 0 !== _b ? _b : "center",
25304
25185
  textBaseline: textSpec.textBaseline,
25305
25186
  ellipsis: !!textSpec.ellipsis,
25306
25187
  maxLineWidth: textSpec.maxLineWidth || 1 / 0,
25307
- lineHeight: textSpec.fontSize || defaultTextTheme.fontSize || 12
25188
+ lineHeight: textSpec.fontSize || 12
25308
25189
  });
25309
25190
  return {
25310
25191
  width: bounds.width(),
@@ -25339,7 +25220,7 @@
25339
25220
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Tag.defaultAttributes, attributes)), this.name = "tag";
25340
25221
  }
25341
25222
  render() {
25342
- var _a, _b, _c;
25223
+ var _a, _b;
25343
25224
  const {
25344
25225
  text = "",
25345
25226
  textStyle = {},
@@ -25420,11 +25301,11 @@
25420
25301
  y: 0
25421
25302
  });
25422
25303
  isNil$3(textAttrs.lineHeight) && (textAttrs.lineHeight = textStyle.fontSize), textShape = group.createOrUpdateChild("tag-text", textAttrs, "text"), isEmpty(null == state ? void 0 : state.text) || (textShape.states = state.text);
25423
- const textBounds = measureTextSize(textAttrs.text, textStyle, null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.getTheme()) || void 0 === _b ? void 0 : _b.text),
25304
+ const textBounds = measureTextSize(textAttrs.text, textStyle, null === (_a = this.stage) || void 0 === _a ? void 0 : _a.getTheme().text.fontFamily),
25424
25305
  textWidth = textBounds.width,
25425
25306
  textHeight = textBounds.height;
25426
25307
  tagWidth += textWidth;
25427
- const size = null !== (_c = shape.size) && void 0 !== _c ? _c : 10,
25308
+ const size = null !== (_b = shape.size) && void 0 !== _b ? _b : 10,
25428
25309
  maxSize = isNumber$4(size) ? size : Math.max(size[0], size[1]);
25429
25310
  tagHeight += Math.max(textHeight, shape.visible ? maxSize : 0);
25430
25311
  const {
@@ -25945,9 +25826,7 @@
25945
25826
  line.name = `${this.name}-line`, line.id = this._getNodeId("line" + index), isEmpty(null == state ? void 0 : state.line) || (line.states = isArray$3(state.line) ? null !== (_b = state.line[index]) && void 0 !== _b ? _b : state.line[state.line.length - 1] : state.line), this.add(line);
25946
25827
  });
25947
25828
  } else {
25948
- let lineCreator = graphicCreator$1.line;
25949
- array$1(lineStyle)[0].cornerRadius && (lineCreator = graphicCreator$1.polygon);
25950
- const line = lineCreator(Object.assign(Object.assign({
25829
+ const line = graphicCreator$1.polygon(Object.assign(Object.assign({
25951
25830
  points: this._clipPoints(this.attribute.points)
25952
25831
  }, array$1(lineStyle)[0]), {
25953
25832
  fill: !1,
@@ -26149,19 +26028,6 @@
26149
26028
  }
26150
26029
  };
26151
26030
 
26152
- function getElMap(g) {
26153
- const elMap = {};
26154
- return traverseGroup(g, el => {
26155
- "group" !== el.type && el.id && (elMap[el.id] = el);
26156
- }), elMap;
26157
- }
26158
- function getVerticalCoord(point, vector) {
26159
- return {
26160
- x: point.x + vector[0],
26161
- y: point.y + vector[1]
26162
- };
26163
- }
26164
-
26165
26031
  class AxisBase extends AbstractComponent {
26166
26032
  constructor() {
26167
26033
  super(...arguments), this.name = "axis", this.data = [], this.tickLineItems = [], this.subTickLineItems = [], this.axisLabelLayerSize = {}, this.axisLabelsContainer = null, this._onHover = e => {
@@ -26199,7 +26065,7 @@
26199
26065
  return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup), this.attribute = currentAttribute, offscreenGroup.AABBBounds;
26200
26066
  }
26201
26067
  render() {
26202
- this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator$1.group({
26068
+ this.removeAllChild(!0), this._prevInnerView = this._innerView, this._innerView = graphicCreator$1.group({
26203
26069
  x: 0,
26204
26070
  y: 0,
26205
26071
  pickable: !1
@@ -26324,7 +26190,11 @@
26324
26190
  axisTitle.name = AXIS_ELEMENT_NAME.title, axisTitle.id = this._getNodeId("title"), container.add(axisTitle);
26325
26191
  }
26326
26192
  getVerticalCoord(point, offset, inside) {
26327
- return getVerticalCoord(point, this.getVerticalVector(offset, inside, point));
26193
+ const vector = this.getVerticalVector(offset, inside, point);
26194
+ return {
26195
+ x: point.x + vector[0],
26196
+ y: point.y + vector[1]
26197
+ };
26328
26198
  }
26329
26199
  getTextAlign(vector) {
26330
26200
  let align = "center";
@@ -26467,9 +26337,6 @@
26467
26337
  }));
26468
26338
  }), data;
26469
26339
  }
26470
- release() {
26471
- super.release(), this._prevInnerView = null, this._innerView = null;
26472
- }
26473
26340
  }
26474
26341
 
26475
26342
  function rotate(x, y, deg, originX, originY) {
@@ -26632,42 +26499,17 @@
26632
26499
  limitLength: limitLength,
26633
26500
  verticalLimitLength: verticalLimitLength,
26634
26501
  ellipsis = "...",
26635
- orient: orient,
26636
- axisLength: axisLength
26502
+ orient: orient
26637
26503
  } = config;
26638
- if (isEmpty(labels) || !isValidNumber$1(limitLength)) return;
26639
- const DELTA = Math.sin(Math.PI / 10);
26640
- labels.forEach(label => {
26504
+ !isEmpty(labels) && isValidNumber$1(limitLength) && labels.forEach(label => {
26641
26505
  var _a;
26642
26506
  const angle = label.attribute.angle,
26643
- hasAngle = !isNil$3(angle),
26644
- cos = hasAngle ? Math.cos(angle) : 1,
26645
- sin = hasAngle ? Math.sin(angle) : 0,
26646
- isHorizontal = !hasAngle || Math.abs(sin) <= DELTA,
26647
- isVertical = hasAngle && Math.abs(cos) <= DELTA,
26648
- isX = "top" === orient || "bottom" === orient;
26649
- if (isX) {
26650
- if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) return;
26651
- if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) return;
26652
- }
26507
+ isRotated = !isNil$3(angle) && 0 !== angle;
26508
+ if (("top" === orient || "bottom" === orient) && (isRotated && Math.floor(label.AABBBounds.height()) <= limitLength || !isRotated && Math.floor(label.AABBBounds.width()) <= verticalLimitLength)) return;
26653
26509
  const direction = label.attribute.direction;
26654
- if (!isX) {
26655
- if ("vertical" === direction && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) return;
26656
- if ("vertical" !== direction) {
26657
- if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) return;
26658
- if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) return;
26659
- }
26660
- }
26510
+ if (("left" === orient || "right" === orient) && ("vertical" === direction && Math.floor(label.AABBBounds.height()) <= verticalLimitLength || "vertical" !== direction && Math.floor(label.AABBBounds.width()) <= limitLength)) return;
26661
26511
  let limitLabelLength = null;
26662
- if (isHorizontal || isVertical) limitLabelLength = isX ? isHorizontal ? verticalLimitLength : limitLength : "vertical" === direction || isVertical ? verticalLimitLength : limitLength;else if (isX) {
26663
- const {
26664
- x1: x1,
26665
- x2: x2
26666
- } = label.AABBBounds,
26667
- tan = sin / cos;
26668
- limitLabelLength = tan > 0 && x1 <= axisLength && limitLength / tan + x1 > axisLength ? (axisLength - x1) / Math.abs(cos) : tan < 0 && x2 >= 0 && limitLength / tan + x2 < 0 ? x2 / Math.abs(cos) : Math.abs(limitLength / sin);
26669
- } else limitLabelLength = Math.abs(limitLength / cos);
26670
- isValidNumber$1(label.attribute.maxLineWidth) && (limitLabelLength = isValidNumber$1(limitLabelLength) ? Math.min(label.attribute.maxLineWidth, limitLabelLength) : label.attribute.maxLineWidth), label.setAttributes({
26512
+ limitLabelLength = isRotated ? Math.abs(limitLength / Math.sin(angle)) : "top" === orient || "bottom" === orient || "vertical" === direction ? verticalLimitLength : limitLength, isValidNumber$1(label.attribute.maxLineWidth) && (limitLabelLength = isValidNumber$1(limitLabelLength) ? Math.min(label.attribute.maxLineWidth, limitLabelLength) : label.attribute.maxLineWidth), label.setAttributes({
26671
26513
  maxLineWidth: limitLabelLength,
26672
26514
  ellipsis: null !== (_a = label.attribute.ellipsis) && void 0 !== _a ? _a : ellipsis
26673
26515
  });
@@ -26840,10 +26682,9 @@
26840
26682
  autoRotate = !0,
26841
26683
  shape: shape,
26842
26684
  background: background,
26843
- state = {},
26844
- maxWidth: maxWidth
26685
+ state = {}
26845
26686
  } = _d,
26846
- restAttrs = __rest$1(_d, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state", "maxWidth"]);
26687
+ restAttrs = __rest$1(_d, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state"]);
26847
26688
  let percent = .5;
26848
26689
  "start" === position ? percent = 0 : "end" === position && (percent = 1);
26849
26690
  const {
@@ -26894,28 +26735,7 @@
26894
26735
  } = this.attribute;
26895
26736
  textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
26896
26737
  } else textAlign = this.getTextAlign(vector), textBaseline = this.getTextBaseline(vector, !1);
26897
- let maxTagWidth = maxWidth;
26898
- if (isNil$3(maxTagWidth)) {
26899
- const {
26900
- verticalLimitSize: verticalLimitSize,
26901
- verticalMinSize: verticalMinSize,
26902
- orient: orient
26903
- } = this.attribute,
26904
- limitSize = Math.min(verticalLimitSize || 1 / 0, verticalMinSize || 1 / 0);
26905
- if (isValidNumber$1(limitSize)) {
26906
- if ("bottom" === orient || "top" === orient) {
26907
- if (angle !== Math.PI / 2) {
26908
- const cosValue = Math.abs(Math.cos(null != angle ? angle : 0));
26909
- maxTagWidth = cosValue < 1e-6 ? 1 / 0 : this.attribute.end.x / cosValue;
26910
- } else maxTagWidth = limitSize - offset;
26911
- } else if (angle && 0 !== angle) {
26912
- const sinValue = Math.abs(Math.sin(angle));
26913
- maxTagWidth = sinValue < 1e-6 ? 1 / 0 : this.attribute.end.y / sinValue;
26914
- } else maxTagWidth = limitSize - offset;
26915
- }
26916
- }
26917
26738
  const attrs = Object.assign(Object.assign(Object.assign({}, titlePoint), restAttrs), {
26918
- maxWidth: maxTagWidth,
26919
26739
  textStyle: Object.assign({
26920
26740
  textAlign: textAlign,
26921
26741
  textBaseline: textBaseline
@@ -26942,9 +26762,9 @@
26942
26762
  }
26943
26763
  getLabelAlign(vector, inside, angle) {
26944
26764
  const orient = this.attribute.orient;
26945
- if (["top", "bottom", "right", "left"].includes(orient) || 0 === vector[0] && 0 === vector[1]) {
26946
- if ("top" === orient || "bottom" === orient) return getXAxisLabelAlign(inside ? "bottom" === orient ? "top" : "bottom" : orient, angle);
26947
- if ("left" === orient || "right" === orient) return getYAxisLabelAlign(inside ? "left" === orient ? "right" : "left" : orient, angle);
26765
+ if (isValidNumber$1(angle) || 0 === vector[0] && 0 === vector[1]) {
26766
+ if ("top" === orient || "bottom" === orient) return getXAxisLabelAlign(orient, angle);
26767
+ if ("left" === orient || "right" === orient) return getYAxisLabelAlign(orient, angle);
26948
26768
  }
26949
26769
  return {
26950
26770
  textAlign: this.getTextAlign(vector),
@@ -27039,15 +26859,12 @@
27039
26859
  labelRotateAngle: autoRotateAngle,
27040
26860
  orient: orient
27041
26861
  }), autoLimit$1 && isValidNumber$1(limitLength) && limitLength > 0) {
27042
- const isVertical = "left" === orient || "right" === orient,
27043
- axisLength = isVertical ? Math.abs(this.attribute.start.y - this.attribute.end.y) : Math.abs(this.attribute.start.x - this.attribute.end.x),
27044
- verticalLimitLength = isVertical ? axisLength / labelShapes.length : autoHide$1 || autoRotate$1 ? 1 / 0 : axisLength / labelShapes.length;
26862
+ const verticalLimitLength = "left" === orient || "right" === orient ? Math.abs(this.attribute.start.y - this.attribute.end.y) / labelShapes.length : autoHide$1 || autoRotate$1 ? 1 / 0 : Math.abs(this.attribute.start.x - this.attribute.end.x) / labelShapes.length;
27045
26863
  autoLimit(labelShapes, {
27046
26864
  limitLength: limitLength,
27047
26865
  verticalLimitLength: verticalLimitLength,
27048
26866
  ellipsis: limitEllipsis,
27049
- orient: orient,
27050
- axisLength: axisLength
26867
+ orient: orient
27051
26868
  });
27052
26869
  }
27053
26870
  autoHide$1 && autoHide(labelShapes, {
@@ -27088,7 +26905,7 @@
27088
26905
  }
27089
26906
  }
27090
26907
  _getAxisLabelLimitLength(limitSize, layerCount) {
27091
- var _a, _b, _c, _d, _e;
26908
+ var _a, _b, _c, _d;
27092
26909
  const {
27093
26910
  label: label,
27094
26911
  title: title,
@@ -27102,7 +26919,7 @@
27102
26919
  const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0,
27103
26920
  tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0;
27104
26921
  if (title && title.visible && "string" == typeof title.text) {
27105
- titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height;
26922
+ titleHeight = measureTextSize(title.text, title.textStyle, null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme().text.fontFamily).height;
27106
26923
  const padding = normalizePadding(title.padding);
27107
26924
  titleSpacing = title.space + padding[0] + padding[2];
27108
26925
  }
@@ -27165,7 +26982,7 @@
27165
26982
  };
27166
26983
  }
27167
26984
  render() {
27168
- var _a, _b, _c;
26985
+ var _a, _b;
27169
26986
  this._reset();
27170
26987
  const {
27171
26988
  layout = "horizontal",
@@ -27207,7 +27024,7 @@
27207
27024
  } = measureTextSize(this._getPageText(total), Object.assign({
27208
27025
  textAlign: "center",
27209
27026
  textBaseline: "middle"
27210
- }, textStyle), null === (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.getTheme()) || void 0 === _c ? void 0 : _c.text),
27027
+ }, textStyle), null === (_b = this.stage) || void 0 === _b ? void 0 : _b.getTheme().text.fontFamily),
27211
27028
  handlerSizeX = isNumber$4(handlerSize) ? handlerSize : handlerSize[0],
27212
27029
  handlerSizeY = isNumber$4(handlerSize) ? handlerSize : handlerSize[1],
27213
27030
  text = graphicCreator$1.text(Object.assign({
@@ -27437,9 +27254,8 @@
27437
27254
  maxRow = 2,
27438
27255
  maxWidth: maxWidth,
27439
27256
  maxHeight: maxHeight,
27440
- defaultSelected: defaultSelected,
27441
- lazyload: lazyload,
27442
- autoPage: autoPage
27257
+ defaultSelected = [],
27258
+ lazyload: lazyload
27443
27259
  } = this.attribute,
27444
27260
  {
27445
27261
  spaceCol = DEFAULT_ITEM_SPACE_COL,
@@ -27449,10 +27265,9 @@
27449
27265
  {
27450
27266
  items: legendItems,
27451
27267
  isHorizontal: isHorizontal,
27452
- startIndex: startIndex,
27453
- isScrollbar: isScrollbar
27268
+ startIndex: startIndex
27454
27269
  } = this._itemContext,
27455
- maxPages = isScrollbar ? 1 : isHorizontal ? maxRow : maxCol;
27270
+ maxPages = isHorizontal ? maxRow : maxCol;
27456
27271
  let item,
27457
27272
  {
27458
27273
  doWrap: doWrap,
@@ -27461,22 +27276,24 @@
27461
27276
  startY: startY,
27462
27277
  pages: pages
27463
27278
  } = this._itemContext;
27464
- for (let index = startIndex, len = legendItems.length; index < len && !(lazyload && pages > this._itemContext.currentPage * maxPages); index++) {
27465
- lazyload && (this._itemContext.startIndex = index + 1), item = legendItems[index], item.id || (item.id = item.label), item.index = index;
27466
- let isSelected = !0;
27467
- isArray$3(defaultSelected) && (isSelected = defaultSelected.includes(item.label));
27468
- const itemGroup = this._renderEachItem(item, isSelected, index, legendItems),
27279
+ for (let index = startIndex, len = legendItems.length; index < len; index++) {
27280
+ if (lazyload && pages > this._itemContext.currentPage * maxPages) {
27281
+ this._itemContext.startIndex = index;
27282
+ break;
27283
+ }
27284
+ item = legendItems[index], item.id || (item.id = item.label), item.index = index;
27285
+ const itemGroup = this._renderEachItem(item, !!isEmpty(defaultSelected) || (null == defaultSelected ? void 0 : defaultSelected.includes(item.label)), index, legendItems),
27469
27286
  itemWidth = itemGroup.attribute.width,
27470
27287
  itemHeight = itemGroup.attribute.height;
27471
- this._itemHeight = Math.max(this._itemHeight, itemHeight), maxWidthInCol = Math.max(itemWidth, maxWidthInCol), this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? (isValid$3(maxWidth) && (isScrollbar && autoPage ? (pages = Math.ceil((startX + itemWidth) / maxWidth), doWrap = pages > 1) : startX + itemWidth > maxWidth && (doWrap = !0, startX > 0 && (pages += 1, startX = 0, startY += itemHeight + spaceRow))), 0 === startX && 0 === startY || itemGroup.setAttributes({
27288
+ this._itemHeight = Math.max(this._itemHeight, itemHeight), maxWidthInCol = Math.max(itemWidth, maxWidthInCol), this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? (isValid$3(maxWidth) && (itemWidth >= maxWidth ? (doWrap = !0, index > 0 && (startX = 0, startY += itemHeight + spaceRow, pages += 1)) : maxWidth < startX + itemWidth && (doWrap = !0, startX = 0, startY += itemHeight + spaceRow, pages += 1)), index > 0 && itemGroup.setAttributes({
27472
27289
  x: startX,
27473
27290
  y: startY
27474
- }), startX += spaceCol + itemWidth) : (isValid$3(maxHeight) && (isScrollbar && autoPage ? (pages = Math.ceil((startY + itemHeight) / maxHeight), doWrap = pages > 1) : maxHeight < startY + itemHeight && (pages += 1, doWrap = !0, startY = 0, startX += maxWidthInCol + spaceCol, maxWidthInCol = 0)), 0 === startX && 0 === startY || itemGroup.setAttributes({
27291
+ }), startX += spaceCol + itemWidth) : (isValid$3(maxHeight) && maxHeight < startY + itemHeight && (doWrap = !0, startY = 0, startX += maxWidthInCol + spaceCol, maxWidthInCol = 0, pages += 1), index > 0 && itemGroup.setAttributes({
27475
27292
  x: startX,
27476
27293
  y: startY
27477
27294
  }), startY += spaceRow + itemHeight), itemsContainer.add(itemGroup);
27478
27295
  }
27479
- return this._itemContext.doWrap = doWrap, this._itemContext.startX = startX, this._itemContext.startY = startY, this._itemContext.maxWidthInCol = maxWidthInCol, this._itemContext.pages = pages, this._itemContext.maxPages = maxPages, isScrollbar && (this._itemContext.totalPage = pages), lazyload || (this._itemContext.startIndex = legendItems.length), this._itemContext;
27296
+ return this._itemContext.doWrap = doWrap, this._itemContext.startX = startX, this._itemContext.startY = startY, this._itemContext.maxWidthInCol = maxWidthInCol, this._itemContext.pages = pages, this._itemContext.maxPages = maxPages, lazyload || (this._itemContext.startIndex = legendItems.length), this._itemContext;
27480
27297
  }
27481
27298
  _renderContent() {
27482
27299
  const {
@@ -27504,10 +27321,8 @@
27504
27321
  height: itemHeight
27505
27322
  } = item,
27506
27323
  widthsOptions = [];
27507
- isValid$3(maxItemWidth) && widthsOptions.push(maxItemWidth), isValid$3(itemWidth) && widthsOptions.push(itemWidth), widthsOptions.length && (isValid$3(maxWidth) && widthsOptions.push(maxWidth), this._itemWidthByUser = minInArray$1(widthsOptions)), isValid$3(itemHeight) && (this._itemHeightByUser = itemHeight);
27508
- const pager = this.attribute.pager;
27509
- this._itemContext = {
27510
- currentPage: pager && pager.defaultCurrent || 1,
27324
+ isValid$3(maxItemWidth) && widthsOptions.push(maxItemWidth), isValid$3(itemWidth) && widthsOptions.push(itemWidth), widthsOptions.length && (isValid$3(maxWidth) && widthsOptions.push(maxWidth), this._itemWidthByUser = minInArray$1(widthsOptions)), isValid$3(itemHeight) && (this._itemHeightByUser = itemHeight), this._itemContext = {
27325
+ currentPage: this.attribute.pager && this.attribute.pager.defaultCurrent || 1,
27511
27326
  doWrap: !1,
27512
27327
  maxWidthInCol: 0,
27513
27328
  maxPages: 1,
@@ -27517,11 +27332,10 @@
27517
27332
  startIndex: 0,
27518
27333
  items: legendItems,
27519
27334
  isHorizontal: isHorizontal,
27520
- totalPage: 1 / 0,
27521
- isScrollbar: pager && "scrollbar" === pager.type
27335
+ totalPage: 1 / 0
27522
27336
  }, this._itemContext = this._renderItems();
27523
27337
  let pagerRendered = !1;
27524
- this._itemContext.doWrap && autoPage && this._itemContext.pages > this._itemContext.maxPages && (pagerRendered = this._renderPagerComponent()), pagerRendered || (itemsContainer.setAttribute("y", this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", 8) : 0), this._innerView.add(itemsContainer));
27338
+ this._itemContext.doWrap && autoPage && this._itemContext.pages > this._itemContext.maxPages && (pagerRendered = this._renderPagerComponent(isHorizontal)), pagerRendered || (itemsContainer.setAttribute("y", this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", 8) : 0), this._innerView.add(itemsContainer));
27525
27339
  }
27526
27340
  _bindEvents() {
27527
27341
  if (this.attribute.disableTriggerEvent) return;
@@ -27670,13 +27484,27 @@
27670
27484
  itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
27671
27485
  return itemGroup.attribute.width = itemGroupWidth, itemGroup.attribute.height = itemGroupHeight, focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]), itemGroup;
27672
27486
  }
27673
- _createPager(compStyle) {
27487
+ _createPager(isScrollbar, isHorizontal, compStyle, compSize) {
27674
27488
  var _a, _b;
27675
27489
  const {
27676
27490
  disableTriggerEvent: disableTriggerEvent,
27677
27491
  maxRow: maxRow
27678
27492
  } = this.attribute;
27679
- return this._itemContext.isHorizontal ? new Pager(Object.assign(Object.assign({
27493
+ return isScrollbar ? new ScrollBar(isHorizontal ? Object.assign(Object.assign({
27494
+ direction: "vertical",
27495
+ width: 12,
27496
+ range: [0, .5]
27497
+ }, compStyle), {
27498
+ height: compSize,
27499
+ disableTriggerEvent: disableTriggerEvent
27500
+ }) : Object.assign(Object.assign({
27501
+ direction: "horizontal",
27502
+ disableTriggerEvent: disableTriggerEvent,
27503
+ range: [0, .5],
27504
+ height: 12
27505
+ }, compStyle), {
27506
+ width: compSize
27507
+ })) : new Pager(isHorizontal ? Object.assign(Object.assign({
27680
27508
  layout: 1 === maxRow ? "horizontal" : "vertical",
27681
27509
  total: 99
27682
27510
  }, merge({
@@ -27687,79 +27515,53 @@
27687
27515
  }, compStyle)), {
27688
27516
  defaultCurrent: null === (_a = this.attribute.pager) || void 0 === _a ? void 0 : _a.defaultCurrent,
27689
27517
  disableTriggerEvent: disableTriggerEvent
27690
- })) : new Pager(Object.assign({
27518
+ }) : Object.assign({
27691
27519
  layout: "horizontal",
27692
27520
  total: 99,
27693
27521
  disableTriggerEvent: disableTriggerEvent,
27694
27522
  defaultCurrent: null === (_b = this.attribute.pager) || void 0 === _b ? void 0 : _b.defaultCurrent
27695
27523
  }, compStyle));
27696
27524
  }
27697
- _createScrollbar(compStyle, compSize) {
27698
- const {
27699
- disableTriggerEvent: disableTriggerEvent
27700
- } = this.attribute;
27701
- return this._itemContext.isHorizontal ? new ScrollBar(Object.assign(Object.assign({
27702
- direction: "horizontal",
27703
- disableTriggerEvent: disableTriggerEvent,
27704
- range: [0, .5],
27705
- height: 12
27706
- }, compStyle), {
27707
- width: compSize
27708
- })) : new ScrollBar(Object.assign(Object.assign({
27709
- direction: "vertical",
27710
- width: 12,
27711
- range: [0, .5]
27712
- }, compStyle), {
27713
- height: compSize,
27714
- disableTriggerEvent: disableTriggerEvent
27715
- }));
27716
- }
27717
- _updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight) {
27525
+ _updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize) {
27718
27526
  const {
27719
27527
  maxHeight: maxHeight,
27720
27528
  pager: pager
27721
27529
  } = this.attribute,
27722
27530
  {
27723
- totalPage: totalPage,
27724
- isHorizontal: isHorizontal
27725
- } = this._itemContext,
27726
- position = pager && pager.position || "middle";
27727
- if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
27728
- let y;
27729
- y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2, this._pagerComponent.setAttributes({
27730
- x: contentWidth,
27731
- y: y
27732
- });
27733
- } else {
27734
- let x;
27735
- x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2, this._pagerComponent.setAttributes({
27736
- x: x,
27737
- y: maxHeight - this._pagerComponent.AABBBounds.height()
27738
- });
27739
- }
27740
- }
27741
- _updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY) {
27742
- const {
27743
- currentPage: currentPage,
27744
- totalPage: totalPage,
27745
- isHorizontal: isHorizontal
27746
- } = this._itemContext;
27747
- this._pagerComponent.setScrollRange([(currentPage - 1) / totalPage, currentPage / totalPage]), isHorizontal ? this._pagerComponent.setAttributes({
27748
- x: 0,
27749
- y: renderStartY + contentHeight
27750
- }) : this._pagerComponent.setAttributes({
27751
- x: contentWidth,
27531
+ currentPage: currentPage,
27532
+ totalPage: totalPage
27533
+ } = this._itemContext;
27534
+ if (isScrollbar) this._pagerComponent.setScrollRange([(currentPage - 1) / totalPage, currentPage / totalPage]), isHorizontal ? this._pagerComponent.setAttributes({
27535
+ x: contentSize,
27752
27536
  y: renderStartY
27753
- });
27537
+ }) : this._pagerComponent.setAttributes({
27538
+ x: 0,
27539
+ y: maxHeight - this._pagerComponent.AABBBounds.height()
27540
+ });else {
27541
+ const position = pager && pager.position || "middle";
27542
+ if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
27543
+ let y;
27544
+ y = "start" === position ? renderStartY : "end" === position ? renderStartY + compSize - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compSize / 2 - this._pagerComponent.AABBBounds.height() / 2, this._pagerComponent.setAttributes({
27545
+ x: contentSize,
27546
+ y: y
27547
+ });
27548
+ } else {
27549
+ let x;
27550
+ x = "start" === position ? 0 : "end" === position ? compSize - this._pagerComponent.AABBBounds.width() : (compSize - this._pagerComponent.AABBBounds.width()) / 2, this._pagerComponent.setAttributes({
27551
+ x: x,
27552
+ y: maxHeight - this._pagerComponent.AABBBounds.height()
27553
+ });
27554
+ }
27555
+ }
27754
27556
  }
27755
- _bindEventsOfPager(pageSize, channel) {
27557
+ _bindEventsOfPager(isScrollbar, isHorizontal, compSize, spaceSize) {
27756
27558
  const pager = this.attribute.pager || {},
27757
27559
  {
27758
27560
  animation = !0,
27759
27561
  animationDuration = 450,
27760
27562
  animationEasing = "quadIn"
27761
27563
  } = pager,
27762
- pageParser = this._itemContext.isScrollbar ? e => {
27564
+ pageParser = isScrollbar ? e => {
27763
27565
  const {
27764
27566
  value: value
27765
27567
  } = e.detail;
@@ -27774,14 +27576,16 @@
27774
27576
  const newTotalPage = Math.ceil(this._itemContext.pages / this._itemContext.maxPages);
27775
27577
  this._itemContext.totalPage = newTotalPage, this._pagerComponent.setScrollRange([(newPage - 1) / newTotalPage, newPage / newTotalPage]);
27776
27578
  }
27777
- animation ? this._itemsContainer.animate().to({
27778
- [channel]: -(newPage - 1) * pageSize
27779
- }, animationDuration, animationEasing) : this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
27579
+ animation ? this._itemsContainer.animate().to(isHorizontal ? {
27580
+ y: -(newPage - 1) * (compSize + spaceSize)
27581
+ } : {
27582
+ x: -(newPage - 1) * (compSize + spaceSize)
27583
+ }, animationDuration, animationEasing) : isHorizontal ? this._itemsContainer.setAttribute("y", -(newPage - 1) * (compSize + spaceSize)) : this._itemsContainer.setAttribute("x", -(newPage - 1) * (compSize + spaceSize));
27780
27584
  }
27781
27585
  };
27782
- this._itemContext.isScrollbar ? (this._pagerComponent.addEventListener("scrollDrag", onPaging), this._pagerComponent.addEventListener("scrollUp", onPaging)) : (this._pagerComponent.addEventListener("toPrev", onPaging), this._pagerComponent.addEventListener("toNext", onPaging));
27586
+ isScrollbar ? (this._pagerComponent.addEventListener("scrollDrag", onPaging), this._pagerComponent.addEventListener("scrollUp", onPaging)) : (this._pagerComponent.addEventListener("toPrev", onPaging), this._pagerComponent.addEventListener("toNext", onPaging));
27783
27587
  }
27784
- _renderPager() {
27588
+ _renderPagerComponent(isHorizontal) {
27785
27589
  const renderStartY = this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", 8) : 0,
27786
27590
  {
27787
27591
  maxWidth: maxWidth,
@@ -27801,105 +27605,51 @@
27801
27605
  defaultCurrent = 1
27802
27606
  } = pager,
27803
27607
  compStyle = __rest(pager, ["space", "defaultCurrent"]),
27804
- {
27805
- isHorizontal: isHorizontal
27806
- } = this._itemContext;
27608
+ isScrollbar = "scrollbar" === pager.type;
27807
27609
  let comp,
27808
- compWidth = 0,
27809
- compHeight = 0,
27810
- contentWidth = 0,
27811
- contentHeight = 0,
27610
+ compSize = 0,
27611
+ contentSize = 0,
27812
27612
  startX = 0,
27813
27613
  startY = 0,
27814
27614
  pages = 1;
27815
27615
  if (isHorizontal) {
27816
- if (compHeight = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, compWidth = maxWidth, comp = this._createPager(compStyle), this._pagerComponent = comp, this._innerView.add(comp), contentWidth = maxWidth - comp.AABBBounds.width() - pagerSpace, contentWidth <= 0) return this._innerView.removeChild(comp), !1;
27616
+ if (compSize = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, comp = this._createPager(isScrollbar, isHorizontal, compStyle, compSize), this._pagerComponent = comp, this._innerView.add(comp), contentSize = maxWidth - comp.AABBBounds.width() - pagerSpace, contentSize <= 0) return this._innerView.removeChild(comp), !1;
27817
27617
  itemsContainer.getChildren().forEach((item, index) => {
27818
27618
  const {
27819
27619
  width: width,
27820
27620
  height: height
27821
27621
  } = item.attribute;
27822
- contentWidth < startX + width && (startX = 0, startY += height + spaceRow, pages += 1), index > 0 && item.setAttributes({
27622
+ contentSize < startX + width && (startX = 0, startY += height + spaceRow, pages += 1), index > 0 && item.setAttributes({
27823
27623
  x: startX,
27824
27624
  y: startY
27825
27625
  }), startX += spaceCol + width;
27826
27626
  }), this._itemContext.startX = startX, this._itemContext.startY = startY, this._itemContext.pages = pages;
27827
27627
  const total = Math.ceil(pages / maxRow);
27828
- this._itemContext.totalPage = total, this._updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight);
27628
+ this._itemContext.totalPage = total, this._updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize);
27829
27629
  } else {
27830
- if (compWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, compHeight = maxHeight, contentWidth = compWidth, comp = this._createPager(compStyle), this._pagerComponent = comp, this._innerView.add(comp), contentHeight = maxHeight - comp.AABBBounds.height() - pagerSpace - renderStartY, contentHeight <= 0) return this._innerView.removeChild(comp), !1;
27630
+ if (compSize = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, comp = this._createPager(isScrollbar, isHorizontal, compStyle, compSize), this._pagerComponent = comp, this._innerView.add(comp), contentSize = maxHeight - comp.AABBBounds.height() - pagerSpace - renderStartY, contentSize <= 0) return this._innerView.removeChild(comp), !1;
27831
27631
  itemsContainer.getChildren().forEach((item, index) => {
27832
27632
  const {
27833
27633
  height: height
27834
27634
  } = item.attribute;
27835
- contentHeight < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol, pages += 1), index > 0 && item.setAttributes({
27635
+ contentSize < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol, pages += 1), index > 0 && item.setAttributes({
27836
27636
  x: startX,
27837
27637
  y: startY
27838
27638
  }), startY += spaceRow + height;
27839
27639
  });
27840
27640
  const total = Math.ceil(pages / maxCol);
27841
- this._itemContext.totalPage = total, this._updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight);
27842
- }
27843
- defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
27844
- const clipGroup = graphicCreator$1.group({
27845
- x: 0,
27846
- y: renderStartY,
27847
- width: isHorizontal ? contentWidth : compWidth,
27848
- height: isHorizontal ? compHeight : contentHeight,
27849
- clip: !0,
27850
- pickable: !1
27851
- });
27852
- return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isHorizontal ? compHeight + spaceRow : compWidth + spaceCol, isHorizontal ? "y" : "x"), !0;
27853
- }
27854
- _renderScrollbar() {
27855
- const renderStartY = this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", 8) : 0,
27856
- {
27857
- maxWidth: maxWidth,
27858
- maxHeight: maxHeight,
27859
- item = {},
27860
- pager = {}
27861
- } = this.attribute,
27862
- {
27863
- spaceCol = DEFAULT_ITEM_SPACE_COL,
27864
- spaceRow = DEFAULT_ITEM_SPACE_ROW
27865
- } = item,
27866
- itemsContainer = this._itemsContainer,
27867
- {
27868
- space: pagerSpace = DEFAULT_PAGER_SPACE,
27869
- defaultCurrent = 1
27870
- } = pager,
27871
- compStyle = __rest(pager, ["space", "defaultCurrent"]),
27872
- {
27873
- isHorizontal: isHorizontal
27874
- } = this._itemContext;
27875
- let comp,
27876
- compSize = 0,
27877
- contentWidth = 0,
27878
- contentHeight = 0,
27879
- startY = 0,
27880
- pages = 1;
27881
- if (isHorizontal) compSize = maxWidth, contentWidth = maxWidth, contentHeight = this._itemHeight, comp = this._createScrollbar(compStyle, compSize), this._pagerComponent = comp, this._innerView.add(comp), this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);else {
27882
- if (compSize = maxHeight, comp = this._createScrollbar(compStyle, compSize), this._pagerComponent = comp, this._innerView.add(comp), contentHeight = maxHeight - renderStartY, contentWidth = this._itemMaxWidth, contentHeight <= 0) return this._innerView.removeChild(comp), !1;
27883
- itemsContainer.getChildren().forEach((item, index) => {
27884
- const {
27885
- height: height
27886
- } = item.attribute;
27887
- pages = Math.floor((startY + height) / contentHeight) + 1, startY += spaceRow + height;
27888
- }), this._itemContext.totalPage = pages, this._itemContext.pages = pages, this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);
27641
+ this._itemContext.totalPage = total, this._updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize);
27889
27642
  }
27890
- defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (contentWidth + spaceCol)) : itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (contentHeight + spaceRow)));
27643
+ defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compSize + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compSize + spaceCol)));
27891
27644
  const clipGroup = graphicCreator$1.group({
27892
27645
  x: 0,
27893
27646
  y: renderStartY,
27894
- width: contentWidth,
27895
- height: contentHeight,
27647
+ width: isHorizontal ? contentSize : compSize,
27648
+ height: isHorizontal ? compSize : contentSize,
27896
27649
  clip: !0,
27897
27650
  pickable: !1
27898
27651
  });
27899
- return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isHorizontal ? contentWidth : contentHeight, isHorizontal ? "x" : "y"), !0;
27900
- }
27901
- _renderPagerComponent() {
27902
- return this._itemContext.isScrollbar ? this._renderScrollbar() : this._renderPager(), !0;
27652
+ return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isScrollbar, isHorizontal, compSize, isHorizontal ? spaceRow : spaceCol), !0;
27903
27653
  }
27904
27654
  _hover(legendItem, e) {
27905
27655
  this._lastActiveItem = legendItem;
@@ -29474,9 +29224,12 @@
29474
29224
  }, this._onTooltipUpdate(e), this._dispatchTooltipEvent("sliderTooltipShow"));
29475
29225
  }, this._onTooltipUpdate = e => {
29476
29226
  if (this._isChanging || !this._tooltipState || !this._tooltipState.isActive) return;
29477
- const railLen = this._isHorizontal ? this._rail.globalAABBBounds.width() : this._rail.globalAABBBounds.height(),
29478
- pos = clamp$3(this._isHorizontal ? (e.viewX - this._rail.globalAABBBounds.x1) / railLen : (e.viewY - this._rail.globalAABBBounds.y1) / railLen, 0, 1);
29479
- pos !== this._tooltipState.pos && (this._tooltipState.pos = pos, this._tooltipState.value = this.calculateValueByPos(pos * railLen), this._updateTooltip(), this._dispatchTooltipEvent("sliderTooltipUpdate"));
29227
+ const {
29228
+ min: min,
29229
+ max: max
29230
+ } = this.attribute,
29231
+ pos = clamp$3(this._isHorizontal ? (e.viewX - this._rail.globalAABBBounds.x1) / this._rail.globalAABBBounds.width() : (e.viewY - this._rail.globalAABBBounds.y1) / this._rail.globalAABBBounds.height(), 0, 1);
29232
+ pos !== this._tooltipState.pos && (this._tooltipState.pos = pos, this._tooltipState.value = min + (max - min) * pos, this._updateTooltip(), this._dispatchTooltipEvent("sliderTooltipUpdate"));
29480
29233
  }, this._onTooltipHide = () => {
29481
29234
  const {
29482
29235
  tooltip: tooltip
@@ -29504,7 +29257,7 @@
29504
29257
  delta = 0;
29505
29258
  this._isHorizontal ? (currentPos = e.clientX, delta = currentPos - this._prePos, originPos = null === (_b = this._currentHandler) || void 0 === _b ? void 0 : _b.attribute.x, railLen = railWidth) : (currentPos = e.clientY, delta = currentPos - this._prePos, originPos = null === (_a = this._currentHandler) || void 0 === _a ? void 0 : _a.attribute.y, railLen = railHeight);
29506
29259
  const newPos = clamp$3(originPos + delta, 0, railLen),
29507
- currentValue = this.calculateValueByPos(newPos);
29260
+ currentValue = newPos / railLen * (max - min) + min;
29508
29261
  "text" === this._currentHandler.type ? this._updateHandlerText(this._currentHandler, newPos, currentValue) : this._updateHandler(this._currentHandler, newPos, currentValue), this._updateTrack(), this._prePos = currentPos, this._dispatchChangeEvent();
29509
29262
  }, this._onHandlerPointerUp = e => {
29510
29263
  e.preventDefault(), this._isChanging = !1, this._currentHandler = null, "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
@@ -29524,8 +29277,7 @@
29524
29277
  railWidth: railWidth,
29525
29278
  railHeight: railHeight,
29526
29279
  min: min,
29527
- max: max,
29528
- inverse: inverse
29280
+ max: max
29529
29281
  } = this.attribute;
29530
29282
  if (max === min) return;
29531
29283
  const {
@@ -29537,14 +29289,14 @@
29537
29289
  const delta = currentPos - this._prePos;
29538
29290
  if (startHandler) {
29539
29291
  const originPos = this._isHorizontal ? startHandler.attribute.x : startHandler.attribute.y,
29540
- newPos = inverse ? clamp$3(originPos + delta, trackLen, railLen) : clamp$3(originPos + delta, 0, railLen - trackLen),
29541
- currentValue = this.calculateValueByPos(newPos);
29292
+ newPos = clamp$3(originPos + delta, 0, railLen - trackLen),
29293
+ currentValue = newPos / railLen * (max - min) + min;
29542
29294
  this._updateHandler(startHandler, newPos, currentValue);
29543
29295
  }
29544
29296
  if (endHandler) {
29545
29297
  const originPos = this._isHorizontal ? endHandler.attribute.x : endHandler.attribute.y,
29546
- newPos = inverse ? clamp$3(originPos + delta, 0, railLen - trackLen) : clamp$3(originPos + delta, trackLen, railLen),
29547
- currentValue = this.calculateValueByPos(newPos),
29298
+ newPos = clamp$3(originPos + delta, trackLen, railLen),
29299
+ currentValue = newPos / railLen * (max - min) + min,
29548
29300
  startHandlerAttribute = null == startHandler ? void 0 : startHandler.attribute;
29549
29301
  this._updateHandler(endHandler, newPos, currentValue), this._track.setAttributes(this._isHorizontal ? {
29550
29302
  x: Math.min(startHandlerAttribute.x, endHandler.attribute.x),
@@ -29572,9 +29324,9 @@
29572
29324
  if (max === min) return;
29573
29325
  const startHandler = this._startHandler,
29574
29326
  endHandler = this._endHandler;
29575
- let currentPos, startHandlerPos, endHandlerPos;
29576
- this._isHorizontal ? (currentPos = e.viewX - this._rail.globalAABBBounds.x1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.x, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.x, railWidth) : (currentPos = e.viewY - this._rail.globalAABBBounds.y1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.y, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.y, railHeight);
29577
- const currentValue = this.calculateValueByPos(currentPos);
29327
+ let currentPos, startHandlerPos, endHandlerPos, railLen;
29328
+ this._isHorizontal ? (currentPos = e.viewX - this._rail.globalAABBBounds.x1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.x, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.x, railLen = railWidth) : (currentPos = e.viewY - this._rail.globalAABBBounds.y1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.y, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.y, railLen = railHeight);
29329
+ const currentValue = currentPos / railLen * (max - min) + min;
29578
29330
  if (isValid$3(endHandlerPos)) {
29579
29331
  const updateHandler = Math.abs(currentPos - startHandlerPos) > Math.abs(currentPos - endHandlerPos) ? endHandler : startHandler;
29580
29332
  this._updateHandler(updateHandler, currentPos, currentValue);
@@ -29582,33 +29334,11 @@
29582
29334
  this._updateTrack(), this._dispatchChangeEvent();
29583
29335
  };
29584
29336
  }
29585
- calculatePosByValue(value, pos) {
29337
+ setValue(value) {
29586
29338
  const {
29587
29339
  layout: layout,
29588
29340
  railWidth: railWidth,
29589
29341
  railHeight: railHeight,
29590
- min: min,
29591
- max: max,
29592
- inverse: inverse
29593
- } = this.attribute;
29594
- let ratio = 0;
29595
- ratio = min === max ? "start" === pos ? 0 : "end" === pos ? 1 : 0 : (value - min) / (max - min);
29596
- return (inverse ? 1 - ratio : ratio) * ("vertical" === layout ? railHeight : railWidth);
29597
- }
29598
- calculateValueByPos(pos) {
29599
- const {
29600
- layout: layout,
29601
- railWidth: railWidth,
29602
- railHeight: railHeight,
29603
- min: min,
29604
- max: max,
29605
- inverse: inverse
29606
- } = this.attribute,
29607
- railLen = "vertical" === layout ? railHeight : railWidth;
29608
- return min + (max - min) * (inverse ? 1 - pos / railLen : pos / railLen);
29609
- }
29610
- setValue(value) {
29611
- const {
29612
29342
  min: min,
29613
29343
  max: max
29614
29344
  } = this.attribute;
@@ -29617,8 +29347,14 @@
29617
29347
  {
29618
29348
  startHandler: startHandler,
29619
29349
  endHandler: endHandler
29620
- } = this._getHandlers();
29621
- startHandler && this._updateHandler(startHandler, this.calculatePosByValue(startValue), startValue), endHandler && this._updateHandler(endHandler, this.calculatePosByValue(endValue), endValue), this._updateTrack();
29350
+ } = this._getHandlers(),
29351
+ railLen = "vertical" === layout ? railHeight : railWidth,
29352
+ startPos = (startValue - min) / (max - min) * railLen;
29353
+ if (startHandler && this._updateHandler(startHandler, startPos, startValue), endHandler) {
29354
+ const endPos = (endValue - min) / (max - min) * railLen;
29355
+ this._updateHandler(endHandler, endPos, endValue);
29356
+ }
29357
+ this._updateTrack();
29622
29358
  }
29623
29359
  render() {
29624
29360
  var _a, _b;
@@ -29721,29 +29457,30 @@
29721
29457
  isNil$3(value) && (value = [min, max]);
29722
29458
  const handlerTextVisible = handlerText && handlerText.visible,
29723
29459
  isHorizontal = this._isHorizontal,
29460
+ railLen = isHorizontal ? railWidth : railHeight,
29724
29461
  [startValue, endValue] = convertValueToRange(value),
29725
- startPos = this.calculatePosByValue(startValue, range ? "start" : "end"),
29462
+ handlerStart = max === min ? range ? 0 : railLen : (startValue - min) / (max - min) * railLen,
29726
29463
  startHandler = this._renderHandler(Object.assign({
29727
- x: isHorizontal ? startPos : railWidth / 2,
29728
- y: isHorizontal ? railHeight / 2 : startPos,
29464
+ x: isHorizontal ? handlerStart : railWidth / 2,
29465
+ y: isHorizontal ? railHeight / 2 : handlerStart,
29729
29466
  size: handlerSize,
29730
29467
  strokeBoundsBuffer: 0,
29731
29468
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
29732
29469
  }, handlerStyle));
29733
- if (startHandler.name = SLIDER_ELEMENT_NAME.startHandler, this._startHandler = startHandler, container.add(startHandler), this._currentValue.startPos = startPos, handlerTextVisible) {
29470
+ if (startHandler.name = SLIDER_ELEMENT_NAME.startHandler, this._startHandler = startHandler, container.add(startHandler), this._currentValue.startPos = handlerStart, handlerTextVisible) {
29734
29471
  const startHandlerText = this._renderHandlerText(startValue, range ? "start" : "end");
29735
29472
  startHandlerText.name = SLIDER_ELEMENT_NAME.startHandlerText, container.add(startHandlerText), this._startHandlerText = startHandlerText;
29736
29473
  }
29737
29474
  if (range) {
29738
- const endPos = this.calculatePosByValue(endValue, "end"),
29475
+ const handlerEnd = max === min ? railLen : (endValue - min) / (max - min) * railLen,
29739
29476
  endHandler = this._renderHandler(Object.assign({
29740
- x: isHorizontal ? endPos : railWidth / 2,
29741
- y: isHorizontal ? railHeight / 2 : endPos,
29477
+ x: isHorizontal ? handlerEnd : railWidth / 2,
29478
+ y: isHorizontal ? railHeight / 2 : handlerEnd,
29742
29479
  size: handlerSize,
29743
29480
  strokeBoundsBuffer: 0,
29744
29481
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
29745
29482
  }, handlerStyle));
29746
- if (endHandler.name = SLIDER_ELEMENT_NAME.endHandler, this._endHandler = endHandler, container.add(endHandler), this._currentValue.endPos = endPos, handlerTextVisible) {
29483
+ if (endHandler.name = SLIDER_ELEMENT_NAME.endHandler, this._endHandler = endHandler, container.add(endHandler), this._currentValue.endPos = handlerEnd, handlerTextVisible) {
29747
29484
  const endHandlerText = this._renderHandlerText(endValue, "end");
29748
29485
  endHandlerText.name = SLIDER_ELEMENT_NAME.endHandlerText, container.add(endHandlerText), this._endHandlerText = endHandlerText;
29749
29486
  }
@@ -29766,7 +29503,8 @@
29766
29503
  const clampValue = clampRange$1(value, min, max);
29767
29504
  startValue = clampValue[0], endValue = clampValue[1];
29768
29505
  } else startValue = min, endValue = clamp$3(value, min, max);
29769
- const isHorizontal = this._isHorizontal;
29506
+ const isHorizontal = this._isHorizontal,
29507
+ railLen = isHorizontal ? railWidth : railHeight;
29770
29508
  range || (startValue = min);
29771
29509
  const trackContainer = graphicCreator$1.group({
29772
29510
  x: 0,
@@ -29781,13 +29519,13 @@
29781
29519
  const draggableTrack = isObject$4(range) && !0 === range.draggableTrack;
29782
29520
  let cursor;
29783
29521
  cursor = !1 === slidable ? "default" : !1 === range || !1 === draggableTrack ? "pointer" : getDefaultCursor(isHorizontal);
29784
- const startPos = this.calculatePosByValue(startValue, "start"),
29785
- endPos = this.calculatePosByValue(endValue, range ? "end" : "start"),
29522
+ const trackWidth = max === min ? railLen : (endValue - startValue) / (max - min) * railLen,
29523
+ startPos = max === min ? 0 : (startValue - min) / (max - min) * railLen,
29786
29524
  track = graphicCreator$1.rect(Object.assign({
29787
- x: isHorizontal ? Math.min(startPos, endPos) : 0,
29788
- y: isHorizontal ? 0 : Math.min(startPos, endPos),
29789
- width: isHorizontal ? Math.abs(endPos - startPos) : railWidth,
29790
- height: isHorizontal ? railHeight : Math.abs(endPos - startPos),
29525
+ x: isHorizontal ? startPos : 0,
29526
+ y: isHorizontal ? 0 : startPos,
29527
+ width: isHorizontal ? trackWidth : railWidth,
29528
+ height: isHorizontal ? railHeight : trackWidth,
29791
29529
  cursor: cursor
29792
29530
  }, trackStyle));
29793
29531
  track.name = SLIDER_ELEMENT_NAME.track, this._track = track, trackContainer.add(track), container.add(trackContainer);
@@ -29799,6 +29537,8 @@
29799
29537
  var _a, _b, _c;
29800
29538
  const {
29801
29539
  align: align,
29540
+ min: min,
29541
+ max: max,
29802
29542
  handlerSize = 14,
29803
29543
  handlerText = {},
29804
29544
  railHeight: railHeight,
@@ -29806,14 +29546,15 @@
29806
29546
  slidable: slidable
29807
29547
  } = this.attribute,
29808
29548
  isHorizontal = this._isHorizontal,
29809
- pos = this.calculatePosByValue(value, position),
29549
+ railLen = isHorizontal ? railWidth : railHeight,
29550
+ handlerStart = max === min ? "start" === position ? 0 : railLen : (value - min) / (max - min) * railLen,
29810
29551
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
29811
29552
  textStyle = {
29812
29553
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
29813
29554
  lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
29814
29555
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
29815
29556
  };
29816
- 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);
29557
+ isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = handlerStart, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = handlerStart, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = handlerStart) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = handlerStart);
29817
29558
  return graphicCreator$1.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
29818
29559
  }
29819
29560
  _renderTooltip() {
@@ -29854,12 +29595,7 @@
29854
29595
  _updateTooltip() {
29855
29596
  var _a, _b;
29856
29597
  if (!this._tooltipShape && !this._tooltipText || !this._tooltipState) return;
29857
- const {
29858
- railWidth: railWidth,
29859
- railHeight: railHeight
29860
- } = this.attribute,
29861
- railLen = this._isHorizontal ? railWidth : railHeight,
29862
- coord = this._tooltipState.pos * railLen,
29598
+ const coord = this._isHorizontal ? this._tooltipState.pos * this.attribute.railWidth : this._tooltipState.pos * this.attribute.railHeight,
29863
29599
  coordKey = this._isHorizontal ? "x" : "y";
29864
29600
  this._tooltipShape && this._tooltipShape.setAttributes({
29865
29601
  visible: !0,
@@ -29889,12 +29625,7 @@
29889
29625
  this.attribute.disableTriggerEvent || (this._mainContainer.addEventListener("pointerenter", this._onTooltipShow), this._mainContainer.addEventListener("pointermove", this._onTooltipUpdate), this._mainContainer.addEventListener("pointerleave", this._onTooltipHide));
29890
29626
  }
29891
29627
  _updateTrack() {
29892
- const {
29893
- inverse: inverse,
29894
- railWidth: railWidth,
29895
- railHeight: railHeight
29896
- } = this.attribute,
29897
- startHandler = this._startHandler,
29628
+ const startHandler = this._startHandler,
29898
29629
  endHandler = this._endHandler;
29899
29630
  if (this._isHorizontal) {
29900
29631
  const startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.x;
@@ -29904,10 +29635,7 @@
29904
29635
  x: Math.min(startHandlerPos, endHandlerPos),
29905
29636
  width: Math.abs(startHandlerPos - endHandlerPos)
29906
29637
  });
29907
- } else inverse ? this._track.setAttributes({
29908
- x: startHandlerPos,
29909
- width: railWidth - startHandlerPos
29910
- }) : this._track.setAttributes({
29638
+ } else this._track.setAttributes({
29911
29639
  width: startHandlerPos
29912
29640
  });
29913
29641
  } else {
@@ -29918,10 +29646,7 @@
29918
29646
  y: Math.min(startHandlerPos, endHandlerPos),
29919
29647
  height: Math.abs(startHandlerPos - endHandlerPos)
29920
29648
  });
29921
- } else inverse ? this._track.setAttributes({
29922
- y: startHandlerPos,
29923
- height: railHeight - startHandlerPos
29924
- }) : this._track.setAttributes({
29649
+ } else this._track.setAttributes({
29925
29650
  height: startHandlerPos
29926
29651
  });
29927
29652
  }
@@ -30081,7 +29806,6 @@
30081
29806
  handlerText: handlerText,
30082
29807
  showTooltip: showTooltip,
30083
29808
  tooltip: tooltip,
30084
- inverse: inverse,
30085
29809
  disableTriggerEvent: disableTriggerEvent
30086
29810
  } = this.attribute,
30087
29811
  domain = [],
@@ -30114,8 +29838,7 @@
30114
29838
  handlerText: handlerText,
30115
29839
  showTooltip: showTooltip,
30116
29840
  tooltip: tooltip,
30117
- disableTriggerEvent: disableTriggerEvent,
30118
- inverse: inverse
29841
+ disableTriggerEvent: disableTriggerEvent
30119
29842
  });
30120
29843
  this._innerView.add(slider), this._slider = slider, slider.translateTo(0 - slider.AABBBounds.x1, (this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", DEFAULT_TITLE_SPACE) : 0) - slider.AABBBounds.y1), this._updateColor();
30121
29844
  }
@@ -30125,8 +29848,7 @@
30125
29848
  _getTrackColor() {
30126
29849
  const {
30127
29850
  colors: colors,
30128
- layout: layout,
30129
- inverse: inverse
29851
+ layout: layout
30130
29852
  } = this.attribute;
30131
29853
  if (isEmpty(colors)) return;
30132
29854
  const count = colors.length;
@@ -30139,16 +29861,15 @@
30139
29861
  color: colors[i]
30140
29862
  });
30141
29863
  }
30142
- const isHorizontal = "horizontal" === layout,
30143
- res = {
30144
- gradient: "linear",
30145
- stops: stops,
30146
- x0: 0,
30147
- y0: 0,
30148
- x1: isHorizontal ? 1 : 0,
30149
- y1: isHorizontal ? 0 : 1
30150
- };
30151
- return inverse && (isHorizontal ? (res.x0 = 1, res.x1 = 0) : (res.y0 = 1, res.y1 = 0)), res;
29864
+ const isHorizontal = "horizontal" === layout;
29865
+ return {
29866
+ gradient: "linear",
29867
+ stops: stops,
29868
+ x0: 0,
29869
+ y0: 0,
29870
+ x1: isHorizontal ? 1 : 0,
29871
+ y1: isHorizontal ? 0 : 1
29872
+ };
30152
29873
  }
30153
29874
  _updateColor() {
30154
29875
  const {
@@ -30270,8 +29991,7 @@
30270
29991
  showTooltip: showTooltip,
30271
29992
  tooltip: tooltip,
30272
29993
  sizeBackground: sizeBackground,
30273
- disableTriggerEvent: disableTriggerEvent,
30274
- inverse: inverse
29994
+ disableTriggerEvent: disableTriggerEvent
30275
29995
  } = this.attribute,
30276
29996
  mainContainer = graphicCreator$1.group({
30277
29997
  x: 0,
@@ -30305,13 +30025,12 @@
30305
30025
  handlerText: handlerText,
30306
30026
  showTooltip: showTooltip,
30307
30027
  tooltip: tooltip,
30308
- disableTriggerEvent: disableTriggerEvent,
30309
- inverse: inverse
30028
+ disableTriggerEvent: disableTriggerEvent
30310
30029
  });
30311
30030
  mainContainer.add(slider);
30312
30031
  let path,
30313
30032
  start = 0;
30314
- "horizontal" === layout ? "top" === align ? (path = `M0,0L${railWidth},0L${inverse ? 0 : railWidth},12Z`, start = railHeight) : (path = `M0,12L${railWidth},12L${inverse ? 0 : railWidth},0Z`, slider.setAttribute("y", 12)) : "left" === align ? path = `M${railWidth},0L${railWidth + 12},${inverse ? 0 : railHeight}L${railWidth},${railHeight}Z` : (path = `M0,${inverse ? 0 : railHeight}L12,${railHeight}L12,0Z`, slider.setAttribute("x", 12));
30033
+ "horizontal" === layout ? "top" === align ? (path = `M0,0L${railWidth},0L${railWidth},12Z`, start = railHeight) : (path = `M0,12L${railWidth},12L${railWidth},0Z`, slider.setAttribute("y", 12)) : "left" === align ? path = `M${railWidth},0L${railWidth},0L${railWidth + 12},${railHeight}L${railWidth},${railHeight}Z` : (path = `M0,${railHeight}L12,${railHeight}L12,0Z`, slider.setAttribute("x", 12));
30315
30034
  const background = graphicCreator$1.path(Object.assign(Object.assign({
30316
30035
  x: 0,
30317
30036
  y: start,
@@ -33017,9 +32736,7 @@
33017
32736
  const axisStylrAttrs = getAxisAttributes(this.option);
33018
32737
  const attrs = this.getUpdateAttribute();
33019
32738
  attrs.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
33020
- this.component = new LineAxis(merge({
33021
- disableTriggerEvent: this.table.options.disableInteraction
33022
- }, axisStylrAttrs, attrs));
32739
+ this.component = new LineAxis(merge({}, axisStylrAttrs, attrs));
33023
32740
  this.component.setAttributes(this.setLayoutStartPosition({ x: 0, y: 0 }));
33024
32741
  this.component.originAxis = this;
33025
32742
  }
@@ -37491,7 +37208,7 @@
37491
37208
  this.numberType = CHART_NUMBER_TYPE;
37492
37209
  this.isShareChartSpec = isShareChartSpec;
37493
37210
  if (!params.chartInstance) {
37494
- const chartInstance = (this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
37211
+ const chartInstance = new params.ClassType(params.spec, {
37495
37212
  renderCanvas: params.canvas,
37496
37213
  mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
37497
37214
  modeParams: this.attribute.modeParams,
@@ -37501,9 +37218,8 @@
37501
37218
  interactive: false,
37502
37219
  animation: false,
37503
37220
  autoFit: false
37504
- })));
37221
+ });
37505
37222
  chartInstance.renderSync();
37506
- chartInstance.getStage().enableDirtyBounds();
37507
37223
  params.chartInstance = this.chartInstance = chartInstance;
37508
37224
  }
37509
37225
  else {
@@ -37521,53 +37237,34 @@
37521
37237
  y1: y1 - table.scrollTop,
37522
37238
  y2: y2 - table.scrollTop
37523
37239
  });
37524
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
37240
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
37525
37241
  renderCanvas: this.attribute.canvas,
37526
37242
  mode: 'desktop-browser',
37527
37243
  canvasControled: false,
37528
37244
  viewBox: {
37529
- x1: 0,
37530
- x2: x2 - x1,
37531
- y1: 0,
37532
- y2: y2 - y1
37245
+ x1: x1 - table.scrollLeft,
37246
+ x2: x2 - table.scrollLeft,
37247
+ y1: y1 - table.scrollTop,
37248
+ y2: y2 - table.scrollTop
37533
37249
  },
37534
37250
  dpr: table.internalProps.pixelRatio,
37535
37251
  animation: false,
37536
37252
  interactive: true,
37537
37253
  autoFit: false,
37538
- beforeRender: (chartStage) => {
37539
- const stage = this.stage;
37540
- const ctx = chartStage.window.getContext();
37541
- const stageMatrix = stage.window.getViewBoxTransform();
37542
- const viewBox = stage.window.getViewBox();
37254
+ beforeRender: (stage) => {
37255
+ const ctx = stage.window.getContext();
37543
37256
  ctx.inuse = true;
37544
37257
  ctx.clearMatrix();
37545
- ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, true);
37546
- ctx.translate(viewBox.x1, viewBox.y1);
37547
37258
  ctx.setTransformForCurrent(true);
37548
37259
  ctx.beginPath();
37549
37260
  ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
37550
37261
  ctx.clip();
37551
- ctx.clearMatrix();
37552
- if (!chartStage.needRender) {
37553
- chartStage.pauseRender();
37554
- table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);
37555
- table.scenegraph.updateNextFrame();
37556
- }
37557
37262
  },
37558
37263
  afterRender(stage) {
37559
37264
  const ctx = stage.window.getContext();
37560
37265
  ctx.inuse = false;
37561
- stage.needRender = false;
37562
- chartStage.resumeRender();
37563
37266
  }
37564
- }));
37565
- const chartStage = this.activeChartInstance.getStage();
37566
- const matrix = this.globalTransMatrix.clone();
37567
- const stageMatrix = this.stage.window.getViewBoxTransform();
37568
- matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
37569
- chartStage.window.setViewBoxTransform &&
37570
- chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
37267
+ });
37571
37268
  this.activeChartInstance.renderSync();
37572
37269
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
37573
37270
  this.activeChartInstance.on('click', (params) => {
@@ -37603,12 +37300,11 @@
37603
37300
  const cellGroup = this.parent;
37604
37301
  const padding = this.attribute.cellPadding;
37605
37302
  const table = this.stage.table;
37606
- const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
37607
37303
  return {
37608
- x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
37609
- x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
37610
- y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
37611
- y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
37304
+ x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
37305
+ x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
37306
+ y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
37307
+ y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
37612
37308
  };
37613
37309
  }
37614
37310
  }
@@ -37639,10 +37335,6 @@
37639
37335
  bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
37640
37336
  bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
37641
37337
  }
37642
- bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);
37643
- bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);
37644
- bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);
37645
- bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);
37646
37338
  return bodyBound;
37647
37339
  }
37648
37340
 
@@ -37701,8 +37393,7 @@
37701
37393
  data: table.getCellValue(col, row),
37702
37394
  cellPadding: padding,
37703
37395
  dpr: table.internalProps.pixelRatio,
37704
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
37705
- tableChartOption: table.options.chartOption
37396
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
37706
37397
  });
37707
37398
  cellGroup.appendChild(chartGroup);
37708
37399
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -37942,7 +37633,7 @@
37942
37633
  wordBreak: 'break-word',
37943
37634
  heightLimit: autoRowHeight ? -1 : cellHeight - (padding[0] + padding[2]),
37944
37635
  pickable: false,
37945
- dx: hierarchyOffset + _contentOffset,
37636
+ dx: (textAlign === 'left' ? hierarchyOffset : 0) + _contentOffset,
37946
37637
  whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal'
37947
37638
  };
37948
37639
  const wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
@@ -38044,7 +37735,8 @@
38044
37735
  lineClamp,
38045
37736
  wordBreak: 'break-word',
38046
37737
  whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal',
38047
- dx: _contentOffset + (!contentLeftIcons.length && !contentRightIcons.length ? hierarchyOffset : 0)
37738
+ dx: (textAlign === 'left' ? (!contentLeftIcons.length && !contentRightIcons.length ? hierarchyOffset : 0) : 0) +
37739
+ _contentOffset
38048
37740
  };
38049
37741
  const wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
38050
37742
  wrapText.name = 'text';
@@ -38261,7 +37953,7 @@
38261
37953
  let contentHeight;
38262
37954
  if (textMark instanceof Text$1) {
38263
37955
  oldTextHeight = textMark.AABBBounds.height();
38264
- textMark.setAttribute('maxLineWidth', distWidth - leftIconWidth - rightIconHeight - (padding[1] + padding[3]));
37956
+ textMark.setAttribute('maxLineWidth', distWidth - leftIconWidth - rightIconHeight - (padding[1] + padding[3]) - (textMark.attribute.dx ?? 0));
38265
37957
  contentHeight = textMark.AABBBounds.height();
38266
37958
  }
38267
37959
  else if (textMark instanceof RichText) {
@@ -38945,7 +38637,7 @@
38945
38637
  wordBreak: 'break-word',
38946
38638
  heightLimit: cellHeight - (padding[0] + padding[2]),
38947
38639
  pickable: false,
38948
- dx: hierarchyOffset,
38640
+ dx: textAlign === 'left' ? hierarchyOffset : 0,
38949
38641
  x
38950
38642
  };
38951
38643
  textMark.setAttributes(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
@@ -40639,7 +40331,8 @@
40639
40331
  }
40640
40332
  }
40641
40333
  else if (autoWrapText) {
40642
- const maxLineWidth = cellWidth - (padding[1] + padding[3]) - iconWidth;
40334
+ const hierarchyOffset = getHierarchyOffset(col, row, table);
40335
+ const maxLineWidth = cellWidth - (padding[1] + padding[3]) - iconWidth - hierarchyOffset;
40643
40336
  utilTextMark.setAttributes({
40644
40337
  maxLineWidth,
40645
40338
  text: lines,
@@ -42458,65 +42151,48 @@
42458
42151
  if (viewBox.y2 <= viewBox.y1) {
42459
42152
  viewBox.y2 = viewBox.y1 + 1;
42460
42153
  }
42461
- chartInstance.updateViewBox({
42462
- x1: 0,
42463
- x2: viewBox.x2 - viewBox.x1,
42464
- y1: 0,
42465
- y2: viewBox.y2 - viewBox.y1
42466
- }, false, false);
42467
- const chartStage = chartInstance.getStage();
42468
- const matrix = chart.globalTransMatrix.clone();
42469
- const stageMatrix = chart.stage.window.getViewBoxTransform();
42470
- matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
42471
- chartStage.window.setViewBoxTransform &&
42472
- chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
42473
- const { table } = chart.getRootNode();
42474
- let updateSpec = false;
42475
- if (table.options.specFormat) {
42476
- const formatResult = table.options.specFormat(chart.attribute.spec);
42477
- if (formatResult.needFormatSpec && formatResult.spec) {
42478
- const spec = formatResult.spec;
42479
- chartInstance.updateSpecSync(spec);
42480
- updateSpec = true;
42481
- }
42482
- }
42483
- if (!updateSpec) {
42484
- axes?.forEach((axis, index) => {
42485
- if (axis.type === 'band') {
42486
- chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
42487
- }
42488
- else {
42489
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
42490
- }
42491
- });
42492
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
42493
- if (typeof dataId === 'string') {
42494
- chartInstance.updateDataSync(dataId, data ?? []);
42154
+ axes?.forEach((axis, index) => {
42155
+ if (axis.type === 'band') {
42156
+ chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
42495
42157
  }
42496
42158
  else {
42497
- const dataBatch = [];
42498
- for (const dataIdStr in dataId) {
42499
- const dataIdAndField = dataId[dataIdStr];
42500
- const series = spec.series.find((item) => item?.data?.id === dataIdStr);
42501
- dataBatch.push({
42502
- id: dataIdStr,
42503
- values: dataIdAndField
42504
- ? data?.filter((item) => {
42505
- return item.hasOwnProperty(dataIdAndField);
42506
- }) ?? []
42507
- : data ?? [],
42508
- fields: series?.data?.fields
42509
- });
42510
- if (!chartInstance.updateFullDataSync) {
42511
- chartInstance.updateDataSync(dataIdStr, dataIdAndField
42512
- ? data?.filter((item) => {
42513
- return item.hasOwnProperty(dataIdAndField);
42514
- }) ?? []
42515
- : data ?? []);
42516
- }
42159
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
42160
+ }
42161
+ });
42162
+ chartInstance.updateViewBox({
42163
+ x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
42164
+ x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
42165
+ y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
42166
+ y2: viewBox.y2 - chart.getRootNode().table.scrollTop
42167
+ }, false, false);
42168
+ const table = chart.getRootNode().table;
42169
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
42170
+ if (typeof dataId === 'string') {
42171
+ chartInstance.updateDataSync(dataId, data ?? []);
42172
+ }
42173
+ else {
42174
+ const dataBatch = [];
42175
+ for (const dataIdStr in dataId) {
42176
+ const dataIdAndField = dataId[dataIdStr];
42177
+ const series = spec.series.find((item) => item?.data?.id === dataIdStr);
42178
+ dataBatch.push({
42179
+ id: dataIdStr,
42180
+ values: dataIdAndField
42181
+ ? data?.filter((item) => {
42182
+ return item.hasOwnProperty(dataIdAndField);
42183
+ }) ?? []
42184
+ : data ?? [],
42185
+ fields: series?.data?.fields
42186
+ });
42187
+ if (!chartInstance.updateFullDataSync) {
42188
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField
42189
+ ? data?.filter((item) => {
42190
+ return item.hasOwnProperty(dataIdAndField);
42191
+ }) ?? []
42192
+ : data ?? []);
42517
42193
  }
42518
- chartInstance.updateFullDataSync?.(dataBatch);
42519
42194
  }
42195
+ chartInstance.updateFullDataSync?.(dataBatch);
42520
42196
  }
42521
42197
  const sg = chartInstance.getStage();
42522
42198
  cacheStageCanvas(sg, chart);
@@ -42578,7 +42254,7 @@
42578
42254
  }
42579
42255
 
42580
42256
  const ChartRender = Symbol.for('ChartRender');
42581
- let DefaultCanvasChartRender = class DefaultCanvasChartRender extends BaseRender {
42257
+ let DefaultCanvasChartRender = class DefaultCanvasChartRender {
42582
42258
  type;
42583
42259
  numberType = CHART_NUMBER_TYPE;
42584
42260
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -42586,7 +42262,6 @@
42586
42262
  const { dataId, data, spec } = chart.attribute;
42587
42263
  chart.getViewBox();
42588
42264
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
42589
- const { table } = chart.getRootNode();
42590
42265
  const { active, cacheCanvas, activeChartInstance } = chart;
42591
42266
  if (!active && cacheCanvas) {
42592
42267
  if (isArray$3(cacheCanvas)) {
@@ -42600,27 +42275,6 @@
42600
42275
  }
42601
42276
  }
42602
42277
  else if (activeChartInstance) {
42603
- if (table.options.specFormat) {
42604
- const formatResult = table.options.specFormat(chart.attribute.spec);
42605
- if (formatResult.needFormatSpec && formatResult.spec) {
42606
- const spec = formatResult.spec;
42607
- activeChartInstance.updateSpecSync(spec);
42608
- return;
42609
- }
42610
- }
42611
- const viewBox = chart.getViewBox();
42612
- activeChartInstance.updateViewBox({
42613
- x1: 0,
42614
- x2: viewBox.x2 - viewBox.x1,
42615
- y1: 0,
42616
- y2: viewBox.y2 - viewBox.y1
42617
- }, false, false);
42618
- const chartStage = activeChartInstance.getStage();
42619
- chartStage.needRender = true;
42620
- const matrix = chart.globalTransMatrix.clone();
42621
- const stageMatrix = chart.stage.window.getViewBoxTransform().clone();
42622
- stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
42623
- chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
42624
42278
  if (typeof dataId === 'string') {
42625
42279
  activeChartInstance.updateDataSync(dataId, data ?? []);
42626
42280
  }
@@ -42650,13 +42304,13 @@
42650
42304
  }
42651
42305
  }
42652
42306
  else {
42653
- if (table.internalProps.renderChartAsync) {
42307
+ if (chart.getRootNode().table.internalProps.renderChartAsync) {
42654
42308
  if (chartRenderKeys.indexOf(`${chart.parent.col}+${chart.parent.row}`) === -1) {
42655
42309
  chartRenderKeys.push(`${chart.parent.col}+${chart.parent.row}`);
42656
42310
  chartRenderQueueList.push(chart);
42657
42311
  }
42658
42312
  if (!IsHandlingChartQueue()) {
42659
- startRenderChartQueue(table);
42313
+ startRenderChartQueue(chart.getRootNode().table);
42660
42314
  }
42661
42315
  }
42662
42316
  else {
@@ -42665,7 +42319,31 @@
42665
42319
  }
42666
42320
  }
42667
42321
  draw(chart, renderService, drawContext, params) {
42668
- this._draw(chart, {}, false, drawContext, params);
42322
+ const { context } = drawContext;
42323
+ if (!context) {
42324
+ return;
42325
+ }
42326
+ const { clip } = chart.attribute;
42327
+ if (clip) {
42328
+ context.save();
42329
+ }
42330
+ else {
42331
+ context.highPerformanceSave();
42332
+ }
42333
+ context.transformFromMatrix(chart.transMatrix, true);
42334
+ context.beginPath();
42335
+ if (params.skipDraw) {
42336
+ this.drawShape(chart, context, 0, 0, drawContext, params, () => false, () => false);
42337
+ }
42338
+ else {
42339
+ this.drawShape(chart, context, 0, 0, drawContext);
42340
+ }
42341
+ if (clip) {
42342
+ context.restore();
42343
+ }
42344
+ else {
42345
+ context.highPerformanceRestore();
42346
+ }
42669
42347
  }
42670
42348
  };
42671
42349
  DefaultCanvasChartRender = __decorate([
@@ -47231,15 +46909,6 @@
47231
46909
  });
47232
46910
  }
47233
46911
  }
47234
- function clearCellChartCacheImage(col, row, scenegraph) {
47235
- const cellGroup = scenegraph.getCell(col, row);
47236
- cellGroup.children.forEach((node) => {
47237
- if (node.type === 'chart') {
47238
- node.cacheCanvas = null;
47239
- node.addUpdateBoundTag();
47240
- }
47241
- });
47242
- }
47243
46912
  function updateChartData(scenegraph) {
47244
46913
  const table = scenegraph.table;
47245
46914
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -48064,12 +47733,7 @@
48064
47733
  setPoptipTheme(this.table.theme.textPopTipStyle);
48065
47734
  let width;
48066
47735
  let height;
48067
- if (table.options.canvas && table.options.viewBox) {
48068
- vglobal.setEnv('browser');
48069
- width = table.options.viewBox.x2 - table.options.viewBox.x1;
48070
- height = table.options.viewBox.y2 - table.options.viewBox.y1;
48071
- }
48072
- else if (Env.mode === 'node') {
47736
+ if (Env.mode === 'node') {
48073
47737
  vglobal.setEnv('node', table.options.modeParams);
48074
47738
  width = table.canvasWidth;
48075
47739
  height = table.canvasHeight;
@@ -48087,15 +47751,9 @@
48087
47751
  background: table.theme.underlayBackgroundColor,
48088
47752
  dpr: table.internalProps.pixelRatio,
48089
47753
  enableLayout: true,
48090
- beforeRender: (stage) => {
48091
- this.table.options.beforeRender && this.table.options.beforeRender(stage);
48092
- },
48093
- afterRender: (stage) => {
48094
- this.table.options.afterRender && this.table.options.afterRender(stage);
47754
+ afterRender: () => {
48095
47755
  this.table.fireListeners('after_render', null);
48096
- },
48097
- canvasControled: !table.options.canvas,
48098
- viewBox: table.options.viewBox
47756
+ }
48099
47757
  });
48100
47758
  this.stage.defaultLayer.setTheme({
48101
47759
  group: {
@@ -51463,8 +51121,8 @@
51463
51121
  function getCellEventArgsSet(e) {
51464
51122
  const tableEvent = {
51465
51123
  abstractPos: {
51466
- x: e.viewport.x,
51467
- y: e.viewport.y
51124
+ x: e.x,
51125
+ y: e.y
51468
51126
  }
51469
51127
  };
51470
51128
  const targetCell = getTargetCell(e.target);
@@ -52530,14 +52188,12 @@
52530
52188
  e.preventDefault();
52531
52189
  }
52532
52190
  });
52533
- if (!table.options.canvas) {
52534
- handler.on(table.getContainer(), 'resize', e => {
52535
- if (e.width === 0 && e.height === 0) {
52536
- return;
52537
- }
52538
- table.resize();
52539
- });
52540
- }
52191
+ handler.on(table.getContainer(), 'resize', e => {
52192
+ if (e.width === 0 && e.height === 0) {
52193
+ return;
52194
+ }
52195
+ table.resize();
52196
+ });
52541
52197
  function pasteHtmlToTable(item) {
52542
52198
  const ranges = table.stateManager.select.ranges;
52543
52199
  const selectRangeLength = ranges.length;
@@ -53057,7 +52713,7 @@
53057
52713
  constructor(table) {
53058
52714
  this.table = table;
53059
52715
  this.inertiaScroll = new InertiaScroll(table.stateManager);
53060
- if (Env.mode === 'node' || table.options.disableInteraction) {
52716
+ if (Env.mode === 'node') {
53061
52717
  return;
53062
52718
  }
53063
52719
  this.bindOuterEvent();
@@ -55524,7 +55180,6 @@
55524
55180
  }
55525
55181
 
55526
55182
  class FocusInput extends EventTarget {
55527
- _container;
55528
55183
  _table;
55529
55184
  _input;
55530
55185
  constructor(table, parentElement) {
@@ -55544,7 +55199,6 @@
55544
55199
  input.dataset.vtable = 'vtable';
55545
55200
  input.readOnly = true;
55546
55201
  parentElement.appendChild(div);
55547
- this._container = div;
55548
55202
  }
55549
55203
  focus() {
55550
55204
  this._input.focus({ preventScroll: true });
@@ -55564,7 +55218,6 @@
55564
55218
  return this._input;
55565
55219
  }
55566
55220
  release() {
55567
- this._container.parentElement?.removeChild(this._container);
55568
55221
  }
55569
55222
  }
55570
55223
 
@@ -55698,8 +55351,7 @@
55698
55351
  height: this.table.tableNoFrameHeight
55699
55352
  });
55700
55353
  const legend = new DiscreteLegend(merge({}, attrs, {
55701
- defaultSelected: this.selectedData,
55702
- disableTriggerEvent: this.table.options.disableInteraction
55354
+ defaultSelected: this.selectedData
55703
55355
  }));
55704
55356
  legend.name = 'legend';
55705
55357
  this.legendComponent = legend;
@@ -56598,7 +56250,7 @@
56598
56250
  return TABLE_EVENT_TYPE;
56599
56251
  }
56600
56252
  options;
56601
- version = "0.23.1-alpha.2";
56253
+ version = "0.23.1";
56602
56254
  pagination;
56603
56255
  id = `VTable${Date.now()}`;
56604
56256
  headerStyleCache;
@@ -56611,7 +56263,7 @@
56611
56263
  columnWidthComputeMode;
56612
56264
  constructor(container, options = {}) {
56613
56265
  super();
56614
- if (!container && options.mode !== 'node' && !options.canvas) {
56266
+ if (!container && options.mode !== 'node') {
56615
56267
  throw new Error("vtable's container is undefined");
56616
56268
  }
56617
56269
  const { frozenColCount = 0, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, keyboardOptions, eventOptions, rowSeriesNumber, columnResizeMode, dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth } = options;
@@ -56647,14 +56299,7 @@
56647
56299
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
56648
56300
  this.showFrozenIcon = false;
56649
56301
  }
56650
- if (this.options.canvas) {
56651
- internalProps.element = this.options.canvas.parentElement;
56652
- internalProps.element.style.position = 'relative';
56653
- internalProps.focusControl = new FocusInput(this, internalProps.element);
56654
- internalProps.canvas = this.options.canvas;
56655
- internalProps.context = internalProps.canvas.getContext('2d');
56656
- }
56657
- else if (Env.mode !== 'node') {
56302
+ if (Env.mode !== 'node') {
56658
56303
  internalProps.element = createRootElement(this.padding);
56659
56304
  internalProps.focusControl = new FocusInput(this, internalProps.element);
56660
56305
  internalProps.canvas = document.createElement('canvas');
@@ -56995,21 +56640,7 @@
56995
56640
  const { padding } = this;
56996
56641
  let widthP = 0;
56997
56642
  let heightP = 0;
56998
- this.tableX = 0;
56999
- this.tableY = 0;
57000
- if (this.options.canvas && this.options.viewBox) {
57001
- widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
57002
- heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
57003
- if (this?.scenegraph?.stage) {
57004
- if (this.options.viewBox) {
57005
- this.scenegraph.stage.setViewBox(this.options.viewBox, false);
57006
- }
57007
- else {
57008
- this.scenegraph.stage.resize(widthP, heightP);
57009
- }
57010
- }
57011
- }
57012
- else if (Env.mode === 'browser') {
56643
+ if (Env.mode === 'browser') {
57013
56644
  const element = this.getElement();
57014
56645
  const width1 = element.parentElement?.offsetWidth ?? 1 - 1;
57015
56646
  const height1 = element.parentElement?.offsetHeight ?? 1 - 1;
@@ -57055,22 +56686,6 @@
57055
56686
  }
57056
56687
  }
57057
56688
  }
57058
- updateViewBox(newViewBox) {
57059
- const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
57060
- const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
57061
- const newWidth = newViewBox.x2 - newViewBox.x1;
57062
- const newHeight = newViewBox.y2 - newViewBox.y1;
57063
- this.options.viewBox = newViewBox;
57064
- if (oldWidth !== newWidth || oldHeight !== newHeight) {
57065
- this.resize();
57066
- }
57067
- else {
57068
- this.scenegraph.stage.setViewBox(this.options.viewBox, true);
57069
- }
57070
- }
57071
- setViewBoxTransform(a, b, c, d, e, f) {
57072
- this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
57073
- }
57074
56689
  get rowHierarchyType() {
57075
56690
  return 'grid';
57076
56691
  }
@@ -57563,8 +57178,6 @@
57563
57178
  const visibleRect = this.getVisibleRect();
57564
57179
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
57565
57180
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
57566
- rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
57567
- rect.offsetTop(this.options.viewBox?.y1 ?? 0);
57568
57181
  return rect;
57569
57182
  }
57570
57183
  getVisibleRect() {
@@ -57718,9 +57331,8 @@
57718
57331
  }
57719
57332
  this.scenegraph.stage.release();
57720
57333
  this.scenegraph.proxy.release();
57721
- internalProps.focusControl.release();
57722
57334
  const { parentElement } = internalProps.element;
57723
- if (parentElement && !this.options.canvas) {
57335
+ if (parentElement) {
57724
57336
  parentElement.removeChild(internalProps.element);
57725
57337
  }
57726
57338
  this.isReleased = true;
@@ -57901,8 +57513,8 @@
57901
57513
  const currentHeight = rect.height;
57902
57514
  const originHeight = this.canvas.offsetHeight || currentHeight;
57903
57515
  const heightRatio = currentHeight / originHeight;
57904
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
57905
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
57516
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0);
57517
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0);
57906
57518
  return { x, y, inTable };
57907
57519
  }
57908
57520
  getTheme() {
@@ -68178,14 +67790,6 @@
68178
67790
  updateChartData(this.scenegraph);
68179
67791
  this.render();
68180
67792
  }
68181
- clearChartCacheImage(col, row) {
68182
- if (isNumber$4(col) && isNumber$4(row)) {
68183
- clearCellChartCacheImage(col, row, this.scenegraph);
68184
- }
68185
- else {
68186
- clearChartCacheImage(this.scenegraph);
68187
- }
68188
- }
68189
67793
  getLegendSelected() {
68190
67794
  return this.internalProps.legends.legendComponent._getSelectedLegends().map((d) => d.label);
68191
67795
  }
@@ -68884,7 +68488,7 @@
68884
68488
  }
68885
68489
 
68886
68490
  registerForVrender();
68887
- const version = "0.23.1-alpha.2";
68491
+ const version = "0.23.1";
68888
68492
  function getIcons() {
68889
68493
  return get$2();
68890
68494
  }