@visactor/vrender-components 1.0.10 → 1.0.12

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
@@ -2496,7 +2496,8 @@ const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute),
2496
2496
  y1: 0,
2497
2497
  strokeBoundsBuffer: 0,
2498
2498
  cornerRadius: 0,
2499
- cornerType: "round"
2499
+ cornerType: "round",
2500
+ drawStrokeWhenZeroWH: !1
2500
2501
  });
2501
2502
  Object.assign(Object.assign({}, DefaultAttribute), {
2502
2503
  width: 0,
@@ -2505,7 +2506,8 @@ Object.assign(Object.assign({}, DefaultAttribute), {
2505
2506
  y1: 0,
2506
2507
  cornerRadius: 0,
2507
2508
  length: 0,
2508
- cornerType: "round"
2509
+ cornerType: "round",
2510
+ drawStrokeWhenZeroWH: !1
2509
2511
  });
2510
2512
  const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2511
2513
  symbolType: "circle",
@@ -6399,7 +6401,7 @@ class Graphic extends Node {
6399
6401
  });
6400
6402
  }
6401
6403
  setAttributes(params, forceUpdateTag = !1, context) {
6402
- (params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context);
6404
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
6403
6405
  }
6404
6406
  _setAttributes(params, forceUpdateTag = !1, context) {
6405
6407
  const keys = Object.keys(params);
@@ -7224,8 +7226,8 @@ function rectFillVisible(opacity, fillOpacity, width, height, fill) {
7224
7226
  function strokeVisible(opacity, strokeOpacity) {
7225
7227
  return opacity * strokeOpacity > 0;
7226
7228
  }
7227
- function rectStrokeVisible(opacity, strokeOpacity, width, height) {
7228
- return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
7229
+ function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
7230
+ return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
7229
7231
  }
7230
7232
  function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
7231
7233
  const x10 = x1 - x0,
@@ -11836,7 +11838,8 @@ let DefaultCanvasRectRender = class extends BaseRender {
11836
11838
  y1: y1,
11837
11839
  x: originX = rectAttribute.x,
11838
11840
  y: originY = rectAttribute.y,
11839
- fillStrokeOrder = rectAttribute.fillStrokeOrder
11841
+ fillStrokeOrder = rectAttribute.fillStrokeOrder,
11842
+ drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
11840
11843
  } = rect.attribute;
11841
11844
  let {
11842
11845
  width: width,
@@ -11844,7 +11847,7 @@ let DefaultCanvasRectRender = class extends BaseRender {
11844
11847
  } = rect.attribute;
11845
11848
  width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
11846
11849
  const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
11847
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
11850
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
11848
11851
  doFill = runFill(fill, background),
11849
11852
  doStroke = runStroke(stroke, lineWidth);
11850
11853
  if (!rect.valid || !visible) return;
@@ -18804,6 +18807,7 @@ class Step {
18804
18807
  return this.getEndProps();
18805
18808
  }
18806
18809
  stop() {}
18810
+ release() {}
18807
18811
  }
18808
18812
  class WaitStep extends Step {
18809
18813
  constructor(type, props, duration, easing) {
@@ -19021,7 +19025,9 @@ class Animate {
19021
19025
  this.status !== AnimateStatus.END && this.onEnd(), this.status = AnimateStatus.END, this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
19022
19026
  }
19023
19027
  release() {
19024
- this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
19028
+ this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [], this.forEachStep(step => {
19029
+ step.release();
19030
+ });
19025
19031
  }
19026
19032
  getDuration() {
19027
19033
  return this._duration;
@@ -19095,6 +19101,10 @@ class Animate {
19095
19101
  getLoop() {
19096
19102
  return this._loopCount;
19097
19103
  }
19104
+ forEachStep(cb) {
19105
+ let step = this._firstStep;
19106
+ for (; step;) cb(step), step = step.next;
19107
+ }
19098
19108
  }
19099
19109
 
19100
19110
  const performanceRAF = new PerformanceRAF();
@@ -19327,6 +19337,9 @@ class AnimateExecutor {
19327
19337
  constructor(target) {
19328
19338
  this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
19329
19339
  }
19340
+ get started() {
19341
+ return this._started;
19342
+ }
19330
19343
  onStart(cb) {
19331
19344
  cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
19332
19345
  cb();
@@ -19467,14 +19480,14 @@ class AnimateExecutor {
19467
19480
  return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
19468
19481
  }
19469
19482
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
19470
- var _a, _b, _c, _d;
19483
+ var _a, _b, _c, _d, _e, _f;
19471
19484
  if (custom && customType) {
19472
19485
  const customParams = Object.assign({
19473
- width: graphic.stage.width,
19474
- height: graphic.stage.height,
19486
+ width: (null === (_a = graphic.stage) || void 0 === _a ? void 0 : _a.width) || 0,
19487
+ height: (null === (_b = graphic.stage) || void 0 === _b ? void 0 : _b.height) || 0,
19475
19488
  group: this._target.parent
19476
19489
  }, this.resolveValue(customParameters, graphic)),
19477
- objOptions = isFunction(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
19490
+ objOptions = isFunction(options) ? options.call(null, null !== (_d = customParams && (null === (_c = customParams.data) || void 0 === _c ? void 0 : _c[0])) && void 0 !== _d ? _d : null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, customParams) : options;
19478
19491
  customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
19479
19492
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
19480
19493
  }
@@ -19694,7 +19707,7 @@ class AnimationStateManager {
19694
19707
  reApplyState(state) {
19695
19708
  var _a;
19696
19709
  const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
19697
- if (stateInfo) {
19710
+ if (stateInfo && stateInfo.executor.started) {
19698
19711
  const stateList = this.stateList.slice();
19699
19712
  stateInfo.executor.stop(), this.stateList = stateList, stateInfo.executor.execute(stateInfo.animationConfig);
19700
19713
  }
@@ -22730,14 +22743,19 @@ class LabelBase extends AnimateComponent {
22730
22743
  let result = labels.filter(label => label.attribute.visible &&
22731
22744
  label.attribute.opacity !== 0 &&
22732
22745
  this.isMarkInsideRect(this.getRelatedGraphic(label.attribute), bmpTool));
22733
- const { clampForce = true, hideOnHit = true, overlapPadding, strategy } = option;
22734
- if (clampForce) {
22746
+ const { clampForce = true, hideOnHit = true, hideOnOverflow = false, overlapPadding, strategy } = option;
22747
+ if (clampForce || hideOnOverflow) {
22735
22748
  for (let i = 0; i < result.length; i++) {
22736
22749
  const text = labels[i];
22737
22750
  const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
22738
22751
  if (dx !== 0 || dy !== 0) {
22739
- text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
22740
- text._isClamped = true;
22752
+ if (hideOnOverflow) {
22753
+ text.setAttributes({ visible: false });
22754
+ }
22755
+ else {
22756
+ text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
22757
+ text._isClamped = true;
22758
+ }
22741
22759
  }
22742
22760
  }
22743
22761
  }
@@ -22756,9 +22774,13 @@ class LabelBase extends AnimateComponent {
22756
22774
  bitmap.setRange(range);
22757
22775
  }
22758
22776
  else {
22759
- if (clampForce) {
22760
- const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap, overlapPadding);
22761
- if (placedAfterClampForce) {
22777
+ if (hideOnOverflow) {
22778
+ if (this._processHideOnOverflow(text, bmpTool)) {
22779
+ continue;
22780
+ }
22781
+ }
22782
+ else if (clampForce) {
22783
+ if (this._processClampForce(text, bmpTool, bitmap, overlapPadding)) {
22762
22784
  continue;
22763
22785
  }
22764
22786
  }
@@ -22772,6 +22794,16 @@ class LabelBase extends AnimateComponent {
22772
22794
  }
22773
22795
  return result;
22774
22796
  }
22797
+ _processHideOnOverflow(text, bmpTool) {
22798
+ const { dy: dy = 0, dx: dx = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
22799
+ if (0 !== dx || 0 !== dy) {
22800
+ text.setAttributes({
22801
+ visible: false
22802
+ });
22803
+ return false;
22804
+ }
22805
+ return true;
22806
+ }
22775
22807
  _processClampForce(text, bmpTool, bitmap, overlapPadding = 0) {
22776
22808
  const { dy = 0, dx = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
22777
22809
  if (dx === 0 && dy === 0) {
@@ -22794,7 +22826,7 @@ class LabelBase extends AnimateComponent {
22794
22826
  }
22795
22827
  _overlapByStrategy(labels, option, bmpTool, bitmap) {
22796
22828
  var _a;
22797
- const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding } = option;
22829
+ const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding, hideOnOverflow = false } = option;
22798
22830
  const result = [];
22799
22831
  const checkBounds = strategy.some(s => s.type === 'bound');
22800
22832
  if (avoidBaseMark) {
@@ -22846,15 +22878,23 @@ class LabelBase extends AnimateComponent {
22846
22878
  : this.getGraphicBounds(baseMark, labels[i].attribute), this.labeling);
22847
22879
  if (hasPlace !== false) {
22848
22880
  text.setAttributes({ x: hasPlace.x, y: hasPlace.y });
22849
- result.push(text);
22850
- break;
22881
+ if (!(hideOnOverflow && !this._processHideOnOverflow(text, bmpTool))) {
22882
+ result.push(text);
22883
+ break;
22884
+ }
22851
22885
  }
22852
22886
  }
22853
- if (!hasPlace && clampForce) {
22854
- const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap, overlapPadding);
22855
- if (placedAfterClampForce) {
22856
- result.push(text);
22857
- continue;
22887
+ if (!hasPlace) {
22888
+ if (hideOnOverflow) {
22889
+ if (!this._processHideOnOverflow(text, bmpTool)) {
22890
+ continue;
22891
+ }
22892
+ }
22893
+ if (clampForce) {
22894
+ if (this._processClampForce(text, bmpTool, bitmap, overlapPadding)) {
22895
+ result.push(text);
22896
+ continue;
22897
+ }
22858
22898
  }
22859
22899
  }
22860
22900
  !hasPlace && !hideOnHit && result.push(text);
@@ -33127,6 +33167,6 @@ StoryLabelItem.defaultAttributes = {
33127
33167
  theme: 'default'
33128
33168
  };
33129
33169
 
33130
- const version = "1.0.10";
33170
+ const version = "1.0.12";
33131
33171
 
33132
33172
  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/axis/line.js CHANGED
@@ -332,5 +332,4 @@ export class LineAxis extends AxisBase {
332
332
  }
333
333
  }
334
334
 
335
- LineAxis.defaultAttributes = DEFAULT_AXIS_THEME, mixin(LineAxis, LineAxisMixin);
336
- //# sourceMappingURL=line.js.map
335
+ LineAxis.defaultAttributes = DEFAULT_AXIS_THEME, mixin(LineAxis, LineAxisMixin);
@@ -24,4 +24,5 @@ export const DEFAULT_BRUSH_ATTRIBUTES = {
24
24
  }
25
25
  };
26
26
 
27
- export const DEFAULT_SIZE_THRESHOLD = 5;
27
+ export const DEFAULT_SIZE_THRESHOLD = 5;
28
+ //# sourceMappingURL=config.js.map
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "1.0.10";
1
+ export declare const version = "1.0.12";
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 = "1.0.10";
1
+ export const version = "1.0.12";
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,QAAQ,CAAC;AAEhC,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 = \"1.0.10\";\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,QAAQ,CAAC;AAEhC,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 = \"1.0.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"]}
@@ -50,6 +50,7 @@ export declare class LabelBase<T extends BaseLabelAttrs> extends AnimateComponen
50
50
  protected _layout(texts: (IText | IRichText)[]): (IText | IRichText)[];
51
51
  protected _overlapping(labels: (IText | IRichText)[]): (IRichText | IText)[];
52
52
  protected _overlapGlobal(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
53
+ protected _processHideOnOverflow(text: IText, bmpTool: BitmapTool): boolean;
53
54
  protected _processClampForce(text: IText, bmpTool: BitmapTool, bitmap: Bitmap, overlapPadding?: number): boolean;
54
55
  protected _overlapByStrategy(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
55
56
  protected isMarkInsideRect(baseMark: IGraphic, bmpTool: BitmapTool): boolean;
package/es/label/base.js CHANGED
@@ -217,13 +217,15 @@ export class LabelBase extends AnimateComponent {
217
217
  }
218
218
  _overlapGlobal(labels, option, bmpTool, bitmap) {
219
219
  let result = labels.filter((label => label.attribute.visible && 0 !== label.attribute.opacity && this.isMarkInsideRect(this.getRelatedGraphic(label.attribute), bmpTool)));
220
- const {clampForce: clampForce = !0, hideOnHit: hideOnHit = !0, overlapPadding: overlapPadding, strategy: strategy} = option;
221
- if (clampForce) for (let i = 0; i < result.length; i++) {
220
+ const {clampForce: clampForce = !0, hideOnHit: hideOnHit = !0, hideOnOverflow: hideOnOverflow = !1, overlapPadding: overlapPadding, strategy: strategy} = option;
221
+ if (clampForce || hideOnOverflow) for (let i = 0; i < result.length; i++) {
222
222
  const text = labels[i], {dx: dx = 0, dy: dy = 0} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
223
- 0 === dx && 0 === dy || (text.setAttributes({
223
+ 0 === dx && 0 === dy || (hideOnOverflow ? text.setAttributes({
224
+ visible: !1
225
+ }) : (text.setAttributes({
224
226
  x: text.attribute.x + dx,
225
227
  y: text.attribute.y + dy
226
- }), text._isClamped = !0);
228
+ }), text._isClamped = !0));
227
229
  }
228
230
  result = shiftY(result, Object.assign(Object.assign({
229
231
  maxY: bmpTool.height
@@ -236,9 +238,9 @@ export class LabelBase extends AnimateComponent {
236
238
  for (let i = 0; i < result.length; i++) {
237
239
  const text = result[i], bounds = text.AABBBounds, range = boundToRange(bmpTool, bounds, !0);
238
240
  if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) bitmap.setRange(range); else {
239
- if (clampForce) {
240
- if (this._processClampForce(text, bmpTool, bitmap, overlapPadding)) continue;
241
- }
241
+ if (hideOnOverflow) {
242
+ if (this._processHideOnOverflow(text, bmpTool)) continue;
243
+ } else if (clampForce && this._processClampForce(text, bmpTool, bitmap, overlapPadding)) continue;
242
244
  hideOnHit ? text.setAttributes({
243
245
  visible: !1
244
246
  }) : bitmap.setRange(range);
@@ -246,6 +248,12 @@ export class LabelBase extends AnimateComponent {
246
248
  }
247
249
  return result;
248
250
  }
251
+ _processHideOnOverflow(text, bmpTool) {
252
+ const {dy: dy = 0, dx: dx = 0} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
253
+ return 0 === dx && 0 === dy || (text.setAttributes({
254
+ visible: !1
255
+ }), !1);
256
+ }
249
257
  _processClampForce(text, bmpTool, bitmap, overlapPadding = 0) {
250
258
  const {dy: dy = 0, dx: dx = 0} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
251
259
  if (0 === dx && 0 === dy) {
@@ -264,7 +272,7 @@ export class LabelBase extends AnimateComponent {
264
272
  }
265
273
  _overlapByStrategy(labels, option, bmpTool, bitmap) {
266
274
  var _a;
267
- const {avoidBaseMark: avoidBaseMark, strategy: strategy = [], hideOnHit: hideOnHit = !0, clampForce: clampForce = !0, avoidMarks: avoidMarks = [], overlapPadding: overlapPadding} = option, result = [], checkBounds = strategy.some((s => "bound" === s.type));
275
+ const {avoidBaseMark: avoidBaseMark, strategy: strategy = [], hideOnHit: hideOnHit = !0, clampForce: clampForce = !0, avoidMarks: avoidMarks = [], overlapPadding: overlapPadding, hideOnOverflow: hideOnOverflow = !1} = option, result = [], checkBounds = strategy.some((s => "bound" === s.type));
268
276
  avoidBaseMark && (null === (_a = this._baseMarks) || void 0 === _a || _a.forEach((mark => {
269
277
  mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, !0));
270
278
  }))), avoidMarks.length > 0 && avoidMarks.forEach((avoid => {
@@ -288,15 +296,16 @@ export class LabelBase extends AnimateComponent {
288
296
  }
289
297
  let hasPlace = !1;
290
298
  for (let j = 0; j < strategy.length; j++) if (hasPlace = place(bmpTool, bitmap, strategy[j], this.attribute, text, this._isCollectionBase ? this.getGraphicBounds(null, this._idToPoint.get(labels[i].attribute.id)) : this.getGraphicBounds(baseMark, labels[i].attribute), this.labeling),
291
- !1 !== hasPlace) {
292
- text.setAttributes({
293
- x: hasPlace.x,
294
- y: hasPlace.y
295
- }), result.push(text);
299
+ !1 !== hasPlace && (text.setAttributes({
300
+ x: hasPlace.x,
301
+ y: hasPlace.y
302
+ }), !hideOnOverflow || this._processHideOnOverflow(text, bmpTool))) {
303
+ result.push(text);
296
304
  break;
297
305
  }
298
- if (!hasPlace && clampForce) {
299
- if (this._processClampForce(text, bmpTool, bitmap, overlapPadding)) {
306
+ if (!hasPlace) {
307
+ if (hideOnOverflow && !this._processHideOnOverflow(text, bmpTool)) continue;
308
+ if (clampForce && this._processClampForce(text, bmpTool, bitmap, overlapPadding)) {
300
309
  result.push(text);
301
310
  continue;
302
311
  }