@visactor/vrender-components 0.22.0-vstory.12 → 0.22.0-vstory.14

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
@@ -434,12 +434,15 @@ class Container {
434
434
  serviceIdentifier: injectIdentifier,
435
435
  constructorArgsMetadata: constructorArgsMetadata
436
436
  },
437
- request = {
437
+ bindings = (this._bindingDictionary.get(injectIdentifier) || []).filter(b => b.constraint(target));
438
+ if (bindings.length) {
439
+ const request = {
438
440
  injectIdentifier: injectIdentifier,
439
441
  metadata: constructorArgsMetadata,
440
- bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
442
+ bindings: bindings
441
443
  };
442
- arr.push(request);
444
+ arr.push(request);
445
+ }
443
446
  }
444
447
  return arr;
445
448
  }
@@ -2275,6 +2278,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
2275
2278
  texturePadding: 2,
2276
2279
  backgroundMode: "no-repeat",
2277
2280
  backgroundFit: !0,
2281
+ backgroundKeepAspectRatio: !1,
2278
2282
  backgroundClip: !0,
2279
2283
  backgroundScale: 1,
2280
2284
  backgroundOffsetX: 0,
@@ -2895,6 +2899,9 @@ let ATextMeasure = class {
2895
2899
  }
2896
2900
  compatibleMetrics(metrics, options) {
2897
2901
  if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
2902
+ metrics = {
2903
+ width: metrics.width
2904
+ };
2898
2905
  const {
2899
2906
  ascent: ascent,
2900
2907
  descent: descent
@@ -2902,6 +2909,13 @@ let ATextMeasure = class {
2902
2909
  metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
2903
2910
  }
2904
2911
  if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
2912
+ metrics = {
2913
+ width: metrics.width,
2914
+ actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
2915
+ actualBoundingBoxDescent: metrics.actualBoundingBoxDescent,
2916
+ fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
2917
+ fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
2918
+ };
2905
2919
  const {
2906
2920
  left: left,
2907
2921
  right: right
@@ -9171,6 +9185,12 @@ class Wrapper {
9171
9185
  }
9172
9186
  }
9173
9187
 
9188
+ let supportIntl = !1;
9189
+ try {
9190
+ supportIntl = Intl && "function" == typeof Intl.Segmenter;
9191
+ } catch (e) {
9192
+ supportIntl = !1;
9193
+ }
9174
9194
  const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", "fontFamily", "fontStyle", "fontWeight", "lineWidth", "opacity", "fillOpacity", "strokeOpacity", ...GRAPHIC_UPDATE_TAG_KEY];
9175
9195
  class RichText extends Graphic {
9176
9196
  constructor(params) {
@@ -9260,6 +9280,16 @@ class RichText extends Graphic {
9260
9280
  return cache.every(item => item.isComposing || !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1));
9261
9281
  }
9262
9282
  static splitText(text) {
9283
+ if (supportIntl) {
9284
+ const segmenter = new Intl.Segmenter(void 0, {
9285
+ granularity: "grapheme"
9286
+ }),
9287
+ segments = [];
9288
+ for (const {
9289
+ segment: segment
9290
+ } of segmenter.segment(text)) segments.push(segment);
9291
+ return segments;
9292
+ }
9263
9293
  return Array.from(text);
9264
9294
  }
9265
9295
  static TransformTextConfig2SingleCharacter(textConfig) {
@@ -9275,14 +9305,14 @@ class RichText extends Graphic {
9275
9305
  }), tc;
9276
9306
  }
9277
9307
  updateAABBBounds(attribute, richtextTheme, aabbBounds) {
9278
- var _a, _b;
9308
+ var _a, _b, _c, _d;
9279
9309
  const {
9280
9310
  width = richtextTheme.width,
9281
9311
  height = richtextTheme.height,
9282
9312
  maxWidth = richtextTheme.maxWidth,
9283
9313
  maxHeight = richtextTheme.maxHeight,
9284
9314
  textAlign = richtextTheme.textAlign,
9285
- textBaseline = richtextTheme.textBaseline,
9315
+ verticalDirection = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : richtextTheme.verticalDirection,
9286
9316
  editOptions: editOptions
9287
9317
  } = attribute;
9288
9318
  if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
@@ -9295,9 +9325,9 @@ class RichText extends Graphic {
9295
9325
  contentHeight = height || actualHeight || 0;
9296
9326
  contentHeight = "number" == typeof maxHeight && contentHeight > maxHeight ? maxHeight : contentHeight || 0, contentWidth = "number" == typeof maxWidth && contentWidth > maxWidth ? maxWidth : contentWidth || 0, aabbBounds.set(0, 0, contentWidth, contentHeight);
9297
9327
  }
9298
- editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_a = attribute.textConfig) || void 0 === _a ? void 0 : _a.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_b = attribute.fontSize) && void 0 !== _b ? _b : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
9328
+ editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_c = attribute.textConfig) || void 0 === _c ? void 0 : _c.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_d = attribute.fontSize) && void 0 !== _d ? _d : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
9299
9329
  let deltaY = 0;
