@antv/g2 4.2.7 → 4.2.9
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/CHANGELOG.md +1433 -0
- package/dist/g2.min.js +2 -2
- package/dist/g2.min.js.map +1 -1
- package/esm/animate/animation/index.d.ts +1 -1
- package/esm/animate/index.js.map +1 -1
- package/esm/chart/controller/axis.d.ts +1 -1
- package/esm/chart/controller/axis.js +2 -1
- package/esm/chart/controller/axis.js.map +1 -1
- package/esm/chart/controller/base.d.ts +1 -1
- package/esm/chart/layout/constraint/types.d.ts +2 -2
- package/esm/chart/layout/index.d.ts +1 -1
- package/esm/chart/layout/padding-cal.d.ts +1 -1
- package/esm/chart/view.js +3 -2
- package/esm/chart/view.js.map +1 -1
- package/esm/component/update-label.d.ts +1 -1
- package/esm/core.d.ts +1 -1
- package/esm/core.js +1 -3
- package/esm/core.js.map +1 -1
- package/esm/dependents.d.ts +1 -1
- package/esm/geometry/label/base.d.ts +1 -1
- package/esm/geometry/label/index.d.ts +1 -1
- package/esm/geometry/label/interface.d.ts +2 -2
- package/esm/geometry/shape/area/index.js.map +1 -1
- package/esm/geometry/shape/area/line.js.map +1 -1
- package/esm/geometry/shape/area/smooth-line.js.map +1 -1
- package/esm/geometry/shape/area/smooth.js.map +1 -1
- package/esm/geometry/shape/base.js.map +1 -1
- package/esm/geometry/shape/edge/arc.js.map +1 -1
- package/esm/geometry/shape/edge/index.js.map +1 -1
- package/esm/geometry/shape/edge/smooth.js.map +1 -1
- package/esm/geometry/shape/edge/vhv.js.map +1 -1
- package/esm/geometry/shape/interval/funnel.js.map +1 -1
- package/esm/geometry/shape/interval/hollow-rect.js.map +1 -1
- package/esm/geometry/shape/interval/index.js.map +1 -1
- package/esm/geometry/shape/interval/line.js.map +1 -1
- package/esm/geometry/shape/interval/pyramid.js.map +1 -1
- package/esm/geometry/shape/interval/tick.js.map +1 -1
- package/esm/geometry/shape/line/index.js.map +1 -1
- package/esm/geometry/shape/line/step.js.map +1 -1
- package/esm/geometry/shape/point/hollow.js.map +1 -1
- package/esm/geometry/shape/point/image.js.map +1 -1
- package/esm/geometry/shape/point/index.js.map +1 -1
- package/esm/geometry/shape/point/solid.js.map +1 -1
- package/esm/geometry/shape/polygon/index.js.map +1 -1
- package/esm/geometry/shape/polygon/square.js.map +1 -1
- package/esm/geometry/shape/schema/box.js.map +1 -1
- package/esm/geometry/shape/schema/candle.js.map +1 -1
- package/esm/geometry/shape/violin/hollow.js.map +1 -1
- package/esm/geometry/shape/violin/index.js.map +1 -1
- package/esm/geometry/shape/violin/smooth.js.map +1 -1
- package/esm/index.js +67 -0
- package/esm/index.js.map +1 -1
- package/esm/interaction/action/element/highlight-util.d.ts +1 -1
- package/esm/interaction/action/element/highlight.d.ts +1 -1
- package/esm/interaction/action/element/link-by-color.d.ts +1 -1
- package/esm/interaction/action/mask/circle.d.ts +5 -0
- package/esm/interaction/action/mask/circle.js +18 -16
- package/esm/interaction/action/mask/circle.js.map +1 -1
- package/esm/interaction/action/mask/dim-rect.d.ts +1 -0
- package/esm/interaction/action/mask/dim-rect.js +38 -37
- package/esm/interaction/action/mask/dim-rect.js.map +1 -1
- package/esm/interaction/action/mask/multiple/base.d.ts +125 -0
- package/esm/interaction/action/mask/multiple/base.js +286 -0
- package/esm/interaction/action/mask/multiple/base.js.map +1 -0
- package/esm/interaction/action/mask/multiple/circle.d.ts +11 -0
- package/esm/interaction/action/mask/multiple/circle.js +19 -0
- package/esm/interaction/action/mask/multiple/circle.js.map +1 -0
- package/esm/interaction/action/mask/multiple/dim-rect.d.ts +10 -0
- package/esm/interaction/action/mask/multiple/dim-rect.js +22 -0
- package/esm/interaction/action/mask/multiple/dim-rect.js.map +1 -0
- package/esm/interaction/action/mask/multiple/path.d.ts +12 -0
- package/esm/interaction/action/mask/multiple/path.js +22 -0
- package/esm/interaction/action/mask/multiple/path.js.map +1 -0
- package/esm/interaction/action/mask/multiple/rect.d.ts +16 -0
- package/esm/interaction/action/mask/multiple/rect.js +25 -0
- package/esm/interaction/action/mask/multiple/rect.js.map +1 -0
- package/esm/interaction/action/mask/multiple/smooth-path.d.ts +11 -0
- package/esm/interaction/action/mask/multiple/smooth-path.js +19 -0
- package/esm/interaction/action/mask/multiple/smooth-path.js.map +1 -0
- package/esm/interaction/action/mask/path.d.ts +9 -0
- package/esm/interaction/action/mask/path.js +27 -18
- package/esm/interaction/action/mask/path.js.map +1 -1
- package/esm/interaction/action/mask/rect.d.ts +12 -0
- package/esm/interaction/action/mask/rect.js +25 -16
- package/esm/interaction/action/mask/rect.js.map +1 -1
- package/esm/interaction/action/mask/smooth-path.d.ts +12 -0
- package/esm/interaction/action/mask/smooth-path.js +17 -3
- package/esm/interaction/action/mask/smooth-path.js.map +1 -1
- package/esm/interaction/action/register.d.ts +1 -1
- package/esm/interaction/action/util.d.ts +6 -0
- package/esm/interaction/action/util.js +112 -12
- package/esm/interaction/action/util.js.map +1 -1
- package/esm/interaction/interaction.d.ts +1 -1
- package/esm/interface.d.ts +59 -59
- package/esm/util/collision-detect.d.ts +1 -1
- package/esm/util/legend.d.ts +1 -1
- package/esm/util/text.d.ts +2 -2
- package/esm/util/types.d.ts +1 -1
- package/lib/animate/animation/index.d.ts +1 -1
- package/lib/animate/index.js.map +1 -1
- package/lib/chart/controller/axis.d.ts +1 -1
- package/lib/chart/controller/axis.js +2 -1
- package/lib/chart/controller/axis.js.map +1 -1
- package/lib/chart/controller/base.d.ts +1 -1
- package/lib/chart/layout/constraint/types.d.ts +2 -2
- package/lib/chart/layout/index.d.ts +1 -1
- package/lib/chart/layout/padding-cal.d.ts +1 -1
- package/lib/chart/view.js +3 -2
- package/lib/chart/view.js.map +1 -1
- package/lib/component/update-label.d.ts +1 -1
- package/lib/core.d.ts +1 -1
- package/lib/core.js +9 -9
- package/lib/core.js.map +1 -1
- package/lib/dependents.d.ts +1 -1
- package/lib/geometry/label/base.d.ts +1 -1
- package/lib/geometry/label/index.d.ts +1 -1
- package/lib/geometry/label/interface.d.ts +2 -2
- package/lib/geometry/shape/area/index.js.map +1 -1
- package/lib/geometry/shape/area/line.js.map +1 -1
- package/lib/geometry/shape/area/smooth-line.js.map +1 -1
- package/lib/geometry/shape/area/smooth.js.map +1 -1
- package/lib/geometry/shape/base.js.map +1 -1
- package/lib/geometry/shape/edge/arc.js.map +1 -1
- package/lib/geometry/shape/edge/index.js.map +1 -1
- package/lib/geometry/shape/edge/smooth.js.map +1 -1
- package/lib/geometry/shape/edge/vhv.js.map +1 -1
- package/lib/geometry/shape/interval/funnel.js.map +1 -1
- package/lib/geometry/shape/interval/hollow-rect.js.map +1 -1
- package/lib/geometry/shape/interval/index.js.map +1 -1
- package/lib/geometry/shape/interval/line.js.map +1 -1
- package/lib/geometry/shape/interval/pyramid.js.map +1 -1
- package/lib/geometry/shape/interval/tick.js.map +1 -1
- package/lib/geometry/shape/line/index.js.map +1 -1
- package/lib/geometry/shape/line/step.js.map +1 -1
- package/lib/geometry/shape/point/hollow.js.map +1 -1
- package/lib/geometry/shape/point/image.js.map +1 -1
- package/lib/geometry/shape/point/index.js.map +1 -1
- package/lib/geometry/shape/point/solid.js.map +1 -1
- package/lib/geometry/shape/polygon/index.js.map +1 -1
- package/lib/geometry/shape/polygon/square.js.map +1 -1
- package/lib/geometry/shape/schema/box.js.map +1 -1
- package/lib/geometry/shape/schema/candle.js.map +1 -1
- package/lib/geometry/shape/violin/hollow.js.map +1 -1
- package/lib/geometry/shape/violin/index.js.map +1 -1
- package/lib/geometry/shape/violin/smooth.js.map +1 -1
- package/lib/index.js +67 -0
- package/lib/index.js.map +1 -1
- package/lib/interaction/action/element/highlight-util.d.ts +1 -1
- package/lib/interaction/action/element/highlight.d.ts +1 -1
- package/lib/interaction/action/element/link-by-color.d.ts +1 -1
- package/lib/interaction/action/mask/circle.d.ts +5 -0
- package/lib/interaction/action/mask/circle.js +20 -16
- package/lib/interaction/action/mask/circle.js.map +1 -1
- package/lib/interaction/action/mask/dim-rect.d.ts +1 -0
- package/lib/interaction/action/mask/dim-rect.js +40 -37
- package/lib/interaction/action/mask/dim-rect.js.map +1 -1
- package/lib/interaction/action/mask/multiple/base.d.ts +125 -0
- package/lib/interaction/action/mask/multiple/base.js +288 -0
- package/lib/interaction/action/mask/multiple/base.js.map +1 -0
- package/lib/interaction/action/mask/multiple/circle.d.ts +11 -0
- package/lib/interaction/action/mask/multiple/circle.js +21 -0
- package/lib/interaction/action/mask/multiple/circle.js.map +1 -0
- package/lib/interaction/action/mask/multiple/dim-rect.d.ts +10 -0
- package/lib/interaction/action/mask/multiple/dim-rect.js +24 -0
- package/lib/interaction/action/mask/multiple/dim-rect.js.map +1 -0
- package/lib/interaction/action/mask/multiple/path.d.ts +12 -0
- package/lib/interaction/action/mask/multiple/path.js +24 -0
- package/lib/interaction/action/mask/multiple/path.js.map +1 -0
- package/lib/interaction/action/mask/multiple/rect.d.ts +16 -0
- package/lib/interaction/action/mask/multiple/rect.js +27 -0
- package/lib/interaction/action/mask/multiple/rect.js.map +1 -0
- package/lib/interaction/action/mask/multiple/smooth-path.d.ts +11 -0
- package/lib/interaction/action/mask/multiple/smooth-path.js +21 -0
- package/lib/interaction/action/mask/multiple/smooth-path.js.map +1 -0
- package/lib/interaction/action/mask/path.d.ts +9 -0
- package/lib/interaction/action/mask/path.js +30 -18
- package/lib/interaction/action/mask/path.js.map +1 -1
- package/lib/interaction/action/mask/rect.d.ts +12 -0
- package/lib/interaction/action/mask/rect.js +28 -16
- package/lib/interaction/action/mask/rect.js.map +1 -1
- package/lib/interaction/action/mask/smooth-path.d.ts +12 -0
- package/lib/interaction/action/mask/smooth-path.js +20 -3
- package/lib/interaction/action/mask/smooth-path.js.map +1 -1
- package/lib/interaction/action/register.d.ts +1 -1
- package/lib/interaction/action/util.d.ts +6 -0
- package/lib/interaction/action/util.js +115 -14
- package/lib/interaction/action/util.js.map +1 -1
- package/lib/interaction/interaction.d.ts +1 -1
- package/lib/interface.d.ts +59 -59
- package/lib/util/collision-detect.d.ts +1 -1
- package/lib/util/legend.d.ts +1 -1
- package/lib/util/text.d.ts +2 -2
- package/lib/util/types.d.ts +1 -1
- package/package.json +2 -21
- package/src/chart/controller/axis.ts +1 -1
- package/src/chart/view.ts +3 -2
- package/src/core.ts +1 -1
- package/src/index.ts +70 -0
- package/src/interaction/action/mask/circle.ts +19 -16
- package/src/interaction/action/mask/dim-rect.ts +39 -37
- package/src/interaction/action/mask/multiple/base.ts +314 -0
- package/src/interaction/action/mask/multiple/circle.ts +13 -0
- package/src/interaction/action/mask/multiple/dim-rect.ts +16 -0
- package/src/interaction/action/mask/multiple/path.ts +16 -0
- package/src/interaction/action/mask/multiple/rect.ts +19 -0
- package/src/interaction/action/mask/multiple/smooth-path.ts +13 -0
- package/src/interaction/action/mask/path.ts +28 -18
- package/src/interaction/action/mask/rect.ts +28 -17
- package/src/interaction/action/mask/smooth-path.ts +19 -3
- package/src/interaction/action/util.ts +123 -12
|
@@ -5,6 +5,43 @@ function clampPoint(point) {
|
|
|
5
5
|
point.x = clamp(point.x, 0, 1);
|
|
6
6
|
point.y = clamp(point.y, 0, 1);
|
|
7
7
|
}
|
|
8
|
+
export function getRegion(points, dim, inPlot, coord) {
|
|
9
|
+
var start = null;
|
|
10
|
+
var end = null;
|
|
11
|
+
var normalStart = coord.invert(head(points));
|
|
12
|
+
var normalEnd = coord.invert(last(points));
|
|
13
|
+
if (inPlot) {
|
|
14
|
+
// 约束到 0 - 1 范围内
|
|
15
|
+
clampPoint(normalStart);
|
|
16
|
+
clampPoint(normalEnd);
|
|
17
|
+
}
|
|
18
|
+
if (dim === 'x') {
|
|
19
|
+
// x 轴方向扩展, y 轴方向占满全部
|
|
20
|
+
start = coord.convert({
|
|
21
|
+
x: normalStart.x,
|
|
22
|
+
y: 0,
|
|
23
|
+
});
|
|
24
|
+
end = coord.convert({
|
|
25
|
+
x: normalEnd.x,
|
|
26
|
+
y: 1,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
// y 轴方向扩展, x 轴方向占满全部
|
|
31
|
+
start = coord.convert({
|
|
32
|
+
x: 0,
|
|
33
|
+
y: normalStart.y,
|
|
34
|
+
});
|
|
35
|
+
end = coord.convert({
|
|
36
|
+
x: 1,
|
|
37
|
+
y: normalEnd.y,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
start: start,
|
|
42
|
+
end: end,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
8
45
|
/**
|
|
9
46
|
* @ignore
|
|
10
47
|
*/
|
|
@@ -17,44 +54,8 @@ var DimRect = /** @class */ (function (_super) {
|
|
|
17
54
|
return _this;
|
|
18
55
|
}
|
|
19
56
|
DimRect.prototype.getRegion = function () {
|
|
20
|
-
var start = null;
|
|
21
|
-
var end = null;
|
|
22
|
-
var points = this.points;
|
|
23
|
-
var dim = this.dim;
|
|
24
57
|
var coord = this.context.view.getCoordinate();
|
|
25
|
-
|
|
26
|
-
var normalEnd = coord.invert(last(points));
|
|
27
|
-
if (this.inPlot) {
|
|
28
|
-
// 约束到 0 - 1 范围内
|
|
29
|
-
clampPoint(normalStart);
|
|
30
|
-
clampPoint(normalEnd);
|
|
31
|
-
}
|
|
32
|
-
if (dim === 'x') {
|
|
33
|
-
// x 轴方向扩展, y 轴方向占满全部
|
|
34
|
-
start = coord.convert({
|
|
35
|
-
x: normalStart.x,
|
|
36
|
-
y: 0,
|
|
37
|
-
});
|
|
38
|
-
end = coord.convert({
|
|
39
|
-
x: normalEnd.x,
|
|
40
|
-
y: 1,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
// y 轴方向扩展, x 轴方向占满全部
|
|
45
|
-
start = coord.convert({
|
|
46
|
-
x: 0,
|
|
47
|
-
y: normalStart.y,
|
|
48
|
-
});
|
|
49
|
-
end = coord.convert({
|
|
50
|
-
x: 1,
|
|
51
|
-
y: normalEnd.y,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
start: start,
|
|
56
|
-
end: end,
|
|
57
|
-
};
|
|
58
|
+
return getRegion(this.points, this.dim, this.inPlot, coord);
|
|
58
59
|
};
|
|
59
60
|
return DimRect;
|
|
60
61
|
}(RectMask));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dim-rect.js","sourceRoot":"","sources":["../../../../src/interaction/action/mask/dim-rect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,QAAQ,MAAM,QAAQ,CAAC;AAE9B,SAAS,UAAU,CAAC,KAAK;IACvB,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/B,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACjC,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"dim-rect.js","sourceRoot":"","sources":["../../../../src/interaction/action/mask/dim-rect.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,QAAQ,MAAM,QAAQ,CAAC;AAE9B,SAAS,UAAU,CAAC,KAAK;IACvB,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/B,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK;IAClD,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAA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AC,AAPD,CAAsB,QAAQ,GAO7B;AAED,eAAe,OAAO,CAAC","sourcesContent":["import { clamp, head, last } from '@antv/util';\nimport { Region } from '../../../interface';\nimport RectMask from './rect';\n\nfunction clampPoint(point) {\n point.x = clamp(point.x, 0, 1);\n point.y = clamp(point.y, 0, 1);\n}\n\nexport function getRegion(points, dim, inPlot, coord): Region {\n let start = null;\n let end = null;\n const normalStart = coord.invert(head(points));\n const normalEnd = coord.invert(last(points));\n if (inPlot) {\n // 约束到 0 - 1 范围内\n clampPoint(normalStart);\n clampPoint(normalEnd);\n }\n if (dim === 'x') {\n // x 轴方向扩展, y 轴方向占满全部\n start = coord.convert({\n x: normalStart.x,\n y: 0,\n });\n end = coord.convert({\n x: normalEnd.x,\n y: 1,\n });\n } else {\n // y 轴方向扩展, x 轴方向占满全部\n start = coord.convert({\n x: 0,\n y: normalStart.y,\n });\n end = coord.convert({\n x: 1,\n y: normalEnd.y,\n });\n }\n return {\n start,\n end,\n };\n}\n\n/**\n * @ignore\n */\nclass DimRect extends RectMask {\n protected dim = 'x';\n protected inPlot = true;\n protected getRegion() {\n const coord = this.context.view.getCoordinate();\n return getRegion(this.points, this.dim, this.inPlot, coord);\n }\n}\n\nexport default DimRect;\n"]}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import Action from '../../base';
|
|
2
|
+
import { LooseObject } from '../../../../interface';
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
* 辅助框 Action 的基类
|
|
6
|
+
*/
|
|
7
|
+
declare abstract class MultipleMaskBase extends Action {
|
|
8
|
+
protected maskShapes: any[];
|
|
9
|
+
protected starting: boolean;
|
|
10
|
+
protected moving: boolean;
|
|
11
|
+
protected recordPoints: any;
|
|
12
|
+
protected preMovePoint: any;
|
|
13
|
+
protected shapeType: string;
|
|
14
|
+
protected maskType: string;
|
|
15
|
+
/**
|
|
16
|
+
* 获取当前的位置
|
|
17
|
+
*/
|
|
18
|
+
protected getCurrentPoint(): {
|
|
19
|
+
x: any;
|
|
20
|
+
y: any;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 触发 mask 的事件
|
|
24
|
+
* @param type
|
|
25
|
+
*/
|
|
26
|
+
protected emitEvent(type: any): void;
|
|
27
|
+
/**
|
|
28
|
+
* 创建 mask
|
|
29
|
+
* @param index
|
|
30
|
+
*/
|
|
31
|
+
private createMask;
|
|
32
|
+
/**
|
|
33
|
+
* 获取 mask shape attributes
|
|
34
|
+
* @param points
|
|
35
|
+
*/
|
|
36
|
+
protected abstract getMaskAttrs(points: number[]): LooseObject;
|
|
37
|
+
/**
|
|
38
|
+
* 生成 mask 的路径
|
|
39
|
+
*/
|
|
40
|
+
protected getMaskPath(points: any): any[];
|
|
41
|
+
/**
|
|
42
|
+
* 显示
|
|
43
|
+
*/
|
|
44
|
+
show(): void;
|
|
45
|
+
/**
|
|
46
|
+
* 开始
|
|
47
|
+
*/
|
|
48
|
+
start(arg?: {
|
|
49
|
+
maskStyle: LooseObject;
|
|
50
|
+
}): void;
|
|
51
|
+
/**
|
|
52
|
+
* 开始移动
|
|
53
|
+
*/
|
|
54
|
+
moveStart(): void;
|
|
55
|
+
/**
|
|
56
|
+
* 移动 mask
|
|
57
|
+
*/
|
|
58
|
+
move(): void;
|
|
59
|
+
/**
|
|
60
|
+
* 更新
|
|
61
|
+
* @param maskStyle
|
|
62
|
+
*/
|
|
63
|
+
protected updateMask(maskStyle?: LooseObject): void;
|
|
64
|
+
/**
|
|
65
|
+
* 大小变化
|
|
66
|
+
*/
|
|
67
|
+
resize(): void;
|
|
68
|
+
/**
|
|
69
|
+
* 结束移动
|
|
70
|
+
*/
|
|
71
|
+
moveEnd(): void;
|
|
72
|
+
/**
|
|
73
|
+
* 结束
|
|
74
|
+
*/
|
|
75
|
+
end(): void;
|
|
76
|
+
/**
|
|
77
|
+
* 隐藏
|
|
78
|
+
*/
|
|
79
|
+
hide(): void;
|
|
80
|
+
/**
|
|
81
|
+
* 清除某个 mask
|
|
82
|
+
*/
|
|
83
|
+
remove(): void;
|
|
84
|
+
/**
|
|
85
|
+
* 清除全部 mask
|
|
86
|
+
*/
|
|
87
|
+
clearAll(): void;
|
|
88
|
+
/**
|
|
89
|
+
* 清除
|
|
90
|
+
*/
|
|
91
|
+
clear(): void;
|
|
92
|
+
/**
|
|
93
|
+
* 销毁
|
|
94
|
+
*/
|
|
95
|
+
destroy(): void;
|
|
96
|
+
/**
|
|
97
|
+
* 获取 mask 节点记录
|
|
98
|
+
*/
|
|
99
|
+
protected getRecordPoints(): any[];
|
|
100
|
+
/**
|
|
101
|
+
* 创建 mask 节点记录
|
|
102
|
+
*/
|
|
103
|
+
protected recordPointStart(): void;
|
|
104
|
+
/**
|
|
105
|
+
* 持续记录 mask 节点
|
|
106
|
+
*/
|
|
107
|
+
protected recordPointContinue(): void;
|
|
108
|
+
/**
|
|
109
|
+
* 清除 mask 节点 记录
|
|
110
|
+
*/
|
|
111
|
+
protected recordPointClear(): void;
|
|
112
|
+
/**
|
|
113
|
+
* 设置 capture
|
|
114
|
+
* false: 避免创建、resize 时触发事件
|
|
115
|
+
* true: 正常触发其它事件
|
|
116
|
+
* @param isCapture
|
|
117
|
+
*/
|
|
118
|
+
protected updateShapesCapture(isCapture: boolean): void;
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* @returns 获取当前 event (x, y) 所在 maskShape 的 index
|
|
122
|
+
*/
|
|
123
|
+
protected getCurMaskShapeIndex(): number;
|
|
124
|
+
}
|
|
125
|
+
export default MultipleMaskBase;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { __assign, __extends, __read, __spreadArray } from "tslib";
|
|
2
|
+
import { deepMix } from '@antv/util';
|
|
3
|
+
import Action from '../../base';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
* 辅助框 Action 的基类
|
|
7
|
+
*/
|
|
8
|
+
var MultipleMaskBase = /** @class */ (function (_super) {
|
|
9
|
+
__extends(MultipleMaskBase, _super);
|
|
10
|
+
function MultipleMaskBase() {
|
|
11
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
+
// mask 图形
|
|
13
|
+
_this.maskShapes = [];
|
|
14
|
+
// 开始 mask 的标记
|
|
15
|
+
_this.starting = false;
|
|
16
|
+
// 开始移动的标记
|
|
17
|
+
_this.moving = false;
|
|
18
|
+
// 记录 mask 节点
|
|
19
|
+
_this.recordPoints = null;
|
|
20
|
+
_this.preMovePoint = null;
|
|
21
|
+
_this.shapeType = 'path';
|
|
22
|
+
_this.maskType = 'multi-mask';
|
|
23
|
+
return _this;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 获取当前的位置
|
|
27
|
+
*/
|
|
28
|
+
MultipleMaskBase.prototype.getCurrentPoint = function () {
|
|
29
|
+
var event = this.context.event;
|
|
30
|
+
return {
|
|
31
|
+
x: event.x,
|
|
32
|
+
y: event.y,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 触发 mask 的事件
|
|
37
|
+
* @param type
|
|
38
|
+
*/
|
|
39
|
+
MultipleMaskBase.prototype.emitEvent = function (type) {
|
|
40
|
+
var eventName = "".concat(this.maskType, ":").concat(type);
|
|
41
|
+
var view = this.context.view;
|
|
42
|
+
var event = this.context.event;
|
|
43
|
+
var target = {
|
|
44
|
+
type: this.shapeType,
|
|
45
|
+
name: this.maskType,
|
|
46
|
+
get: function (key) { return (target.hasOwnProperty(key) ? target[key] : undefined); },
|
|
47
|
+
};
|
|
48
|
+
view.emit(eventName, {
|
|
49
|
+
target: target,
|
|
50
|
+
maskShapes: this.maskShapes,
|
|
51
|
+
multiPoints: this.recordPoints,
|
|
52
|
+
x: event.x,
|
|
53
|
+
y: event.y,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* 创建 mask
|
|
58
|
+
* @param index
|
|
59
|
+
*/
|
|
60
|
+
MultipleMaskBase.prototype.createMask = function (index) {
|
|
61
|
+
var view = this.context.view;
|
|
62
|
+
var points = this.recordPoints[index];
|
|
63
|
+
var maskAttrs = this.getMaskAttrs(points);
|
|
64
|
+
var maskShape = view.foregroundGroup.addShape({
|
|
65
|
+
type: this.shapeType,
|
|
66
|
+
name: 'mask',
|
|
67
|
+
draggable: true,
|
|
68
|
+
attrs: __assign({ fill: '#C5D4EB', opacity: 0.3 }, maskAttrs),
|
|
69
|
+
});
|
|
70
|
+
this.maskShapes.push(maskShape);
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* 生成 mask 的路径
|
|
74
|
+
*/
|
|
75
|
+
MultipleMaskBase.prototype.getMaskPath = function (points) {
|
|
76
|
+
return [];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* 显示
|
|
80
|
+
*/
|
|
81
|
+
MultipleMaskBase.prototype.show = function () {
|
|
82
|
+
if (this.maskShapes.length > 0) {
|
|
83
|
+
this.maskShapes.forEach(function (maskShape) { return maskShape.show(); });
|
|
84
|
+
this.emitEvent('show');
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* 开始
|
|
89
|
+
*/
|
|
90
|
+
MultipleMaskBase.prototype.start = function (arg) {
|
|
91
|
+
this.recordPointStart();
|
|
92
|
+
this.starting = true;
|
|
93
|
+
// 开始时,保证移动结束
|
|
94
|
+
this.moving = false;
|
|
95
|
+
// 开始第 index 个 mask
|
|
96
|
+
var index = this.recordPoints.length - 1;
|
|
97
|
+
this.createMask(index);
|
|
98
|
+
// 开始时设置 capture: false,可以避免创建、resize 时触发事件
|
|
99
|
+
this.updateShapesCapture(false);
|
|
100
|
+
this.updateMask(arg === null || arg === void 0 ? void 0 : arg.maskStyle);
|
|
101
|
+
this.emitEvent('start');
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* 开始移动
|
|
105
|
+
*/
|
|
106
|
+
MultipleMaskBase.prototype.moveStart = function () {
|
|
107
|
+
this.moving = true;
|
|
108
|
+
this.preMovePoint = this.getCurrentPoint();
|
|
109
|
+
this.updateShapesCapture(false);
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* 移动 mask
|
|
113
|
+
*/
|
|
114
|
+
MultipleMaskBase.prototype.move = function () {
|
|
115
|
+
if (!this.moving || this.maskShapes.length === 0) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
var currentPoint = this.getCurrentPoint();
|
|
119
|
+
var preMovePoint = this.preMovePoint;
|
|
120
|
+
var dx = currentPoint.x - preMovePoint.x;
|
|
121
|
+
var dy = currentPoint.y - preMovePoint.y;
|
|
122
|
+
// 只移动当前 event (x, y) 所在的某个 mask
|
|
123
|
+
var index = this.getCurMaskShapeIndex();
|
|
124
|
+
if (index > -1) {
|
|
125
|
+
this.recordPoints[index].forEach(function (point) {
|
|
126
|
+
point.x += dx;
|
|
127
|
+
point.y += dy;
|
|
128
|
+
});
|
|
129
|
+
this.updateMask();
|
|
130
|
+
this.emitEvent('change');
|
|
131
|
+
this.preMovePoint = currentPoint;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* 更新
|
|
136
|
+
* @param maskStyle
|
|
137
|
+
*/
|
|
138
|
+
MultipleMaskBase.prototype.updateMask = function (maskStyle) {
|
|
139
|
+
var _this = this;
|
|
140
|
+
this.recordPoints.forEach(function (points, index) {
|
|
141
|
+
var attrs = deepMix({}, _this.getMaskAttrs(points), maskStyle);
|
|
142
|
+
_this.maskShapes[index].attr(attrs);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* 大小变化
|
|
147
|
+
*/
|
|
148
|
+
MultipleMaskBase.prototype.resize = function () {
|
|
149
|
+
if (this.starting && this.maskShapes.length > 0) {
|
|
150
|
+
this.recordPointContinue();
|
|
151
|
+
this.updateMask();
|
|
152
|
+
this.emitEvent('change');
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* 结束移动
|
|
157
|
+
*/
|
|
158
|
+
MultipleMaskBase.prototype.moveEnd = function () {
|
|
159
|
+
this.moving = false;
|
|
160
|
+
this.preMovePoint = null;
|
|
161
|
+
this.updateShapesCapture(true);
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* 结束
|
|
165
|
+
*/
|
|
166
|
+
MultipleMaskBase.prototype.end = function () {
|
|
167
|
+
this.starting = false;
|
|
168
|
+
this.emitEvent('end');
|
|
169
|
+
this.updateShapesCapture(true);
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* 隐藏
|
|
173
|
+
*/
|
|
174
|
+
MultipleMaskBase.prototype.hide = function () {
|
|
175
|
+
if (this.maskShapes.length > 0) {
|
|
176
|
+
this.maskShapes.forEach(function (maskShape) { return maskShape.hide(); });
|
|
177
|
+
this.emitEvent('hide');
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* 清除某个 mask
|
|
182
|
+
*/
|
|
183
|
+
MultipleMaskBase.prototype.remove = function () {
|
|
184
|
+
var index = this.getCurMaskShapeIndex();
|
|
185
|
+
if (index > -1) {
|
|
186
|
+
// event (x, y) 在的某个 mask 区域内时,清除该 mask
|
|
187
|
+
this.recordPoints.splice(index, 1);
|
|
188
|
+
this.maskShapes[index].remove();
|
|
189
|
+
this.maskShapes.splice(index, 1);
|
|
190
|
+
this.preMovePoint = null;
|
|
191
|
+
this.updateShapesCapture(true);
|
|
192
|
+
this.emitEvent('change');
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* 清除全部 mask
|
|
197
|
+
*/
|
|
198
|
+
MultipleMaskBase.prototype.clearAll = function () {
|
|
199
|
+
this.recordPointClear();
|
|
200
|
+
this.maskShapes.forEach(function (maskShape) { return maskShape.remove(); });
|
|
201
|
+
this.maskShapes = [];
|
|
202
|
+
this.preMovePoint = null;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* 清除
|
|
206
|
+
*/
|
|
207
|
+
MultipleMaskBase.prototype.clear = function () {
|
|
208
|
+
var index = this.getCurMaskShapeIndex();
|
|
209
|
+
if (index === -1) {
|
|
210
|
+
this.recordPointClear();
|
|
211
|
+
this.maskShapes.forEach(function (maskShape) { return maskShape.remove(); });
|
|
212
|
+
this.maskShapes = [];
|
|
213
|
+
this.emitEvent('clearAll');
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.recordPoints.splice(index, 1);
|
|
217
|
+
this.maskShapes[index].remove();
|
|
218
|
+
this.maskShapes.splice(index, 1);
|
|
219
|
+
this.preMovePoint = null;
|
|
220
|
+
this.emitEvent('clearSingle');
|
|
221
|
+
}
|
|
222
|
+
this.preMovePoint = null;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* 销毁
|
|
226
|
+
*/
|
|
227
|
+
MultipleMaskBase.prototype.destroy = function () {
|
|
228
|
+
this.clear();
|
|
229
|
+
_super.prototype.destroy.call(this);
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* 获取 mask 节点记录
|
|
233
|
+
*/
|
|
234
|
+
MultipleMaskBase.prototype.getRecordPoints = function () {
|
|
235
|
+
var _a;
|
|
236
|
+
return __spreadArray([], __read(((_a = this.recordPoints) !== null && _a !== void 0 ? _a : [])), false);
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* 创建 mask 节点记录
|
|
240
|
+
*/
|
|
241
|
+
MultipleMaskBase.prototype.recordPointStart = function () {
|
|
242
|
+
var recordPoints = this.getRecordPoints();
|
|
243
|
+
var currentPoint = this.getCurrentPoint();
|
|
244
|
+
this.recordPoints = __spreadArray(__spreadArray([], __read(recordPoints), false), [[currentPoint]], false);
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* 持续记录 mask 节点
|
|
248
|
+
*/
|
|
249
|
+
MultipleMaskBase.prototype.recordPointContinue = function () {
|
|
250
|
+
var recordPoints = this.getRecordPoints();
|
|
251
|
+
var currentPoint = this.getCurrentPoint();
|
|
252
|
+
var lastPoints = recordPoints.splice(-1, 1)[0] || [];
|
|
253
|
+
lastPoints.push(currentPoint);
|
|
254
|
+
this.recordPoints = __spreadArray(__spreadArray([], __read(recordPoints), false), [lastPoints], false);
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* 清除 mask 节点 记录
|
|
258
|
+
*/
|
|
259
|
+
MultipleMaskBase.prototype.recordPointClear = function () {
|
|
260
|
+
this.recordPoints = [];
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* 设置 capture
|
|
264
|
+
* false: 避免创建、resize 时触发事件
|
|
265
|
+
* true: 正常触发其它事件
|
|
266
|
+
* @param isCapture
|
|
267
|
+
*/
|
|
268
|
+
MultipleMaskBase.prototype.updateShapesCapture = function (isCapture) {
|
|
269
|
+
this.maskShapes.forEach(function (maskShape) { return maskShape.set('capture', isCapture); });
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
*
|
|
273
|
+
* @returns 获取当前 event (x, y) 所在 maskShape 的 index
|
|
274
|
+
*/
|
|
275
|
+
MultipleMaskBase.prototype.getCurMaskShapeIndex = function () {
|
|
276
|
+
var currentPoint = this.getCurrentPoint();
|
|
277
|
+
return this.maskShapes.findIndex(function (maskShape) {
|
|
278
|
+
var _a = maskShape.attrs, width = _a.width, height = _a.height, r = _a.r;
|
|
279
|
+
var isEmpty = width === 0 || height === 0 || r === 0;
|
|
280
|
+
return !isEmpty && maskShape.isHit(currentPoint.x, currentPoint.y);
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
return MultipleMaskBase;
|
|
284
|
+
}(Action));
|
|
285
|
+
export default MultipleMaskBase;
|
|
286
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../src/interaction/action/mask/multiple/base.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,MAAM,M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AA1B;QACE,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACO,8CAAmB,GAA7B,UAA8B,SAAkB;QAC9C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,SAAS,IAAK,OAAA,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,EAAnC,CAAmC,CAAC,CAAC;IAC9E,CAAC;IAED;;;OAGG;IACO,+CAAoB,GAA9B;QACE,IAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAC,SAAS;YACnC,IAAA,KAAuB,SAAS,CAAC,KAAK,EAApC,KAAK,WAAA,EAAE,MAAM,YAAA,EAAE,CAAC,OAAoB,CAAC;YAC7C,IAAM,OAAO,GAAG,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvD,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC;IACH,uBAAC;AAAD,CAAC,AA/SD,CAAwC,MAAM,GA+S7C;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import { deepMix } from '@antv/util';\nimport Action from '../../base';\nimport { LooseObject } from '../../../../interface';\n\n/**\n * @ignore\n * 辅助框 Action 的基类\n */\nabstract class MultipleMaskBase extends Action {\n // mask 图形\n protected maskShapes = [];\n // 开始 mask 的标记\n protected starting = false;\n // 开始移动的标记\n protected moving = false;\n // 记录 mask 节点\n protected recordPoints = null;\n protected preMovePoint = null;\n protected shapeType = 'path';\n protected maskType = 'multi-mask';\n\n /**\n * 获取当前的位置\n */\n protected getCurrentPoint() {\n const event = this.context.event;\n return {\n x: event.x,\n y: event.y,\n };\n }\n\n /**\n * 触发 mask 的事件\n * @param type\n */\n protected emitEvent(type) {\n const eventName = `${this.maskType}:${type}`;\n const view = this.context.view;\n const event = this.context.event;\n const target = {\n type: this.shapeType,\n name: this.maskType,\n get: (key: string) => (target.hasOwnProperty(key) ? target[key] : undefined),\n };\n view.emit(eventName, {\n target,\n maskShapes: this.maskShapes,\n multiPoints: this.recordPoints,\n x: event.x,\n y: event.y,\n });\n }\n\n /**\n * 创建 mask\n * @param index\n */\n private createMask(index: number) {\n const view = this.context.view;\n const points = this.recordPoints[index];\n const maskAttrs = this.getMaskAttrs(points);\n const maskShape = view.foregroundGroup.addShape({\n type: this.shapeType,\n name: 'mask',\n draggable: true,\n attrs: {\n fill: '#C5D4EB',\n opacity: 0.3,\n ...maskAttrs,\n },\n });\n this.maskShapes.push(maskShape);\n }\n\n /**\n * 获取 mask shape attributes\n * @param points\n */\n protected abstract getMaskAttrs(points: number[]): LooseObject;\n\n /**\n * 生成 mask 的路径\n */\n protected getMaskPath(points) {\n return [];\n }\n\n /**\n * 显示\n */\n public show() {\n if (this.maskShapes.length > 0) {\n this.maskShapes.forEach((maskShape) => maskShape.show());\n this.emitEvent('show');\n }\n }\n\n /**\n * 开始\n */\n public start(arg?: { maskStyle: LooseObject }) {\n this.recordPointStart();\n\n this.starting = true;\n // 开始时,保证移动结束\n this.moving = false;\n // 开始第 index 个 mask\n const index = this.recordPoints.length - 1;\n this.createMask(index);\n // 开始时设置 capture: false,可以避免创建、resize 时触发事件\n this.updateShapesCapture(false);\n this.updateMask(arg?.maskStyle);\n this.emitEvent('start');\n }\n\n /**\n * 开始移动\n */\n public moveStart() {\n this.moving = true;\n this.preMovePoint = this.getCurrentPoint();\n this.updateShapesCapture(false);\n }\n\n /**\n * 移动 mask\n */\n public move() {\n if (!this.moving || this.maskShapes.length === 0) {\n return;\n }\n const currentPoint = this.getCurrentPoint();\n const preMovePoint = this.preMovePoint;\n const dx = currentPoint.x - preMovePoint.x;\n const dy = currentPoint.y - preMovePoint.y;\n\n // 只移动当前 event (x, y) 所在的某个 mask\n const index = this.getCurMaskShapeIndex();\n if (index > -1) {\n this.recordPoints[index].forEach((point) => {\n point.x += dx;\n point.y += dy;\n });\n this.updateMask();\n this.emitEvent('change');\n this.preMovePoint = currentPoint;\n }\n }\n\n /**\n * 更新\n * @param maskStyle\n */\n protected updateMask(maskStyle?: LooseObject) {\n this.recordPoints.forEach((points, index) => {\n const attrs = deepMix({}, this.getMaskAttrs(points), maskStyle);\n this.maskShapes[index].attr(attrs);\n });\n }\n\n /**\n * 大小变化\n */\n public resize() {\n if (this.starting && this.maskShapes.length > 0) {\n this.recordPointContinue();\n\n this.updateMask();\n this.emitEvent('change');\n }\n }\n\n /**\n * 结束移动\n */\n public moveEnd() {\n this.moving = false;\n this.preMovePoint = null;\n this.updateShapesCapture(true);\n }\n\n /**\n * 结束\n */\n public end() {\n this.starting = false;\n this.emitEvent('end');\n this.updateShapesCapture(true);\n }\n\n /**\n * 隐藏\n */\n public hide() {\n if (this.maskShapes.length > 0) {\n this.maskShapes.forEach((maskShape) => maskShape.hide());\n this.emitEvent('hide');\n }\n }\n\n /**\n * 清除某个 mask\n */\n public remove() {\n const index = this.getCurMaskShapeIndex();\n if (index > -1) {\n // event (x, y) 在的某个 mask 区域内时,清除该 mask\n this.recordPoints.splice(index, 1);\n this.maskShapes[index].remove();\n this.maskShapes.splice(index, 1);\n this.preMovePoint = null;\n this.updateShapesCapture(true);\n this.emitEvent('change');\n }\n }\n\n /**\n * 清除全部 mask\n */\n public clearAll() {\n this.recordPointClear();\n this.maskShapes.forEach((maskShape) => maskShape.remove());\n this.maskShapes = [];\n this.preMovePoint = null;\n }\n\n /**\n * 清除\n */\n public clear() {\n const index = this.getCurMaskShapeIndex();\n if (index === -1) {\n this.recordPointClear();\n this.maskShapes.forEach((maskShape) => maskShape.remove());\n this.maskShapes = [];\n this.emitEvent('clearAll');\n } else {\n this.recordPoints.splice(index, 1);\n this.maskShapes[index].remove();\n this.maskShapes.splice(index, 1);\n this.preMovePoint = null;\n this.emitEvent('clearSingle');\n }\n this.preMovePoint = null;\n }\n\n /**\n * 销毁\n */\n public destroy() {\n this.clear();\n super.destroy();\n }\n\n /**\n * 获取 mask 节点记录\n */\n protected getRecordPoints() {\n return [...(this.recordPoints ?? [])];\n }\n\n /**\n * 创建 mask 节点记录\n */\n protected recordPointStart() {\n const recordPoints = this.getRecordPoints();\n const currentPoint = this.getCurrentPoint();\n this.recordPoints = [...recordPoints, [currentPoint]];\n }\n\n /**\n * 持续记录 mask 节点\n */\n protected recordPointContinue() {\n const recordPoints = this.getRecordPoints();\n const currentPoint = this.getCurrentPoint();\n const lastPoints = recordPoints.splice(-1, 1)[0] || [];\n lastPoints.push(currentPoint);\n this.recordPoints = [...recordPoints, lastPoints];\n }\n\n /**\n * 清除 mask 节点 记录\n */\n protected recordPointClear() {\n this.recordPoints = [];\n }\n\n /**\n * 设置 capture\n * false: 避免创建、resize 时触发事件\n * true: 正常触发其它事件\n * @param isCapture\n */\n protected updateShapesCapture(isCapture: boolean) {\n this.maskShapes.forEach((maskShape) => maskShape.set('capture', isCapture));\n }\n\n /**\n *\n * @returns 获取当前 event (x, y) 所在 maskShape 的 index\n */\n protected getCurMaskShapeIndex() {\n const currentPoint = this.getCurrentPoint();\n return this.maskShapes.findIndex((maskShape) => {\n const { width, height, r } = maskShape.attrs;\n const isEmpty = width === 0 || height === 0 || r === 0;\n return !isEmpty && maskShape.isHit(currentPoint.x, currentPoint.y);\n });\n }\n}\n\nexport default MultipleMaskBase;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import MultipleMaskBase from './base';
|
|
2
|
+
import { getMaskAttrs } from '../circle';
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
* 圆形辅助框 Action
|
|
6
|
+
*/
|
|
7
|
+
declare class CircleMultiMask extends MultipleMaskBase {
|
|
8
|
+
protected shapeType: string;
|
|
9
|
+
protected getMaskAttrs: typeof getMaskAttrs;
|
|
10
|
+
}
|
|
11
|
+
export default CircleMultiMask;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import MultipleMaskBase from './base';
|
|
3
|
+
import { getMaskAttrs } from '../circle';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
* 圆形辅助框 Action
|
|
7
|
+
*/
|
|
8
|
+
var CircleMultiMask = /** @class */ (function (_super) {
|
|
9
|
+
__extends(CircleMultiMask, _super);
|
|
10
|
+
function CircleMultiMask() {
|
|
11
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
+
_this.shapeType = 'circle';
|
|
13
|
+
_this.getMaskAttrs = getMaskAttrs;
|
|
14
|
+
return _this;
|
|
15
|
+
}
|
|
16
|
+
return CircleMultiMask;
|
|
17
|
+
}(MultipleMaskBase));
|
|
18
|
+
export default CircleMultiMask;
|
|
19
|
+
//# sourceMappingURL=circle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle.js","sourceRoot":"","sources":["../../../../../src/interaction/action/mask/multiple/circle.ts"],"names":[],"mappings":";AAAA,OAAO,gBAAgB,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;GAGG;AACH;IAA8B,mCAAgB;IAA9C;QAAA,qEAGC;QAFW,eAAS,GAAG,QAAQ,CAAC;QACrB,kBAAY,GAAG,YAAY,CAAC;;IACxC,CAAC;IAAD,sBAAC;AAAD,CAAC,AAHD,CAA8B,gBAAgB,GAG7C;AAED,eAAe,eAAe,CAAC","sourcesContent":["import MultipleMaskBase from './base';\nimport { getMaskAttrs } from '../circle';\n\n/**\n * @ignore\n * 圆形辅助框 Action\n */\nclass CircleMultiMask extends MultipleMaskBase {\n protected shapeType = 'circle';\n protected getMaskAttrs = getMaskAttrs;\n}\n\nexport default CircleMultiMask;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import MultipleRectMask from './rect';
|
|
2
|
+
/**
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
declare class DimRectMultiMask extends MultipleRectMask {
|
|
6
|
+
protected dim: string;
|
|
7
|
+
protected inPlot: boolean;
|
|
8
|
+
protected getRegion(points: any): import("../../../../interface").Region;
|
|
9
|
+
}
|
|
10
|
+
export default DimRectMultiMask;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import MultipleRectMask from './rect';
|
|
3
|
+
import { getRegion } from '../dim-rect';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
var DimRectMultiMask = /** @class */ (function (_super) {
|
|
8
|
+
__extends(DimRectMultiMask, _super);
|
|
9
|
+
function DimRectMultiMask() {
|
|
10
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
11
|
+
_this.dim = 'x';
|
|
12
|
+
_this.inPlot = true;
|
|
13
|
+
return _this;
|
|
14
|
+
}
|
|
15
|
+
DimRectMultiMask.prototype.getRegion = function (points) {
|
|
16
|
+
var coord = this.context.view.getCoordinate();
|
|
17
|
+
return getRegion(points, this.dim, this.inPlot, coord);
|
|
18
|
+
};
|
|
19
|
+
return DimRectMultiMask;
|
|
20
|
+
}(MultipleRectMask));
|
|
21
|
+
export default DimRectMultiMask;
|
|
22
|
+
//# sourceMappingURL=dim-rect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dim-rect.js","sourceRoot":"","sources":["../../../../../src/interaction/action/mask/multiple/dim-rect.ts"],"names":[],"mappings":";AAAA,OAAO,gBAAgB,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH;IAA+B,oCAAgB;IAA/C;QAAA,qEAOC;QANW,SAAG,GAAG,GAAG,CAAC;QACV,YAAM,GAAG,IAAI,CAAC;;IAK1B,CAAC;IAJW,oCAAS,GAAnB,UAAoB,MAAM;QACxB,IAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QAChD,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IACH,uBAAC;AAAD,CAAC,AAPD,CAA+B,gBAAgB,GAO9C;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import MultipleRectMask from './rect';\nimport { getRegion } from '../dim-rect';\n\n/**\n * @ignore\n */\nclass DimRectMultiMask extends MultipleRectMask {\n protected dim = 'x';\n protected inPlot = true;\n protected getRegion(points) {\n const coord = this.context.view.getCoordinate();\n return getRegion(points, this.dim, this.inPlot, coord);\n }\n}\n\nexport default DimRectMultiMask;\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import MultipleMaskBase from './base';
|
|
2
|
+
import { getMaskAttrs, getMaskPath } from '../path';
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
* 多个点构成的 Path 辅助框 Action
|
|
6
|
+
*/
|
|
7
|
+
declare class PathMultiMask extends MultipleMaskBase {
|
|
8
|
+
protected getMaskPath: typeof getMaskPath;
|
|
9
|
+
protected getMaskAttrs: typeof getMaskAttrs;
|
|
10
|
+
addPoint(): void;
|
|
11
|
+
}
|
|
12
|
+
export default PathMultiMask;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import MultipleMaskBase from './base';
|
|
3
|
+
import { getMaskAttrs, getMaskPath } from '../path';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
* 多个点构成的 Path 辅助框 Action
|
|
7
|
+
*/
|
|
8
|
+
var PathMultiMask = /** @class */ (function (_super) {
|
|
9
|
+
__extends(PathMultiMask, _super);
|
|
10
|
+
function PathMultiMask() {
|
|
11
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
+
_this.getMaskPath = getMaskPath;
|
|
13
|
+
_this.getMaskAttrs = getMaskAttrs;
|
|
14
|
+
return _this;
|
|
15
|
+
}
|
|
16
|
+
PathMultiMask.prototype.addPoint = function () {
|
|
17
|
+
this.resize();
|
|
18
|
+
};
|
|
19
|
+
return PathMultiMask;
|
|
20
|
+
}(MultipleMaskBase));
|
|
21
|
+
export default PathMultiMask;
|
|
22
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../src/interaction/action/mask/multiple/path.ts"],"names":[],"mappings":";AAAA,OAAO,gBAAgB,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD;;;GAGG;AACH;IAA4B,iCAAgB;IAA5C;QAAA,qEAMC;QALW,iBAAW,GAAG,WAAW,CAAC;QAC1B,kBAAY,GAAG,YAAY,CAAC;;IAIxC,CAAC;IAHQ,gCAAQ,GAAf;QACE,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IACH,oBAAC;AAAD,CAAC,AAND,CAA4B,gBAAgB,GAM3C;AAED,eAAe,aAAa,CAAC","sourcesContent":["import MultipleMaskBase from './base';\nimport { getMaskAttrs, getMaskPath } from '../path';\n\n/**\n * @ignore\n * 多个点构成的 Path 辅助框 Action\n */\nclass PathMultiMask extends MultipleMaskBase {\n protected getMaskPath = getMaskPath;\n protected getMaskAttrs = getMaskAttrs;\n public addPoint() {\n this.resize();\n }\n}\n\nexport default PathMultiMask;\n"]}
|