@visactor/vrender-components 0.15.0-alpha.22 → 0.15.0-alpha.24

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/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.15.0-alpha.22";
1
+ export declare const version = "0.15.0-alpha.24";
2
2
  export * from './core/base';
3
3
  export * from './scrollbar';
4
4
  export * from './tag';
package/cjs/index.js CHANGED
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
17
17
 
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
- }), exports.version = void 0, exports.version = "0.15.0-alpha.22", __exportStar(require("./core/base"), exports),
20
+ }), exports.version = void 0, exports.version = "0.15.0-alpha.24", __exportStar(require("./core/base"), exports),
21
21
  __exportStar(require("./scrollbar"), exports), __exportStar(require("./tag"), exports),
22
22
  __exportStar(require("./poptip"), exports), __exportStar(require("./crosshair"), exports),
23
23
  __exportStar(require("./label"), exports), __exportStar(require("./axis"), exports),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.15.0-alpha.22\";\n\nexport * from './core/base';\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 './interface';\nexport * from './jsx';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.15.0-alpha.24\";\n\nexport * from './core/base';\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 './interface';\nexport * from './jsx';\n"]}
@@ -35,8 +35,8 @@ class MarkArea extends base_1.Marker {
35
35
  const {label: label} = this.attribute, labelPosition = null !== (_a = null == label ? void 0 : label.position) && void 0 !== _a ? _a : "middle", labelPoint = this._getPositionByDirection(this._area, labelPosition);
36
36
  if (this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), {
37
37
  textStyle: Object.assign(Object.assign({}, config_1.DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
38
- })), this.attribute.clipRange && (null == label ? void 0 : label.confineInClipRange)) {
39
- const {x: x, y: y, width: width, height: height} = this.attribute.clipRange;
38
+ })), this.attribute.limitRect && (null == label ? void 0 : label.confine)) {
39
+ const {x: x, y: y, width: width, height: height} = this.attribute.limitRect;
40
40
  (0, limit_shape_1.limitShapeInBounds)(this._label, {
41
41
  x1: x,
42
42
  y1: y,
@@ -61,8 +61,10 @@ class MarkArea extends base_1.Marker {
61
61
  const {points: points, label: label, areaStyle: areaStyle} = this.attribute;
62
62
  null === (_a = this._area) || void 0 === _a || _a.setAttributes(Object.assign({
63
63
  points: points
64
- }, areaStyle)), null === (_b = this._label) || void 0 === _b || _b.setAttributes(Object.assign({}, label)),
65
- this.setLabelPos();
64
+ }, areaStyle)), null === (_b = this._label) || void 0 === _b || _b.setAttributes(Object.assign({
65
+ dx: 0,
66
+ dy: 0
67
+ }, label)), this.setLabelPos();
66
68
  }
67
69
  }
68
70
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/area.ts"],"names":[],"mappings":";;;AACA,+CAAkD;AAClD,6CAAyC;AACzC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAqF;AAErF,qDAAyD;AAEzD,MAAa,QAAS,SAAQ,aAAqB;IAIjD,YAAY,UAAyB;QACnC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3D,CAAC;IAEO,uBAAuB,CAAC,IAAc,EAAE,SAAiB;QAC/D,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAEjD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAC5D,OAAO;gB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,CAAC,KAAK,0CAAE,aAAa,iBACvB,MAAM,EAAE,MAAM,IACX,SAAS,EACZ,CAAC;QACH,MAAA,IAAI,CAAC,MAAM,0CAAE,aAAa,mBACrB,KAAK,EACR,CAAC;QACH,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;;AAhGH,4BAiGC;AAhGQ,0BAAiB,GAAG,gCAAuB,CAAC","file":"area.js","sourcesContent":["import type { IGroup, INode, IPolygon } from '@visactor/vrender';\nimport { createPolygon } from '@visactor/vrender';\nimport { merge } from '@visactor/vutils';\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_AREA_TEXT_STYLE_MAP, DEFAULT_MARK_AREA_THEME } from './config';\nimport type { MarkAreaAttrs } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\n\nexport class MarkArea extends Marker<MarkAreaAttrs> {\n static defaultAttributes = DEFAULT_MARK_AREA_THEME;\n private _area!: IPolygon;\n\n constructor(attributes: MarkAreaAttrs) {\n super(merge({}, MarkArea.defaultAttributes, attributes));\n }\n\n private _getPositionByDirection(area: IPolygon, direction: string) {\n const { x1, x2, y1, y2 } = this._area.AABBBounds;\n\n if (direction.includes('left') || direction.includes('Left')) {\n return {\n x: x1,\n y: (y1 + y2) / 2\n };\n }\n if (direction.includes('right') || direction.includes('Right')) {\n return {\n x: x2,\n y: (y1 + y2) / 2\n };\n }\n if (direction.includes('top') || direction.includes('Top')) {\n return {\n x: (x1 + x2) / 2,\n y: y1\n };\n }\n if (direction.includes('bottom') || direction.includes('Bottom')) {\n return {\n x: (x1 + x2) / 2,\n y: y2\n };\n }\n\n return {\n x: (x1 + x2) / 2,\n y: (y1 + y2) / 2\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label } = this.attribute as MarkAreaAttrs;\n const labelPosition = label?.position ?? 'middle';\n const labelPoint = this._getPositionByDirection(this._area, labelPosition);\n this._label.setAttributes({\n ...labelPoint,\n textStyle: {\n ...DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition],\n ...label.textStyle\n }\n });\n\n if (this.attribute.clipRange && label?.confineInClipRange) {\n const { x, y, width, height } = this.attribute.clipRange;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n }\n\n protected initMarker(container: IGroup) {\n const { points, label, areaStyle } = this.attribute as MarkAreaAttrs;\n const area = createPolygon({\n points: points,\n ...areaStyle\n });\n area.name = 'mark-area-area';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...label\n });\n markLabel.name = 'mark-area-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { points, label, areaStyle } = this.attribute as MarkAreaAttrs;\n this._area?.setAttributes({\n points: points,\n ...areaStyle\n });\n this._label?.setAttributes({\n ...label\n });\n this.setLabelPos();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/marker/area.ts"],"names":[],"mappings":";;;AACA,+CAAkD;AAClD,6CAAyC;AACzC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAqF;AAErF,qDAAyD;AAEzD,MAAa,QAAS,SAAQ,aAAqB;IAIjD,YAAY,UAAyB;QACnC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3D,CAAC;IAEO,uBAAuB,CAAC,IAAc,EAAE,SAAiB;QAC/D,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAEjD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAC5D,OAAO;gBACL,CAAC,EAAE,EAAE;gBACL,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC;aACjB,CAAC;SACH;QACD,I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AAE,aAAa,iBACxB,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,IACF,KAAK,EACR,CAAC;QACH,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;;AAlGH,4BAmGC;AAlGQ,0BAAiB,GAAG,gCAAuB,CAAC","file":"area.js","sourcesContent":["import type { IGroup, INode, IPolygon } from '@visactor/vrender';\nimport { createPolygon } from '@visactor/vrender';\nimport { merge } from '@visactor/vutils';\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_AREA_TEXT_STYLE_MAP, DEFAULT_MARK_AREA_THEME } from './config';\nimport type { MarkAreaAttrs } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\n\nexport class MarkArea extends Marker<MarkAreaAttrs> {\n static defaultAttributes = DEFAULT_MARK_AREA_THEME;\n private _area!: IPolygon;\n\n constructor(attributes: MarkAreaAttrs) {\n super(merge({}, MarkArea.defaultAttributes, attributes));\n }\n\n private _getPositionByDirection(area: IPolygon, direction: string) {\n const { x1, x2, y1, y2 } = this._area.AABBBounds;\n\n if (direction.includes('left') || direction.includes('Left')) {\n return {\n x: x1,\n y: (y1 + y2) / 2\n };\n }\n if (direction.includes('right') || direction.includes('Right')) {\n return {\n x: x2,\n y: (y1 + y2) / 2\n };\n }\n if (direction.includes('top') || direction.includes('Top')) {\n return {\n x: (x1 + x2) / 2,\n y: y1\n };\n }\n if (direction.includes('bottom') || direction.includes('Bottom')) {\n return {\n x: (x1 + x2) / 2,\n y: y2\n };\n }\n\n return {\n x: (x1 + x2) / 2,\n y: (y1 + y2) / 2\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label } = this.attribute as MarkAreaAttrs;\n const labelPosition = label?.position ?? 'middle';\n const labelPoint = this._getPositionByDirection(this._area, labelPosition);\n this._label.setAttributes({\n ...labelPoint,\n textStyle: {\n ...DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition],\n ...label.textStyle\n }\n });\n\n if (this.attribute.limitRect && label?.confine) {\n const { x, y, width, height } = this.attribute.limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n }\n\n protected initMarker(container: IGroup) {\n const { points, label, areaStyle } = this.attribute as MarkAreaAttrs;\n const area = createPolygon({\n points: points,\n ...areaStyle\n });\n area.name = 'mark-area-area';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...label\n });\n markLabel.name = 'mark-area-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { points, label, areaStyle } = this.attribute as MarkAreaAttrs;\n this._area?.setAttributes({\n points: points,\n ...areaStyle\n });\n this._label?.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...label\n });\n this.setLabelPos();\n }\n}\n"]}
@@ -4,38 +4,45 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.Marker = void 0;
6
6
 