9300
- switch (textBaseline) {
9330
+ switch (verticalDirection) {
9301
9331
  case "top":
9302
9332
  deltaY = 0;
9303
9333
  break;
@@ -10144,6 +10174,7 @@ class DefaultBaseBackgroundRenderContribution {
10144
10174
  opacity = graphicAttribute.opacity,
10145
10175
  backgroundMode = graphicAttribute.backgroundMode,
10146
10176
  backgroundFit = graphicAttribute.backgroundFit,
10177
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
10147
10178
  backgroundScale = graphicAttribute.backgroundScale,
10148
10179
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
10149
10180
  backgroundOffsetY = graphicAttribute.backgroundOffsetY,
@@ -10165,6 +10196,7 @@ class DefaultBaseBackgroundRenderContribution {
10165
10196
  context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, this.doDrawImage(context, res.data, b, {
10166
10197
  backgroundMode: backgroundMode,
10167
10198
  backgroundFit: backgroundFit,
10199
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10168
10200
  backgroundScale: backgroundScale,
10169
10201
  backgroundOffsetX: backgroundOffsetX,
10170
10202
  backgroundOffsetY: backgroundOffsetY
@@ -10175,6 +10207,7 @@ class DefaultBaseBackgroundRenderContribution {
10175
10207
  const {
10176
10208
  backgroundMode: backgroundMode,
10177
10209
  backgroundFit: backgroundFit,
10210
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10178
10211
  backgroundScale = 1,
10179
10212
  backgroundOffsetX = 0,
10180
10213
  backgroundOffsetY = 0
@@ -10184,7 +10217,12 @@ class DefaultBaseBackgroundRenderContribution {
10184
10217
  let w = targetW,
10185
10218
  h = targetH;
10186
10219
  if ("no-repeat" === backgroundMode) {
10187
- if (backgroundFit) context.drawImage(data, b.x1, b.y1, b.width(), b.height());else {
10220
+ if (backgroundFit) {
10221
+ if (backgroundKeepAspectRatio) {
10222
+ const maxScale = Math.max(targetW / data.width, targetH / data.height);
10223
+ context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
10224
+ } else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
10225
+ } else {
10188
10226
  const resW = data.width * backgroundScale,
10189
10227
  resH = data.height * backgroundScale;
10190
10228
  context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
@@ -10490,6 +10528,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
10490
10528
  background: background,
10491
10529
  backgroundMode = graphicAttribute.backgroundMode,
10492
10530
  backgroundFit = graphicAttribute.backgroundFit,
10531
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
10493
10532
  backgroundScale = graphicAttribute.backgroundScale,
10494
10533
  backgroundOffsetX = graphicAttribute.backgroundOffsetX,
10495
10534
  backgroundOffsetY = graphicAttribute.backgroundOffsetY
@@ -10502,6 +10541,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
10502
10541
  this.doDrawImage(context, res.data, b, {
10503
10542
  backgroundMode: backgroundMode,
10504
10543
  backgroundFit: backgroundFit,
10544
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio,
10505
10545
  backgroundScale: backgroundScale,
10506
10546
  backgroundOffsetX: backgroundOffsetX,
10507
10547
  backgroundOffsetY: backgroundOffsetY
@@ -11833,7 +11873,8 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
11833
11873
  var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
11834
11874
  const {
11835
11875
  backgroundMode = graphicAttribute.backgroundMode,
11836
- backgroundFit = graphicAttribute.backgroundFit
11876
+ backgroundFit = graphicAttribute.backgroundFit,
11877
+ backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
11837
11878
  } = graphic.attribute;
11838
11879
  let matrix,
11839
11880
  {
@@ -11872,7 +11913,8 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
11872
11913
  if ("success" !== res.state || !res.data) return void restore();
11873
11914
  context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, {
11874
11915
  backgroundMode: backgroundMode,
11875
- backgroundFit: backgroundFit
11916
+ backgroundFit: backgroundFit,
11917
+ backgroundKeepAspectRatio: backgroundKeepAspectRatio
11876
11918
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
11877
11919
  } else {
11878
11920
  const {
@@ -12989,7 +13031,7 @@ var __decorate$q = undefined && undefined.__decorate || function (decorators, ta
12989
13031
  };
12990
13032
  let DefaultDrawContribution = class {
12991
13033
  constructor(contributions, drawItemInterceptorContributions) {
12992
- this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, this.init();
13034
+ this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, isArray(this.contributions) || (this.contributions = [this.contributions]), this.init();
12993
13035
  }
12994
13036
  init() {
12995
13037
  this.contributions.forEach(item => {
@@ -13792,6 +13834,7 @@ class PickerBase {
13792
13834
  contains(graphic, point, params) {
13793
13835
  if (!graphic.AABBBounds.containsPoint(point)) return !1;
13794
13836
  if ("imprecise" === graphic.attribute.pickMode) return !0;
13837
+ if (!this.canvasRenderer) return !0;
13795
13838
  const {
13796
13839
  pickContext: pickContext
13797
13840
  } = null != params ? params : {};
@@ -20502,13 +20545,13 @@ class LabelBase extends AbstractComponent {
20502
20545
  }
20503
20546
  let labels = this._initText(data);
20504
20547
  if (isFunction(customLayoutFunc)) {
20505
- labels = customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
20548
+ labels = customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
20506
20549
  }
20507
20550
  else {
20508
20551
  labels = this._layout(labels);
20509
20552
  }
20510
20553
  if (isFunction(customOverlapFunc)) {
20511
- labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
20554
+ labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
20512
20555
  }
20513
20556
  else {
20514
20557
  if (overlap !== false) {
@@ -20516,7 +20559,7 @@ class LabelBase extends AbstractComponent {
20516
20559
  }
20517
20560
  }
20518
20561
  if (isFunction(this.attribute.onAfterOverlapping)) {
20519
- this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null);
20562
+ this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? (d) => this._idToPoint.get(d.id) : null, this);
20520
20563
  }
20521
20564
  if (labels && labels.length) {
20522
20565
  labels.forEach(label => {
@@ -31212,6 +31255,6 @@ StoryLabelItem.defaultAttributes = {
31212
31255
  theme: 'default'
31213
31256
  };
31214
31257
 
31215
- const version = "0.22.0-vstory.12";
31258
+ const version = "0.22.0-vstory.14";
31216
31259
 
31217
31260
  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, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, 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, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.22.0-vstory.12";
1
+ export declare const version = "0.22.0-vstory.14";
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.22.0-vstory.12";
1
+ export const version = "0.22.0-vstory.14";
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,kBAAkB,CAAC;AAE1C,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,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.22.0-vstory.12\";\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 './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAE1C,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,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.22.0-vstory.14\";\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 './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\n"]}
package/es/label/base.js CHANGED
@@ -102,9 +102,9 @@ export class LabelBase extends AbstractComponent {
102
102
  data = data.filter((d => !seenIds.has(d.id) && seenIds.add(d.id)));
103
103
  }
104
104
  let labels = this._initText(data);
105
- labels = isFunction(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : this._layout(labels),
106
- isFunction(customOverlapFunc) ? labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : !1 !== overlap && (labels = this._overlapping(labels)),
107
- isFunction(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null),
105
+ labels = isFunction(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels),
106
+ isFunction(customOverlapFunc) ? labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : !1 !== overlap && (labels = this._overlapping(labels)),
107
+ isFunction(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this),
108
108
  labels && labels.length && labels.forEach((label => {
109
109
  this._bindEvent(label), this._setStatesOfText(label);
110
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import type {\n IGroup,\n Text,\n IGraphic,\n IText,\n FederatedPointerEvent,\n IColor,\n ILine,\n IArea,\n IRichText,\n ILineGraphicAttribute,\n ILinearGradient\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator, AttributeUpdateType, IContainPointMode, CustomPath2D } from '@visactor/vrender-core';\nimport type { IAABBBounds, IBoundsLike, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport {\n isFunction,\n isEmpty,\n isValid,\n isString,\n merge,\n isRectIntersect,\n isNil,\n isArray,\n isObject\n} from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert, contrastAccessibilityChecker, smartInvertStrategy } from '../util/label-smartInvert';\nimport { createTextGraphicByType, getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap, BitmapTool } from './overlap';\n// eslint-disable-next-line no-duplicate-imports\nimport { bitmapTool, boundToRange, canPlace, clampText, place } from './overlap';\nimport type {\n BaseLabelAttrs,\n OverlapAttrs,\n ILabelAnimation,\n LabelItem,\n SmartInvertAttrs,\n ILabelEnterAnimation,\n ILabelExitAnimation,\n ILabelUpdateAnimation,\n LabelContent,\n ShiftYStrategy,\n Strategy\n} from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes, updateAnimation } from './animate/animate';\nimport { connectLineBetweenBounds, getPointsOfLineArea } from './util';\nimport type { ComponentOptions } from '../interface';\nimport { loadLabelComponent } from './register';\nimport { shiftY } from './overlap/shiftY';\n\nloadLabelComponent();\nexport class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _isCollectionBase: boolean;\n\n protected _bitmap?: Bitmap;\n\n // parsed animation config\n protected _animationConfig?: {\n enter: ILabelEnterAnimation | false;\n exit: ILabelExitAnimation | false;\n update: ILabelUpdateAnimation | false;\n };\n\n static defaultAttributes: Partial<BaseLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n // FIXME: we need a default color. Yet in current logic, textStyle will override fill from baseMark.\n // This need a new config option like `colorFull`\n // fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-2, -1, -2, -1] // to ignore the textBound buf\n },\n offset: 0,\n pickable: false\n };\n\n setBitmap(bitmap: Bitmap) {\n this._bitmap = bitmap;\n }\n\n protected _bmpTool?: ReturnType<typeof bitmapTool>;\n setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>) {\n this._bmpTool = bmpTool;\n }\n\n protected _graphicToText: Map<IGraphic, LabelContent>;\n\n protected _idToGraphic: Map<string, IGraphic>;\n\n protected _idToPoint: Map<string, IPointLike>;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n constructor(attributes: BaseLabelAttrs, options?: ComponentOptions) {\n const { data, ...restAttributes } = attributes;\n super(options?.skipDefault ? attributes : { data, ...merge({}, LabelBase.defaultAttributes, restAttributes) });\n }\n\n /**\n * 计算 text 的最终位置属性x, y\n * @param textBounds\n * @param graphicBounds\n * @param position\n * @param offset\n * @returns\n */\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): { x: number; y: number } | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected _getLabelLinePoints(text: IText | IRichText, baseMark?: IGraphic) {\n return connectLineBetweenBounds(text.AABBBounds, baseMark?.AABBBounds);\n }\n\n protected _createLabelLine(text: IText | IRichText, baseMark?: IGraphic): ILine | undefined {\n const points = this._getLabelLinePoints(text, baseMark);\n if (points) {\n const lineGraphic = graphicCreator.line({\n points\n });\n\n const { line = {} } = text.attribute as any;\n\n if (line.customShape) {\n const customShape = line.customShape;\n lineGraphic.pathProxy = (attrs: Partial<ILineGraphicAttribute>) => {\n return customShape(\n {\n text,\n baseMark: baseMark\n },\n attrs,\n new CustomPath2D()\n );\n };\n }\n\n if (baseMark && baseMark.attribute.fill) {\n lineGraphic.setAttribute('stroke', baseMark.attribute.fill);\n }\n\n if (this.attribute.line && !isEmpty(this.attribute.line.style)) {\n lineGraphic.setAttributes(this.attribute.line.style);\n }\n this._setStatesOfLabelLine(lineGraphic);\n return lineGraphic;\n }\n }\n\n protected render() {\n this._prepare();\n if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {\n return;\n }\n\n const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;\n let data = this.attribute.data;\n\n if (isFunction(dataFilter)) {\n data = dataFilter(data);\n }\n\n if (data && data.length) {\n // 数据保护,防止重复 id 造成不可预知的问题\n const seenIds = new Set();\n data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));\n }\n\n let labels: (IText | IRichText)[] = this._initText(data);\n\n if (isFunction(customLayoutFunc)) {\n labels = customLayoutFunc(\n data,\n labels,\n this.getRelatedGraphic.bind(this),\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null\n );\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this._layout(labels);\n }\n\n if (isFunction(customOverlapFunc)) {\n labels = customOverlapFunc(\n labels as Text[],\n this.getRelatedGraphic.bind(this),\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null\n );\n } else {\n // 防重叠逻辑\n if (overlap !== false) {\n labels = this._overlapping(labels);\n }\n }\n\n if (isFunction(this.attribute.onAfterOverlapping)) {\n this.attribute.onAfterOverlapping(\n labels as Text[],\n this.getRelatedGraphic.bind(this),\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null\n );\n }\n\n if (labels && labels.length) {\n labels.forEach(label => {\n this._bindEvent(label);\n this._setStatesOfText(label);\n });\n }\n\n if (smartInvert !== false) {\n this._smartInvert(labels);\n }\n\n this._renderLabels(labels);\n }\n\n private _bindEvent(target: IGraphic) {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n if (!target) {\n return;\n }\n\n const { hover, select } = this.attribute;\n\n if (hover) {\n target.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n target.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n target.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _setStatesOfText(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.state;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n protected _setStatesOfLabelLine(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.labelLineState;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState('selected')) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (!isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n protected _createLabelText(attributes: LabelItem) {\n const textAttrs = {\n ...this.stage?.getTheme()?.text,\n ...attributes\n };\n return createTextGraphicByType(textAttrs, 'textType');\n }\n\n private _prepare() {\n const currentBaseMarks: IGraphic[] = [];\n let baseMarks;\n if (isFunction(this.attribute.getBaseMarks)) {\n baseMarks = this.attribute.getBaseMarks();\n } else {\n baseMarks = getMarksByName(this.getRootNode() as IGroup, this.attribute.baseMarkGroupName);\n }\n\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._idToPoint?.clear();\n this._baseMarks = currentBaseMarks;\n this._isCollectionBase = this.attribute.type === 'line-data';\n\n if (!currentBaseMarks || currentBaseMarks.length === 0) {\n return;\n }\n\n const { data } = this.attribute;\n\n if (!data || data.length === 0) {\n return;\n }\n if (!this._idToGraphic) {\n this._idToGraphic = new Map();\n }\n\n // generate id mapping before data filter\n if (this._isCollectionBase) {\n if (!this._idToPoint) {\n this._idToPoint = new Map();\n }\n let cur = 0;\n for (let i = 0; i < currentBaseMarks.length; i++) {\n const baseMark = currentBaseMarks[i];\n const points = getPointsOfLineArea(baseMark as ILine | IArea);\n\n if (points && points.length) {\n for (let j = 0; j < points.length; j++) {\n const textData = data[cur];\n if (textData && points[j]) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${cur}`;\n }\n this._idToPoint.set(textData.id, points[j]);\n this._idToGraphic.set(textData.id, baseMark);\n }\n\n cur++;\n }\n }\n }\n } else {\n for (let i = 0; i < currentBaseMarks.length; i++) {\n const textData = data[i];\n const baseMark = currentBaseMarks[i] as IGraphic;\n if (textData && baseMark) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${i}`;\n }\n this._idToGraphic.set(textData.id, baseMark);\n }\n }\n }\n\n if (this.attribute.animation !== false) {\n const { animation, animationEnter, animationExit, animationUpdate } = this.attribute;\n const animationCfg = isObject(animation) ? animation : {};\n this._animationConfig = {\n enter: animationEnter !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationEnter ?? {}) : false,\n exit: animationExit !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationExit ?? {}) : false,\n update:\n animationUpdate !== false\n ? isArray(animationUpdate)\n ? animationUpdate\n : merge({}, DefaultLabelAnimation, animationCfg, animationUpdate ?? {})\n : false\n };\n } else {\n this._animationConfig = {\n enter: false,\n exit: false,\n update: false\n };\n }\n }\n\n protected getRelatedGraphic(item: LabelItem) {\n return this._idToGraphic.get(item.id);\n }\n\n protected _initText(data: LabelItem[] = []): (IText | IRichText)[] {\n const { textStyle = {} } = this.attribute;\n const labels = [];\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const baseMark = this.getRelatedGraphic(textData);\n if (!baseMark) {\n continue;\n }\n\n const labelAttribute = {\n fill: this._isCollectionBase\n ? isArray(baseMark.attribute.stroke)\n ? baseMark.attribute.stroke.find(entry => !!entry && entry !== true)\n : baseMark.attribute.stroke\n : baseMark.attribute.fill,\n ...textStyle,\n ...textData\n };\n const text = this._createLabelText(labelAttribute);\n labels.push(text);\n }\n\n return labels;\n }\n\n protected _layout(texts: (IText | IRichText)[]): (IText | IRichText)[] {\n const { position, offset } = this.attribute;\n for (let i = 0; i < texts.length; i++) {\n const text = texts[i];\n if (!text) {\n return;\n }\n const textData = text.attribute as LabelItem;\n const baseMark = this.getRelatedGraphic(textData);\n if (!baseMark) {\n continue;\n }\n\n text.attachedThemeGraphic = this as any;\n const textBounds = this.getGraphicBounds(text);\n text.attachedThemeGraphic = null;\n const actualPosition = isFunction(position) ? position(textData) : (position as string);\n\n const graphicBounds = this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get(textData.id), actualPosition)\n : this.getGraphicBounds(baseMark, { x: textData.x as number, y: textData.y as number }, actualPosition);\n\n const textLocation = this.labeling(textBounds, graphicBounds, actualPosition, offset);\n\n if (textLocation) {\n text.setAttributes(textLocation);\n }\n }\n\n return texts;\n }\n\n protected _overlapping(labels: (IText | IRichText)[]) {\n if (labels.length === 0) {\n return [];\n }\n const option = (isObject(this.attribute.overlap) ? this.attribute.overlap : {}) as OverlapAttrs;\n const baseMarkGroup = this.getBaseMarkGroup();\n\n const size = option.size ?? {\n width: baseMarkGroup?.AABBBounds.width() ?? 0,\n height: baseMarkGroup?.AABBBounds.height() ?? 0\n };\n\n if (size.width === 0 || size.height === 0) {\n return labels;\n }\n\n const { strategy, priority } = option;\n\n const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);\n const bitmap = this._bitmap || bmpTool.bitmap();\n\n if (priority) {\n labels = labels.sort((a, b) => priority((b.attribute as any).data) - priority((a.attribute as any).data));\n }\n\n if ((strategy as ShiftYStrategy)?.type === 'shiftY') {\n return this._overlapGlobal(labels, option, bmpTool, bitmap);\n }\n return this._overlapByStrategy(labels, option, bmpTool, bitmap);\n }\n\n protected _overlapGlobal(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap) {\n let result = labels.filter(label => label.attribute.visible && label.attribute.opacity !== 0);\n const { clampForce = true, hideOnHit = true, overlapPadding, strategy } = option;\n if (clampForce) {\n for (let i = 0; i < result.length; i++) {\n const text = labels[i];\n const { dx = 0, dy = 0 } = clampText(text as IText, bmpTool.width, bmpTool.height, bmpTool.padding);\n if (dx !== 0 || dy !== 0) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n text._isClamped = true;\n }\n }\n }\n result = shiftY(result as any, {\n maxY: bmpTool.height,\n ...(strategy as ShiftYStrategy),\n labelling: (text: IText) => {\n const baseMark = this.getRelatedGraphic(text.attribute);\n const graphicBound = this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get((text.attribute as any).id))\n : this.getGraphicBounds(baseMark, text);\n return this.labeling(text.AABBBounds, graphicBound, 'bottom', this.attribute.offset);\n }\n });\n\n for (let i = 0; i < result.length; i++) {\n const text = result[i];\n const bounds = text.AABBBounds;\n const range = boundToRange(bmpTool, bounds, true);\n if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {\n bitmap.setRange(range);\n } else {\n if (clampForce) {\n const placedAfterClampForce = this._processClampForce(text as IText, bmpTool, bitmap, overlapPadding);\n if (placedAfterClampForce) {\n continue;\n }\n }\n if (hideOnHit) {\n text.setAttributes({ visible: false });\n } else {\n bitmap.setRange(range);\n }\n }\n }\n return result;\n }\n\n protected _processClampForce(text: IText, bmpTool: BitmapTool, bitmap: Bitmap, overlapPadding = 0) {\n const { dy = 0, dx = 0 } = clampText(text as IText, bmpTool.width, bmpTool.height, bmpTool.padding);\n if (dx === 0 && dy === 0) {\n // 再次检查,若不考虑边界,仍然可以放得下,代表当前 text 没有与其他 text 重叠\n if (canPlace(bmpTool, bitmap, text.AABBBounds, false, overlapPadding)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n return true;\n }\n } else if (\n canPlace(\n bmpTool,\n bitmap,\n {\n x1: text.AABBBounds.x1 + dx,\n x2: text.AABBBounds.x2 + dx,\n y1: text.AABBBounds.y1 + dy,\n y2: text.AABBBounds.y2 + dy\n }\n // 向内 clamp 只处理超出的位移量,不叠加 overlapPadding\n )\n ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n return true;\n }\n return false;\n }\n\n protected _overlapByStrategy(\n labels: (IText | IRichText)[],\n option: OverlapAttrs,\n bmpTool: BitmapTool,\n bitmap: Bitmap\n ) {\n const {\n avoidBaseMark,\n strategy = [],\n hideOnHit = true,\n clampForce = true,\n avoidMarks = [],\n overlapPadding\n } = option;\n const result: (IText | IRichText)[] = [];\n\n const checkBounds = (strategy as Strategy[]).some(s => s.type === 'bound');\n // 躲避关联的基础图元\n if (avoidBaseMark) {\n this._baseMarks?.forEach(mark => {\n mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));\n });\n }\n\n // 躲避指定图元\n if (avoidMarks.length > 0) {\n avoidMarks.forEach(avoid => {\n if (isString(avoid)) {\n getNoneGroupMarksByName(this.getRootNode() as IGroup, avoid).forEach(avoidMark => {\n avoidMark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, avoidMark.AABBBounds, true));\n });\n } else if (avoid.AABBBounds) {\n bitmap.setRange(boundToRange(bmpTool, avoid.AABBBounds, true));\n }\n });\n }\n\n for (let i = 0; i < labels.length; i++) {\n if (labels[i].attribute.visible === false) {\n continue;\n }\n\n const text = labels[i] as IText | IRichText;\n const baseMark = this.getRelatedGraphic(text.attribute);\n text.update();\n if (!isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {\n continue;\n }\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {\n // 如果配置了限制在图形内部,需要提前判断;\n if (!checkBounds) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n\n if (\n checkBounds &&\n baseMark &&\n baseMark.AABBBounds &&\n this._canPlaceInside(text.AABBBounds, baseMark.AABBBounds)\n ) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n let hasPlace: ReturnType<typeof place> = false;\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < (strategy as Strategy[]).length; j++) {\n hasPlace = place(\n bmpTool,\n bitmap,\n strategy[j],\n <BaseLabelAttrs>this.attribute,\n text as Text,\n this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get((labels[i].attribute as any).id))\n : this.getGraphicBounds(baseMark, labels[i].attribute),\n this.labeling\n );\n if (hasPlace !== false) {\n text.setAttributes({ x: hasPlace.x, y: hasPlace.y });\n result.push(text);\n break;\n }\n }\n\n // 尝试向内挤压\n if (!hasPlace && clampForce) {\n const placedAfterClampForce = this._processClampForce(text as IText, bmpTool, bitmap, overlapPadding);\n if (placedAfterClampForce) {\n result.push(text);\n continue;\n }\n }\n\n !hasPlace && !hideOnHit && result.push(text);\n }\n return result;\n }\n\n protected getBaseMarkGroup() {\n const { baseMarkGroupName } = this.attribute as BaseLabelAttrs;\n if (!baseMarkGroupName) {\n return;\n }\n return (this.getRootNode() as IGroup).find(node => node.name === baseMarkGroupName, true) as IGroup;\n }\n\n protected getGraphicBounds(\n graphic?: IGraphic,\n point: Partial<PointLocationCfg> = {},\n position?: string\n ): IBoundsLike {\n if (graphic) {\n if (graphic.attribute.visible !== false) {\n return graphic.AABBBounds;\n }\n const { x, y } = graphic.attribute;\n return { x1: x, x2: x, y1: y, y2: y } as IBoundsLike;\n }\n if (point && position && position === 'inside-middle') {\n const { x, y, x1 = x, y1 = y } = point;\n return {\n x1: (x + x1) / 2,\n x2: (x + x1) / 2,\n y1: (y + y1) / 2,\n y2: (y + y1) / 2\n };\n }\n const { x, y } = point;\n return { x1: x, x2: x, y1: y, y2: y } as IBoundsLike;\n }\n\n protected _renderLabels(labels: (IText | IRichText)[]) {\n const { syncState } = this.attribute;\n const currentTextMap: Map<any, LabelContent> = new Map();\n const prevTextMap: Map<any, LabelContent> = this._graphicToText || new Map();\n const texts = [] as (IText | IRichText)[];\n const labelLines = [] as ILine[];\n const { visible: showLabelLine } = this.attribute.line ?? {};\n\n labels &&\n labels.forEach((text, index) => {\n const relatedGraphic = this.getRelatedGraphic(text.attribute);\n const textKey = this._isCollectionBase ? (text.attribute as LabelItem).id : relatedGraphic;\n const state = prevTextMap?.get(textKey) ? 'update' : 'enter';\n let labelLine;\n if (showLabelLine) {\n labelLine = this._createLabelLine(text as IText, relatedGraphic);\n }\n if (syncState) {\n this.updateStatesOfLabels([labelLine ? { text, labelLine } : { text }], relatedGraphic.currentStates ?? []);\n }\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });\n this._addLabel({ text, labelLine }, texts, labelLines, index);\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(textKey);\n prevTextMap.delete(textKey);\n currentTextMap.set(textKey, prevLabel);\n this._updateLabel(prevLabel, { text, labelLine });\n }\n });\n\n this._removeLabel(prevTextMap);\n\n this._graphicToText = currentTextMap;\n }\n\n protected _addLabel(\n label: LabelContent,\n texts?: LabelContent['text'][],\n labelLines?: LabelContent['labelLine'][],\n index?: number\n ) {\n const { text, labelLine } = label;\n // TODO: 或许还需要判断关联图元是否有动画?\n const relatedGraphic = this.getRelatedGraphic(text.attribute);\n this._syncStateWithRelatedGraphic(relatedGraphic);\n\n if (this._enableAnimation !== false && this._animationConfig.enter !== false) {\n if (relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n if (text) {\n this.add(text);\n }\n\n if (labelLine) {\n labelLines.push(labelLine);\n this.add(labelLine);\n }\n\n // enter的时长如果不是大于0,那么直接跳过动画\n this._animationConfig.enter.duration > 0 &&\n relatedGraphic.once('animate-bind', a => {\n // text和labelLine共用一个from\n text.setAttributes(from);\n labelLine && labelLine.setAttributes(from);\n const listener = this._afterRelatedGraphicAttributeUpdate(\n text,\n texts,\n labelLine,\n labelLines,\n index,\n relatedGraphic,\n to,\n this._animationConfig.enter as ILabelEnterAnimation\n );\n relatedGraphic.on('afterAttributeUpdate', listener);\n });\n }\n } else {\n if (text) {\n this.add(text);\n }\n if (labelLine) {\n this.add(labelLine);\n }\n }\n }\n\n protected _updateLabel(prevLabel: LabelContent, currentLabel: LabelContent) {\n const { text: prevText, labelLine: prevLabelLine } = prevLabel;\n const { text: curText, labelLine: curLabelLine } = currentLabel;\n if (this._enableAnimation !== false && this._animationConfig.update !== false) {\n const { duration, easing } = this._animationConfig.update;\n updateAnimation(prevText, curText, this._animationConfig.update);\n if (prevLabelLine && curLabelLine) {\n prevLabel.labelLine.animate().to(curLabelLine.attribute, duration, easing);\n }\n } else {\n prevLabel.text.setAttributes(curText.attribute as any);\n if (prevLabelLine && curLabelLine) {\n prevLabel.labelLine.setAttributes(curLabelLine.attribute);\n }\n }\n }\n\n protected _removeLabel(textMap: Map<any, LabelContent>) {\n const removeLabelAndLine = (label: LabelContent) => {\n this.removeChild(label.text);\n if (label.labelLine) {\n this.removeChild(label.labelLine);\n }\n };\n\n if (this._enableAnimation !== false && this._animationConfig.exit !== false) {\n const { duration, easing } = this._animationConfig.exit;\n textMap.forEach(label => {\n label.text\n ?.animate()\n .to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n removeLabelAndLine(label);\n });\n });\n } else {\n textMap.forEach(label => {\n removeLabelAndLine(label);\n });\n }\n }\n\n private updateStatesOfLabels(labels: LabelContent[], currentStates?: string[]) {\n labels.forEach(label => {\n if (label) {\n if (label.text) {\n label.text.useStates(currentStates);\n }\n\n if (label.labelLine) {\n label.labelLine.useStates(currentStates);\n }\n }\n });\n }\n\n protected _handleRelatedGraphicSetState = (e: any) => {\n if (\n e.detail?.type === AttributeUpdateType.STATE ||\n (e.detail?.type === AttributeUpdateType.ANIMATE_UPDATE && e.detail.animationState?.isFirstFrameOfStep)\n ) {\n const currentStates = e.target?.currentStates ?? [];\n const labels = this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)];\n\n this.updateStatesOfLabels(labels, currentStates);\n }\n };\n\n protected _syncStateWithRelatedGraphic(relatedGraphic: IGraphic) {\n if (this.attribute.syncState && relatedGraphic) {\n relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);\n }\n }\n\n // 默认labelLine和text共用相同动画属性\n protected _afterRelatedGraphicAttributeUpdate(\n text: IText | IRichText,\n texts: (IText | IRichText)[],\n labelLine: ILine,\n labelLines: ILine[],\n index: number,\n relatedGraphic: IGraphic,\n to: any,\n { mode, duration, easing, delay }: ILabelAnimation\n ) {\n // TODO: 跟随动画\n const listener = (event: any) => {\n const { detail } = event;\n if (!detail) {\n return {};\n }\n const step = detail.animationState?.step;\n const isValidAnimateState =\n detail.type === AttributeUpdateType.ANIMATE_UPDATE &&\n step &&\n // 不是第一个wait\n !(step.type === 'wait' && step.prev?.type == null);\n\n if (!isValidAnimateState) {\n return {};\n }\n // const prevStep = step.prev;\n // if (prevStep && prevStep.type === 'wait' && prevStep.prev?.type == null) {\n // delay = delay ?? step.position;\n // }\n if (detail.type === AttributeUpdateType.ANIMATE_END) {\n text.setAttributes(to);\n labelLine && labelLine.setAttributes(to);\n return;\n }\n\n const onStart = () => {\n if (relatedGraphic) {\n relatedGraphic.onAnimateBind = undefined;\n relatedGraphic.removeEventListener('afterAttributeUpdate', listener);\n }\n };\n\n switch (mode) {\n case 'after':\n // 3. 当前关联图元的动画播放结束后\n if (detail.animationState.end) {\n text.animate({ onStart }).wait(delay).to(to, duration, easing);\n labelLine && labelLine.animate().wait(delay).to(to, duration, easing);\n }\n break;\n case 'after-all':\n // 2. 所有完成后才开始;\n if (index === texts.length - 1) {\n if (detail.animationState.end) {\n texts.forEach(t => {\n t.animate({ onStart }).wait(delay).to(to, duration, easing);\n });\n labelLines.forEach(t => {\n t.animate().wait(delay).to(to, duration, easing);\n });\n }\n }\n break;\n case 'same-time':\n default:\n if (this._isCollectionBase) {\n const point = this._idToPoint.get((text.attribute as LabelItem).id);\n if (\n point &&\n (!text.animates || !text.animates.has('label-animate')) &&\n relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, this.stage?.getPickerService())\n ) {\n text.animate({ onStart }).wait(delay).to(to, duration, easing);\n labelLine && labelLine.animate().wait(delay).to(to, duration, easing);\n }\n } else if (detail.animationState.isFirstFrameOfStep) {\n text.animate({ onStart }).wait(delay).to(to, duration, easing);\n labelLine && labelLine.animate().wait(delay).to(to, duration, easing);\n }\n\n break;\n }\n };\n return listener;\n }\n\n protected _smartInvert(labels: (IText | IRichText)[]) {\n const option = (isObject(this.attribute.smartInvert) ? this.attribute.smartInvert : {}) as SmartInvertAttrs;\n const { textType, contrastRatiosThreshold, alternativeColors, mode, interactInvertType } = option;\n const fillStrategy = option.fillStrategy ?? 'invertBase';\n const strokeStrategy = option.strokeStrategy ?? 'base';\n const brightColor = option.brightColor ?? '#ffffff';\n const darkColor = option.darkColor ?? '#000000';\n const outsideEnable = option.outsideEnable ?? false;\n\n if (fillStrategy === 'null' && strokeStrategy === 'null') {\n return;\n }\n\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (!label) {\n continue;\n }\n\n const baseMark = this.getRelatedGraphic(label.attribute as LabelItem);\n\n /**\n * 增加smartInvert时fillStrategy和 strokeStrategy的四种策略:\n * base(baseMark色),\n * inverBase(执行智能反色),\n * similarBase(智能反色的补色),\n * null(不执行智能反色,保持fill设置的颜色)\n * */\n let backgroundColor = baseMark.attribute.fill as IColor;\n let foregroundColor = label.attribute.fill as IColor;\n\n if (isObject(backgroundColor) && backgroundColor.gradient) {\n const firstStopColor = (backgroundColor as ILinearGradient).stops?.[0]?.color;\n\n if (firstStopColor) {\n backgroundColor = firstStopColor;\n foregroundColor = firstStopColor; // 渐变色的时候,标签的颜色可能会和背景色不一致,所以需要设置为相同的颜色\n }\n }\n\n const invertColor = labelSmartInvert(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors,\n mode\n );\n const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;\n const isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds);\n const isIntersect =\n !isInside && label.AABBBounds && baseMark.AABBBounds && baseMark.AABBBounds.intersects(label.AABBBounds);\n\n if (isInside || outsideEnable || (isIntersect && interactInvertType === 'inside')) {\n // 按照标签展示在柱子内部的情况,执行反色逻辑\n const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0 || label.attribute.strokeOpacity === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else if (isIntersect && interactInvertType !== 'none') {\n // 存在相交的情况\n /** 当label无法设置stroke时,不进行反色计算(容易反色为白色与白色背景混合不可见) */\n if (label.attribute.lineWidth === 0 || label.attribute.strokeOpacity === 0) {\n continue;\n }\n /** 当label设置stroke时,保留stroke设置的颜色,根据stroke对fill做反色 */\n if (label.attribute.stroke) {\n // stroke 作为背景色进行反色计算\n label.setAttributes({\n fill: labelSmartInvert(\n label.attribute.fill as IColor,\n label.attribute.stroke as IColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors,\n mode\n )\n });\n continue;\n }\n /** 当label未设置stroke,且可设置stroke时,正常计算 */\n const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n }\n }\n }\n\n /**\n * 是否在图形内部\n * @param textBound\n * @param shapeBound\n * @returns\n */\n protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds) {\n if (!textBound || !shapeBound) {\n return false;\n }\n return shapeBound.encloses(textBound);\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._enableAnimation = false;\n }\n\n enableAnimation() {\n this._enableAnimation = true;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/label/base.ts"],"names":[],"mappings":";;;;;;;;;;;AAiBA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG9G,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,eAAe,EACf,KAAK,EACL,OAAO,EACP,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChH,OAAO,E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ACH,CAAC;IAQS,eAAe,CAAC,SAAsB,EAAE,UAAuB;QACvE,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,EAAE;YAC7B,OAAO,KAAK,CAAC;SACd;QACD,OAAO,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,WAAW,CAAC,KAAuB;QACjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,eAAe;QACb,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;;AAhhCM,2BAAiB,GAA4B;IAClD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QAIZ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAChC;IACD,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport type {\n IGroup,\n Text,\n IGraphic,\n IText,\n FederatedPointerEvent,\n IColor,\n ILine,\n IArea,\n IRichText,\n ILineGraphicAttribute,\n ILinearGradient\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator, AttributeUpdateType, IContainPointMode, CustomPath2D } from '@visactor/vrender-core';\nimport type { IAABBBounds, IBoundsLike, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport {\n isFunction,\n isEmpty,\n isValid,\n isString,\n merge,\n isRectIntersect,\n isNil,\n isArray,\n isObject\n} from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert, contrastAccessibilityChecker, smartInvertStrategy } from '../util/label-smartInvert';\nimport { createTextGraphicByType, getMarksByName, getNoneGroupMarksByName, traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap, BitmapTool } from './overlap';\n// eslint-disable-next-line no-duplicate-imports\nimport { bitmapTool, boundToRange, canPlace, clampText, place } from './overlap';\nimport type {\n BaseLabelAttrs,\n OverlapAttrs,\n ILabelAnimation,\n LabelItem,\n SmartInvertAttrs,\n ILabelEnterAnimation,\n ILabelExitAnimation,\n ILabelUpdateAnimation,\n LabelContent,\n ShiftYStrategy,\n Strategy\n} from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes, updateAnimation } from './animate/animate';\nimport { connectLineBetweenBounds, getPointsOfLineArea } from './util';\nimport type { ComponentOptions } from '../interface';\nimport { loadLabelComponent } from './register';\nimport { shiftY } from './overlap/shiftY';\n\nloadLabelComponent();\nexport class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _isCollectionBase: boolean;\n\n protected _bitmap?: Bitmap;\n\n // parsed animation config\n protected _animationConfig?: {\n enter: ILabelEnterAnimation | false;\n exit: ILabelExitAnimation | false;\n update: ILabelUpdateAnimation | false;\n };\n\n static defaultAttributes: Partial<BaseLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n // FIXME: we need a default color. Yet in current logic, textStyle will override fill from baseMark.\n // This need a new config option like `colorFull`\n // fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-2, -1, -2, -1] // to ignore the textBound buf\n },\n offset: 0,\n pickable: false\n };\n\n setBitmap(bitmap: Bitmap) {\n this._bitmap = bitmap;\n }\n\n protected _bmpTool?: ReturnType<typeof bitmapTool>;\n setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>) {\n this._bmpTool = bmpTool;\n }\n\n protected _graphicToText: Map<IGraphic, LabelContent>;\n\n protected _idToGraphic: Map<string, IGraphic>;\n\n protected _idToPoint: Map<string, IPointLike>;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n constructor(attributes: BaseLabelAttrs, options?: ComponentOptions) {\n const { data, ...restAttributes } = attributes;\n super(options?.skipDefault ? attributes : { data, ...merge({}, LabelBase.defaultAttributes, restAttributes) });\n }\n\n /**\n * 计算 text 的最终位置属性x, y\n * @param textBounds\n * @param graphicBounds\n * @param position\n * @param offset\n * @returns\n */\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): { x: number; y: number } | undefined {\n // 基类没有指定的图元类型,需要在 data 中指定位置,故无需进行 labeling\n return;\n }\n\n protected _getLabelLinePoints(text: IText | IRichText, baseMark?: IGraphic) {\n return connectLineBetweenBounds(text.AABBBounds, baseMark?.AABBBounds);\n }\n\n protected _createLabelLine(text: IText | IRichText, baseMark?: IGraphic): ILine | undefined {\n const points = this._getLabelLinePoints(text, baseMark);\n if (points) {\n const lineGraphic = graphicCreator.line({\n points\n });\n\n const { line = {} } = text.attribute as any;\n\n if (line.customShape) {\n const customShape = line.customShape;\n lineGraphic.pathProxy = (attrs: Partial<ILineGraphicAttribute>) => {\n return customShape(\n {\n text,\n baseMark: baseMark\n },\n attrs,\n new CustomPath2D()\n );\n };\n }\n\n if (baseMark && baseMark.attribute.fill) {\n lineGraphic.setAttribute('stroke', baseMark.attribute.fill);\n }\n\n if (this.attribute.line && !isEmpty(this.attribute.line.style)) {\n lineGraphic.setAttributes(this.attribute.line.style);\n }\n this._setStatesOfLabelLine(lineGraphic);\n return lineGraphic;\n }\n }\n\n protected render() {\n this._prepare();\n if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {\n return;\n }\n\n const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;\n let data = this.attribute.data;\n\n if (isFunction(dataFilter)) {\n data = dataFilter(data);\n }\n\n if (data && data.length) {\n // 数据保护,防止重复 id 造成不可预知的问题\n const seenIds = new Set();\n data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));\n }\n\n let labels: (IText | IRichText)[] = this._initText(data);\n\n if (isFunction(customLayoutFunc)) {\n labels = customLayoutFunc(\n data,\n labels,\n this.getRelatedGraphic.bind(this),\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null,\n this\n );\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this._layout(labels);\n }\n\n if (isFunction(customOverlapFunc)) {\n labels = customOverlapFunc(\n labels as Text[],\n this.getRelatedGraphic.bind(this),\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null,\n this\n );\n } else {\n // 防重叠逻辑\n if (overlap !== false) {\n labels = this._overlapping(labels);\n }\n }\n\n if (isFunction(this.attribute.onAfterOverlapping)) {\n this.attribute.onAfterOverlapping(\n labels as Text[],\n this.getRelatedGraphic.bind(this),\n this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null,\n this\n );\n }\n\n if (labels && labels.length) {\n labels.forEach(label => {\n this._bindEvent(label);\n this._setStatesOfText(label);\n });\n }\n\n if (smartInvert !== false) {\n this._smartInvert(labels);\n }\n\n this._renderLabels(labels);\n }\n\n private _bindEvent(target: IGraphic) {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n if (!target) {\n return;\n }\n\n const { hover, select } = this.attribute;\n\n if (hover) {\n target.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n target.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n target.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _setStatesOfText(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.state;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n protected _setStatesOfLabelLine(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.labelLineState;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState('selected')) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (!isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n protected _createLabelText(attributes: LabelItem) {\n const textAttrs = {\n ...this.stage?.getTheme()?.text,\n ...attributes\n };\n return createTextGraphicByType(textAttrs, 'textType');\n }\n\n private _prepare() {\n const currentBaseMarks: IGraphic[] = [];\n let baseMarks;\n if (isFunction(this.attribute.getBaseMarks)) {\n baseMarks = this.attribute.getBaseMarks();\n } else {\n baseMarks = getMarksByName(this.getRootNode() as IGroup, this.attribute.baseMarkGroupName);\n }\n\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._idToPoint?.clear();\n this._baseMarks = currentBaseMarks;\n this._isCollectionBase = this.attribute.type === 'line-data';\n\n if (!currentBaseMarks || currentBaseMarks.length === 0) {\n return;\n }\n\n const { data } = this.attribute;\n\n if (!data || data.length === 0) {\n return;\n }\n if (!this._idToGraphic) {\n this._idToGraphic = new Map();\n }\n\n // generate id mapping before data filter\n if (this._isCollectionBase) {\n if (!this._idToPoint) {\n this._idToPoint = new Map();\n }\n let cur = 0;\n for (let i = 0; i < currentBaseMarks.length; i++) {\n const baseMark = currentBaseMarks[i];\n const points = getPointsOfLineArea(baseMark as ILine | IArea);\n\n if (points && points.length) {\n for (let j = 0; j < points.length; j++) {\n const textData = data[cur];\n if (textData && points[j]) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${cur}`;\n }\n this._idToPoint.set(textData.id, points[j]);\n this._idToGraphic.set(textData.id, baseMark);\n }\n\n cur++;\n }\n }\n }\n } else {\n for (let i = 0; i < currentBaseMarks.length; i++) {\n const textData = data[i];\n const baseMark = currentBaseMarks[i] as IGraphic;\n if (textData && baseMark) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${i}`;\n }\n this._idToGraphic.set(textData.id, baseMark);\n }\n }\n }\n\n if (this.attribute.animation !== false) {\n const { animation, animationEnter, animationExit, animationUpdate } = this.attribute;\n const animationCfg = isObject(animation) ? animation : {};\n this._animationConfig = {\n enter: animationEnter !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationEnter ?? {}) : false,\n exit: animationExit !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationExit ?? {}) : false,\n update:\n animationUpdate !== false\n ? isArray(animationUpdate)\n ? animationUpdate\n : merge({}, DefaultLabelAnimation, animationCfg, animationUpdate ?? {})\n : false\n };\n } else {\n this._animationConfig = {\n enter: false,\n exit: false,\n update: false\n };\n }\n }\n\n protected getRelatedGraphic(item: LabelItem) {\n return this._idToGraphic.get(item.id);\n }\n\n protected _initText(data: LabelItem[] = []): (IText | IRichText)[] {\n const { textStyle = {} } = this.attribute;\n const labels = [];\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const baseMark = this.getRelatedGraphic(textData);\n if (!baseMark) {\n continue;\n }\n\n const labelAttribute = {\n fill: this._isCollectionBase\n ? isArray(baseMark.attribute.stroke)\n ? baseMark.attribute.stroke.find(entry => !!entry && entry !== true)\n : baseMark.attribute.stroke\n : baseMark.attribute.fill,\n ...textStyle,\n ...textData\n };\n const text = this._createLabelText(labelAttribute);\n labels.push(text);\n }\n\n return labels;\n }\n\n protected _layout(texts: (IText | IRichText)[]): (IText | IRichText)[] {\n const { position, offset } = this.attribute;\n for (let i = 0; i < texts.length; i++) {\n const text = texts[i];\n if (!text) {\n return;\n }\n const textData = text.attribute as LabelItem;\n const baseMark = this.getRelatedGraphic(textData);\n if (!baseMark) {\n continue;\n }\n\n text.attachedThemeGraphic = this as any;\n const textBounds = this.getGraphicBounds(text);\n text.attachedThemeGraphic = null;\n const actualPosition = isFunction(position) ? position(textData) : (position as string);\n\n const graphicBounds = this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get(textData.id), actualPosition)\n : this.getGraphicBounds(baseMark, { x: textData.x as number, y: textData.y as number }, actualPosition);\n\n const textLocation = this.labeling(textBounds, graphicBounds, actualPosition, offset);\n\n if (textLocation) {\n text.setAttributes(textLocation);\n }\n }\n\n return texts;\n }\n\n protected _overlapping(labels: (IText | IRichText)[]) {\n if (labels.length === 0) {\n return [];\n }\n const option = (isObject(this.attribute.overlap) ? this.attribute.overlap : {}) as OverlapAttrs;\n const baseMarkGroup = this.getBaseMarkGroup();\n\n const size = option.size ?? {\n width: baseMarkGroup?.AABBBounds.width() ?? 0,\n height: baseMarkGroup?.AABBBounds.height() ?? 0\n };\n\n if (size.width === 0 || size.height === 0) {\n return labels;\n }\n\n const { strategy, priority } = option;\n\n const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);\n const bitmap = this._bitmap || bmpTool.bitmap();\n\n if (priority) {\n labels = labels.sort((a, b) => priority((b.attribute as any).data) - priority((a.attribute as any).data));\n }\n\n if ((strategy as ShiftYStrategy)?.type === 'shiftY') {\n return this._overlapGlobal(labels, option, bmpTool, bitmap);\n }\n return this._overlapByStrategy(labels, option, bmpTool, bitmap);\n }\n\n protected _overlapGlobal(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap) {\n let result = labels.filter(label => label.attribute.visible && label.attribute.opacity !== 0);\n const { clampForce = true, hideOnHit = true, overlapPadding, strategy } = option;\n if (clampForce) {\n for (let i = 0; i < result.length; i++) {\n const text = labels[i];\n const { dx = 0, dy = 0 } = clampText(text as IText, bmpTool.width, bmpTool.height, bmpTool.padding);\n if (dx !== 0 || dy !== 0) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n text._isClamped = true;\n }\n }\n }\n result = shiftY(result as any, {\n maxY: bmpTool.height,\n ...(strategy as ShiftYStrategy),\n labelling: (text: IText) => {\n const baseMark = this.getRelatedGraphic(text.attribute);\n const graphicBound = this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get((text.attribute as any).id))\n : this.getGraphicBounds(baseMark, text);\n return this.labeling(text.AABBBounds, graphicBound, 'bottom', this.attribute.offset);\n }\n });\n\n for (let i = 0; i < result.length; i++) {\n const text = result[i];\n const bounds = text.AABBBounds;\n const range = boundToRange(bmpTool, bounds, true);\n if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {\n bitmap.setRange(range);\n } else {\n if (clampForce) {\n const placedAfterClampForce = this._processClampForce(text as IText, bmpTool, bitmap, overlapPadding);\n if (placedAfterClampForce) {\n continue;\n }\n }\n if (hideOnHit) {\n text.setAttributes({ visible: false });\n } else {\n bitmap.setRange(range);\n }\n }\n }\n return result;\n }\n\n protected _processClampForce(text: IText, bmpTool: BitmapTool, bitmap: Bitmap, overlapPadding = 0) {\n const { dy = 0, dx = 0 } = clampText(text as IText, bmpTool.width, bmpTool.height, bmpTool.padding);\n if (dx === 0 && dy === 0) {\n // 再次检查,若不考虑边界,仍然可以放得下,代表当前 text 没有与其他 text 重叠\n if (canPlace(bmpTool, bitmap, text.AABBBounds, false, overlapPadding)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n return true;\n }\n } else if (\n canPlace(\n bmpTool,\n bitmap,\n {\n x1: text.AABBBounds.x1 + dx,\n x2: text.AABBBounds.x2 + dx,\n y1: text.AABBBounds.y1 + dy,\n y2: text.AABBBounds.y2 + dy\n }\n // 向内 clamp 只处理超出的位移量,不叠加 overlapPadding\n )\n ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n return true;\n }\n return false;\n }\n\n protected _overlapByStrategy(\n labels: (IText | IRichText)[],\n option: OverlapAttrs,\n bmpTool: BitmapTool,\n bitmap: Bitmap\n ) {\n const {\n avoidBaseMark,\n strategy = [],\n hideOnHit = true,\n clampForce = true,\n avoidMarks = [],\n overlapPadding\n } = option;\n const result: (IText | IRichText)[] = [];\n\n const checkBounds = (strategy as Strategy[]).some(s => s.type === 'bound');\n // 躲避关联的基础图元\n if (avoidBaseMark) {\n this._baseMarks?.forEach(mark => {\n mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));\n });\n }\n\n // 躲避指定图元\n if (avoidMarks.length > 0) {\n avoidMarks.forEach(avoid => {\n if (isString(avoid)) {\n getNoneGroupMarksByName(this.getRootNode() as IGroup, avoid).forEach(avoidMark => {\n avoidMark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, avoidMark.AABBBounds, true));\n });\n } else if (avoid.AABBBounds) {\n bitmap.setRange(boundToRange(bmpTool, avoid.AABBBounds, true));\n }\n });\n }\n\n for (let i = 0; i < labels.length; i++) {\n if (labels[i].attribute.visible === false) {\n continue;\n }\n\n const text = labels[i] as IText | IRichText;\n const baseMark = this.getRelatedGraphic(text.attribute);\n text.update();\n if (!isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {\n continue;\n }\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {\n // 如果配置了限制在图形内部,需要提前判断;\n if (!checkBounds) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n\n if (\n checkBounds &&\n baseMark &&\n baseMark.AABBBounds &&\n this._canPlaceInside(text.AABBBounds, baseMark.AABBBounds)\n ) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n let hasPlace: ReturnType<typeof place> = false;\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < (strategy as Strategy[]).length; j++) {\n hasPlace = place(\n bmpTool,\n bitmap,\n strategy[j],\n <BaseLabelAttrs>this.attribute,\n text as Text,\n this._isCollectionBase\n ? this.getGraphicBounds(null, this._idToPoint.get((labels[i].attribute as any).id))\n : this.getGraphicBounds(baseMark, labels[i].attribute),\n this.labeling\n );\n if (hasPlace !== false) {\n text.setAttributes({ x: hasPlace.x, y: hasPlace.y });\n result.push(text);\n break;\n }\n }\n\n // 尝试向内挤压\n if (!hasPlace && clampForce) {\n const placedAfterClampForce = this._processClampForce(text as IText, bmpTool, bitmap, overlapPadding);\n if (placedAfterClampForce) {\n result.push(text);\n continue;\n }\n }\n\n !hasPlace && !hideOnHit && result.push(text);\n }\n return result;\n }\n\n protected getBaseMarkGroup() {\n const { baseMarkGroupName } = this.attribute as BaseLabelAttrs;\n if (!baseMarkGroupName) {\n return;\n }\n return (this.getRootNode() as IGroup).find(node => node.name === baseMarkGroupName, true) as IGroup;\n }\n\n protected getGraphicBounds(\n graphic?: IGraphic,\n point: Partial<PointLocationCfg> = {},\n position?: string\n ): IBoundsLike {\n if (graphic) {\n if (graphic.attribute.visible !== false) {\n return graphic.AABBBounds;\n }\n const { x, y } = graphic.attribute;\n return { x1: x, x2: x, y1: y, y2: y } as IBoundsLike;\n }\n if (point && position && position === 'inside-middle') {\n const { x, y, x1 = x, y1 = y } = point;\n return {\n x1: (x + x1) / 2,\n x2: (x + x1) / 2,\n y1: (y + y1) / 2,\n y2: (y + y1) / 2\n };\n }\n const { x, y } = point;\n return { x1: x, x2: x, y1: y, y2: y } as IBoundsLike;\n }\n\n protected _renderLabels(labels: (IText | IRichText)[]) {\n const { syncState } = this.attribute;\n const currentTextMap: Map<any, LabelContent> = new Map();\n const prevTextMap: Map<any, LabelContent> = this._graphicToText || new Map();\n const texts = [] as (IText | IRichText)[];\n const labelLines = [] as ILine[];\n const { visible: showLabelLine } = this.attribute.line ?? {};\n\n labels &&\n labels.forEach((text, index) => {\n const relatedGraphic = this.getRelatedGraphic(text.attribute);\n const textKey = this._isCollectionBase ? (text.attribute as LabelItem).id : relatedGraphic;\n const state = prevTextMap?.get(textKey) ? 'update' : 'enter';\n let labelLine;\n if (showLabelLine) {\n labelLine = this._createLabelLine(text as IText, relatedGraphic);\n }\n if (syncState) {\n this.updateStatesOfLabels([labelLine ? { text, labelLine } : { text }], relatedGraphic.currentStates ?? []);\n }\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });\n this._addLabel({ text, labelLine }, texts, labelLines, index);\n } else if (state === 'update') {\n const prevLabel = prevTextMap.get(textKey);\n prevTextMap.delete(textKey);\n currentTextMap.set(textKey, prevLabel);\n this._updateLabel(prevLabel, { text, labelLine });\n }\n });\n\n this._removeLabel(prevTextMap);\n\n this._graphicToText = currentTextMap;\n }\n\n protected _addLabel(\n label: LabelContent,\n texts?: LabelContent['text'][],\n labelLines?: LabelContent['labelLine'][],\n index?: number\n ) {\n const { text, labelLine } = label;\n // TODO: 或许还需要判断关联图元是否有动画?\n const relatedGraphic = this.getRelatedGraphic(text.attribute);\n this._syncStateWithRelatedGraphic(relatedGraphic);\n\n if (this._enableAnimation !== false && this._animationConfig.enter !== false) {\n if (relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n if (text) {\n this.add(text);\n }\n\n if (labelLine) {\n labelLines.push(labelLine);\n this.add(labelLine);\n }\n\n // enter的时长如果不是大于0,那么直接跳过动画\n this._animationConfig.enter.duration > 0 &&\n relatedGraphic.once('animate-bind', a => {\n // text和labelLine共用一个from\n text.setAttributes(from);\n labelLine && labelLine.setAttributes(from);\n const listener = this._afterRelatedGraphicAttributeUpdate(\n text,\n texts,\n labelLine,\n labelLines,\n index,\n relatedGraphic,\n to,\n this._animationConfig.enter as ILabelEnterAnimation\n );\n relatedGraphic.on('afterAttributeUpdate', listener);\n });\n }\n } else {\n if (text) {\n this.add(text);\n }\n if (labelLine) {\n this.add(labelLine);\n }\n }\n }\n\n protected _updateLabel(prevLabel: LabelContent, currentLabel: LabelContent) {\n const { text: prevText, labelLine: prevLabelLine } = prevLabel;\n const { text: curText, labelLine: curLabelLine } = currentLabel;\n if (this._enableAnimation !== false && this._animationConfig.update !== false) {\n const { duration, easing } = this._animationConfig.update;\n updateAnimation(prevText, curText, this._animationConfig.update);\n if (prevLabelLine && curLabelLine) {\n prevLabel.labelLine.animate().to(curLabelLine.attribute, duration, easing);\n }\n } else {\n prevLabel.text.setAttributes(curText.attribute as any);\n if (prevLabelLine && curLabelLine) {\n prevLabel.labelLine.setAttributes(curLabelLine.attribute);\n }\n }\n }\n\n protected _removeLabel(textMap: Map<any, LabelContent>) {\n const removeLabelAndLine = (label: LabelContent) => {\n this.removeChild(label.text);\n if (label.labelLine) {\n this.removeChild(label.labelLine);\n }\n };\n\n if (this._enableAnimation !== false && this._animationConfig.exit !== false) {\n const { duration, easing } = this._animationConfig.exit;\n textMap.forEach(label => {\n label.text\n ?.animate()\n .to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n removeLabelAndLine(label);\n });\n });\n } else {\n textMap.forEach(label => {\n removeLabelAndLine(label);\n });\n }\n }\n\n private updateStatesOfLabels(labels: LabelContent[], currentStates?: string[]) {\n labels.forEach(label => {\n if (label) {\n if (label.text) {\n label.text.useStates(currentStates);\n }\n\n if (label.labelLine) {\n label.labelLine.useStates(currentStates);\n }\n }\n });\n }\n\n protected _handleRelatedGraphicSetState = (e: any) => {\n if (\n e.detail?.type === AttributeUpdateType.STATE ||\n (e.detail?.type === AttributeUpdateType.ANIMATE_UPDATE && e.detail.animationState?.isFirstFrameOfStep)\n ) {\n const currentStates = e.target?.currentStates ?? [];\n const labels = this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)];\n\n this.updateStatesOfLabels(labels, currentStates);\n }\n };\n\n protected _syncStateWithRelatedGraphic(relatedGraphic: IGraphic) {\n if (this.attribute.syncState && relatedGraphic) {\n relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);\n }\n }\n\n // 默认labelLine和text共用相同动画属性\n protected _afterRelatedGraphicAttributeUpdate(\n text: IText | IRichText,\n texts: (IText | IRichText)[],\n labelLine: ILine,\n labelLines: ILine[],\n index: number,\n relatedGraphic: IGraphic,\n to: any,\n { mode, duration, easing, delay }: ILabelAnimation\n ) {\n // TODO: 跟随动画\n const listener = (event: any) => {\n const { detail } = event;\n if (!detail) {\n return {};\n }\n const step = detail.animationState?.step;\n const isValidAnimateState =\n detail.type === AttributeUpdateType.ANIMATE_UPDATE &&\n step &&\n // 不是第一个wait\n !(step.type === 'wait' && step.prev?.type == null);\n\n if (!isValidAnimateState) {\n return {};\n }\n // const prevStep = step.prev;\n // if (prevStep && prevStep.type === 'wait' && prevStep.prev?.type == null) {\n // delay = delay ?? step.position;\n // }\n if (detail.type === AttributeUpdateType.ANIMATE_END) {\n text.setAttributes(to);\n labelLine && labelLine.setAttributes(to);\n return;\n }\n\n const onStart = () => {\n if (relatedGraphic) {\n relatedGraphic.onAnimateBind = undefined;\n relatedGraphic.removeEventListener('afterAttributeUpdate', listener);\n }\n };\n\n switch (mode) {\n case 'after':\n // 3. 当前关联图元的动画播放结束后\n if (detail.animationState.end) {\n text.animate({ onStart }).wait(delay).to(to, duration, easing);\n labelLine && labelLine.animate().wait(delay).to(to, duration, easing);\n }\n break;\n case 'after-all':\n // 2. 所有完成后才开始;\n if (index === texts.length - 1) {\n if (detail.animationState.end) {\n texts.forEach(t => {\n t.animate({ onStart }).wait(delay).to(to, duration, easing);\n });\n labelLines.forEach(t => {\n t.animate().wait(delay).to(to, duration, easing);\n });\n }\n }\n break;\n case 'same-time':\n default:\n if (this._isCollectionBase) {\n const point = this._idToPoint.get((text.attribute as LabelItem).id);\n if (\n point &&\n (!text.animates || !text.animates.has('label-animate')) &&\n relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, this.stage?.getPickerService())\n ) {\n text.animate({ onStart }).wait(delay).to(to, duration, easing);\n labelLine && labelLine.animate().wait(delay).to(to, duration, easing);\n }\n } else if (detail.animationState.isFirstFrameOfStep) {\n text.animate({ onStart }).wait(delay).to(to, duration, easing);\n labelLine && labelLine.animate().wait(delay).to(to, duration, easing);\n }\n\n break;\n }\n };\n return listener;\n }\n\n protected _smartInvert(labels: (IText | IRichText)[]) {\n const option = (isObject(this.attribute.smartInvert) ? this.attribute.smartInvert : {}) as SmartInvertAttrs;\n const { textType, contrastRatiosThreshold, alternativeColors, mode, interactInvertType } = option;\n const fillStrategy = option.fillStrategy ?? 'invertBase';\n const strokeStrategy = option.strokeStrategy ?? 'base';\n const brightColor = option.brightColor ?? '#ffffff';\n const darkColor = option.darkColor ?? '#000000';\n const outsideEnable = option.outsideEnable ?? false;\n\n if (fillStrategy === 'null' && strokeStrategy === 'null') {\n return;\n }\n\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (!label) {\n continue;\n }\n\n const baseMark = this.getRelatedGraphic(label.attribute as LabelItem);\n\n /**\n * 增加smartInvert时fillStrategy和 strokeStrategy的四种策略:\n * base(baseMark色),\n * inverBase(执行智能反色),\n * similarBase(智能反色的补色),\n * null(不执行智能反色,保持fill设置的颜色)\n * */\n let backgroundColor = baseMark.attribute.fill as IColor;\n let foregroundColor = label.attribute.fill as IColor;\n\n if (isObject(backgroundColor) && backgroundColor.gradient) {\n const firstStopColor = (backgroundColor as ILinearGradient).stops?.[0]?.color;\n\n if (firstStopColor) {\n backgroundColor = firstStopColor;\n foregroundColor = firstStopColor; // 渐变色的时候,标签的颜色可能会和背景色不一致,所以需要设置为相同的颜色\n }\n }\n\n const invertColor = labelSmartInvert(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors,\n mode\n );\n const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;\n const isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds);\n const isIntersect =\n !isInside && label.AABBBounds && baseMark.AABBBounds && baseMark.AABBBounds.intersects(label.AABBBounds);\n\n if (isInside || outsideEnable || (isIntersect && interactInvertType === 'inside')) {\n // 按照标签展示在柱子内部的情况,执行反色逻辑\n const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n if (label.attribute.lineWidth === 0 || label.attribute.strokeOpacity === 0) {\n continue;\n }\n\n const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n } else if (isIntersect && interactInvertType !== 'none') {\n // 存在相交的情况\n /** 当label无法设置stroke时,不进行反色计算(容易反色为白色与白色背景混合不可见) */\n if (label.attribute.lineWidth === 0 || label.attribute.strokeOpacity === 0) {\n continue;\n }\n /** 当label设置stroke时,保留stroke设置的颜色,根据stroke对fill做反色 */\n if (label.attribute.stroke) {\n // stroke 作为背景色进行反色计算\n label.setAttributes({\n fill: labelSmartInvert(\n label.attribute.fill as IColor,\n label.attribute.stroke as IColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors,\n mode\n )\n });\n continue;\n }\n /** 当label未设置stroke,且可设置stroke时,正常计算 */\n const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);\n fill && label.setAttributes({ fill });\n\n const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);\n stroke && label.setAttributes({ stroke });\n }\n }\n }\n\n /**\n * 是否在图形内部\n * @param textBound\n * @param shapeBound\n * @returns\n */\n protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds) {\n if (!textBound || !shapeBound) {\n return false;\n }\n return shapeBound.encloses(textBound);\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._enableAnimation = false;\n }\n\n enableAnimation() {\n this._enableAnimation = true;\n }\n}\n"]}