@visactor/vrender-components 0.19.0-alpha.0 → 0.19.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/brush/brush.js +2 -1
- package/cjs/brush/type.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/index.js +1 -2
- package/cjs/label/line.js +1 -1
- package/cjs/label/polygon.js +1 -1
- package/cjs/label/rect.js +1 -1
- package/cjs/label/register.js +1 -1
- package/cjs/label/symbol.js +1 -1
- package/cjs/label/type.js +1 -1
- package/cjs/legend/base.js +1 -1
- package/cjs/legend/constant.js +1 -1
- package/cjs/legend/index.js +1 -1
- package/cjs/legend/register.js +1 -1
- package/cjs/legend/type.js +2 -1
- package/cjs/legend/util.js +1 -1
- package/cjs/marker/animate/animate.d.ts +3 -3
- package/cjs/marker/animate/animate.js +3 -3
- package/cjs/marker/animate/animate.js.map +1 -1
- package/cjs/marker/arc-area.js +2 -2
- package/cjs/marker/arc-area.js.map +1 -1
- package/cjs/marker/arc-line.js +3 -3
- package/cjs/marker/arc-line.js.map +1 -1
- package/cjs/marker/area.js +2 -2
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/common-line.d.ts +3 -3
- package/cjs/marker/common-line.js.map +1 -1
- package/cjs/marker/line.js +3 -3
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.js +1 -1
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/register.js.map +1 -1
- package/cjs/marker/type.d.ts +6 -6
- package/cjs/marker/type.js.map +1 -1
- package/es/brush/brush.js +2 -1
- package/es/brush/type.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/index.js +1 -2
- package/es/label/line.js +1 -1
- package/es/label/polygon.js +1 -1
- package/es/label/rect.js +1 -1
- package/es/label/register.js +1 -1
- package/es/label/symbol.js +1 -1
- package/es/label/type.js +1 -1
- package/es/legend/base.js +1 -1
- package/es/legend/constant.js +1 -1
- package/es/legend/index.js +1 -1
- package/es/legend/register.js +1 -1
- package/es/legend/type.js +2 -1
- package/es/legend/util.js +1 -1
- package/es/marker/animate/animate.d.ts +3 -3
- package/es/marker/animate/animate.js +1 -1
- package/es/marker/animate/animate.js.map +1 -1
- package/es/marker/arc-area.js +2 -2
- package/es/marker/arc-area.js.map +1 -1
- package/es/marker/arc-line.js +4 -4
- package/es/marker/arc-line.js.map +1 -1
- package/es/marker/area.js +2 -2
- package/es/marker/area.js.map +1 -1
- package/es/marker/common-line.d.ts +3 -3
- package/es/marker/common-line.js.map +1 -1
- package/es/marker/line.js +4 -4
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.js +1 -1
- package/es/marker/point.js.map +1 -1
- package/es/marker/register.js.map +1 -1
- package/es/marker/type.d.ts +6 -6
- package/es/marker/type.js.map +1 -1
- package/package.json +5 -5
package/cjs/brush/brush.js
CHANGED
|
@@ -190,4 +190,5 @@ class Brush extends base_1.AbstractComponent {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
exports.Brush = Brush, Brush.defaultAttributes = config_1.DEFAULT_BRUSH_ATTRIBUTES;
|
|
193
|
+
exports.Brush = Brush, Brush.defaultAttributes = config_1.DEFAULT_BRUSH_ATTRIBUTES;
|
|
194
|
+
//# sourceMappingURL=brush.js.map
|
package/cjs/brush/type.js
CHANGED
|
@@ -8,5 +8,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing",
|
|
9
9
|
IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd",
|
|
10
10
|
IOperateType.brushClear = "brushClear";
|
|
11
|
-
}(IOperateType = exports.IOperateType || (exports.IOperateType = {}));
|
|
12
|
-
//# sourceMappingURL=type.js.map
|
|
11
|
+
}(IOperateType = exports.IOperateType || (exports.IOperateType = {}));
|
package/cjs/index.d.ts
CHANGED
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.19.0-alpha.
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.19.0-alpha.1", __exportStar(require("./core/base"), exports),
|
|
21
21
|
__exportStar(require("./core/type"), exports), __exportStar(require("./scrollbar"), exports),
|
|
22
22
|
__exportStar(require("./tag"), exports), __exportStar(require("./poptip"), exports),
|
|
23
23
|
__exportStar(require("./crosshair"), exports), __exportStar(require("./label"), exports),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,8CAA4B;AAC5B,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;AACtB,6CAA2B;AAC3B,yCAAuB","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.0-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,8CAA4B;AAC5B,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;AACtB,6CAA2B;AAC3B,yCAAuB","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.0-alpha.1\";\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 './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './util';\n"]}
|
package/cjs/label/index.js
CHANGED
|
@@ -21,5 +21,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
__exportStar(require("./rect"), exports), __exportStar(require("./line"), exports),
|
|
22
22
|
__exportStar(require("./base"), exports), __exportStar(require("./arc"), exports),
|
|
23
23
|
__exportStar(require("./area"), exports), __exportStar(require("./line-data"), exports),
|
|
24
|
-
__exportStar(require("./dataLabel"), exports);
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
24
|
+
__exportStar(require("./dataLabel"), exports);
|
package/cjs/label/line.js
CHANGED
package/cjs/label/polygon.js
CHANGED
package/cjs/label/rect.js
CHANGED
package/cjs/label/register.js
CHANGED
package/cjs/label/symbol.js
CHANGED
package/cjs/label/type.js
CHANGED
package/cjs/legend/base.js
CHANGED
package/cjs/legend/constant.js
CHANGED
|
@@ -21,4 +21,4 @@ function(LegendEvent) {
|
|
|
21
21
|
LEGEND_ELEMENT_NAME.itemLabel = "legendItemLabel", LEGEND_ELEMENT_NAME.itemValue = "legendItemValue",
|
|
22
22
|
LEGEND_ELEMENT_NAME.focus = "legendItemFocus";
|
|
23
23
|
}(LEGEND_ELEMENT_NAME = exports.LEGEND_ELEMENT_NAME || (exports.LEGEND_ELEMENT_NAME = {}));
|
|
24
|
-
//# sourceMappingURL=constant.js.map
|
|
24
|
+
//# sourceMappingURL=constant.js.map
|
package/cjs/legend/index.js
CHANGED
|
@@ -22,4 +22,4 @@ __exportStar(require("./color/color"), exports), __exportStar(require("./color/t
|
|
|
22
22
|
__exportStar(require("./size/size"), exports), __exportStar(require("./size/type"), exports),
|
|
23
23
|
__exportStar(require("./type"), exports), __exportStar(require("./constant"), exports),
|
|
24
24
|
__exportStar(require("./util"), exports);
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/legend/register.js
CHANGED
|
@@ -24,4 +24,4 @@ function loadSizeContinuousLegendComponent() {
|
|
|
24
24
|
|
|
25
25
|
exports.loadDiscreteLegendComponent = loadDiscreteLegendComponent, exports.loadColorContinuousLegendComponent = loadColorContinuousLegendComponent,
|
|
26
26
|
exports.loadSizeContinuousLegendComponent = loadSizeContinuousLegendComponent;
|
|
27
|
-
//# sourceMappingURL=register.js.map
|
|
27
|
+
//# sourceMappingURL=register.js.map
|
package/cjs/legend/type.js
CHANGED
package/cjs/legend/util.js
CHANGED
|
@@ -10,4 +10,4 @@ function getSizeHandlerPath(align = "bottom") {
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", {
|
|
11
11
|
value: !0
|
|
12
12
|
}), exports.getSizeHandlerPath = void 0, exports.getSizeHandlerPath = getSizeHandlerPath;
|
|
13
|
-
//# sourceMappingURL=util.js.map
|
|
13
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -2,12 +2,12 @@ import type { IRichText, ISymbol, IImage, IArc } from '@visactor/vrender-core';
|
|
|
2
2
|
import type { ILine, IPolygon } from '@visactor/vrender-core';
|
|
3
3
|
import type { ArcSegment, Segment } from '../../segment';
|
|
4
4
|
import type { Tag } from '../../tag';
|
|
5
|
-
import type { CommonMarkAreaAnimationType,
|
|
6
|
-
export declare function
|
|
5
|
+
import type { CommonMarkAreaAnimationType, MarkCommonLineAnimationType, MarkPointAnimationType, MarkerAnimationState, MarkerExitAnimation, MarkerUpdateAnimation } from '../type';
|
|
6
|
+
export declare function markCommonLineAnimate(line: Segment | ArcSegment, label: Tag, animationconfig: any, state: MarkerAnimationState): void;
|
|
7
7
|
export declare function markAreaAnimate(area: IPolygon, label: Tag, animationconfig: any, state: MarkerAnimationState): void;
|
|
8
8
|
export declare function markArcAreaAnimate(area: IArc, label: Tag, animationconfig: any, state: MarkerAnimationState): void;
|
|
9
9
|
export declare function markPointAnimate(lines: [Segment, ILine], item: Tag | IRichText | ISymbol | IImage, animationconfig: any, state: MarkerAnimationState): void;
|
|
10
|
-
export declare const DefaultUpdateMarkLineAnimation: MarkerUpdateAnimation<
|
|
10
|
+
export declare const DefaultUpdateMarkLineAnimation: MarkerUpdateAnimation<MarkCommonLineAnimationType>;
|
|
11
11
|
export declare const DefaultUpdateMarkAreaAnimation: MarkerUpdateAnimation<CommonMarkAreaAnimationType>;
|
|
12
12
|
export declare const DefaultUpdateMarkPointAnimation: MarkerUpdateAnimation<MarkPointAnimationType>;
|
|
13
13
|
export declare const DefaultExitMarkerAnimation: MarkerExitAnimation;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.DefaultExitMarkerAnimation = exports.DefaultUpdateMarkPointAnimation = exports.DefaultUpdateMarkAreaAnimation = exports.DefaultUpdateMarkLineAnimation = exports.markPointAnimate = exports.markArcAreaAnimate = exports.markAreaAnimate = exports.
|
|
5
|
+
}), exports.DefaultExitMarkerAnimation = exports.DefaultUpdateMarkPointAnimation = exports.DefaultUpdateMarkAreaAnimation = exports.DefaultUpdateMarkLineAnimation = exports.markPointAnimate = exports.markArcAreaAnimate = exports.markAreaAnimate = exports.markCommonLineAnimate = void 0;
|
|
6
6
|
|
|
7
7
|
const clip_in_1 = require("./clip-in"), fade_in_1 = require("./fade-in"), fade_out_1 = require("./fade-out"), call_in_1 = require("./call-in");
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function markCommonLineAnimate(line, label, animationconfig, state) {
|
|
10
10
|
const {enter: enter, update: update, exit: exit} = animationconfig;
|
|
11
11
|
if ("enter" === state) {
|
|
12
12
|
const {type: type, duration: duration, delay: delay, easing: easing} = enter;
|
|
@@ -66,7 +66,7 @@ function markPointAnimate(lines, item, animationconfig, state) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
exports.
|
|
69
|
+
exports.markCommonLineAnimate = markCommonLineAnimate, exports.markAreaAnimate = markAreaAnimate,
|
|
70
70
|
exports.markArcAreaAnimate = markArcAreaAnimate, exports.markPointAnimate = markPointAnimate,
|
|
71
71
|
exports.DefaultUpdateMarkLineAnimation = {
|
|
72
72
|
type: "clipIn",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/animate/animate.ts"],"names":[],"mappings":";;;AAaA,uCAA6C;AAC7C,uCAAqF;AACrF,yCAA0F;AAC1F,uCAAwC;AAExC,SAAgB,qBAAqB,CACnC,IAA0B,EAC1B,KAAU,EACV,eAAoB,EACpB,KAA2B;IAE3B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;IAChD,IAAI,KAAK,KAAK,OAAO,EAAE;QACrB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAChD,IAAI,IAAI,KAAK,QAAQ,EAAE;YACrB,IAAA,0BAAgB,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ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tE;KACF;SAAM,IAAI,KAAK,KAAK,MAAM,EAAE;QAC3B,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACzC,IAAA,uBAAY,EAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;KACvE;AACH,CAAC;AA1BD,4CA0BC;AAEY,QAAA,8BAA8B,GAAuD;IAChG,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,CAAC;CACF,CAAC;AAEI,QAAA,8BAA8B,GAAuD;IAChG,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,CAAC;CACF,CAAC;AAEI,QAAA,+BAA+B,GAAkD;IAC5F,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,CAAC;CACF,CAAC;AAEI,QAAA,0BAA0B,GAAwB;IAC7D,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,CAAC;CACT,CAAC","file":"animate.js","sourcesContent":["import type { IRichText, ISymbol, IImage, IArc } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { ILine, IPolygon } from '@visactor/vrender-core';\nimport type { ArcSegment, Segment } from '../../segment';\nimport type { Tag } from '../../tag';\nimport type {\n CommonMarkAreaAnimationType,\n
|
|
1
|
+
{"version":3,"sources":["../src/marker/animate/animate.ts"],"names":[],"mappings":";;;AAaA,uCAA6C;AAC7C,uCAAqF;AACrF,yCAA0F;AAC1F,uCAAwC;AAExC,SAAgB,qBAAqB,CACnC,IAA0B,EAC1B,KAAU,EACV,eAAoB,EACpB,KAA2B;IAE3B,MAAM,EAAE,KAAK,EAAE,M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B,IAAA,qBAAW,EAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;SACtE;aAAM,IAAI,IAAI,KAAK,QAAQ,EAAE;YAC5B,IAAA,qBAAW,EAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;SACtE;KACF;SAAM,IAAI,KAAK,KAAK,MAAM,EAAE;QAC3B,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACzC,IAAA,uBAAY,EAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;KACvE;AACH,CAAC;AA1BD,4CA0BC;AAEY,QAAA,8BAA8B,GAAuD;IAChG,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,CAAC;CACF,CAAC;AAEI,QAAA,8BAA8B,GAAuD;IAChG,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,CAAC;CACF,CAAC;AAEI,QAAA,+BAA+B,GAAkD;IAC5F,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,CAAC;CACF,CAAC;AAEI,QAAA,0BAA0B,GAAwB;IAC7D,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,CAAC;CACT,CAAC","file":"animate.js","sourcesContent":["import type { IRichText, ISymbol, IImage, IArc } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { ILine, IPolygon } from '@visactor/vrender-core';\nimport type { ArcSegment, Segment } from '../../segment';\nimport type { Tag } from '../../tag';\nimport type {\n CommonMarkAreaAnimationType,\n MarkCommonLineAnimationType,\n MarkPointAnimationType,\n MarkerAnimationState,\n MarkerExitAnimation,\n MarkerUpdateAnimation\n} from '../type';\nimport { commonLineClipIn } from './clip-in';\nimport { areaFadeIn, commonLineFadeIn, arcAreaFadeIn, pointFadeIn } from './fade-in';\nimport { areaFadeOut, commonLineFadeOut, arcAreaFadeOut, pointFadeOut } from './fade-out';\nimport { pointCallIn } from './call-in';\n\nexport function markCommonLineAnimate(\n line: Segment | ArcSegment,\n label: Tag,\n animationconfig: any,\n state: MarkerAnimationState\n) {\n const { enter, update, exit } = animationconfig;\n if (state === 'enter') {\n const { type, duration, delay, easing } = enter;\n if (type === 'clipIn') {\n commonLineClipIn(line, label, duration, delay, easing);\n } else if (type === 'fadeIn') {\n commonLineFadeIn(line, label, duration, delay, easing);\n }\n } else if (state === 'update') {\n const { type, duration, delay, easing } = update;\n if (type === 'clipIn') {\n commonLineClipIn(line, label, duration, delay, easing);\n } else if (type === 'fadeIn') {\n commonLineFadeIn(line, label, duration, delay, easing);\n }\n } else if (state === 'exit') {\n const { duration, delay, easing } = exit;\n commonLineFadeOut(line, label, duration, delay, easing);\n }\n}\n\nexport function markAreaAnimate(area: IPolygon, label: Tag, animationconfig: any, state: MarkerAnimationState) {\n const { enter, update, exit } = animationconfig;\n if (state === 'enter') {\n const { type, duration, delay, easing } = enter;\n if (type === 'fadeIn') {\n areaFadeIn(area, label, duration, delay, easing);\n }\n } else if (state === 'update') {\n const { type, duration, delay, easing } = update;\n if (type === 'fadeIn') {\n areaFadeIn(area, label, duration, delay, easing);\n }\n } else if (state === 'exit') {\n const { duration, delay, easing } = exit;\n areaFadeOut(area, label, duration, delay, easing);\n }\n}\n\nexport function markArcAreaAnimate(area: IArc, label: Tag, animationconfig: any, state: MarkerAnimationState) {\n const { enter, update, exit } = animationconfig;\n if (state === 'enter') {\n const { type, duration, delay, easing } = enter;\n if (type === 'fadeIn') {\n arcAreaFadeIn(area, label, duration, delay, easing);\n }\n } else if (state === 'update') {\n const { type, duration, delay, easing } = update;\n if (type === 'fadeIn') {\n arcAreaFadeIn(area, label, duration, delay, easing);\n }\n } else if (state === 'exit') {\n const { duration, delay, easing } = exit;\n arcAreaFadeOut(area, label, duration, delay, easing);\n }\n}\n\nexport function markPointAnimate(\n lines: [Segment, ILine],\n item: Tag | IRichText | ISymbol | IImage,\n animationconfig: any,\n state: MarkerAnimationState\n) {\n const [itemLine, decorativeLine] = lines;\n const { enter, update, exit } = animationconfig;\n if (state === 'enter') {\n const { type, duration, delay, easing } = enter;\n if (type === 'fadeIn') {\n pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing);\n } else if (type === 'callIn') {\n pointCallIn(itemLine, decorativeLine, item, duration, delay, easing);\n }\n } else if (state === 'update') {\n const { type, duration, delay, easing } = update;\n if (type === 'fadeIn') {\n pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing);\n } else if (type === 'callIn') {\n pointCallIn(itemLine, decorativeLine, item, duration, delay, easing);\n }\n } else if (state === 'exit') {\n const { duration, delay, easing } = exit;\n pointFadeOut(itemLine, decorativeLine, item, duration, delay, easing);\n }\n}\n\nexport const DefaultUpdateMarkLineAnimation: MarkerUpdateAnimation<MarkCommonLineAnimationType> = {\n type: 'clipIn',\n duration: 500,\n easing: 'linear',\n delay: 0\n} as any;\n\nexport const DefaultUpdateMarkAreaAnimation: MarkerUpdateAnimation<CommonMarkAreaAnimationType> = {\n type: 'fadeIn',\n duration: 500,\n easing: 'linear',\n delay: 0\n} as any;\n\nexport const DefaultUpdateMarkPointAnimation: MarkerUpdateAnimation<MarkPointAnimationType> = {\n type: 'callIn',\n duration: 500,\n easing: 'linear',\n delay: 0\n} as any;\n\nexport const DefaultExitMarkerAnimation: MarkerExitAnimation = {\n type: 'fadeOut',\n duration: 500,\n easing: 'linear',\n delay: 0\n};\n"]}
|
package/cjs/marker/arc-area.js
CHANGED
|
@@ -14,7 +14,7 @@ function registerMarkArcAreaAnimate() {
|
|
|
14
14
|
|
|
15
15
|
class MarkArcArea extends base_1.Marker {
|
|
16
16
|
markerAnimate(state) {
|
|
17
|
-
MarkArcArea._animate && MarkArcArea._animate(this._area, this._label, this._animationConfig, state);
|
|
17
|
+
MarkArcArea._animate && this._animationConfig && MarkArcArea._animate(this._area, this._label, this._animationConfig, state);
|
|
18
18
|
}
|
|
19
19
|
getArea() {
|
|
20
20
|
return this._area;
|
|
@@ -29,7 +29,7 @@ class MarkArcArea extends base_1.Marker {
|
|
|
29
29
|
}
|
|
30
30
|
getPointAttrByPosition(position) {
|
|
31
31
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
|
-
const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label,
|
|
32
|
+
const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, labelTextHeight = this._label.getTextShape().attribute.visible ? Math.abs((null !== (_b = null === (_a = this._label.getTextShape().AABBBounds) || void 0 === _a ? void 0 : _a.y2) && void 0 !== _b ? _b : 0) - (null !== (_d = null === (_c = this._label.getTextShape()) || void 0 === _c ? void 0 : _c.AABBBounds.y1) && void 0 !== _d ? _d : 0)) : 0, labelRectHeight = this._label.getBgRect().attribute.visible ? Math.abs((null !== (_f = null === (_e = this._label.getBgRect().AABBBounds) || void 0 === _e ? void 0 : _e.y2) && void 0 !== _f ? _f : 0) - (null !== (_h = null === (_g = this._label.getBgRect()) || void 0 === _g ? void 0 : _g.AABBBounds.y1) && void 0 !== _h ? _h : 0)) : 0, labelHeight = Math.max(labelRectHeight, labelTextHeight);
|
|
33
33
|
let radius, angle, orthogonalOffsetDirection;
|
|
34
34
|
switch (position) {
|
|
35
35
|
case type_1.IMarkCommonArcLabelPosition.center:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/arc-area.ts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M,CAAC,CAAC,EACX,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,WAAW;gBACX,WAAW;gBACX,UAAU;gBACV,QAAQ,IACL,SAAS,EACZ,CAAC;SACJ;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,aAAa,iBACvB,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,IACD,KAAuB,EAC3B,CAAC;SACJ;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AArLH,kCAsLC;AApLQ,6BAAiB,GAAG,oCAA2B,CAAC","file":"arc-area.js","sourcesContent":["import type { IArc, IGroup, INode } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_ARC_AREA_THEME } from './config';\nimport type { CommonMarkAreaAnimationType, MarkerAnimationState } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkCommonArcLabelPosition, type MarkArcAreaAttrs } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkArcAreaComponent } from './register';\nimport { DEFAULT_STATES } from '../constant';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkAreaAnimation, markArcAreaAnimate } from './animate/animate';\n\nloadMarkArcAreaComponent();\n\nexport function registerMarkArcAreaAnimate() {\n MarkArcArea._animate = markArcAreaAnimate;\n}\n\nexport class MarkArcArea extends Marker<MarkArcAreaAttrs, CommonMarkAreaAnimationType> {\n name = 'markArcArea';\n static defaultAttributes = DEFAULT_MARK_ARC_AREA_THEME;\n private _area!: IArc;\n\n /** animate */\n defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArcArea._animate) {\n MarkArcArea._animate(this._area, this._label, this._animationConfig, state);\n }\n }\n\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: MarkArcAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArcArea.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkCommonArcLabelPosition) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, label } = this.attribute as MarkArcAreaAttrs;\n const { refX = 0, refY = 0 } = label;\n // eslint-disable-next-line max-len\n const labelRectHeight = Math.abs(\n (this._label.getTextShape().AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0)\n );\n // eslint-disable-next-line max-len\n const labelTextHeight = Math.abs(\n (this._label.getBgRect().AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0)\n );\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n let radius;\n let angle;\n // tag在正交方向是向内偏移,还是向外偏移\n // 不偏移: 0, 内: -1, 外: 1\n let orthogonalOffsetDirection;\n\n switch (position) {\n case IMarkCommonArcLabelPosition.center:\n radius = (innerRadius + outerRadius) / 2;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 0;\n break;\n case IMarkCommonArcLabelPosition.arcInnerStart:\n radius = innerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterStart:\n radius = outerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerEnd:\n radius = innerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterEnd:\n radius = outerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerMiddle:\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterMiddle:\n radius = outerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 1;\n break;\n default: // default arcInnerMiddle\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n }\n\n return {\n position: {\n x:\n center.x +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.cos(angle) +\n refX * Math.cos(angle - Math.PI / 2),\n y:\n center.y +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.sin(angle) +\n refX * Math.sin(angle - Math.PI / 2)\n },\n angle\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as MarkArcAreaAttrs;\n const { position: labelPosition = 'arcInnerMiddle', autoRotate = true } = label;\n const labelAttr = this.getPointAttrByPosition(labelPosition as IMarkCommonArcLabelPosition);\n\n this._label.setAttributes({\n ...labelAttr.position,\n angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (label.refAngle ?? 0) : 0\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 { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this\n .attribute as MarkArcAreaAttrs;\n const area = graphicCreator.arc({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'polar-mark-area-area';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\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 { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label } = this\n .attribute as MarkArcAreaAttrs;\n if (this._area) {\n this._area.setAttributes({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n }\n if (this._area) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes)\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/arc-area.ts"],"names":[],"mappings":";;;AAEA,yDAAwD;AACxD,6CAAyC;AAGzC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAuD;AAGvD,iCAA4E;AAC5E,qDAAyD;AAEzD,yCAAsD;AACtD,0CAA6C;AAC7C,+CAAmH;AAEnH,IAAA,mCAAwB,GAAE,CAAC;AAE3B,SAAgB,0BAA0B;IACxC,WAAW,CAAC,QAAQ,GAAG,4BAAkB,CAAC;AAC5C,CAAC;AAFD,gEAEC;AAED,MAAa,WAAY,SAAQ,aAAqD;IAQ1E,aAAa,CAAC,KAA2B;QACjD,IAAI,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACjD,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SAC7E;IACH,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,YAAY,UAA4B,EAAE,OAA0B;QAClE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAA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AK,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;gBACxD,IAAI,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;aAC9C,IACD,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,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;aACtF,SAA6B,CAAC;QACjC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,aAAa,iBACtB,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,WAAW;gBACX,WAAW;gBACX,UAAU;gBACV,QAAQ,IACL,SAAS,EACZ,CAAC;SACJ;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,aAAa,iBACvB,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,IACD,KAAuB,EAC3B,CAAC;SACJ;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AArLH,kCAsLC;AApLQ,6BAAiB,GAAG,oCAA2B,CAAC","file":"arc-area.js","sourcesContent":["import type { IArc, IGroup, INode } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_ARC_AREA_THEME } from './config';\nimport type { CommonMarkAreaAnimationType, MarkerAnimationState } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkCommonArcLabelPosition, type MarkArcAreaAttrs } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkArcAreaComponent } from './register';\nimport { DEFAULT_STATES } from '../constant';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkAreaAnimation, markArcAreaAnimate } from './animate/animate';\n\nloadMarkArcAreaComponent();\n\nexport function registerMarkArcAreaAnimate() {\n MarkArcArea._animate = markArcAreaAnimate;\n}\n\nexport class MarkArcArea extends Marker<MarkArcAreaAttrs, CommonMarkAreaAnimationType> {\n name = 'markArcArea';\n static defaultAttributes = DEFAULT_MARK_ARC_AREA_THEME;\n private _area!: IArc;\n\n /** animate */\n defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArcArea._animate && this._animationConfig) {\n MarkArcArea._animate(this._area, this._label, this._animationConfig, state);\n }\n }\n\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: MarkArcAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArcArea.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkCommonArcLabelPosition) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, label } = this.attribute as MarkArcAreaAttrs;\n const { refX = 0, refY = 0 } = label;\n // eslint-disable-next-line max-len\n const labelTextHeight = this._label.getTextShape().attribute.visible\n ? Math.abs((this._label.getTextShape().AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0))\n : 0;\n // eslint-disable-next-line max-len\n const labelRectHeight = this._label.getBgRect().attribute.visible\n ? Math.abs((this._label.getBgRect().AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0))\n : 0;\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n let radius;\n let angle;\n // tag在正交方向是向内偏移,还是向外偏移\n // 不偏移: 0, 内: -1, 外: 1\n let orthogonalOffsetDirection;\n\n switch (position) {\n case IMarkCommonArcLabelPosition.center:\n radius = (innerRadius + outerRadius) / 2;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 0;\n break;\n case IMarkCommonArcLabelPosition.arcInnerStart:\n radius = innerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterStart:\n radius = outerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerEnd:\n radius = innerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterEnd:\n radius = outerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerMiddle:\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterMiddle:\n radius = outerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 1;\n break;\n default: // default arcInnerMiddle\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n }\n\n return {\n position: {\n x:\n center.x +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.cos(angle) +\n refX * Math.cos(angle - Math.PI / 2),\n y:\n center.y +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.sin(angle) +\n refX * Math.sin(angle - Math.PI / 2)\n },\n angle\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as MarkArcAreaAttrs;\n const { position: labelPosition = 'arcInnerMiddle', autoRotate = true } = label;\n const labelAttr = this.getPointAttrByPosition(labelPosition as IMarkCommonArcLabelPosition);\n\n this._label.setAttributes({\n ...labelAttr.position,\n angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (label.refAngle ?? 0) : 0\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 { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this\n .attribute as MarkArcAreaAttrs;\n const area = graphicCreator.arc({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'polar-mark-area-area';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\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 { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label } = this\n .attribute as MarkArcAreaAttrs;\n if (this._area) {\n this._area.setAttributes({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n }\n if (this._area) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes)\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n return true;\n }\n}\n"]}
|
package/cjs/marker/arc-line.js
CHANGED
|
@@ -7,14 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), segment_1 = require("../segment"), register_1 = require("./register"), constant_1 = require("../constant"), common_line_1 = require("./common-line"), type_1 = require("./type"), config_1 = require("./config"), animate_1 = require("./animate/animate");
|
|
8
8
|
|
|
9
9
|
function registerMarkArcLineAnimate() {
|
|
10
|
-
MarkArcLine._animate = animate_1.
|
|
10
|
+
MarkArcLine._animate = animate_1.markCommonLineAnimate;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
(0, register_1.loadMarkArcLineComponent)(), exports.registerMarkArcLineAnimate = registerMarkArcLineAnimate;
|
|
14
14
|
|
|
15
15
|
class MarkArcLine extends common_line_1.MarkCommonLine {
|
|
16
16
|
markerAnimate(state) {
|
|
17
|
-
MarkArcLine._animate && MarkArcLine._animate(this._line, this._label, this._animationConfig, state);
|
|
17
|
+
MarkArcLine._animate && this._animationConfig && MarkArcLine._animate(this._line, this._label, this._animationConfig, state);
|
|
18
18
|
}
|
|
19
19
|
constructor(attributes, options) {
|
|
20
20
|
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, MarkArcLine.defaultAttributes, attributes)),
|
|
@@ -22,7 +22,7 @@ class MarkArcLine extends common_line_1.MarkCommonLine {
|
|
|
22
22
|
}
|
|
23
23
|
getPointAttrByPosition(direction) {
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
25
|
-
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label,
|
|
25
|
+
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, labelTextHeight = this._label.getTextShape().attribute.visible ? Math.abs((null !== (_c = null === (_b = null === (_a = this._label.getTextShape()) || void 0 === _a ? void 0 : _a.AABBBounds) || void 0 === _b ? void 0 : _b.y2) && void 0 !== _c ? _c : 0) - (null !== (_e = null === (_d = this._label.getTextShape()) || void 0 === _d ? void 0 : _d.AABBBounds.y1) && void 0 !== _e ? _e : 0)) : 0, labelRectHeight = this._label.getBgRect().attribute.visible ? Math.abs((null !== (_h = null === (_g = null === (_f = this._label.getBgRect()) || void 0 === _f ? void 0 : _f.AABBBounds) || void 0 === _g ? void 0 : _g.y2) && void 0 !== _h ? _h : 0) - (null !== (_k = null === (_j = this._label.getBgRect()) || void 0 === _j ? void 0 : _j.AABBBounds.y1) && void 0 !== _k ? _k : 0)) : 0, labelHeight = Math.max(labelRectHeight, labelTextHeight);
|
|
26
26
|
let angle, orthogonalOffsetDirection;
|
|
27
27
|
switch (direction) {
|
|
28
28
|
case type_1.IMarkCommonArcLabelPosition.center:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/arc-line.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,wCAAwC;AACxC,yCAAsD;AACtD,0CAA6C;AAC7C,+CAA+C;AAG/C,iCAAqD;AAGrD,qCAAuD;AACvD,+CAA0D;AAE1D,IAAA,mCAAwB,GAAE,CAAC;AAE3B,SAAgB,0BAA0B;IACxC,WAAW,CAAC,QAAQ,GAAG,+BAAqB,CAAC;AAC/C,CAAC;AAFD,gEAEC;AACD,MAAa,WAAY,SAAQ,4BAAiE;IAMtF,aAAa,CAAC,KAA2B;QACjD,IAAI,WAAW,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"sources":["../src/marker/arc-line.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,wCAAwC;AACxC,yCAAsD;AACtD,0CAA6C;AAC7C,+CAA+C;AAG/C,iCAAqD;AAGrD,qCAAuD;AACvD,+CAA0D;AAE1D,IAAA,mCAAwB,GAAE,CAAC;AAE3B,SAAgB,0BAA0B;IACxC,WAAW,CAAC,QAAQ,GAAG,+BAAqB,CAAC;AAC/C,CAAC;AAFD,gEAEC;AACD,MAAa,WAAY,SAAQ,4BAAiE;IAMtF,aAAa,CAAC,KAA2B;QACjD,IAAI,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACj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AK,CAAE,IAAI,CAAC;gBAC5C,WAAW,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;gBAC9D,SAAS,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,CAAC;aAC3D;SACF,CAAC,CAAC;IACL,CAAC;IAES,iBAAiB;QACzB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI;aACrF,SAA6B,CAAC;QACjC,IAAI,IAAI,CAAC,KAAK,EAAE;YACb,IAAI,CAAC,KAAa,CAAC,aAAa,CAAC;gBAChC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,QAAQ;gBACR,WAAW;gBACX,SAAS;gBACT,SAAS;aACV,CAAC,CAAC;SACJ;IACH,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AA1HH,kCA2HC;AAxHQ,6BAAiB,GAA8B,oCAA0D,CAAC","file":"arc-line.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { ArcSegment } from '../segment';\nimport { loadMarkArcLineComponent } from './register';\nimport { DEFAULT_STATES } from '../constant';\nimport { MarkCommonLine } from './common-line';\nimport type { ComponentOptions } from '../interface';\nimport type { IArcGraphicAttribute } from '@visactor/vrender-core';\nimport { IMarkCommonArcLabelPosition } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport type { MarkArcLineAttrs, MarkerAnimationState } from './type';\nimport { DEFAULT_MARK_ARC_LINE_THEME } from './config';\nimport { markCommonLineAnimate } from './animate/animate';\n\nloadMarkArcLineComponent();\n\nexport function registerMarkArcLineAnimate() {\n MarkArcLine._animate = markCommonLineAnimate;\n}\nexport class MarkArcLine extends MarkCommonLine<IArcGraphicAttribute, IMarkCommonArcLabelPosition> {\n name = 'markArcLine';\n // eslint-disable-next-line max-len\n static defaultAttributes: Partial<MarkArcLineAttrs> = DEFAULT_MARK_ARC_LINE_THEME as unknown as MarkArcLineAttrs;\n protected _line!: ArcSegment;\n\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArcLine._animate && this._animationConfig) {\n MarkArcLine._animate(this._line, this._label, this._animationConfig, state);\n }\n }\n\n constructor(attributes: MarkArcLineAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArcLine.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(direction: IMarkCommonArcLabelPosition) {\n const { center, radius, startAngle, endAngle, label } = this.attribute as MarkArcLineAttrs;\n const { refX = 0, refY = 0 } = label;\n const labelTextHeight = this._label.getTextShape().attribute.visible\n ? Math.abs((this._label.getTextShape()?.AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0))\n : 0;\n const labelRectHeight = this._label.getBgRect().attribute.visible\n ? Math.abs((this._label.getBgRect()?.AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0))\n : 0;\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n let angle;\n // tag在正交方向是向内偏移,还是向外偏移\n // 不偏移: 0, 内: -1, 外: 1\n let orthogonalOffsetDirection;\n\n switch (direction) {\n case IMarkCommonArcLabelPosition.center:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 0;\n break;\n case IMarkCommonArcLabelPosition.arcInnerStart:\n angle = startAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterStart:\n angle = startAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerEnd:\n angle = endAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterEnd:\n angle = endAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerMiddle:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterMiddle:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 1;\n break;\n default: // default arcInnerMiddle\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n }\n\n return {\n position: {\n x:\n center.x +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.cos(angle) +\n refX * Math.cos(angle - Math.PI / 2),\n y:\n center.y +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.sin(angle) +\n refX * Math.sin(angle - Math.PI / 2)\n },\n angle\n };\n }\n\n protected getRotateByAngle(angle: number): number {\n return angle - Math.PI / 2 + (this.attribute.label.refAngle ?? 0);\n }\n\n protected createSegment() {\n const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this\n .attribute as MarkArcLineAttrs;\n return new ArcSegment({\n center,\n radius,\n startAngle,\n endAngle,\n startSymbol,\n endSymbol,\n lineStyle,\n state: {\n line: merge({}, DEFAULT_STATES, state?.line),\n startSymbol: merge({}, DEFAULT_STATES, state?.lineStartSymbol),\n endSymbol: merge({}, DEFAULT_STATES, state?.lineEndSymbol)\n }\n });\n }\n\n protected setLineAttributes() {\n const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle } = this\n .attribute as MarkArcLineAttrs;\n if (this._line) {\n (this._line as any).setAttributes({\n center,\n radius,\n startAngle,\n endAngle,\n startSymbol,\n endSymbol,\n lineStyle\n });\n }\n }\n\n protected isValidPoints() {\n return true;\n }\n}\n"]}
|
package/cjs/marker/area.js
CHANGED
|
@@ -14,7 +14,7 @@ function registerMarkAreaAnimate() {
|
|
|
14
14
|
|
|
15
15
|
class MarkArea extends base_1.Marker {
|
|
16
16
|
markerAnimate(state) {
|
|
17
|
-
MarkArea._animate && MarkArea._animate(this._area, this._label, this._animationConfig, state);
|
|
17
|
+
MarkArea._animate && this._animationConfig && MarkArea._animate(this._area, this._label, this._animationConfig, state);
|
|
18
18
|
}
|
|
19
19
|
getArea() {
|
|
20
20
|
return this._area;
|
|
@@ -29,7 +29,7 @@ class MarkArea extends base_1.Marker {
|
|
|
29
29
|
}
|
|
30
30
|
getPointAttrByPosition(position) {
|
|
31
31
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
32
|
-
const {x1: x1, x2: x2, y1: y1, y2: y2} = this._area.AABBBounds,
|
|
32
|
+
const {x1: x1, x2: x2, y1: y1, y2: y2} = this._area.AABBBounds, labelTextHeight = this._label.getTextShape().attribute.visible ? Math.abs((null !== (_b = null === (_a = this._label.getTextShape().AABBBounds) || void 0 === _a ? void 0 : _a.y2) && void 0 !== _b ? _b : 0) - (null !== (_d = null === (_c = this._label.getTextShape()) || void 0 === _c ? void 0 : _c.AABBBounds.y1) && void 0 !== _d ? _d : 0)) : 0, labelRectHeight = this._label.getBgRect().attribute.visible ? Math.abs((null !== (_f = null === (_e = this._label.getBgRect().AABBBounds) || void 0 === _e ? void 0 : _e.y2) && void 0 !== _f ? _f : 0) - (null !== (_h = null === (_g = this._label.getBgRect()) || void 0 === _g ? void 0 : _g.AABBBounds.y1) && void 0 !== _h ? _h : 0)) : 0, labelHeight = Math.max(labelRectHeight, labelTextHeight), labelRectWidth = Math.abs((null !== (_k = null === (_j = this._label.getTextShape().AABBBounds) || void 0 === _j ? void 0 : _j.x2) && void 0 !== _k ? _k : 0) - (null !== (_m = null === (_l = this._label.getTextShape()) || void 0 === _l ? void 0 : _l.AABBBounds.x1) && void 0 !== _m ? _m : 0)), labelTextWidth = Math.abs((null !== (_p = null === (_o = this._label.getBgRect().AABBBounds) || void 0 === _o ? void 0 : _o.x2) && void 0 !== _p ? _p : 0) - (null !== (_r = null === (_q = this._label.getBgRect()) || void 0 === _q ? void 0 : _q.AABBBounds.x1) && void 0 !== _r ? _r : 0)), labelWidth = Math.max(labelRectWidth, labelTextWidth);
|
|
33
33
|
return position.includes("left") || position.includes("Left") ? {
|
|
34
34
|
x: x1 + (position.includes("inside") ? .5 : -.5) * labelWidth,
|
|
35
35
|
y: (y1 + y2) / 2
|
package/cjs/marker/area.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/area.ts"],"names":[],"mappings":";;;AAEA,yDAAwD;AACxD,6CAAwD;AAGxD,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAmD;AAEnD,qDAAyD;AAEzD,yCAAmD;AAEnD,0CAA6C;AAC7C,+CAAgH;AAEhH,IAAA,gCAAqB,GAAE,CAAC;AAExB,SAAgB,uBAAuB;IACrC,QAAQ,CAAC,QAAQ,GAAG,yBAAe,CAAC;AACtC,CAAC;AAFD,0DAEC;AAED,MAAa,QAAS,SAAQ,aAAkD;IAOpE,aAAa,CAAC,KAA2B;QACjD,IAAI,QAAQ,CAAC,QAAQ,EAAE;YACrB,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SAC1E;IACH,CAAC;IAGD,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,YAAY,UAAyB,EAAE,OAA0B;QAC/D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAtB/F,SAAI,GAAG,UAAU,CAAC;QAIlB,2BAAsB,GAAG,wCAA8B,CAAC;QACxD,yBAAoB,GAAG,oCAA0B,CAAC;IAkBlD,CAAC;IAES,sBAAsB,CAAC,QAAgC;;QAC/D,MAAM,EAAE,EAAE,EAA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CAAC;IACrB,CAAC;IAES,aAAa;QACrB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAA0B,CAAC;QACnD,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,OAAO,KAAK,CAAC;SACd;QACD,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAY,EAAE,EAAE;YAC9B,IAAI,CAAC,IAAA,sBAAa,EAAE,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAa,EAAE,KAAe,CAAC,CAAC,CAAC,EAAE;gBAC5E,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AAzJH,4BA0JC;AAxJQ,0BAAiB,GAAG,gCAAuB,CAAC","file":"area.js","sourcesContent":["import type { IGroup, INode, IPolygon } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { isValidNumber, merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_AREA_THEME } from './config';\nimport type { CommonMarkAreaAnimationType, IMarkAreaLabelPosition, MarkAreaAttrs, MarkerAnimationState } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkAreaComponent } from './register';\nimport type { Point } from '../core/type';\nimport { DEFAULT_STATES } from '../constant';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkAreaAnimation, markAreaAnimate } from './animate/animate';\n\nloadMarkAreaComponent();\n\nexport function registerMarkAreaAnimate() {\n MarkArea._animate = markAreaAnimate;\n}\n\nexport class MarkArea extends Marker<MarkAreaAttrs, CommonMarkAreaAnimationType> {\n name = 'markArea';\n static defaultAttributes = DEFAULT_MARK_AREA_THEME;\n\n /** animate */\n defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArea._animate) {\n MarkArea._animate(this._area, this._label, this._animationConfig, state);\n }\n }\n\n private _area!: IPolygon;\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: MarkAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArea.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkAreaLabelPosition) {\n const { x1, x2, y1, y2 } = this._area.AABBBounds;\n // labelHeight\n const labelRectHeight = Math.abs(\n (this._label.getTextShape().AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0)\n );\n const labelTextHeight = Math.abs(\n (this._label.getBgRect().AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0)\n );\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n // labelWidth\n const labelRectWidth = Math.abs(\n (this._label.getTextShape().AABBBounds?.x2 ?? 0) - (this._label.getTextShape()?.AABBBounds.x1 ?? 0)\n );\n const labelTextWidth = Math.abs(\n (this._label.getBgRect().AABBBounds?.x2 ?? 0) - (this._label.getBgRect()?.AABBBounds.x1 ?? 0)\n );\n const labelWidth = Math.max(labelRectWidth, labelTextWidth);\n\n if (position.includes('left') || position.includes('Left')) {\n return {\n x: x1 + (position.includes('inside') ? 0.5 : -0.5) * labelWidth,\n y: (y1 + y2) / 2\n };\n }\n if (position.includes('right') || position.includes('Right')) {\n return {\n x: x2 + (position.includes('inside') ? -0.5 : 0.5) * labelWidth,\n y: (y1 + y2) / 2\n };\n }\n if (position.includes('top') || position.includes('Top')) {\n return {\n x: (x1 + x2) / 2,\n y: y1 + (position.includes('inside') ? 0.5 : -0.5) * labelHeight\n };\n }\n if (position.includes('bottom') || position.includes('Bottom')) {\n return {\n x: (x1 + x2) / 2,\n y: y2 + (position.includes('inside') ? -0.5 : 0.5) * labelHeight\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.getPointAttrByPosition(labelPosition as IMarkAreaLabelPosition);\n this._label.setAttributes({\n ...labelPoint\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, state } = this.attribute as MarkAreaAttrs;\n const area = graphicCreator.polygon({\n points: points,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'mark-area-polygon';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\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 if (this._area) {\n this._area.setAttributes({\n points: points,\n ...areaStyle\n });\n }\n if (this._area) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes)\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n const { points } = this.attribute as MarkAreaAttrs;\n if (!points || points.length < 3) {\n return false;\n }\n let validFlag = true;\n points.forEach((point: Point) => {\n if (!isValidNumber((point as Point).x) || !isValidNumber((point as Point).y)) {\n validFlag = false;\n return;\n }\n });\n return validFlag;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/area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AAC;SACJ;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,aAAa;QACrB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAA0B,CAAC;QACnD,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,OAAO,KAAK,CAAC;SACd;QACD,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAY,EAAE,EAAE;YAC9B,IAAI,CAAC,IAAA,sBAAa,EAAE,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAa,EAAE,KAAe,CAAC,CAAC,CAAC,EAAE;gBAC5E,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AAzJH,4BA0JC;AAxJQ,0BAAiB,GAAG,gCAAuB,CAAC","file":"area.js","sourcesContent":["import type { IGroup, INode, IPolygon } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { isValidNumber, merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_AREA_THEME } from './config';\nimport type { CommonMarkAreaAnimationType, IMarkAreaLabelPosition, MarkAreaAttrs, MarkerAnimationState } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkAreaComponent } from './register';\nimport type { Point } from '../core/type';\nimport { DEFAULT_STATES } from '../constant';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkAreaAnimation, markAreaAnimate } from './animate/animate';\n\nloadMarkAreaComponent();\n\nexport function registerMarkAreaAnimate() {\n MarkArea._animate = markAreaAnimate;\n}\n\nexport class MarkArea extends Marker<MarkAreaAttrs, CommonMarkAreaAnimationType> {\n name = 'markArea';\n static defaultAttributes = DEFAULT_MARK_AREA_THEME;\n\n /** animate */\n defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArea._animate && this._animationConfig) {\n MarkArea._animate(this._area, this._label, this._animationConfig, state);\n }\n }\n\n private _area!: IPolygon;\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: MarkAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArea.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkAreaLabelPosition) {\n const { x1, x2, y1, y2 } = this._area.AABBBounds;\n // labelHeight\n const labelTextHeight = this._label.getTextShape().attribute.visible\n ? Math.abs((this._label.getTextShape().AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0))\n : 0;\n const labelRectHeight = this._label.getBgRect().attribute.visible\n ? Math.abs((this._label.getBgRect().AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0))\n : 0;\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n // labelWidth\n const labelRectWidth = Math.abs(\n (this._label.getTextShape().AABBBounds?.x2 ?? 0) - (this._label.getTextShape()?.AABBBounds.x1 ?? 0)\n );\n const labelTextWidth = Math.abs(\n (this._label.getBgRect().AABBBounds?.x2 ?? 0) - (this._label.getBgRect()?.AABBBounds.x1 ?? 0)\n );\n const labelWidth = Math.max(labelRectWidth, labelTextWidth);\n\n if (position.includes('left') || position.includes('Left')) {\n return {\n x: x1 + (position.includes('inside') ? 0.5 : -0.5) * labelWidth,\n y: (y1 + y2) / 2\n };\n }\n if (position.includes('right') || position.includes('Right')) {\n return {\n x: x2 + (position.includes('inside') ? -0.5 : 0.5) * labelWidth,\n y: (y1 + y2) / 2\n };\n }\n if (position.includes('top') || position.includes('Top')) {\n return {\n x: (x1 + x2) / 2,\n y: y1 + (position.includes('inside') ? 0.5 : -0.5) * labelHeight\n };\n }\n if (position.includes('bottom') || position.includes('Bottom')) {\n return {\n x: (x1 + x2) / 2,\n y: y2 + (position.includes('inside') ? -0.5 : 0.5) * labelHeight\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.getPointAttrByPosition(labelPosition as IMarkAreaLabelPosition);\n this._label.setAttributes({\n ...labelPoint\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, state } = this.attribute as MarkAreaAttrs;\n const area = graphicCreator.polygon({\n points: points,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'mark-area-polygon';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\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 if (this._area) {\n this._area.setAttributes({\n points: points,\n ...areaStyle\n });\n }\n if (this._area) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes)\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n const { points } = this.attribute as MarkAreaAttrs;\n if (!points || points.length < 3) {\n return false;\n }\n let validFlag = true;\n points.forEach((point: Point) => {\n if (!isValidNumber((point as Point).x) || !isValidNumber((point as Point).y)) {\n validFlag = false;\n return;\n }\n });\n return validFlag;\n }\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { IGroup } from '@visactor/vrender-core';
|
|
2
2
|
import type { ArcSegment, Segment } from '../segment';
|
|
3
3
|
import { Tag } from '../tag';
|
|
4
|
-
import type {
|
|
4
|
+
import type { MarkCommonLineAnimationType, MarkCommonLineAttrs, MarkerAnimationState } from './type';
|
|
5
5
|
import { Marker } from './base';
|
|
6
|
-
export declare abstract class MarkCommonLine<LineAttr, LabelPosition> extends Marker<
|
|
6
|
+
export declare abstract class MarkCommonLine<LineAttr, LabelPosition> extends Marker<MarkCommonLineAttrs<LineAttr, LabelPosition, MarkCommonLineAnimationType>, MarkCommonLineAnimationType> {
|
|
7
7
|
name: string;
|
|
8
8
|
static _animate?: (line: Segment | ArcSegment, label: Tag, animationConfig: any, state: MarkerAnimationState) => void;
|
|
9
9
|
defaultUpdateAnimation: never;
|
|
10
|
-
defaultExitAnimation: MarkerExitAnimation;
|
|
10
|
+
defaultExitAnimation: import("./type").MarkerExitAnimation;
|
|
11
11
|
protected _line: Segment | ArcSegment;
|
|
12
12
|
protected abstract createSegment(): any;
|
|
13
13
|
protected abstract setLineAttributes(): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/common-line.ts"],"names":[],"mappings":";;;AACA,6CAAyC;AAIzC,gCAA6B;
|
|
1
|
+
{"version":3,"sources":["../src/marker/common-line.ts"],"names":[],"mappings":";;;AACA,6CAAyC;AAIzC,gCAA6B;AAE7B,qDAAyD;AACzD,0CAA6C;AAC7C,iCAAgC;AAChC,+CAA+F;AAE/F,MAAsB,cAAwC,SAAQ,aAGrE;IAHD;;QAIE,SAAI,GAAG,gBAAgB,CAAC;QAIxB,2BAAsB,GAAG,wCAA8B,CAAC;QACxD,yBAAoB,GAAG,oCAA0B,CAAC;IA0EpD,CAAC;IAjEC,OAAO;QACL,OAAO,IAAI,CAAC,K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cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;gBACxD,IAAI,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;aAC9C,IACD,CAAC;QACH,SAAS,CAAC,IAAI,GAAG,wBAAwB,CAAC;QAC1C,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,KAAK,EAAE,GAAG,IAAI,CAAC,SAAsF,CAAC;QAE9G,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAEzB,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,MAAM,CAAC,aAAa,iBACvB,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,IACD,KAAuB,EAC3B,CAAC;SACJ;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;CACF;AAnFD,wCAmFC","file":"common-line.js","sourcesContent":["import type { IGroup, INode } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { ArcSegment, Segment } from '../segment';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport type { MarkCommonLineAnimationType, MarkCommonLineAttrs, MarkerAnimationState } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport { DEFAULT_STATES } from '../constant';\nimport { Marker } from './base';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkLineAnimation } from './animate/animate';\n\nexport abstract class MarkCommonLine<LineAttr, LabelPosition> extends Marker<\n MarkCommonLineAttrs<LineAttr, LabelPosition, MarkCommonLineAnimationType>,\n MarkCommonLineAnimationType\n> {\n name = 'markCommonLine';\n\n /** animate */\n static _animate?: (line: Segment | ArcSegment, label: Tag, animationConfig: any, state: MarkerAnimationState) => void;\n defaultUpdateAnimation = DefaultUpdateMarkLineAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n\n protected _line!: Segment | ArcSegment;\n protected abstract createSegment(): any;\n protected abstract setLineAttributes(): any;\n protected abstract getPointAttrByPosition(position: any): any;\n protected abstract getRotateByAngle(angle: number): number;\n protected abstract markerAnimate(state: MarkerAnimationState): void;\n\n getLine() {\n return this._line;\n }\n getLabel() {\n return this._label;\n }\n\n protected setLabelPos() {\n const { label = {}, limitRect } = this.attribute;\n const { position, confine, autoRotate = true } = label;\n const labelPoint = this.getPointAttrByPosition(position);\n this._label.setAttributes({\n ...labelPoint.position,\n angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0\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 { label, state } = this.attribute as MarkCommonLineAttrs<\n LineAttr,\n LabelPosition,\n MarkCommonLineAnimationType\n >;\n const line = this.createSegment();\n line.name = 'mark-common-line-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n markLabel.name = 'mark-common-line-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { label } = this.attribute as MarkCommonLineAttrs<LineAttr, LabelPosition, MarkCommonLineAnimationType>;\n\n this.setLineAttributes();\n\n if (this._label) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes)\n });\n }\n\n this.setLabelPos();\n }\n}\n"]}
|
package/cjs/marker/line.js
CHANGED
|
@@ -7,14 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), type_1 = require("./type"), register_1 = require("./register"), common_line_1 = require("./common-line"), segment_1 = require("../segment"), constant_1 = require("../constant"), config_1 = require("./config"), animate_1 = require("./animate/animate");
|
|
8
8
|
|
|
9
9
|
function registerMarkLineAnimate() {
|
|
10
|
-
MarkLine._animate = animate_1.
|
|
10
|
+
MarkLine._animate = animate_1.markCommonLineAnimate;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
(0, register_1.loadMarkLineComponent)(), exports.registerMarkLineAnimate = registerMarkLineAnimate;
|
|
14
14
|
|
|
15
15
|
class MarkLine extends common_line_1.MarkCommonLine {
|
|
16
16
|
markerAnimate(state) {
|
|
17
|
-
MarkLine._animate && MarkLine._animate(this._line, this._label, this._animationConfig, state);
|
|
17
|
+
MarkLine._animate && this._animationConfig && MarkLine._animate(this._line, this._label, this._animationConfig, state);
|
|
18
18
|
}
|
|
19
19
|
constructor(attributes, options) {
|
|
20
20
|
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, MarkLine.defaultAttributes, attributes)),
|
|
@@ -22,7 +22,7 @@ class MarkLine extends common_line_1.MarkCommonLine {
|
|
|
22
22
|
}
|
|
23
23
|
getLabelOffsetByPosition(position) {
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
25
|
-
const
|
|
25
|
+
const labelTextHeight = this._label.getTextShape().attribute.visible ? Math.abs((null !== (_c = null === (_b = null === (_a = this._label.getTextShape()) || void 0 === _a ? void 0 : _a.AABBBounds) || void 0 === _b ? void 0 : _b.y2) && void 0 !== _c ? _c : 0) - (null !== (_e = null === (_d = this._label.getTextShape()) || void 0 === _d ? void 0 : _d.AABBBounds.y1) && void 0 !== _e ? _e : 0)) : 0, labelRectHeight = this._label.getBgRect().attribute.visible ? Math.abs((null !== (_h = null === (_g = null === (_f = this._label.getBgRect()) || void 0 === _f ? void 0 : _f.AABBBounds) || void 0 === _g ? void 0 : _g.y2) && void 0 !== _h ? _h : 0) - (null !== (_k = null === (_j = this._label.getBgRect()) || void 0 === _j ? void 0 : _j.AABBBounds.y1) && void 0 !== _k ? _k : 0)) : 0, labelHeight = Math.max(labelRectHeight, labelTextHeight), labelTextWidth = this._label.getTextShape().attribute.visible ? Math.abs((null !== (_o = null === (_m = null === (_l = this._label.getTextShape()) || void 0 === _l ? void 0 : _l.AABBBounds) || void 0 === _m ? void 0 : _m.x2) && void 0 !== _o ? _o : 0) - (null !== (_q = null === (_p = this._label.getTextShape()) || void 0 === _p ? void 0 : _p.AABBBounds.x1) && void 0 !== _q ? _q : 0)) : 0, labelRectWidth = this._label.getBgRect().attribute.visible ? Math.abs((null !== (_t = null === (_s = null === (_r = this._label.getBgRect()) || void 0 === _r ? void 0 : _r.AABBBounds) || void 0 === _s ? void 0 : _s.x2) && void 0 !== _t ? _t : 0) - (null !== (_v = null === (_u = this._label.getBgRect()) || void 0 === _u ? void 0 : _u.AABBBounds.x1) && void 0 !== _v ? _v : 0)) : 0, labelWidth = Math.max(labelRectWidth, labelTextWidth);
|
|
26
26
|
switch (position) {
|
|
27
27
|
case type_1.IMarkLineLabelPosition.start:
|
|
28
28
|
return {
|