7
- const vrender_1 = require("@visactor/vrender"), vutils_1 = require("@visactor/vutils"), base_1 = require("../core/base");
7
+ const vrender_1 = require("@visactor/vrender"), base_1 = require("../core/base");
8
8
 
9
9
  class Marker extends base_1.AbstractComponent {
10
10
  constructor() {
11
11
  super(...arguments), this.name = "marker";
12
12
  }
13
13
  _initContainer() {
14
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
15
- const groupClip = (0, vrender_1.createGroup)(Object.assign(Object.assign({}, null === (_a = this.attribute) || void 0 === _a ? void 0 : _a.clipRange), {
16
- clip: null !== (_c = (0, vutils_1.isValid)(null === (_b = this.attribute) || void 0 === _b ? void 0 : _b.clipRange)) && void 0 !== _c && _c
17
- }));
18
- groupClip.name = "marker-container";
19
- const group = (0, vrender_1.createGroup)({
20
- x: -(null !== (_f = null === (_e = null === (_d = this.attribute) || void 0 === _d ? void 0 : _d.clipRange) || void 0 === _e ? void 0 : _e.x) && void 0 !== _f ? _f : 0),
21
- y: -(null !== (_j = null === (_h = null === (_g = this.attribute) || void 0 === _g ? void 0 : _g.clipRange) || void 0 === _h ? void 0 : _h.y) && void 0 !== _j ? _j : 0)
22
- });
23
- groupClip.add(group), this._containerClip = groupClip, this.add(groupClip), this._container = group;
14
+ var _a, _b;
15
+ const {limitRect: limitRect, clipInRange: clipInRange} = this.attribute;
16
+ let group;
17
+ if (clipInRange) {
18
+ const groupClip = (0, vrender_1.createGroup)(Object.assign(Object.assign({}, limitRect), {
19
+ clip: !0,
20
+ pickable: !1
21
+ }));
22
+ group = (0, vrender_1.createGroup)({
23
+ x: -(null !== (_a = null == limitRect ? void 0 : limitRect.x) && void 0 !== _a ? _a : 0),
24
+ y: -(null !== (_b = null == limitRect ? void 0 : limitRect.y) && void 0 !== _b ? _b : 0)
25
+ }), groupClip.add(group), this._containerClip = groupClip, this.add(groupClip);
26
+ } else group = (0, vrender_1.createGroup)({
27
+ x: 0,
28
+ y: 0
29
+ }), this.add(group);
30
+ group.name = "marker-container", this._container = group;
24
31
  }
25
32
  _updateContainer() {
26
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
27
- this._containerClip.setAttributes(Object.assign(Object.assign({}, null === (_a = this.attribute) || void 0 === _a ? void 0 : _a.clipRange), {
28
- clip: null !== (_c = (0, vutils_1.isValid)(null === (_b = this.attribute) || void 0 === _b ? void 0 : _b.clipRange)) && void 0 !== _c && _c
29
- })), this._container.setAttributes({
30
- x: -(null !== (_f = null === (_e = null === (_d = this.attribute) || void 0 === _d ? void 0 : _d.clipRange) || void 0 === _e ? void 0 : _e.x) && void 0 !== _f ? _f : 0),
31
- y: -(null !== (_j = null === (_h = null === (_g = this.attribute) || void 0 === _g ? void 0 : _g.clipRange) || void 0 === _h ? void 0 : _h.y) && void 0 !== _j ? _j : 0)
33
+ var _a, _b, _c;
34
+ const {limitRect: limitRect, clipInRange: clipInRange} = this.attribute;
35
+ null === (_a = this._containerClip) || void 0 === _a || _a.setAttributes(Object.assign({}, limitRect)),
36
+ this._container.setAttributes({
37
+ x: clipInRange ? -(null !== (_b = null == limitRect ? void 0 : limitRect.x) && void 0 !== _b ? _b : 0) : 0,
38
+ y: clipInRange ? -(null !== (_c = null == limitRect ? void 0 : limitRect.y) && void 0 !== _c ? _c : 0) : 0
32
39
  });
33
40
  }
34
41
  render() {
35
42
  var _a, _b;
36
43
  const markerVisible = null === (_a = this.attribute.visible) || void 0 === _a || _a;
37
44
  null !== (_b = this.attribute.interactive) && void 0 !== _b && _b || (this.setAttribute("pickable", !1),
38
- this.setAttribute("childrenPickable", !1)), markerVisible && (this._containerClip ? (this._updateContainer(),
45
+ this.setAttribute("childrenPickable", !1)), markerVisible && (this._container ? (this._updateContainer(),
39
46
  this.updateMarker()) : (this._initContainer(), this.initMarker(this._container)));
40
47
  }
41
48
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/base.ts"],"names":[],"mappings":";;;AACA,+CAAgD;AAChD,6CAA2C;AAC3C,uCAAiD;AAIjD,MAAsB,MAA8B,SAAQ,wBAA8B;IAA1F;;QACE,SAAI,GAAG,QAAQ,CAAC;IAwDlB,CAAC;IA9CS,cAAc;;QACpB,MAAM,SAAS,GAAG,IAAA,qBAAW,kCACxB,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,KAC5B,IAAI,EAAE,MAAA,IAAA,gBAAO,EAAC,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,mCAAI,KAAK,IACjD,CAAC;QACH,SAAS,CAAC,IAAI,GAAG,kBAAkB,CAAC;QACpC,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC;YACxB,CAAC,EAAE,CAAC,CAAC,MAAA,MAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,0CAAE,CAAC,mCAAI,CAAC,CAAC;YACvC,CAAC,EAAE,CAAC,CAAC,MAAA,MAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,0CAAE,CAAC,mCAAI,CAAC,CAAC;SACxC,CAAC,CAAC;QACH,SAAS,CAAC,GAAG,CAAC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I,CAAC,YAAY,EAAE,CAAC;aACrB;SACF;IACH,CAAC;CACF;AAzDD,wBAyDC","file":"base.js","sourcesContent":["import type { IGroup } from '@visactor/vrender';\nimport { createGroup } from '@visactor/vrender';\nimport { isValid } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { Tag } from '../tag';\nimport type { MarkerAttrs } from './type';\n\nexport abstract class Marker<T extends MarkerAttrs> extends AbstractComponent<Required<T>> {\n name = 'marker';\n private _containerClip!: IGroup;\n private _container!: IGroup;\n\n protected _label!: Tag;\n\n protected abstract setLabelPos(): any;\n protected abstract initMarker(container: IGroup): any;\n protected abstract updateMarker(): any;\n\n private _initContainer() {\n const groupClip = createGroup({\n ...this.attribute?.clipRange,\n clip: isValid(this.attribute?.clipRange) ?? false\n });\n groupClip.name = 'marker-container';\n const group = createGroup({\n x: -(this.attribute?.clipRange?.x ?? 0),\n y: -(this.attribute?.clipRange?.y ?? 0)\n });\n groupClip.add(group);\n this._containerClip = groupClip;\n this.add(groupClip);\n this._container = group;\n }\n\n private _updateContainer() {\n this._containerClip.setAttributes({\n ...this.attribute?.clipRange,\n clip: isValid(this.attribute?.clipRange) ?? false\n });\n this._container.setAttributes({\n x: -(this.attribute?.clipRange?.x ?? 0),\n y: -(this.attribute?.clipRange?.y ?? 0)\n });\n }\n\n protected render() {\n const markerVisible = this.attribute.visible ?? true;\n const markerInteractive = this.attribute.interactive ?? false;\n\n if (!markerInteractive) {\n this.setAttribute('pickable', false);\n this.setAttribute('childrenPickable', false);\n }\n\n if (markerVisible) {\n if (!this._containerClip) {\n this._initContainer();\n this.initMarker(this._container);\n } else {\n this._updateContainer();\n this.updateMarker();\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/marker/base.ts"],"names":[],"mappings":";;;AACA,+CAAgD;AAEhD,uCAAiD;AAIjD,MAAsB,MAA8B,SAAQ,wBAA8B;IAA1F;;QACE,SAAI,GAAG,QAAQ,CAAC;IAoElB,CAAC;IA1DS,cAAc;;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;YACzC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,CAAC,mCAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1C,CAAC,CAAC;IACL,CAAC;IAES,MAAM;;QACd,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,OAAO,mCAAI,IAAI,CAAC;QACrD,MAAM,iBAAiB,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,WAAW,mCAAI,KAAK,CAAC;QAE9D,IAAI,CAAC,iBAAiB,EAAE;YACtB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACrC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;SAC9C;QAED,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,IAAI,CAAC,cAAc,EAAE,CAAC;gBACtB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aAClC;iBAAM;gBACL,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACxB,IAAI,CAAC,YAAY,EAAE,CAAC;aACrB;SACF;IACH,CAAC;CACF;AArED,wBAqEC","file":"base.js","sourcesContent":["import type { IGroup } from '@visactor/vrender';\nimport { createGroup } from '@visactor/vrender';\nimport { isValid } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { Tag } from '../tag';\nimport type { MarkerAttrs } from './type';\n\nexport abstract class Marker<T extends MarkerAttrs> extends AbstractComponent<Required<T>> {\n name = 'marker';\n private _containerClip!: IGroup;\n private _container!: IGroup;\n\n protected _label!: Tag;\n\n protected abstract setLabelPos(): any;\n protected abstract initMarker(container: IGroup): any;\n protected abstract updateMarker(): any;\n\n private _initContainer() {\n const { limitRect, clipInRange } = this.attribute;\n let group;\n if (clipInRange) {\n // 如果用户配置了剪切\n const groupClip = createGroup({\n ...limitRect,\n clip: true,\n pickable: false\n });\n group = createGroup({\n x: -(limitRect?.x ?? 0),\n y: -(limitRect?.y ?? 0)\n });\n groupClip.add(group);\n this._containerClip = groupClip;\n this.add(groupClip);\n } else {\n group = createGroup({\n x: 0,\n y: 0\n });\n this.add(group);\n }\n group.name = 'marker-container';\n this._container = group;\n }\n\n private _updateContainer() {\n const { limitRect, clipInRange } = this.attribute;\n this._containerClip?.setAttributes({\n ...limitRect\n });\n this._container.setAttributes({\n x: clipInRange ? -(limitRect?.x ?? 0) : 0,\n y: clipInRange ? -(limitRect?.y ?? 0) : 0\n });\n }\n\n protected render() {\n const markerVisible = this.attribute.visible ?? true;\n const markerInteractive = this.attribute.interactive ?? false;\n\n if (!markerInteractive) {\n this.setAttribute('pickable', false);\n this.setAttribute('childrenPickable', false);\n }\n\n if (markerVisible) {\n if (!this._container) {\n this._initContainer();\n this.initMarker(this._container);\n } else {\n this._updateContainer();\n this.updateMarker();\n }\n }\n }\n}\n"]}
@@ -12,7 +12,7 @@ class MarkLine extends base_1.Marker {
12
12
  }
13
13
  setLabelPos() {
14
14
  var _a, _b;
15
- const {label: label = {}, clipRange: clipRange} = this.attribute, {position: position = "end", refX: refX = 0, refY: refY = 0, confineInClipRange: confineInClipRange} = label, points = this._line.getMainSegmentPoints(), labelAngle = null !== (_a = this._line.getEndAngle()) && void 0 !== _a ? _a : 0, labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2), labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);
15
+ const {label: label = {}, limitRect: limitRect} = this.attribute, {position: position = "end", refX: refX = 0, refY: refY = 0, confine: confine} = label, points = this._line.getMainSegmentPoints(), labelAngle = null !== (_a = this._line.getEndAngle()) && void 0 !== _a ? _a : 0, labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2), labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);
16
16
  let labelPoint;
17
17
  if (labelPoint = position.includes("start") || position.includes("Start") ? {
18
18
  x: points[0].x + labelOffsetX,
@@ -26,8 +26,8 @@ class MarkLine extends base_1.Marker {
26
26
  }, this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), {
27
27
  angle: label.autoRotate ? labelAngle + (null !== (_b = null == label ? void 0 : label.refAngle) && void 0 !== _b ? _b : 0) : 0,
28
28
  textStyle: Object.assign(Object.assign({}, config_1.DEFAULT_MARK_LINE_TEXT_STYLE_MAP[position]), label.textStyle)
29
- })), clipRange && confineInClipRange) {
30
- const {x: x, y: y, width: width, height: height} = clipRange;
29
+ })), limitRect && confine) {
30
+ const {x: x, y: y, width: width, height: height} = limitRect;
31
31
  (0, limit_shape_1.limitShapeInBounds)(this._label, {
32
32
  x1: x,
33
33
  y1: y,
@@ -58,8 +58,10 @@ class MarkLine extends base_1.Marker {
58
58
  startSymbol: startSymbol,
59
59
  endSymbol: endSymbol,
60
60
  lineStyle: lineStyle
61
- }), null === (_b = this._label) || void 0 === _b || _b.setAttributes(Object.assign({}, label)),
62
- this.setLabelPos();
61
+ }), null === (_b = this._label) || void 0 === _b || _b.setAttributes(Object.assign({
62
+ dx: 0,
63
+ dy: 0
64
+ }, label)), this.setLabelPos();
63
65
  }
64
66
  }
65
67
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/line.ts"],"names":[],"mappings":";;;AACA,6CAAsE;AACtE,wCAAqC;AACrC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAqF;AAErF,qDAAyD;AAGzD,MAAa,QAAS,SAAQ,aAAqB;IAKjD,YAAY,UAAyB;QACnC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3D,CAAC;IAES,WAAW;;QACnB,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,SAA0B,CAAC;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,SAAS;YACT,gBAAgB;YAChB,YAAY;SACb,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,SAAS,CAAC,GAAG,CAAC,IAAwB,CAAC,CAAC;QAExC,MAAM,SAAS,GAAG,IAAI,SAAG,mBACpB,KAAK,EACR,CAAC;QACH,SAAS,CAAC,IAAI,GAAG,iBAAiB,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,SAAS,CAAC,GAAG,CAAC,SAA6B,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,YAAY;;QACpB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,SAA0B,CAAC;QAC7F,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,CAAC;YACxB,MAAM;YACN,WAAW;YACX,SAAS;YACT,SAAS;SACV,CAAC,CAAC;QAEH,MAAA,IAAI,CAAC,MAAM,0CAAE,aAAa,mBACrB,KAAK,EACR,CAAC;QAEH,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;;AA1FH,4BA2FC;AA1FQ,0BAAiB,GAA2B,gCAAuB,CAAC","file":"line.js","sourcesContent":["import type { IGroup, INode } from '@visactor/vrender';\nimport { flattenArray, isValidNumber, merge } from '@visactor/vutils';\nimport { Segment } from '../segment';\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_LINE_THEME, DEFAULT_MARK_LINE_TEXT_STYLE_MAP } from './config';\nimport type { MarkLineAttrs } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { Point } from '../core/type';\n\nexport class MarkLine extends Marker<MarkLineAttrs> {\n static defaultAttributes: Partial<MarkLineAttrs> = DEFAULT_MARK_LINE_THEME;\n\n private _line!: Segment;\n\n constructor(attributes: MarkLineAttrs) {\n super(merge({}, MarkLine.defaultAttributes, attributes));\n }\n\n protected setLabelPos() {\n const { label = {}, clipRange } = this.attribute as MarkLineAttrs;\n const { position = 'end', refX = 0, refY = 0, confineInClipRange } = label;\n const points = this._line.getMainSegmentPoints();\n const labelAngle = this._line.getEndAngle() ?? 0;\n const labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2);\n const labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);\n let labelPoint: Point;\n if (position.includes('start') || position.includes('Start')) {\n labelPoint = {\n x: points[0].x + labelOffsetX,\n y: points[0].y + labelOffsetY\n };\n } else if (position.includes('middle') || position.includes('Middle')) {\n labelPoint = {\n x: (points[0].x + points[points.length - 1].x) / 2 + labelOffsetX,\n y: (points[0].y + points[points.length - 1].y) / 2 + labelOffsetY\n };\n } else {\n labelPoint = {\n x: points[points.length - 1].x + labelOffsetX,\n y: points[points.length - 1].y + labelOffsetY\n };\n }\n this._label.setAttributes({\n ...labelPoint,\n angle: label.autoRotate ? labelAngle + (label?.refAngle ?? 0) : 0,\n textStyle: {\n ...DEFAULT_MARK_LINE_TEXT_STYLE_MAP[position],\n ...label.textStyle\n }\n });\n if (clipRange && confineInClipRange) {\n const { x, y, width, height } = clipRange;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n\n protected initMarker(container: IGroup) {\n const { points, startSymbol, endSymbol, label, lineStyle, mainSegmentIndex, multiSegment } = this\n .attribute as MarkLineAttrs;\n const line = new Segment({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n mainSegmentIndex,\n multiSegment\n });\n line.name = 'mark-line-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const markLabel = new Tag({\n ...label\n });\n markLabel.name = 'mark-line-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { points, startSymbol, endSymbol, label, lineStyle } = this.attribute as MarkLineAttrs;\n this._line?.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle\n });\n\n this._label?.setAttributes({\n ...label\n });\n\n this.setLabelPos();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/marker/line.ts"],"names":[],"mappings":";;;AACA,6CAAsE;AACtE,wCAAqC;AACrC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAqF;AAErF,qDAAyD;AAGzD,MAAa,QAAS,SAAQ,aAAqB;IAKjD,YAAY,UAAyB;QACnC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3D,CAAC;IAES,WAAW;;QACnB,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,SAA0B,CAAC;QAClE,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;QAChE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,mCAAI,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAC7F,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAC7F,IAAI,UAAiB,CAAC;QACtB,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IA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,aAAa,iBACxB,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,IACF,KAAK,EACR,CAAC;QAEH,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;;AA5FH,4BA6FC;AA5FQ,0BAAiB,GAA2B,gCAAuB,CAAC","file":"line.js","sourcesContent":["import type { IGroup, INode } from '@visactor/vrender';\nimport { flattenArray, isValidNumber, merge } from '@visactor/vutils';\nimport { Segment } from '../segment';\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_LINE_THEME, DEFAULT_MARK_LINE_TEXT_STYLE_MAP } from './config';\nimport type { MarkLineAttrs } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { Point } from '../core/type';\n\nexport class MarkLine extends Marker<MarkLineAttrs> {\n static defaultAttributes: Partial<MarkLineAttrs> = DEFAULT_MARK_LINE_THEME;\n\n private _line!: Segment;\n\n constructor(attributes: MarkLineAttrs) {\n super(merge({}, MarkLine.defaultAttributes, attributes));\n }\n\n protected setLabelPos() {\n const { label = {}, limitRect } = this.attribute as MarkLineAttrs;\n const { position = 'end', refX = 0, refY = 0, confine } = label;\n const points = this._line.getMainSegmentPoints();\n const labelAngle = this._line.getEndAngle() ?? 0;\n const labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2);\n const labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);\n let labelPoint: Point;\n if (position.includes('start') || position.includes('Start')) {\n labelPoint = {\n x: points[0].x + labelOffsetX,\n y: points[0].y + labelOffsetY\n };\n } else if (position.includes('middle') || position.includes('Middle')) {\n labelPoint = {\n x: (points[0].x + points[points.length - 1].x) / 2 + labelOffsetX,\n y: (points[0].y + points[points.length - 1].y) / 2 + labelOffsetY\n };\n } else {\n labelPoint = {\n x: points[points.length - 1].x + labelOffsetX,\n y: points[points.length - 1].y + labelOffsetY\n };\n }\n this._label.setAttributes({\n ...labelPoint,\n angle: label.autoRotate ? labelAngle + (label?.refAngle ?? 0) : 0,\n textStyle: {\n ...DEFAULT_MARK_LINE_TEXT_STYLE_MAP[position],\n ...label.textStyle\n }\n });\n if (limitRect && confine) {\n const { x, y, width, height } = limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n\n protected initMarker(container: IGroup) {\n const { points, startSymbol, endSymbol, label, lineStyle, mainSegmentIndex, multiSegment } = this\n .attribute as MarkLineAttrs;\n const line = new Segment({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n mainSegmentIndex,\n multiSegment\n });\n line.name = 'mark-line-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const markLabel = new Tag({\n ...label\n });\n markLabel.name = 'mark-line-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { points, startSymbol, endSymbol, label, lineStyle } = this.attribute as MarkLineAttrs;\n this._line?.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle\n });\n\n this._label?.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...label\n });\n\n this.setLabelPos();\n }\n}\n"]}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.MarkPoint = void 0;
6
6
 
