@visactor/vrender-components 0.20.13-alpha.3 → 0.20.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -2460,6 +2460,14 @@ let ATextMeasure = class {
2460
2460
  return data;
2461
2461
  }
2462
2462
  _clipTextEnd(text, options, width, leftIdx, rightIdx) {
2463
+ if (leftIdx === rightIdx) {
2464
+ Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`);
2465
+ const subText = text.substring(0, rightIdx + 1);
2466
+ return {
2467
+ str: subText,
2468
+ width: this.measureTextWidth(subText, options)
2469
+ };
2470
+ }
2463
2471
  const middleIdx = Math.floor((leftIdx + rightIdx) / 2),
2464
2472
  subText = text.substring(0, middleIdx + 1),
2465
2473
  strWidth = this.measureTextWidth(subText, options);
@@ -2493,7 +2501,7 @@ let ATextMeasure = class {
2493
2501
  }
2494
2502
  _clipTextStart(text, options, width, leftIdx, rightIdx) {
2495
2503
  const middleIdx = Math.ceil((leftIdx + rightIdx) / 2),
2496
- subText = text.substring(middleIdx - 1, text.length - 1),
2504
+ subText = text.substring(middleIdx - 1, text.length),
2497
2505
  strWidth = this.measureTextWidth(subText, options);
2498
2506
  let length;
2499
2507
  if (strWidth > width) {
@@ -2501,18 +2509,18 @@ let ATextMeasure = class {
2501
2509
  str: "",
2502
2510
  width: 0
2503
2511
  };
2504
- const str = text.substring(middleIdx, text.length - 1);
2512
+ const str = text.substring(middleIdx, text.length);
2505
2513
  return length = this.measureTextWidth(str, options), length <= width ? {
2506
2514
  str: str,
2507
2515
  width: length
2508
- } : this._clipTextStart(text, options, width, middleIdx, text.length - 1);
2516
+ } : this._clipTextStart(text, options, width, middleIdx, text.length);
2509
2517
  }
2510
2518
  if (strWidth < width) {
2511
2519
  if (middleIdx <= 0) return {
2512
2520
  str: text,
2513
2521
  width: this.measureTextWidth(text, options)
2514
2522
  };
2515
- const str = text.substring(middleIdx - 2, text.length - 1);
2523
+ const str = text.substring(middleIdx - 2, text.length);
2516
2524
  return length = this.measureTextWidth(str, options), length >= width ? {
2517
2525
  str: subText,
2518
2526
  width: strWidth
@@ -17019,7 +17027,7 @@ class LabelBase extends AbstractComponent {
17019
17027
  return listener;
17020
17028
  }
17021
17029
  _smartInvert(labels) {
17022
- var _a, _b, _c, _d, _e;
17030
+ var _a, _b, _c, _d, _e, _f, _g;
17023
17031
  const option = (isObject(this.attribute.smartInvert) ? this.attribute.smartInvert : {});
17024
17032
  const { textType, contrastRatiosThreshold, alternativeColors, mode, interactInvertType } = option;
17025
17033
  const fillStrategy = (_a = option.fillStrategy) !== null && _a !== void 0 ? _a : 'invertBase';
@@ -17036,8 +17044,15 @@ class LabelBase extends AbstractComponent {
17036
17044
  continue;
17037
17045
  }
17038
17046
  const baseMark = this.getRelatedGraphic(label.attribute);
17039
- const backgroundColor = baseMark.attribute.fill;
17040
- const foregroundColor = label.attribute.fill;
17047
+ let backgroundColor = baseMark.attribute.fill;
17048
+ let foregroundColor = label.attribute.fill;
17049
+ if (isObject(backgroundColor) && backgroundColor.gradient) {
17050
+ const firstStopColor = (_g = (_f = backgroundColor.stops) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.color;
17051
+ if (firstStopColor) {
17052
+ backgroundColor = firstStopColor;
17053
+ foregroundColor = firstStopColor;
17054
+ }
17055
+ }
17041
17056
  const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
17042
17057
  const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
17043
17058
  const isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds);
@@ -24393,10 +24408,10 @@ class LegendBase extends AbstractComponent {
24393
24408
  render() {
24394
24409
  this.removeAllChild(true);
24395
24410
  const { interactive = true, title, padding = 0 } = this.attribute;
24396
- const parsedPadding = normalizePadding(padding);
24411
+ this._parsedPadding = normalizePadding(padding);
24397
24412
  const innerView = graphicCreator.group({
24398
- x: parsedPadding[3],
24399
- y: parsedPadding[0],
24413
+ x: this._parsedPadding[3],
24414
+ y: this._parsedPadding[0],
24400
24415
  pickable: interactive,
24401
24416
  childrenPickable: interactive
24402
24417
  });
@@ -24412,8 +24427,8 @@ class LegendBase extends AbstractComponent {
24412
24427
  this._bindEvents();
24413
24428
  }
24414
24429
  const viewBounds = this._innerView.AABBBounds;
24415
- this.attribute.width = viewBounds.width() + parsedPadding[1] + parsedPadding[3];
24416
- this.attribute.height = viewBounds.height() + parsedPadding[0] + parsedPadding[2];
24430
+ this.attribute.width = viewBounds.width() + this._parsedPadding[1] + this._parsedPadding[3];
24431
+ this.attribute.height = viewBounds.height() + this._parsedPadding[0] + this._parsedPadding[2];
24417
24432
  }
24418
24433
  _renderTitle(title) {
24419
24434
  const { text = '', textStyle, padding = 0, background, minWidth, maxWidth, shape } = title;
@@ -24498,6 +24513,7 @@ class DiscreteLegend extends LegendBase {
24498
24513
  this._itemHeightByUser = undefined;
24499
24514
  this._itemHeight = 0;
24500
24515
  this._itemMaxWidth = 0;
24516
+ this._contentMaxHeight = 0;
24501
24517
  this._onHover = (e) => {
24502
24518
  const target = e.target;
24503
24519
  if (target && target.name && target.name.startsWith(LEGEND_ELEMENT_NAME.item)) {
@@ -24602,11 +24618,12 @@ class DiscreteLegend extends LegendBase {
24602
24618
  });
24603
24619
  }
24604
24620
  _renderItems() {
24605
- const { item: itemAttrs = {}, maxCol = 1, maxRow = 2, maxWidth, maxHeight, defaultSelected, lazyload, autoPage } = this.attribute;
24621
+ const { item: itemAttrs = {}, maxCol = 1, maxRow = 2, maxWidth, defaultSelected, lazyload, autoPage } = this.attribute;
24606
24622
  const { spaceCol = DEFAULT_ITEM_SPACE_COL, spaceRow = DEFAULT_ITEM_SPACE_ROW } = itemAttrs;
24607
24623
  const itemsContainer = this._itemsContainer;
24608
24624
  const { items: legendItems, isHorizontal, startIndex, isScrollbar } = this._itemContext;
24609
24625
  const maxPages = isScrollbar ? 1 : isHorizontal ? maxRow : maxCol;
24626
+ const maxHeight = this._contentMaxHeight;
24610
24627
  let { doWrap, maxWidthInCol, startX, startY, pages } = this._itemContext;
24611
24628
  let item;
24612
24629
  let lastItemWidth = 0;
@@ -24703,7 +24720,7 @@ class DiscreteLegend extends LegendBase {
24703
24720
  return this._itemContext;
24704
24721
  }
24705
24722
  _renderContent() {
24706
- const { item = {}, items, reversed, maxWidth } = this.attribute;
24723
+ const { item = {}, items, reversed, maxWidth, maxHeight } = this.attribute;
24707
24724
  if (item.visible === false || isEmpty(items)) {
24708
24725
  return;
24709
24726
  }
@@ -24711,6 +24728,7 @@ class DiscreteLegend extends LegendBase {
24711
24728
  if (reversed) {
24712
24729
  legendItems = items === null || items === void 0 ? void 0 : items.reverse();
24713
24730
  }
24731
+ this._contentMaxHeight = Math.max(0, maxHeight - this._parsedPadding[0] - this._parsedPadding[2]);
24714
24732
  const itemsContainer = graphicCreator.group({
24715
24733
  x: 0,
24716
24734
  y: 0
@@ -24748,7 +24766,8 @@ class DiscreteLegend extends LegendBase {
24748
24766
  items: legendItems,
24749
24767
  isHorizontal,
24750
24768
  totalPage: Infinity,
24751
- isScrollbar: pager && pager.type === 'scrollbar'
24769
+ isScrollbar: pager && pager.type === 'scrollbar',
24770
+ clipContainer: undefined
24752
24771
  };
24753
24772
  this._itemContext = this._renderItems();
24754
24773
  let pagerRendered = false;
@@ -24769,11 +24788,21 @@ class DiscreteLegend extends LegendBase {
24769
24788
  }
24770
24789
  const { hover = true, select = true } = this.attribute;
24771
24790
  if (hover) {
24772
- this._itemsContainer.addEventListener('pointermove', this._onHover);
24773
- this._itemsContainer.addEventListener('pointerleave', this._onUnHover);
24791
+ let trigger = 'pointerdown';
24792
+ let triggerOff = 'pointerleave';
24793
+ if (isObject(hover)) {
24794
+ hover.trigger && (trigger = hover.trigger);
24795
+ hover.triggerOff && (triggerOff = hover.triggerOff);
24796
+ }
24797
+ this._itemsContainer.addEventListener(trigger, this._onHover);
24798
+ this._itemsContainer.addEventListener(triggerOff, this._onUnHover);
24774
24799
  }
24775
24800
  if (select) {
24776
- this._itemsContainer.addEventListener('pointerdown', this._onClick);
24801
+ let trigger = 'pointerdown';
24802
+ if (isObject(select) && select.trigger) {
24803
+ trigger = select.trigger;
24804
+ }
24805
+ this._itemsContainer.addEventListener(trigger, this._onClick);
24777
24806
  }
24778
24807
  }
24779
24808
  _autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape) {
@@ -24978,8 +25007,8 @@ class DiscreteLegend extends LegendBase {
24978
25007
  _createScrollbar(compStyle, compSize) {
24979
25008
  const { disableTriggerEvent } = this.attribute;
24980
25009
  return this._itemContext.isHorizontal
24981
- ? new ScrollBar(Object.assign(Object.assign({ direction: 'horizontal', disableTriggerEvent, range: [0, 0.5], height: 12 }, compStyle), { width: compSize }))
24982
- : new ScrollBar(Object.assign(Object.assign({ direction: 'vertical', width: 12, range: [0, 0.5] }, compStyle), { height: compSize, disableTriggerEvent }));
25010
+ ? new ScrollBar(Object.assign(Object.assign({ direction: 'horizontal', disableTriggerEvent, range: [0, 0.5], height: compStyle.visible === false ? 0 : 12 }, compStyle), { width: compSize }))
25011
+ : new ScrollBar(Object.assign(Object.assign({ direction: 'vertical', width: compStyle.visible === false ? 0 : 12, range: [0, 0.5] }, compStyle), { height: compSize, disableTriggerEvent }));
24983
25012
  }
24984
25013
  _updatePositionOfPager(renderStartY, compWidth, compHeight) {
24985
25014
  const { pager } = this.attribute;
@@ -25019,9 +25048,26 @@ class DiscreteLegend extends LegendBase {
25019
25048
  });
25020
25049
  }
25021
25050
  }
25051
+ _computeScrollbarDelta() {
25052
+ const { isHorizontal, clipContainer } = this._itemContext;
25053
+ const itemContainerBounds = this._itemsContainer.AABBBounds;
25054
+ const clipContainerBounds = clipContainer.AABBBounds;
25055
+ let delta;
25056
+ let innerViewSize;
25057
+ if (isHorizontal) {
25058
+ innerViewSize = clipContainerBounds.width();
25059
+ delta = innerViewSize / itemContainerBounds.width();
25060
+ }
25061
+ else {
25062
+ innerViewSize = clipContainerBounds.height();
25063
+ delta = innerViewSize / itemContainerBounds.height();
25064
+ }
25065
+ return delta;
25066
+ }
25022
25067
  _updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY) {
25023
- const { currentPage, totalPage, isHorizontal } = this._itemContext;
25024
- this._pagerComponent.setScrollRange([(currentPage - 1) / totalPage, currentPage / totalPage]);
25068
+ const { isHorizontal, currentPage, totalPage } = this._itemContext;
25069
+ const start = (currentPage - 1) / totalPage;
25070
+ this._pagerComponent.setScrollRange([start, start + this._computeScrollbarDelta()]);
25025
25071
  if (isHorizontal) {
25026
25072
  this._pagerComponent.setAttributes({
25027
25073
  x: 0,
@@ -25049,13 +25095,7 @@ class DiscreteLegend extends LegendBase {
25049
25095
  newPage = this._itemContext.totalPage;
25050
25096
  }
25051
25097
  else {
25052
- newPage = value[0] * this._itemContext.totalPage;
25053
- if (pager.scrollByPosition) {
25054
- newPage = newPage + 1;
25055
- }
25056
- else {
25057
- newPage = Math.floor(newPage) + 1;
25058
- }
25098
+ newPage = value[0] * this._itemContext.totalPage + 1;
25059
25099
  }
25060
25100
  return newPage;
25061
25101
  }
@@ -25069,6 +25109,7 @@ class DiscreteLegend extends LegendBase {
25069
25109
  const { width, height } = scrollComponent.getSliderRenderBounds();
25070
25110
  const currentScrollValue = direction === 'vertical' ? e.deltaY / height : e.deltaX / width;
25071
25111
  scrollComponent.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], true);
25112
+ this.updateScrollMask();
25072
25113
  };
25073
25114
  const onPaging = (e) => {
25074
25115
  const newPage = pageParser(e);
@@ -25080,15 +25121,39 @@ class DiscreteLegend extends LegendBase {
25080
25121
  this._renderItems();
25081
25122
  const newTotalPage = Math.ceil(this._itemContext.pages / this._itemContext.maxPages);
25082
25123
  this._itemContext.totalPage = newTotalPage;
25083
- this._pagerComponent.setScrollRange([(newPage - 1) / newTotalPage, newPage / newTotalPage]);
25124
+ if (this._itemContext.isScrollbar && this._pagerComponent) {
25125
+ const newDelta = this._computeScrollbarDelta();
25126
+ const [start] = this._pagerComponent.getScrollRange();
25127
+ this._pagerComponent.setScrollRange([start, start + newDelta]);
25128
+ }
25084
25129
  }
25085
- if (animation) {
25086
- this._itemsContainer
25087
- .animate()
25088
- .to({ [channel]: -(newPage - 1) * pageSize }, animationDuration, animationEasing);
25130
+ if (!this._itemContext.isScrollbar) {
25131
+ if (animation) {
25132
+ this._itemsContainer
25133
+ .animate()
25134
+ .to({ [channel]: -(newPage - 1) * pageSize }, animationDuration, animationEasing);
25135
+ }
25136
+ else {
25137
+ this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
25138
+ }
25089
25139
  }
25090
25140
  else {
25091
- this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
25141
+ const [start] = this._pagerComponent.getScrollRange();
25142
+ let containerSize;
25143
+ if (this._itemContext.isHorizontal) {
25144
+ containerSize = this._itemsContainer.AABBBounds.width();
25145
+ }
25146
+ else {
25147
+ containerSize = this._itemsContainer.AABBBounds.height();
25148
+ }
25149
+ const startOffset = containerSize * start;
25150
+ this.updateScrollMask();
25151
+ if (animation) {
25152
+ this._itemsContainer.animate().to({ [channel]: -startOffset }, animationDuration, animationEasing);
25153
+ }
25154
+ else {
25155
+ this._itemsContainer.setAttribute(channel, -startOffset);
25156
+ }
25092
25157
  }
25093
25158
  };
25094
25159
  if (this._itemContext.isScrollbar) {
@@ -25107,11 +25172,12 @@ class DiscreteLegend extends LegendBase {
25107
25172
  }
25108
25173
  _renderPager() {
25109
25174
  const renderStartY = this._title ? this._title.AABBBounds.height() + get(this.attribute, 'title.space', 8) : 0;
25110
- const { maxWidth, maxHeight, maxCol = 1, maxRow = 2, item = {}, pager = {} } = this.attribute;
25175
+ const { maxWidth, maxCol = 1, maxRow = 2, item = {}, pager = {} } = this.attribute;
25111
25176
  const { spaceCol = DEFAULT_ITEM_SPACE_COL, spaceRow = DEFAULT_ITEM_SPACE_ROW } = item;
25112
25177
  const itemsContainer = this._itemsContainer;
25113
25178
  const { space: pagerSpace = DEFAULT_PAGER_SPACE, defaultCurrent = 1 } = pager, compStyle = __rest(pager, ["space", "defaultCurrent"]);
25114
25179
  const { isHorizontal } = this._itemContext;
25180
+ const maxHeight = this._contentMaxHeight;
25115
25181
  let comp;
25116
25182
  let compWidth = 0;
25117
25183
  let compHeight = 0;
@@ -25202,38 +25268,37 @@ class DiscreteLegend extends LegendBase {
25202
25268
  });
25203
25269
  clipGroup.add(itemsContainer);
25204
25270
  this._innerView.add(clipGroup);
25271
+ this._itemContext.clipContainer = clipGroup;
25205
25272
  this._bindEventsOfPager(isHorizontal ? compHeight + spaceRow : compWidth + spaceCol, isHorizontal ? 'y' : 'x');
25206
25273
  return true;
25207
25274
  }
25208
25275
  _renderScrollbar() {
25276
+ var _a;
25209
25277
  const renderStartY = this._title ? this._title.AABBBounds.height() + get(this.attribute, 'title.space', 8) : 0;
25210
- const { maxWidth, maxHeight, item = {}, pager = {} } = this.attribute;
25278
+ const { maxWidth, item = {}, pager = {} } = this.attribute;
25211
25279
  const { spaceCol = DEFAULT_ITEM_SPACE_COL, spaceRow = DEFAULT_ITEM_SPACE_ROW } = item;
25212
25280
  const itemsContainer = this._itemsContainer;
25213
25281
  const { space: pagerSpace = DEFAULT_PAGER_SPACE, defaultCurrent = 1 } = pager, compStyle = __rest(pager, ["space", "defaultCurrent"]);
25214
25282
  const { isHorizontal } = this._itemContext;
25283
+ const maxHeight = this._contentMaxHeight;
25215
25284
  let comp;
25216
- let compSize = 0;
25217
25285
  let contentWidth = 0;
25218
25286
  let contentHeight = 0;
25219
25287
  let startY = 0;
25220
25288
  let pages = 1;
25221
25289
  if (isHorizontal) {
25222
- compSize = maxWidth;
25223
25290
  contentWidth = maxWidth;
25224
25291
  contentHeight = this._itemHeight;
25225
- comp = this._createScrollbar(compStyle, compSize);
25292
+ comp = this._createScrollbar(compStyle, contentWidth);
25226
25293
  this._pagerComponent = comp;
25227
25294
  this._innerView.add(comp);
25228
- this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);
25229
25295
  }
25230
25296
  else {
25231
- compSize = maxHeight;
25232
- comp = this._createScrollbar(compStyle, compSize);
25233
- this._pagerComponent = comp;
25234
- this._innerView.add(comp);
25235
25297
  contentHeight = maxHeight - renderStartY;
25236
25298
  contentWidth = this._itemMaxWidth;
25299
+ comp = this._createScrollbar(compStyle, contentHeight);
25300
+ this._pagerComponent = comp;
25301
+ this._innerView.add(comp);
25237
25302
  if (contentHeight <= 0) {
25238
25303
  this._innerView.removeChild(comp);
25239
25304
  return false;
@@ -25264,14 +25329,15 @@ class DiscreteLegend extends LegendBase {
25264
25329
  }
25265
25330
  this._itemContext.totalPage = pages;
25266
25331
  this._itemContext.pages = pages;
25267
- this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);
25268
25332
  }
25269
25333
  if (defaultCurrent > 1) {
25270
25334
  if (isHorizontal) {
25271
- itemsContainer.setAttribute('x', -(defaultCurrent - 1) * (contentWidth + spaceCol));
25335
+ const maxOffset = this._itemsContainer.AABBBounds.width() - contentWidth;
25336
+ itemsContainer.setAttribute('x', -Math.min((defaultCurrent - 1) * (contentWidth + spaceCol), maxOffset));
25272
25337
  }
25273
25338
  else {
25274
- itemsContainer.setAttribute('y', -(defaultCurrent - 1) * (contentHeight + spaceRow));
25339
+ const maxOffset = this._itemsContainer.AABBBounds.height() - contentHeight;
25340
+ itemsContainer.setAttribute('y', -Math.min((defaultCurrent - 1) * (contentHeight + spaceRow), maxOffset));
25275
25341
  }
25276
25342
  }
25277
25343
  const clipGroup = graphicCreator.group({
@@ -25284,9 +25350,89 @@ class DiscreteLegend extends LegendBase {
25284
25350
  });
25285
25351
  clipGroup.add(itemsContainer);
25286
25352
  this._innerView.add(clipGroup);
25353
+ this._itemContext.clipContainer = clipGroup;
25354
+ this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);
25355
+ if ((_a = pager.scrollMask) === null || _a === void 0 ? void 0 : _a.visible) {
25356
+ this.renderScrollMask(clipGroup);
25357
+ }
25287
25358
  this._bindEventsOfPager(isHorizontal ? contentWidth : contentHeight, isHorizontal ? 'x' : 'y');
25288
25359
  return true;
25289
25360
  }
25361
+ renderScrollMask(clipGroup) {
25362
+ const { scrollMask = {} } = this.attribute
25363
+ .pager;
25364
+ const { visible = true, gradientLength = 16, gradientStops } = scrollMask;
25365
+ if (!visible || !gradientStops) {
25366
+ return;
25367
+ }
25368
+ const width = clipGroup.AABBBounds.width();
25369
+ const height = clipGroup.AABBBounds.height();
25370
+ const totalLength = this._itemContext.isHorizontal ? width : height;
25371
+ const startStops = gradientStops.map(stop => {
25372
+ return {
25373
+ offset: (gradientLength * stop.offset) / totalLength,
25374
+ color: stop.color
25375
+ };
25376
+ });
25377
+ const endStops = gradientStops.map(stop => {
25378
+ return {
25379
+ offset: (totalLength - gradientLength * stop.offset) / totalLength,
25380
+ color: stop.color
25381
+ };
25382
+ });
25383
+ const mask = graphicCreator.rect({
25384
+ x: 0,
25385
+ y: 0,
25386
+ width,
25387
+ height
25388
+ });
25389
+ this._scrollMask = mask;
25390
+ this._scrollMaskContext = { startStops, endStops };
25391
+ this.updateScrollMask();
25392
+ clipGroup.add(mask);
25393
+ }
25394
+ updateScrollMask() {
25395
+ if (!this._scrollMask || !this._pagerComponent) {
25396
+ return;
25397
+ }
25398
+ if (!this._itemContext.isScrollbar) {
25399
+ return;
25400
+ }
25401
+ const [start, end] = this._pagerComponent.getScrollRange();
25402
+ const stops = [];
25403
+ if (!isNumberClose(clamp(end, 0, 1), 1)) {
25404
+ stops.push(...this._scrollMaskContext.endStops);
25405
+ }
25406
+ if (!isNumberClose(clamp(start, 0, 1), 0)) {
25407
+ stops.push(...this._scrollMaskContext.startStops);
25408
+ }
25409
+ if (stops.length) {
25410
+ if (this._itemContext.isHorizontal) {
25411
+ this._scrollMask.setAttributes({
25412
+ fill: {
25413
+ gradient: 'linear',
25414
+ x0: 0,
25415
+ y0: 0,
25416
+ x1: 1,
25417
+ y1: 0,
25418
+ stops
25419
+ }
25420
+ });
25421
+ }
25422
+ else {
25423
+ this._scrollMask.setAttributes({
25424
+ fill: {
25425
+ gradient: 'linear',
25426
+ x0: 0,
25427
+ y0: 0,
25428
+ x1: 0,
25429
+ y1: 1,
25430
+ stops
25431
+ }
25432
+ });
25433
+ }
25434
+ }
25435
+ }
25290
25436
  _renderPagerComponent() {
25291
25437
  if (this._itemContext.isScrollbar) {
25292
25438
  this._renderScrollbar();
@@ -29400,6 +29546,6 @@ EmptyTip.defaultAttributes = {
29400
29546
  }
29401
29547
  };
29402
29548
 
29403
- const version = "0.20.13-alpha.3";
29549
+ const version = "0.20.13";
29404
29550
 
29405
29551
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
package/es/brush/brush.js CHANGED
@@ -194,5 +194,4 @@ export class Brush extends AbstractComponent {
194
194
  }
195
195
  }
196
196
 
197
- Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
198
- //# sourceMappingURL=brush.js.map
197
+ Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
package/es/brush/type.js CHANGED
@@ -4,4 +4,5 @@ export var IOperateType;
4
4
  IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing",
5
5
  IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd",
6
6
  IOperateType.brushClear = "brushClear";
7
- }(IOperateType || (IOperateType = {}));
7
+ }(IOperateType || (IOperateType = {}));
8
+ //# sourceMappingURL=type.js.map
package/es/core/base.js CHANGED
@@ -45,5 +45,4 @@ export class AbstractComponent extends Group {
45
45
  changeEvent.manager = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem.manager,
46
46
  this.dispatchEvent(changeEvent);
47
47
  }
48
- }
49
- //# sourceMappingURL=base.js.map
48
+ }
@@ -51,4 +51,5 @@ EmptyTip.defaultAttributes = {
51
51
  height: 100,
52
52
  pickable: !1
53
53
  }
54
- };
54
+ };
55
+ //# sourceMappingURL=empty-tip.js.map
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.20.13-alpha.3";
1
+ export declare const version = "0.20.13";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.20.13-alpha.3";
1
+ export const version = "0.20.13";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAEzC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.20.13-alpha.3\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.20.13\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
package/es/label/base.js CHANGED
@@ -441,12 +441,18 @@ export class LabelBase extends AbstractComponent {
441
441
  return listener;
442
442
  }
443
443
  _smartInvert(labels) {
444
- var _a, _b, _c, _d, _e;
444
+ var _a, _b, _c, _d, _e, _f, _g;
445
445
  const option = isObject(this.attribute.smartInvert) ? this.attribute.smartInvert : {}, {textType: textType, contrastRatiosThreshold: contrastRatiosThreshold, alternativeColors: alternativeColors, mode: mode, interactInvertType: interactInvertType} = option, fillStrategy = null !== (_a = option.fillStrategy) && void 0 !== _a ? _a : "invertBase", strokeStrategy = null !== (_b = option.strokeStrategy) && void 0 !== _b ? _b : "base", brightColor = null !== (_c = option.brightColor) && void 0 !== _c ? _c : "#ffffff", darkColor = null !== (_d = option.darkColor) && void 0 !== _d ? _d : "#000000", outsideEnable = null !== (_e = option.outsideEnable) && void 0 !== _e && _e;
446
446
  if ("null" !== fillStrategy || "null" !== strokeStrategy) for (let i = 0; i < labels.length; i++) {
447
447
  const label = labels[i];
448
448
  if (!label) continue;
449
- const baseMark = this.getRelatedGraphic(label.attribute), backgroundColor = baseMark.attribute.fill, foregroundColor = label.attribute.fill, invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode), similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor, isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds), isIntersect = !isInside && label.AABBBounds && baseMark.AABBBounds && baseMark.AABBBounds.intersects(label.AABBBounds);
449
+ const baseMark = this.getRelatedGraphic(label.attribute);
450
+ let backgroundColor = baseMark.attribute.fill, foregroundColor = label.attribute.fill;
451
+ if (isObject(backgroundColor) && backgroundColor.gradient) {
452
+ const firstStopColor = null === (_g = null === (_f = backgroundColor.stops) || void 0 === _f ? void 0 : _f[0]) || void 0 === _g ? void 0 : _g.color;
453
+ firstStopColor && (backgroundColor = firstStopColor, foregroundColor = firstStopColor);
454
+ }
455
+ const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode), similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor, isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds), isIntersect = !isInside && label.AABBBounds && baseMark.AABBBounds && baseMark.AABBBounds.intersects(label.AABBBounds);
450
456
  if (isInside || outsideEnable || isIntersect && "inside" === interactInvertType) {
451
457
  const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);
452
458
  if (fill && label.setAttributes({