7
- const vrender_1 = require("@visactor/vrender"), vutils_1 = require("@visactor/vutils"), segment_1 = require("../segment"), tag_1 = require("../tag"), base_1 = require("./base"), config_1 = require("./config"), type_1 = require("./type"), limit_shape_1 = require("../util/limit-shape");
7
+ const vrender_1 = require("@visactor/vrender"), vutils_1 = require("@visactor/vutils"), segment_1 = require("../segment"), tag_1 = require("../tag"), base_1 = require("./base"), config_1 = require("./config"), type_1 = require("./type");
8
8
 
9
9
  class MarkPoint extends base_1.Marker {
10
10
  constructor(attributes) {
@@ -12,10 +12,10 @@ class MarkPoint extends base_1.Marker {
12
12
  }
13
13
  setLabelPos() {}
14
14
  setItemAttributes(item, itemContent, itemPosition, itemType) {
15
- var _a, _b;
15
+ var _a;
16
16
  if (!item) return;
17
17
  const {autoRotate: autoRotate = !0, refX: refX = 0, refY: refY = 0, refAngle: refAngle = 0, textStyle: textStyle, richTextStyle: richTextStyle, imageStyle: imageStyle, position: position = type_1.IMarkPointItemPosition.middle} = itemContent, itemAngle = (null === (_a = this._line) || void 0 === _a ? void 0 : _a.getEndAngle()) || 0, itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2), itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);
18
- if ("text" === itemType ? item.setAttributes(Object.assign(Object.assign({}, textStyle), {
18
+ "text" === itemType ? item.setAttributes(Object.assign(Object.assign({}, textStyle), {
19
19
  textStyle: Object.assign(Object.assign({}, config_1.DEFAULT_MARK_POINT_TEXT_STYLE_MAP[(null == itemContent ? void 0 : itemContent.position) || "end"]), null == textStyle ? void 0 : textStyle.textStyle)
20
20
  })) : "richText" === itemType ? item.setAttributes({
21
21
  dx: this.getItemDx(item, position, richTextStyle) + ((null == richTextStyle ? void 0 : richTextStyle.dx) || 0),
@@ -27,15 +27,7 @@ class MarkPoint extends base_1.Marker {
27
27
  x: itemPosition.x + (itemOffsetX || 0),
28
28
  y: itemPosition.y + (itemOffsetY || 0),
29
29
  angle: autoRotate && itemAngle + refAngle
30
- }), this.attribute.clipRange && (null === (_b = this.attribute.itemContent) || void 0 === _b ? void 0 : _b.confineInClipRange)) {
31
- const {x: x, y: y, width: width, height: height} = this.attribute.clipRange;
32
- (0, limit_shape_1.limitShapeInBounds)(item, {
33
- x1: x,
34
- y1: y,
35
- x2: x + width,
36
- y2: y + height
37
- });
38
- }
30
+ });
39
31
  }
40
32
  getItemDx(item, position, style) {
41
33
  var _a, _b;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/point.ts"],"names":[],"mappings":";;;AAYA,+CAA0F;AAG1F,6CAAyC;AACzC,wCAAqC;AACrC,gCAA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EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;QACtC,MAAM,YAAY,GAAG;YACnB,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,KAAI,CAAC,CAAC;YAC3C,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,KAAI,CAAC,CAAC;SAC5C,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,CAAC;QAC1E,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,cAAc,0CAAE,OAAO,CAAC,CAAC;QACtF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;;AAlQH,8BAmQC;AAlQQ,2BAAiB,GAAG,iCAAwB,CAAC","file":"point.js","sourcesContent":["import type {\n IGroup,\n IImage,\n INode,\n ISymbol,\n IImageGraphicAttribute,\n IRichText,\n IRichTextGraphicAttribute,\n ILine,\n ILineGraphicAttribute\n} from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { createRichText, createSymbol, createImage, createLine } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { merge } from '@visactor/vutils';\nimport { Segment } from '../segment';\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_POINT_TEXT_STYLE_MAP, DEFAULT_MARK_POINT_THEME } from './config';\nimport type { IItemContent, IItemLine, MarkPointAttrs } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkPointItemPosition } from './type';\nimport type { Point } from '../core/type';\nimport { limitShapeInBounds } from '../util/limit-shape';\n\nexport class MarkPoint extends Marker<MarkPointAttrs> {\n static defaultAttributes = DEFAULT_MARK_POINT_THEME;\n\n private _item!: ISymbol | Tag | IImage | IRichText;\n\n private _line?: Segment;\n\n private _decorativeLine!: ILine;\n\n constructor(attributes: MarkPointAttrs) {\n super(merge({}, MarkPoint.defaultAttributes, attributes));\n }\n\n protected setLabelPos() {\n //do nothing\n }\n\n protected setItemAttributes(\n item: ISymbol | Tag | IImage | IRichText,\n itemContent: IItemContent,\n itemPosition: Point,\n itemType: 'symbol' | 'text' | 'image' | 'richText' | 'custom'\n ) {\n if (!item) {\n return;\n }\n const {\n autoRotate = true,\n refX = 0,\n refY = 0,\n refAngle = 0,\n textStyle,\n richTextStyle,\n imageStyle,\n position = IMarkPointItemPosition.middle\n } = itemContent;\n const itemAngle = this._line?.getEndAngle() || 0;\n const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);\n const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);\n if (itemType === 'text') {\n item.setAttributes({\n ...textStyle,\n textStyle: {\n ...DEFAULT_MARK_POINT_TEXT_STYLE_MAP[itemContent?.position || 'end'],\n ...textStyle?.textStyle\n }\n });\n } else if (itemType === 'richText') {\n item.setAttributes({\n dx: this.getItemDx(item, position, richTextStyle) + (richTextStyle?.dx || 0),\n dy: this.getItemDy(item, position, richTextStyle) + (richTextStyle?.dy || 0)\n });\n } else if (itemType === 'image') {\n item.setAttributes({\n dx: this.getItemDx(item, position, imageStyle) + (imageStyle?.dx || 0),\n dy: this.getItemDy(item, position, imageStyle) + (imageStyle?.dy || 0)\n });\n }\n item.setAttributes({\n x: itemPosition.x + (itemOffsetX || 0),\n y: itemPosition.y + (itemOffsetY || 0),\n angle: autoRotate && itemAngle + refAngle\n });\n\n if (this.attribute.clipRange && this.attribute.itemContent?.confineInClipRange) {\n const { x, y, width, height } = this.attribute.clipRange;\n limitShapeInBounds(item, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n\n protected getItemDx(\n item: ISymbol | Tag | IImage | IRichText,\n position: IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const width = (item as IGroup)?.AABBBounds?.width() ?? (style?.width || 0);\n if (position.includes('inside')) {\n return -width;\n }\n if (position === 'insideTop') {\n return 0;\n }\n return 0;\n }\n\n protected getItemDy(\n item: ISymbol | Tag | IImage | IRichText,\n position: IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const height = (item as IGroup)?.AABBBounds?.height() ?? (style?.height || 0);\n if (position.includes('top') || position.includes('Top')) {\n return -height;\n }\n if (position.includes('middle') || position.includes('Middle')) {\n return -height / 2;\n }\n return 0;\n }\n\n protected initItem(itemContent: IItemContent, itemPosition: Point) {\n const { type = 'text', symbolStyle, richTextStyle, imageStyle, renderCustomCallback } = itemContent;\n let item: ISymbol | Tag | IImage | IRichText | IGroup;\n if (type === 'symbol') {\n item = createSymbol({\n ...itemPosition,\n ...symbolStyle\n });\n } else if (type === 'text') {\n item = new Tag({\n ...itemPosition\n });\n } else if (type === 'richText') {\n item = createRichText({\n ...itemPosition,\n ...richTextStyle\n });\n } else if (type === 'image') {\n item = createImage({\n ...itemPosition,\n ...imageStyle\n });\n } else if (type === 'custom' && renderCustomCallback) {\n item = renderCustomCallback();\n }\n this.setItemAttributes(item, itemContent, itemPosition, type);\n return item;\n }\n\n protected getItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point) {\n let points: Point[] = [];\n const { type = 'type-s' } = itemLine;\n if (type === 'type-do') {\n points = [\n position,\n {\n x: (position.x + itemPosition.x) / 2,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else if (type === 'type-po') {\n points = [\n position,\n {\n x: itemPosition.x,\n y: position.y\n },\n itemPosition\n ];\n } else if (type === 'type-op') {\n points = [\n position,\n {\n x: position.x,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else {\n points = [position, itemPosition];\n }\n return points;\n }\n\n protected setItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point, visible: boolean) {\n const { startSymbol, endSymbol, lineStyle } = itemLine;\n const points = this.getItemLineAttr(itemLine, position, itemPosition);\n this._line?.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n visible\n });\n }\n\n protected getDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point) {\n const decorativeLength = itemLine?.decorativeLine?.length || 10;\n const itemAngle = this._line.getEndAngle() || 0;\n const startPointOffsetX = (decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const startPointOffsetY = (decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n const endPointOffsetX = (-decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const endPointOffsetY = (-decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n return {\n startPointOffsetX,\n startPointOffsetY,\n endPointOffsetX,\n endPointOffsetY\n };\n }\n\n protected setDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point, visible: boolean) {\n const { lineStyle } = itemLine;\n const { startPointOffsetX, startPointOffsetY, endPointOffsetX, endPointOffsetY } = this.getDecorativeLineAttr(\n itemLine,\n itemPosition\n );\n this._decorativeLine?.setAttributes({\n points: [\n {\n x: itemPosition.x + startPointOffsetX,\n y: itemPosition.y + startPointOffsetY\n },\n {\n x: itemPosition.x + endPointOffsetX,\n y: itemPosition.y + endPointOffsetY\n }\n ] as IPointLike[],\n ...(lineStyle as Partial<ILineGraphicAttribute>),\n visible\n });\n }\n\n protected initMarker(container: IGroup) {\n const { position, itemLine, itemContent } = this.attribute as MarkPointAttrs;\n const itemPosition = {\n x: position.x + (itemContent?.offsetX || 0),\n y: position.y + (itemContent?.offsetY || 0)\n };\n\n const line = new Segment({\n points: []\n });\n line.name = 'mark-point-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const decorativeLine = createLine({\n points: []\n });\n decorativeLine.name = 'mark-point-decorativeLine';\n this._decorativeLine = decorativeLine;\n container.add(decorativeLine as unknown as INode);\n\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine?.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine?.decorativeLine?.visible);\n\n const item = this.initItem(itemContent as any, itemPosition);\n this._item = item;\n container.add(item as unknown as INode);\n }\n\n protected updateMarker() {\n const { position, itemLine, itemContent } = this.attribute as MarkPointAttrs;\n const { type = 'text' } = itemContent;\n const itemPosition = {\n x: position.x + (itemContent?.offsetX || 0),\n y: position.y + (itemContent?.offsetY || 0)\n };\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine?.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine?.decorativeLine?.visible);\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/marker/point.ts"],"names":[],"mappings":";;;AAYA,+CAA0F;AAG1F,6CAAyC;AACzC,wCAAqC;AACrC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAuF;AAGvF,iCAAgD;AAGhD,MAAa,SAAU,SAAQ,aAAsB;IASnD,YAAY,UAA0B;QACpC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5D,CAAC;IAES,WAAW;IAErB,CAAC;IAES,iBAAiB,CACzB,IAAwC,EACxC,WAAyB,EACzB,YAAmB,EACnB,QAA6D;;QAE7D,IAAI,CAAC,IAAI,EAAE;YACT,OAAO;SACR;QACD,MAAM,EACJ,UAAU,GAAG,IAAI,EACjB,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,CAAC,EACR,QAAQ,GAAG,CAAC,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,QAAQ,GAAG,6BAAsB,CAAC,MAAM,EACzC,GAAG,WAAW,CAAC;QAChB,MAAM,SAAS,G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AE,YAAY,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,SAAS,CAAC,GAAG,CAAC,IAAwB,CAAC,CAAC;IAC1C,CAAC;IAES,YAAY;;QACpB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,SAA2B,CAAC;QAC7E,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;QACtC,MAAM,YAAY,GAAG;YACnB,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,KAAI,CAAC,CAAC;YAC3C,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,KAAI,CAAC,CAAC;SAC5C,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,CAAC;QAC1E,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,cAAc,0CAAE,OAAO,CAAC,CAAC;QACtF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;;AAlQH,8BAmQC;AAlQQ,2BAAiB,GAAG,iCAAwB,CAAC","file":"point.js","sourcesContent":["import type {\n IGroup,\n IImage,\n INode,\n ISymbol,\n IImageGraphicAttribute,\n IRichText,\n IRichTextGraphicAttribute,\n ILine,\n ILineGraphicAttribute\n} from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { createRichText, createSymbol, createImage, createLine } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { merge } from '@visactor/vutils';\nimport { Segment } from '../segment';\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_POINT_TEXT_STYLE_MAP, DEFAULT_MARK_POINT_THEME } from './config';\nimport type { IItemContent, IItemLine, MarkPointAttrs } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkPointItemPosition } from './type';\nimport type { Point } from '../core/type';\n\nexport class MarkPoint extends Marker<MarkPointAttrs> {\n static defaultAttributes = DEFAULT_MARK_POINT_THEME;\n\n private _item!: ISymbol | Tag | IImage | IRichText;\n\n private _line?: Segment;\n\n private _decorativeLine!: ILine;\n\n constructor(attributes: MarkPointAttrs) {\n super(merge({}, MarkPoint.defaultAttributes, attributes));\n }\n\n protected setLabelPos() {\n //do nothing\n }\n\n protected setItemAttributes(\n item: ISymbol | Tag | IImage | IRichText,\n itemContent: IItemContent,\n itemPosition: Point,\n itemType: 'symbol' | 'text' | 'image' | 'richText' | 'custom'\n ) {\n if (!item) {\n return;\n }\n const {\n autoRotate = true,\n refX = 0,\n refY = 0,\n refAngle = 0,\n textStyle,\n richTextStyle,\n imageStyle,\n position = IMarkPointItemPosition.middle\n } = itemContent;\n const itemAngle = this._line?.getEndAngle() || 0;\n const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);\n const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);\n if (itemType === 'text') {\n item.setAttributes({\n ...textStyle,\n textStyle: {\n ...DEFAULT_MARK_POINT_TEXT_STYLE_MAP[itemContent?.position || 'end'],\n ...textStyle?.textStyle\n }\n });\n } else if (itemType === 'richText') {\n item.setAttributes({\n dx: this.getItemDx(item, position, richTextStyle) + (richTextStyle?.dx || 0),\n dy: this.getItemDy(item, position, richTextStyle) + (richTextStyle?.dy || 0)\n });\n } else if (itemType === 'image') {\n item.setAttributes({\n dx: this.getItemDx(item, position, imageStyle) + (imageStyle?.dx || 0),\n dy: this.getItemDy(item, position, imageStyle) + (imageStyle?.dy || 0)\n });\n }\n item.setAttributes({\n x: itemPosition.x + (itemOffsetX || 0),\n y: itemPosition.y + (itemOffsetY || 0),\n angle: autoRotate && itemAngle + refAngle\n });\n\n // if (this.attribute.limitRect && this.attribute.itemContent?.confine) {\n // const { x, y, width, height } = this.attribute.limitRect;\n // limitShapeInBounds(item, {\n // x1: x,\n // y1: y,\n // x2: x + width,\n // y2: y + height\n // });\n // }\n }\n\n protected getItemDx(\n item: ISymbol | Tag | IImage | IRichText,\n position: IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const width = (item as IGroup)?.AABBBounds?.width() ?? (style?.width || 0);\n if (position.includes('inside')) {\n return -width;\n }\n if (position === 'insideTop') {\n return 0;\n }\n return 0;\n }\n\n protected getItemDy(\n item: ISymbol | Tag | IImage | IRichText,\n position: IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const height = (item as IGroup)?.AABBBounds?.height() ?? (style?.height || 0);\n if (position.includes('top') || position.includes('Top')) {\n return -height;\n }\n if (position.includes('middle') || position.includes('Middle')) {\n return -height / 2;\n }\n return 0;\n }\n\n protected initItem(itemContent: IItemContent, itemPosition: Point) {\n const { type = 'text', symbolStyle, richTextStyle, imageStyle, renderCustomCallback } = itemContent;\n let item: ISymbol | Tag | IImage | IRichText | IGroup;\n if (type === 'symbol') {\n item = createSymbol({\n ...itemPosition,\n ...symbolStyle\n });\n } else if (type === 'text') {\n item = new Tag({\n ...itemPosition\n });\n } else if (type === 'richText') {\n item = createRichText({\n ...itemPosition,\n ...richTextStyle\n });\n } else if (type === 'image') {\n item = createImage({\n ...itemPosition,\n ...imageStyle\n });\n } else if (type === 'custom' && renderCustomCallback) {\n item = renderCustomCallback();\n }\n this.setItemAttributes(item, itemContent, itemPosition, type);\n return item;\n }\n\n protected getItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point) {\n let points: Point[] = [];\n const { type = 'type-s' } = itemLine;\n if (type === 'type-do') {\n points = [\n position,\n {\n x: (position.x + itemPosition.x) / 2,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else if (type === 'type-po') {\n points = [\n position,\n {\n x: itemPosition.x,\n y: position.y\n },\n itemPosition\n ];\n } else if (type === 'type-op') {\n points = [\n position,\n {\n x: position.x,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else {\n points = [position, itemPosition];\n }\n return points;\n }\n\n protected setItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point, visible: boolean) {\n const { startSymbol, endSymbol, lineStyle } = itemLine;\n const points = this.getItemLineAttr(itemLine, position, itemPosition);\n this._line?.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n visible\n });\n }\n\n protected getDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point) {\n const decorativeLength = itemLine?.decorativeLine?.length || 10;\n const itemAngle = this._line.getEndAngle() || 0;\n const startPointOffsetX = (decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const startPointOffsetY = (decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n const endPointOffsetX = (-decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const endPointOffsetY = (-decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n return {\n startPointOffsetX,\n startPointOffsetY,\n endPointOffsetX,\n endPointOffsetY\n };\n }\n\n protected setDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point, visible: boolean) {\n const { lineStyle } = itemLine;\n const { startPointOffsetX, startPointOffsetY, endPointOffsetX, endPointOffsetY } = this.getDecorativeLineAttr(\n itemLine,\n itemPosition\n );\n this._decorativeLine?.setAttributes({\n points: [\n {\n x: itemPosition.x + startPointOffsetX,\n y: itemPosition.y + startPointOffsetY\n },\n {\n x: itemPosition.x + endPointOffsetX,\n y: itemPosition.y + endPointOffsetY\n }\n ] as IPointLike[],\n ...(lineStyle as Partial<ILineGraphicAttribute>),\n visible\n });\n }\n\n protected initMarker(container: IGroup) {\n const { position, itemLine, itemContent } = this.attribute as MarkPointAttrs;\n const itemPosition = {\n x: position.x + (itemContent?.offsetX || 0),\n y: position.y + (itemContent?.offsetY || 0)\n };\n\n const line = new Segment({\n points: []\n });\n line.name = 'mark-point-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const decorativeLine = createLine({\n points: []\n });\n decorativeLine.name = 'mark-point-decorativeLine';\n this._decorativeLine = decorativeLine;\n container.add(decorativeLine as unknown as INode);\n\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine?.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine?.decorativeLine?.visible);\n\n const item = this.initItem(itemContent as any, itemPosition);\n this._item = item;\n container.add(item as unknown as INode);\n }\n\n protected updateMarker() {\n const { position, itemLine, itemContent } = this.attribute as MarkPointAttrs;\n const { type = 'text' } = itemContent;\n const itemPosition = {\n x: position.x + (itemContent?.offsetX || 0),\n y: position.y + (itemContent?.offsetY || 0)\n };\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine?.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine?.decorativeLine?.visible);\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n }\n}\n"]}
@@ -50,7 +50,8 @@ export interface MarkerAttrs extends IGroupGraphicAttribute {
50
50
  type?: 'line' | 'area' | 'point';
51
51
  interactive?: boolean;
52
52
  visible?: boolean;
53
- clipRange?: {
53
+ clipInRange?: boolean;
54
+ limitRect?: {
54
55
  x: number;
55
56
  y: number;
56
57
  width: number;
@@ -62,7 +63,7 @@ export interface MarkLineAttrs extends MarkerAttrs, SegmentAttributes {
62
63
  points: Point[] | Point[][];
63
64
  label?: {
64
65
  position?: keyof typeof IMarkLineLabelPosition;
65
- confineInClipRange?: boolean;
66
+ confine?: boolean;
66
67
  } & IMarkRef & IMarkLabel;
67
68
  }
68
69
  export interface MarkAreaAttrs extends MarkerAttrs {
@@ -70,7 +71,7 @@ export interface MarkAreaAttrs extends MarkerAttrs {
70
71
  points: Point[];
71
72
  label?: {
72
73
  position?: IMarkAreaLabelPosition;
73
- confineInClipRange?: boolean;
74
+ confine?: boolean;
74
75
  } & IMarkLabel;
75
76
  areaStyle?: IPolygonAttribute;
76
77
  }
@@ -84,7 +85,6 @@ export interface IItemContent extends IMarkRef {
84
85
  textStyle?: IMarkLabel;
85
86
  richTextStyle?: IRichTextGraphicAttribute;
86
87
  renderCustomCallback?: () => IGroup;
87
- confineInClipRange?: boolean;
88
88
  }
89
89
  export type IItemLine = {
90
90
  type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAYA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n IPolygonAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender';\nimport type { SegmentAttributes, SymbolAttributes } from '../segment';\nimport type { TagAttributes } from '../tag';\nimport type { Point } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport interface IMarkLabel extends Omit<TagAttributes, 'x' | 'y' | 'panel'> {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n}\n\nexport interface IMarkRef {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n}\n\nexport interface MarkerAttrs extends IGroupGraphicAttribute {\n type?: 'line' | 'area' | 'point';\n /**\n * 是否支持交互\n * @default false\n */\n interactive?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * clip 范围配置\n */\n clipRange?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n}\n\nexport interface MarkLineAttrs extends MarkerAttrs, SegmentAttributes {\n type?: 'line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof IMarkLineLabelPosition;\n /**\n * 当 mark 配置了 clip 之后,label 是否自动调整位置\n */\n confineInClipRange?: boolean;\n } & IMarkRef &\n IMarkLabel;\n}\n\nexport interface MarkAreaAttrs extends MarkerAttrs {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 clip 之后,label 是否自动调整位置\n */\n confineInClipRange?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n}\n\nexport interface IItemContent extends IMarkRef {\n /**\n * 标注类型\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 clip 之后,label 是否自动调整位置\n */\n confineInClipRange?: boolean;\n}\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport interface MarkPointAttrs extends Omit<MarkerAttrs, 'labelStyle'> {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n}\n"]}
1
+ {"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAYA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n IPolygonAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender';\nimport type { SegmentAttributes, SymbolAttributes } from '../segment';\nimport type { TagAttributes } from '../tag';\nimport type { Point } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport interface IMarkLabel extends Omit<TagAttributes, 'x' | 'y' | 'panel'> {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n}\n\nexport interface IMarkRef {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n}\n\nexport interface MarkerAttrs extends IGroupGraphicAttribute {\n type?: 'line' | 'area' | 'point';\n /**\n * 是否支持交互\n * @default false\n */\n interactive?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n}\n\nexport interface MarkLineAttrs extends MarkerAttrs, SegmentAttributes {\n type?: 'line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof IMarkLineLabelPosition;\n /**\n * 当 mark 配置了 clip 之后,label 是否自动调整位置\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n}\n\nexport interface MarkAreaAttrs extends MarkerAttrs {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 clip 之后,label 是否自动调整位置\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n}\n\nexport interface IItemContent extends IMarkRef {\n /**\n * 标注类型\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n // /**\n // * 当 mark 配置了 clip 之后,label 是否自动调整位置\n // */\n // confine?: boolean;\n}\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport interface MarkPointAttrs extends Omit<MarkerAttrs, 'labelStyle'> {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n}\n"]}
package/dist/index.js CHANGED
@@ -6089,24 +6089,36 @@
6089
6089
  this.name = 'marker';
6090
6090
  }
6091
6091
  _initContainer() {
6092
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
6093
- const groupClip = vrender.createGroup(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
6094
- groupClip.name = 'marker-container';
6095
- const group = vrender.createGroup({
6096
- x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
6097
- y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
6098
- });
6099
- groupClip.add(group);
6100
- this._containerClip = groupClip;
6101
- this.add(groupClip);
6092
+ var _a, _b;
6093
+ const { limitRect, clipInRange } = this.attribute;
6094
+ let group;
6095
+ if (clipInRange) {
6096
+ const groupClip = vrender.createGroup(Object.assign(Object.assign({}, limitRect), { clip: true, pickable: false }));
6097
+ group = vrender.createGroup({
6098
+ x: -((_a = limitRect === null || limitRect === void 0 ? void 0 : limitRect.x) !== null && _a !== void 0 ? _a : 0),
6099
+ y: -((_b = limitRect === null || limitRect === void 0 ? void 0 : limitRect.y) !== null && _b !== void 0 ? _b : 0)
6100
+ });
6101
+ groupClip.add(group);
6102
+ this._containerClip = groupClip;
6103
+ this.add(groupClip);
6104
+ }
6105
+ else {
6106
+ group = vrender.createGroup({
6107
+ x: 0,
6108
+ y: 0
6109
+ });
6110
+ this.add(group);
6111
+ }
6112
+ group.name = 'marker-container';
6102
6113
  this._container = group;
6103
6114
  }
6104
6115
  _updateContainer() {
6105
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
6106
- this._containerClip.setAttributes(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
6116
+ var _a, _b, _c;
6117
+ const { limitRect, clipInRange } = this.attribute;
6118
+ (_a = this._containerClip) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({}, limitRect));
6107
6119
  this._container.setAttributes({
6108
- x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
6109
- y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
6120
+ x: clipInRange ? -((_b = limitRect === null || limitRect === void 0 ? void 0 : limitRect.x) !== null && _b !== void 0 ? _b : 0) : 0,
6121
+ y: clipInRange ? -((_c = limitRect === null || limitRect === void 0 ? void 0 : limitRect.y) !== null && _c !== void 0 ? _c : 0) : 0
6110
6122
  });
6111
6123
  }
6112
6124
  render() {
@@ -6118,7 +6130,7 @@
6118
6130
  this.setAttribute('childrenPickable', false);
6119
6131
  }
6120
6132
  if (markerVisible) {
6121
- if (!this._containerClip) {
6133
+ if (!this._container) {
6122
6134
  this._initContainer();
6123
6135
  this.initMarker(this._container);
6124
6136
  }
@@ -6387,8 +6399,8 @@
6387
6399
  }
6388
6400
  setLabelPos() {
6389
6401
  var _a, _b;
6390
- const { label = {}, clipRange } = this.attribute;
6391
- const { position = 'end', refX = 0, refY = 0, confineInClipRange } = label;
6402
+ const { label = {}, limitRect } = this.attribute;
6403
+ const { position = 'end', refX = 0, refY = 0, confine } = label;
6392
6404
  const points = this._line.getMainSegmentPoints();
6393
6405
  const labelAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
6394
6406
  const labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2);
@@ -6413,8 +6425,8 @@
6413
6425
  };
6414
6426
  }
6415
6427
  this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { angle: label.autoRotate ? labelAngle + ((_b = label === null || label === void 0 ? void 0 : label.refAngle) !== null && _b !== void 0 ? _b : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_LINE_TEXT_STYLE_MAP[position]), label.textStyle) }));
6416
- if (clipRange && confineInClipRange) {
6417
- const { x, y, width, height } = clipRange;
6428
+ if (limitRect && confine) {
6429
+ const { x, y, width, height } = limitRect;
6418
6430
  limitShapeInBounds(this._label, {
6419
6431
  x1: x,
6420
6432
  y1: y,
@@ -6452,7 +6464,7 @@
6452
6464
  endSymbol,
6453
6465
  lineStyle
6454
6466
  });
6455
- (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, label));
6467
+ (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({ dx: 0, dy: 0 }, label));
6456
6468
  this.setLabelPos();
6457
6469
  }
6458
6470
  }
@@ -6500,8 +6512,8 @@
6500
6512
  const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'middle';
6501
6513
  const labelPoint = this._getPositionByDirection(this._area, labelPosition);
6502
6514
  this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle) }));
6503
- if (this.attribute.clipRange && (label === null || label === void 0 ? void 0 : label.confineInClipRange)) {
6504
- const { x, y, width, height } = this.attribute.clipRange;
6515
+ if (this.attribute.limitRect && (label === null || label === void 0 ? void 0 : label.confine)) {
6516
+ const { x, y, width, height } = this.attribute.limitRect;
6505
6517
  limitShapeInBounds(this._label, {
6506
6518
  x1: x,
6507
6519
  y1: y,
@@ -6527,7 +6539,7 @@
6527
6539
  var _a, _b;
6528
6540
  const { points, label, areaStyle } = this.attribute;
6529
6541
  (_a = this._area) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({ points: points }, areaStyle));
6530
- (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, label));
6542
+ (_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({ dx: 0, dy: 0 }, label));
6531
6543
  this.setLabelPos();
6532
6544
  }
6533
6545
  }
@@ -6540,7 +6552,7 @@
6540
6552
  setLabelPos() {
6541
6553
  }
6542
6554
  setItemAttributes(item, itemContent, itemPosition, itemType) {
6543
- var _a, _b;
6555
+ var _a;
6544
6556
  if (!item) {
6545
6557
  return;
6546
6558
  }
@@ -6568,15 +6580,6 @@
6568
6580
  y: itemPosition.y + (itemOffsetY || 0),
6569
6581
  angle: autoRotate && itemAngle + refAngle
6570
6582
  });
6571
- if (this.attribute.clipRange && ((_b = this.attribute.itemContent) === null || _b === void 0 ? void 0 : _b.confineInClipRange)) {
6572
- const { x, y, width, height } = this.attribute.clipRange;
6573
- limitShapeInBounds(item, {
6574
- x1: x,
6575
- y1: y,
6576
- x2: x + width,
6577
- y2: y + height
6578
- });
6579
- }
6580
6583
  }
6581
6584
  getItemDx(item, position, style) {
6582
6585
  var _a, _b;
@@ -10472,7 +10475,7 @@
10472
10475
  return new Tag(params ? params.attribute : {});
10473
10476
  }
10474
10477
 
10475
- const version = "0.15.0-alpha.22";
10478
+ const version = "0.15.0-alpha.24";
10476
10479
 
10477
10480
  exports.AbstractComponent = AbstractComponent;
10478
10481
  exports.ArcInfo = ArcInfo;