@antv/g2 4.2.8 → 4.2.10

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.
Files changed (183) hide show
  1. package/dist/g2.min.js +2 -2
  2. package/dist/g2.min.js.map +1 -1
  3. package/esm/animate/animation/sector-path-update.js +2 -1
  4. package/esm/animate/animation/sector-path-update.js.map +1 -1
  5. package/esm/animate/animation/wave-in.js +2 -0
  6. package/esm/animate/animation/wave-in.js.map +1 -1
  7. package/esm/animate/animation/zoom.js +2 -1
  8. package/esm/animate/animation/zoom.js.map +1 -1
  9. package/esm/animate/index.js.map +1 -1
  10. package/esm/chart/controller/axis.js +2 -1
  11. package/esm/chart/controller/axis.js.map +1 -1
  12. package/esm/core.d.ts +1 -1
  13. package/esm/core.js +3 -1
  14. package/esm/core.js.map +1 -1
  15. package/esm/geometry/shape/area/index.js.map +1 -1
  16. package/esm/geometry/shape/area/line.js.map +1 -1
  17. package/esm/geometry/shape/area/smooth-line.js.map +1 -1
  18. package/esm/geometry/shape/area/smooth.js.map +1 -1
  19. package/esm/geometry/shape/base.js.map +1 -1
  20. package/esm/geometry/shape/edge/arc.js.map +1 -1
  21. package/esm/geometry/shape/edge/index.js.map +1 -1
  22. package/esm/geometry/shape/edge/smooth.js.map +1 -1
  23. package/esm/geometry/shape/edge/vhv.js.map +1 -1
  24. package/esm/geometry/shape/interval/funnel.js.map +1 -1
  25. package/esm/geometry/shape/interval/hollow-rect.js +1 -0
  26. package/esm/geometry/shape/interval/hollow-rect.js.map +1 -1
  27. package/esm/geometry/shape/interval/index.js +1 -0
  28. package/esm/geometry/shape/interval/index.js.map +1 -1
  29. package/esm/geometry/shape/interval/line.js.map +1 -1
  30. package/esm/geometry/shape/interval/pyramid.js.map +1 -1
  31. package/esm/geometry/shape/interval/tick.js.map +1 -1
  32. package/esm/geometry/shape/line/index.js.map +1 -1
  33. package/esm/geometry/shape/line/step.js.map +1 -1
  34. package/esm/geometry/shape/point/hollow.js.map +1 -1
  35. package/esm/geometry/shape/point/image.js.map +1 -1
  36. package/esm/geometry/shape/point/index.js.map +1 -1
  37. package/esm/geometry/shape/point/solid.js.map +1 -1
  38. package/esm/geometry/shape/polygon/index.js.map +1 -1
  39. package/esm/geometry/shape/polygon/square.js.map +1 -1
  40. package/esm/geometry/shape/schema/box.js.map +1 -1
  41. package/esm/geometry/shape/schema/candle.js.map +1 -1
  42. package/esm/geometry/shape/violin/hollow.js.map +1 -1
  43. package/esm/geometry/shape/violin/index.js.map +1 -1
  44. package/esm/geometry/shape/violin/smooth.js.map +1 -1
  45. package/esm/index.js +69 -2
  46. package/esm/index.js.map +1 -1
  47. package/esm/interaction/action/mask/circle.d.ts +5 -0
  48. package/esm/interaction/action/mask/circle.js +18 -16
  49. package/esm/interaction/action/mask/circle.js.map +1 -1
  50. package/esm/interaction/action/mask/dim-rect.d.ts +1 -0
  51. package/esm/interaction/action/mask/dim-rect.js +38 -37
  52. package/esm/interaction/action/mask/dim-rect.js.map +1 -1
  53. package/esm/interaction/action/mask/multiple/base.d.ts +125 -0
  54. package/esm/interaction/action/mask/multiple/base.js +286 -0
  55. package/esm/interaction/action/mask/multiple/base.js.map +1 -0
  56. package/esm/interaction/action/mask/multiple/circle.d.ts +11 -0
  57. package/esm/interaction/action/mask/multiple/circle.js +19 -0
  58. package/esm/interaction/action/mask/multiple/circle.js.map +1 -0
  59. package/esm/interaction/action/mask/multiple/dim-rect.d.ts +10 -0
  60. package/esm/interaction/action/mask/multiple/dim-rect.js +22 -0
  61. package/esm/interaction/action/mask/multiple/dim-rect.js.map +1 -0
  62. package/esm/interaction/action/mask/multiple/path.d.ts +12 -0
  63. package/esm/interaction/action/mask/multiple/path.js +22 -0
  64. package/esm/interaction/action/mask/multiple/path.js.map +1 -0
  65. package/esm/interaction/action/mask/multiple/rect.d.ts +16 -0
  66. package/esm/interaction/action/mask/multiple/rect.js +25 -0
  67. package/esm/interaction/action/mask/multiple/rect.js.map +1 -0
  68. package/esm/interaction/action/mask/multiple/smooth-path.d.ts +11 -0
  69. package/esm/interaction/action/mask/multiple/smooth-path.js +19 -0
  70. package/esm/interaction/action/mask/multiple/smooth-path.js.map +1 -0
  71. package/esm/interaction/action/mask/path.d.ts +9 -0
  72. package/esm/interaction/action/mask/path.js +27 -18
  73. package/esm/interaction/action/mask/path.js.map +1 -1
  74. package/esm/interaction/action/mask/rect.d.ts +12 -0
  75. package/esm/interaction/action/mask/rect.js +25 -16
  76. package/esm/interaction/action/mask/rect.js.map +1 -1
  77. package/esm/interaction/action/mask/smooth-path.d.ts +12 -0
  78. package/esm/interaction/action/mask/smooth-path.js +17 -3
  79. package/esm/interaction/action/mask/smooth-path.js.map +1 -1
  80. package/esm/interaction/action/util.d.ts +6 -0
  81. package/esm/interaction/action/util.js +112 -12
  82. package/esm/interaction/action/util.js.map +1 -1
  83. package/lib/animate/animation/sector-path-update.js +1 -0
  84. package/lib/animate/animation/sector-path-update.js.map +1 -1
  85. package/lib/animate/animation/wave-in.js +2 -0
  86. package/lib/animate/animation/wave-in.js.map +1 -1
  87. package/lib/animate/animation/zoom.js +1 -0
  88. package/lib/animate/animation/zoom.js.map +1 -1
  89. package/lib/animate/index.js.map +1 -1
  90. package/lib/chart/controller/axis.js +2 -1
  91. package/lib/chart/controller/axis.js.map +1 -1
  92. package/lib/core.d.ts +1 -1
  93. package/lib/core.js +9 -9
  94. package/lib/core.js.map +1 -1
  95. package/lib/geometry/shape/area/index.js.map +1 -1
  96. package/lib/geometry/shape/area/line.js.map +1 -1
  97. package/lib/geometry/shape/area/smooth-line.js.map +1 -1
  98. package/lib/geometry/shape/area/smooth.js.map +1 -1
  99. package/lib/geometry/shape/base.js.map +1 -1
  100. package/lib/geometry/shape/edge/arc.js.map +1 -1
  101. package/lib/geometry/shape/edge/index.js.map +1 -1
  102. package/lib/geometry/shape/edge/smooth.js.map +1 -1
  103. package/lib/geometry/shape/edge/vhv.js.map +1 -1
  104. package/lib/geometry/shape/interval/funnel.js.map +1 -1
  105. package/lib/geometry/shape/interval/hollow-rect.js +1 -0
  106. package/lib/geometry/shape/interval/hollow-rect.js.map +1 -1
  107. package/lib/geometry/shape/interval/index.js +1 -0
  108. package/lib/geometry/shape/interval/index.js.map +1 -1
  109. package/lib/geometry/shape/interval/line.js.map +1 -1
  110. package/lib/geometry/shape/interval/pyramid.js.map +1 -1
  111. package/lib/geometry/shape/interval/tick.js.map +1 -1
  112. package/lib/geometry/shape/line/index.js.map +1 -1
  113. package/lib/geometry/shape/line/step.js.map +1 -1
  114. package/lib/geometry/shape/point/hollow.js.map +1 -1
  115. package/lib/geometry/shape/point/image.js.map +1 -1
  116. package/lib/geometry/shape/point/index.js.map +1 -1
  117. package/lib/geometry/shape/point/solid.js.map +1 -1
  118. package/lib/geometry/shape/polygon/index.js.map +1 -1
  119. package/lib/geometry/shape/polygon/square.js.map +1 -1
  120. package/lib/geometry/shape/schema/box.js.map +1 -1
  121. package/lib/geometry/shape/schema/candle.js.map +1 -1
  122. package/lib/geometry/shape/violin/hollow.js.map +1 -1
  123. package/lib/geometry/shape/violin/index.js.map +1 -1
  124. package/lib/geometry/shape/violin/smooth.js.map +1 -1
  125. package/lib/index.js +69 -2
  126. package/lib/index.js.map +1 -1
  127. package/lib/interaction/action/mask/circle.d.ts +5 -0
  128. package/lib/interaction/action/mask/circle.js +20 -16
  129. package/lib/interaction/action/mask/circle.js.map +1 -1
  130. package/lib/interaction/action/mask/dim-rect.d.ts +1 -0
  131. package/lib/interaction/action/mask/dim-rect.js +40 -37
  132. package/lib/interaction/action/mask/dim-rect.js.map +1 -1
  133. package/lib/interaction/action/mask/multiple/base.d.ts +125 -0
  134. package/lib/interaction/action/mask/multiple/base.js +288 -0
  135. package/lib/interaction/action/mask/multiple/base.js.map +1 -0
  136. package/lib/interaction/action/mask/multiple/circle.d.ts +11 -0
  137. package/lib/interaction/action/mask/multiple/circle.js +21 -0
  138. package/lib/interaction/action/mask/multiple/circle.js.map +1 -0
  139. package/lib/interaction/action/mask/multiple/dim-rect.d.ts +10 -0
  140. package/lib/interaction/action/mask/multiple/dim-rect.js +24 -0
  141. package/lib/interaction/action/mask/multiple/dim-rect.js.map +1 -0
  142. package/lib/interaction/action/mask/multiple/path.d.ts +12 -0
  143. package/lib/interaction/action/mask/multiple/path.js +24 -0
  144. package/lib/interaction/action/mask/multiple/path.js.map +1 -0
  145. package/lib/interaction/action/mask/multiple/rect.d.ts +16 -0
  146. package/lib/interaction/action/mask/multiple/rect.js +27 -0
  147. package/lib/interaction/action/mask/multiple/rect.js.map +1 -0
  148. package/lib/interaction/action/mask/multiple/smooth-path.d.ts +11 -0
  149. package/lib/interaction/action/mask/multiple/smooth-path.js +21 -0
  150. package/lib/interaction/action/mask/multiple/smooth-path.js.map +1 -0
  151. package/lib/interaction/action/mask/path.d.ts +9 -0
  152. package/lib/interaction/action/mask/path.js +30 -18
  153. package/lib/interaction/action/mask/path.js.map +1 -1
  154. package/lib/interaction/action/mask/rect.d.ts +12 -0
  155. package/lib/interaction/action/mask/rect.js +28 -16
  156. package/lib/interaction/action/mask/rect.js.map +1 -1
  157. package/lib/interaction/action/mask/smooth-path.d.ts +12 -0
  158. package/lib/interaction/action/mask/smooth-path.js +20 -3
  159. package/lib/interaction/action/mask/smooth-path.js.map +1 -1
  160. package/lib/interaction/action/util.d.ts +6 -0
  161. package/lib/interaction/action/util.js +115 -14
  162. package/lib/interaction/action/util.js.map +1 -1
  163. package/package.json +2 -21
  164. package/src/animate/animation/sector-path-update.ts +2 -1
  165. package/src/animate/animation/wave-in.ts +2 -0
  166. package/src/animate/animation/zoom.ts +2 -1
  167. package/src/chart/controller/axis.ts +1 -1
  168. package/src/core.ts +1 -1
  169. package/src/geometry/shape/interval/hollow-rect.ts +1 -0
  170. package/src/geometry/shape/interval/index.ts +1 -0
  171. package/src/index.ts +72 -2
  172. package/src/interaction/action/mask/circle.ts +19 -16
  173. package/src/interaction/action/mask/dim-rect.ts +39 -37
  174. package/src/interaction/action/mask/multiple/base.ts +314 -0
  175. package/src/interaction/action/mask/multiple/circle.ts +13 -0
  176. package/src/interaction/action/mask/multiple/dim-rect.ts +16 -0
  177. package/src/interaction/action/mask/multiple/path.ts +16 -0
  178. package/src/interaction/action/mask/multiple/rect.ts +19 -0
  179. package/src/interaction/action/mask/multiple/smooth-path.ts +13 -0
  180. package/src/interaction/action/mask/path.ts +28 -18
  181. package/src/interaction/action/mask/rect.ts +28 -17
  182. package/src/interaction/action/mask/smooth-path.ts +19 -3
  183. package/src/interaction/action/util.ts +123 -12
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var util_1 = require("@antv/util");
5
+ var base_1 = tslib_1.__importDefault(require("../../base"));
6
+ /**
7
+ * @ignore
8
+ * 辅助框 Action 的基类
9
+ */
10
+ var MultipleMaskBase = /** @class */ (function (_super) {
11
+ tslib_1.__extends(MultipleMaskBase, _super);
12
+ function MultipleMaskBase() {
13
+ var _this = _super !== null && _super.apply(this, arguments) || this;
14
+ // mask 图形
15
+ _this.maskShapes = [];
16
+ // 开始 mask 的标记
17
+ _this.starting = false;
18
+ // 开始移动的标记
19
+ _this.moving = false;
20
+ // 记录 mask 节点
21
+ _this.recordPoints = null;
22
+ _this.preMovePoint = null;
23
+ _this.shapeType = 'path';
24
+ _this.maskType = 'multi-mask';
25
+ return _this;
26
+ }
27
+ /**
28
+ * 获取当前的位置
29
+ */
30
+ MultipleMaskBase.prototype.getCurrentPoint = function () {
31
+ var event = this.context.event;
32
+ return {
33
+ x: event.x,
34
+ y: event.y,
35
+ };
36
+ };
37
+ /**
38
+ * 触发 mask 的事件
39
+ * @param type
40
+ */
41
+ MultipleMaskBase.prototype.emitEvent = function (type) {
42
+ var eventName = "".concat(this.maskType, ":").concat(type);
43
+ var view = this.context.view;
44
+ var event = this.context.event;
45
+ var target = {
46
+ type: this.shapeType,
47
+ name: this.maskType,
48
+ get: function (key) { return (target.hasOwnProperty(key) ? target[key] : undefined); },
49
+ };
50
+ view.emit(eventName, {
51
+ target: target,
52
+ maskShapes: this.maskShapes,
53
+ multiPoints: this.recordPoints,
54
+ x: event.x,
55
+ y: event.y,
56
+ });
57
+ };
58
+ /**
59
+ * 创建 mask
60
+ * @param index
61
+ */
62
+ MultipleMaskBase.prototype.createMask = function (index) {
63
+ var view = this.context.view;
64
+ var points = this.recordPoints[index];
65
+ var maskAttrs = this.getMaskAttrs(points);
66
+ var maskShape = view.foregroundGroup.addShape({
67
+ type: this.shapeType,
68
+ name: 'mask',
69
+ draggable: true,
70
+ attrs: tslib_1.__assign({ fill: '#C5D4EB', opacity: 0.3 }, maskAttrs),
71
+ });
72
+ this.maskShapes.push(maskShape);
73
+ };
74
+ /**
75
+ * 生成 mask 的路径
76
+ */
77
+ MultipleMaskBase.prototype.getMaskPath = function (points) {
78
+ return [];
79
+ };
80
+ /**
81
+ * 显示
82
+ */
83
+ MultipleMaskBase.prototype.show = function () {
84
+ if (this.maskShapes.length > 0) {
85
+ this.maskShapes.forEach(function (maskShape) { return maskShape.show(); });
86
+ this.emitEvent('show');
87
+ }
88
+ };
89
+ /**
90
+ * 开始
91
+ */
92
+ MultipleMaskBase.prototype.start = function (arg) {
93
+ this.recordPointStart();
94
+ this.starting = true;
95
+ // 开始时,保证移动结束
96
+ this.moving = false;
97
+ // 开始第 index 个 mask
98
+ var index = this.recordPoints.length - 1;
99
+ this.createMask(index);
100
+ // 开始时设置 capture: false,可以避免创建、resize 时触发事件
101
+ this.updateShapesCapture(false);
102
+ this.updateMask(arg === null || arg === void 0 ? void 0 : arg.maskStyle);
103
+ this.emitEvent('start');
104
+ };
105
+ /**
106
+ * 开始移动
107
+ */
108
+ MultipleMaskBase.prototype.moveStart = function () {
109
+ this.moving = true;
110
+ this.preMovePoint = this.getCurrentPoint();
111
+ this.updateShapesCapture(false);
112
+ };
113
+ /**
114
+ * 移动 mask
115
+ */
116
+ MultipleMaskBase.prototype.move = function () {
117
+ if (!this.moving || this.maskShapes.length === 0) {
118
+ return;
119
+ }
120
+ var currentPoint = this.getCurrentPoint();
121
+ var preMovePoint = this.preMovePoint;
122
+ var dx = currentPoint.x - preMovePoint.x;
123
+ var dy = currentPoint.y - preMovePoint.y;
124
+ // 只移动当前 event (x, y) 所在的某个 mask
125
+ var index = this.getCurMaskShapeIndex();
126
+ if (index > -1) {
127
+ this.recordPoints[index].forEach(function (point) {
128
+ point.x += dx;
129
+ point.y += dy;
130
+ });
131
+ this.updateMask();
132
+ this.emitEvent('change');
133
+ this.preMovePoint = currentPoint;
134
+ }
135
+ };
136
+ /**
137
+ * 更新
138
+ * @param maskStyle
139
+ */
140
+ MultipleMaskBase.prototype.updateMask = function (maskStyle) {
141
+ var _this = this;
142
+ this.recordPoints.forEach(function (points, index) {
143
+ var attrs = (0, util_1.deepMix)({}, _this.getMaskAttrs(points), maskStyle);
144
+ _this.maskShapes[index].attr(attrs);
145
+ });
146
+ };
147
+ /**
148
+ * 大小变化
149
+ */
150
+ MultipleMaskBase.prototype.resize = function () {
151
+ if (this.starting && this.maskShapes.length > 0) {
152
+ this.recordPointContinue();
153
+ this.updateMask();
154
+ this.emitEvent('change');
155
+ }
156
+ };
157
+ /**
158
+ * 结束移动
159
+ */
160
+ MultipleMaskBase.prototype.moveEnd = function () {
161
+ this.moving = false;
162
+ this.preMovePoint = null;
163
+ this.updateShapesCapture(true);
164
+ };
165
+ /**
166
+ * 结束
167
+ */
168
+ MultipleMaskBase.prototype.end = function () {
169
+ this.starting = false;
170
+ this.emitEvent('end');
171
+ this.updateShapesCapture(true);
172
+ };
173
+ /**
174
+ * 隐藏
175
+ */
176
+ MultipleMaskBase.prototype.hide = function () {
177
+ if (this.maskShapes.length > 0) {
178
+ this.maskShapes.forEach(function (maskShape) { return maskShape.hide(); });
179
+ this.emitEvent('hide');
180
+ }
181
+ };
182
+ /**
183
+ * 清除某个 mask
184
+ */
185
+ MultipleMaskBase.prototype.remove = function () {
186
+ var index = this.getCurMaskShapeIndex();
187
+ if (index > -1) {
188
+ // event (x, y) 在的某个 mask 区域内时,清除该 mask
189
+ this.recordPoints.splice(index, 1);
190
+ this.maskShapes[index].remove();
191
+ this.maskShapes.splice(index, 1);
192
+ this.preMovePoint = null;
193
+ this.updateShapesCapture(true);
194
+ this.emitEvent('change');
195
+ }
196
+ };
197
+ /**
198
+ * 清除全部 mask
199
+ */
200
+ MultipleMaskBase.prototype.clearAll = function () {
201
+ this.recordPointClear();
202
+ this.maskShapes.forEach(function (maskShape) { return maskShape.remove(); });
203
+ this.maskShapes = [];
204
+ this.preMovePoint = null;
205
+ };
206
+ /**
207
+ * 清除
208
+ */
209
+ MultipleMaskBase.prototype.clear = function () {
210
+ var index = this.getCurMaskShapeIndex();
211
+ if (index === -1) {
212
+ this.recordPointClear();
213
+ this.maskShapes.forEach(function (maskShape) { return maskShape.remove(); });
214
+ this.maskShapes = [];
215
+ this.emitEvent('clearAll');
216
+ }
217
+ else {
218
+ this.recordPoints.splice(index, 1);
219
+ this.maskShapes[index].remove();
220
+ this.maskShapes.splice(index, 1);
221
+ this.preMovePoint = null;
222
+ this.emitEvent('clearSingle');
223
+ }
224
+ this.preMovePoint = null;
225
+ };
226
+ /**
227
+ * 销毁
228
+ */
229
+ MultipleMaskBase.prototype.destroy = function () {
230
+ this.clear();
231
+ _super.prototype.destroy.call(this);
232
+ };
233
+ /**
234
+ * 获取 mask 节点记录
235
+ */
236
+ MultipleMaskBase.prototype.getRecordPoints = function () {
237
+ var _a;
238
+ return tslib_1.__spreadArray([], tslib_1.__read(((_a = this.recordPoints) !== null && _a !== void 0 ? _a : [])), false);
239
+ };
240
+ /**
241
+ * 创建 mask 节点记录
242
+ */
243
+ MultipleMaskBase.prototype.recordPointStart = function () {
244
+ var recordPoints = this.getRecordPoints();
245
+ var currentPoint = this.getCurrentPoint();
246
+ this.recordPoints = tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(recordPoints), false), [[currentPoint]], false);
247
+ };
248
+ /**
249
+ * 持续记录 mask 节点
250
+ */
251
+ MultipleMaskBase.prototype.recordPointContinue = function () {
252
+ var recordPoints = this.getRecordPoints();
253
+ var currentPoint = this.getCurrentPoint();
254
+ var lastPoints = recordPoints.splice(-1, 1)[0] || [];
255
+ lastPoints.push(currentPoint);
256
+ this.recordPoints = tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(recordPoints), false), [lastPoints], false);
257
+ };
258
+ /**
259
+ * 清除 mask 节点 记录
260
+ */
261
+ MultipleMaskBase.prototype.recordPointClear = function () {
262
+ this.recordPoints = [];
263
+ };
264
+ /**
265
+ * 设置 capture
266
+ * false: 避免创建、resize 时触发事件
267
+ * true: 正常触发其它事件
268
+ * @param isCapture
269
+ */
270
+ MultipleMaskBase.prototype.updateShapesCapture = function (isCapture) {
271
+ this.maskShapes.forEach(function (maskShape) { return maskShape.set('capture', isCapture); });
272
+ };
273
+ /**
274
+ *
275
+ * @returns 获取当前 event (x, y) 所在 maskShape 的 index
276
+ */
277
+ MultipleMaskBase.prototype.getCurMaskShapeIndex = function () {
278
+ var currentPoint = this.getCurrentPoint();
279
+ return this.maskShapes.findIndex(function (maskShape) {
280
+ var _a = maskShape.attrs, width = _a.width, height = _a.height, r = _a.r;
281
+ var isEmpty = width === 0 || height === 0 || r === 0;
282
+ return !isEmpty && maskShape.isHit(currentPoint.x, currentPoint.y);
283
+ });
284
+ };
285
+ return MultipleMaskBase;
286
+ }(base_1.default));
287
+ exports.default = MultipleMaskBase;
288
+ //# 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,mCAAqC;AACrC,4DAAgC;AAGhC;;;GAGG;AACH;IAAwC,4CAAM;IAA9C;QAAA,qEA+SC;QA9SC,UAAU;QACA,gBAAU,GAAG,EAAE,CAAC;QAC1B,cAAc;QACJ,cAAQ,GAAG,KAAK,CAAC;QAC3B,UAAU;QACA,YAAM,GAAG,KAAK,C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AG,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,cAAM,GA+S7C;AAED,kBAAe,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,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var base_1 = tslib_1.__importDefault(require("./base"));
5
+ var circle_1 = require("../circle");
6
+ /**
7
+ * @ignore
8
+ * 圆形辅助框 Action
9
+ */
10
+ var CircleMultiMask = /** @class */ (function (_super) {
11
+ tslib_1.__extends(CircleMultiMask, _super);
12
+ function CircleMultiMask() {
13
+ var _this = _super !== null && _super.apply(this, arguments) || this;
14
+ _this.shapeType = 'circle';
15
+ _this.getMaskAttrs = circle_1.getMaskAttrs;
16
+ return _this;
17
+ }
18
+ return CircleMultiMask;
19
+ }(base_1.default));
20
+ exports.default = CircleMultiMask;
21
+ //# 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,wDAAsC;AACtC,oCAAyC;AAEzC;;;GAGG;AACH;IAA8B,2CAAgB;IAA9C;QAAA,qEAGC;QAFW,eAAS,GAAG,QAAQ,CAAC;QACrB,kBAAY,GAAG,qBAAY,CAAC;;IACxC,CAAC;IAAD,sBAAC;AAAD,CAAC,AAHD,CAA8B,cAAgB,GAG7C;AAED,kBAAe,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,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var rect_1 = tslib_1.__importDefault(require("./rect"));
5
+ var dim_rect_1 = require("../dim-rect");
6
+ /**
7
+ * @ignore
8
+ */
9
+ var DimRectMultiMask = /** @class */ (function (_super) {
10
+ tslib_1.__extends(DimRectMultiMask, _super);
11
+ function DimRectMultiMask() {
12
+ var _this = _super !== null && _super.apply(this, arguments) || this;
13
+ _this.dim = 'x';
14
+ _this.inPlot = true;
15
+ return _this;
16
+ }
17
+ DimRectMultiMask.prototype.getRegion = function (points) {
18
+ var coord = this.context.view.getCoordinate();
19
+ return (0, dim_rect_1.getRegion)(points, this.dim, this.inPlot, coord);
20
+ };
21
+ return DimRectMultiMask;
22
+ }(rect_1.default));
23
+ exports.default = DimRectMultiMask;
24
+ //# 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,wDAAsC;AACtC,wCAAwC;AAExC;;GAEG;AACH;IAA+B,4CAAgB;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,IAAA,oBAAS,EAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IACH,uBAAC;AAAD,CAAC,AAPD,CAA+B,cAAgB,GAO9C;AAED,kBAAe,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,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var base_1 = tslib_1.__importDefault(require("./base"));
5
+ var path_1 = require("../path");
6
+ /**
7
+ * @ignore
8
+ * 多个点构成的 Path 辅助框 Action
9
+ */
10
+ var PathMultiMask = /** @class */ (function (_super) {
11
+ tslib_1.__extends(PathMultiMask, _super);
12
+ function PathMultiMask() {
13
+ var _this = _super !== null && _super.apply(this, arguments) || this;
14
+ _this.getMaskPath = path_1.getMaskPath;
15
+ _this.getMaskAttrs = path_1.getMaskAttrs;
16
+ return _this;
17
+ }
18
+ PathMultiMask.prototype.addPoint = function () {
19
+ this.resize();
20
+ };
21
+ return PathMultiMask;
22
+ }(base_1.default));
23
+ exports.default = PathMultiMask;
24
+ //# 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,wDAAsC;AACtC,gCAAoD;AAEpD;;;GAGG;AACH;IAA4B,yCAAgB;IAA5C;QAAA,qEAMC;QALW,iBAAW,GAAG,kBAAW,CAAC;QAC1B,kBAAY,GAAG,mBAAY,CAAC;;IAIxC,CAAC;IAHQ,gCAAQ,GAAf;QACE,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IACH,oBAAC;AAAD,CAAC,AAND,CAA4B,cAAgB,GAM3C;AAED,kBAAe,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"]}
@@ -0,0 +1,16 @@
1
+ import MultipleMaskBase from './base';
2
+ /**
3
+ * @ignore
4
+ * 矩形的辅助框 Action
5
+ */
6
+ declare class RectMultiMask extends MultipleMaskBase {
7
+ protected shapeType: string;
8
+ protected getRegion(points: any): import("../../../../interface").Region;
9
+ protected getMaskAttrs(points: any): {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ };
15
+ }
16
+ export default RectMultiMask;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var base_1 = tslib_1.__importDefault(require("./base"));
5
+ var rect_1 = require("../rect");
6
+ /**
7
+ * @ignore
8
+ * 矩形的辅助框 Action
9
+ */
10
+ var RectMultiMask = /** @class */ (function (_super) {
11
+ tslib_1.__extends(RectMultiMask, _super);
12
+ function RectMultiMask() {
13
+ var _this = _super !== null && _super.apply(this, arguments) || this;
14
+ _this.shapeType = 'rect';
15
+ return _this;
16
+ }
17
+ RectMultiMask.prototype.getRegion = function (points) {
18
+ return (0, rect_1.getRegion)(points);
19
+ };
20
+ RectMultiMask.prototype.getMaskAttrs = function (points) {
21
+ var _a = this.getRegion(points), start = _a.start, end = _a.end;
22
+ return (0, rect_1.getMaskAttrs)(start, end);
23
+ };
24
+ return RectMultiMask;
25
+ }(base_1.default));
26
+ exports.default = RectMultiMask;
27
+ //# sourceMappingURL=rect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../../../src/interaction/action/mask/multiple/rect.ts"],"names":[],"mappings":";;;AAAA,wDAAsC;AACtC,gCAAkD;AAElD;;;GAGG;AACH;IAA4B,yCAAgB;IAA5C;QAAA,qEASC;QARW,eAAS,GAAG,MAAM,CAAC;;IAQ/B,CAAC;IAPW,iCAAS,GAAnB,UAAoB,MAAM;QACxB,OAAO,IAAA,gBAAS,EAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IACS,oCAAY,GAAtB,UAAuB,MAAM;QACrB,IAAA,KAAiB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAArC,KAAK,WAAA,EAAE,GAAG,SAA2B,CAAC;QAC9C,OAAO,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IACH,oBAAC;AAAD,CAAC,AATD,CAA4B,cAAgB,GAS3C;AAED,kBAAe,aAAa,CAAC","sourcesContent":["import MultipleMaskBase from './base';\nimport { getRegion, getMaskAttrs } from '../rect';\n\n/**\n * @ignore\n * 矩形的辅助框 Action\n */\nclass RectMultiMask extends MultipleMaskBase {\n protected shapeType = 'rect';\n protected getRegion(points) {\n return getRegion(points);\n }\n protected getMaskAttrs(points) {\n const { start, end } = this.getRegion(points);\n return getMaskAttrs(start, end);\n }\n}\n\nexport default RectMultiMask;\n"]}
@@ -0,0 +1,11 @@
1
+ import MultiplePathMask from './path';
2
+ import { getMaskPath, getMaskAttrs } from '../smooth-path';
3
+ /**
4
+ * Smooth path mask
5
+ * @ignore
6
+ */
7
+ declare class SmoothPathMultiMask extends MultiplePathMask {
8
+ protected getMaskPath: typeof getMaskPath;
9
+ protected getMaskAttrs: typeof getMaskAttrs;
10
+ }
11
+ export default SmoothPathMultiMask;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var path_1 = tslib_1.__importDefault(require("./path"));
5
+ var smooth_path_1 = require("../smooth-path");
6
+ /**
7
+ * Smooth path mask
8
+ * @ignore
9
+ */
10
+ var SmoothPathMultiMask = /** @class */ (function (_super) {
11
+ tslib_1.__extends(SmoothPathMultiMask, _super);
12
+ function SmoothPathMultiMask() {
13
+ var _this = _super !== null && _super.apply(this, arguments) || this;
14
+ _this.getMaskPath = smooth_path_1.getMaskPath;
15
+ _this.getMaskAttrs = smooth_path_1.getMaskAttrs;
16
+ return _this;
17
+ }
18
+ return SmoothPathMultiMask;
19
+ }(path_1.default));
20
+ exports.default = SmoothPathMultiMask;
21
+ //# sourceMappingURL=smooth-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smooth-path.js","sourceRoot":"","sources":["../../../../../src/interaction/action/mask/multiple/smooth-path.ts"],"names":[],"mappings":";;;AAAA,wDAAsC;AACtC,8CAA2D;AAE3D;;;GAGG;AACH;IAAkC,+CAAgB;IAAlD;QAAA,qEAGC;QAFW,iBAAW,GAAG,yBAAW,CAAC;QAC1B,kBAAY,GAAG,0BAAY,CAAC;;IACxC,CAAC;IAAD,0BAAC;AAAD,CAAC,AAHD,CAAkC,cAAgB,GAGjD;AAED,kBAAe,mBAAmB,CAAC","sourcesContent":["import MultiplePathMask from './path';\nimport { getMaskPath, getMaskAttrs } from '../smooth-path';\n\n/**\n * Smooth path mask\n * @ignore\n */\nclass SmoothPathMultiMask extends MultiplePathMask {\n protected getMaskPath = getMaskPath;\n protected getMaskAttrs = getMaskAttrs;\n}\n\nexport default SmoothPathMultiMask;\n"]}
@@ -1,4 +1,13 @@
1
1
  import MaskBase from './base';
2
+ /**
3
+ * 生成 mask 的路径
4
+ * @param points
5
+ * @returns
6
+ */
7
+ export declare function getMaskPath(points: any): any[];
8
+ export declare function getMaskAttrs(points: any): {
9
+ path: any[];
10
+ };
2
11
  /**
3
12
  * @ignore
4
13
  * 多个点构成的 Path 辅助框 Action
@@ -1,8 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMaskAttrs = exports.getMaskPath = void 0;
3
4
  var tslib_1 = require("tslib");
4
5
  var util_1 = require("@antv/util");
5
6
  var base_1 = tslib_1.__importDefault(require("./base"));
7
+ /**
8
+ * 生成 mask 的路径
9
+ * @param points
10
+ * @returns
11
+ */
12
+ function getMaskPath(points) {
13
+ var path = [];
14
+ if (points.length) {
15
+ (0, util_1.each)(points, function (point, index) {
16
+ if (index === 0) {
17
+ path.push(['M', point.x, point.y]);
18
+ }
19
+ else {
20
+ path.push(['L', point.x, point.y]);
21
+ }
22
+ });
23
+ path.push(['L', points[0].x, points[0].y]);
24
+ }
25
+ return path;
26
+ }
27
+ exports.getMaskPath = getMaskPath;
28
+ function getMaskAttrs(points) {
29
+ return {
30
+ path: getMaskPath(points),
31
+ };
32
+ }
33
+ exports.getMaskAttrs = getMaskAttrs;
6
34
  /**
7
35
  * @ignore
8
36
  * 多个点构成的 Path 辅助框 Action
@@ -12,27 +40,11 @@ var PathMask = /** @class */ (function (_super) {
12
40
  function PathMask() {
13
41
  return _super !== null && _super.apply(this, arguments) || this;
14
42
  }
15
- // 生成 mask 的路径
16
43
  PathMask.prototype.getMaskPath = function () {
17
- var points = this.points;
18
- var path = [];
19
- if (points.length) {
20
- (0, util_1.each)(points, function (point, index) {
21
- if (index === 0) {
22
- path.push(['M', point.x, point.y]);
23
- }
24
- else {
25
- path.push(['L', point.x, point.y]);
26
- }
27
- });
28
- path.push(['L', points[0].x, points[0].y]);
29
- }
30
- return path;
44
+ return getMaskPath(this.points);
31
45
  };
32
46
  PathMask.prototype.getMaskAttrs = function () {
33
- return {
34
- path: this.getMaskPath(),
35
- };
47
+ return getMaskAttrs(this.points);
36
48
  };
37
49
  /**
38
50
  * 添加一个点
@@ -1 +1 @@
1
- {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../src/interaction/action/mask/path.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAClC,wDAA8B;AAE9B;;;GAGG;AACH;IAAuB,oCAAQ;IAA/B;;IA8BA,CAAC;IA7BC,cAAc;IACJ,8BAAW,GAArB;QACE,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAM,IAAI,GAAG,EAAE,CAAC;QAChB,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,IAAA,WAAI,EAAC,MAAM,EAAE,UAAC,KAAK,EAAE,KAAK;gBACxB,IAAI,KAAK,KAAK,CAAC,EAAE;oBACf,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpC;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpC;YACH,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5C;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAES,+BAAY,GAAtB;QACE,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE;SACzB,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,2BAAQ,GAAf;QACE,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IACH,eAAC;AAAD,CAAC,AA9BD,CAAuB,cAAQ,GA8B9B;AAED,kBAAe,QAAQ,CAAC","sourcesContent":["import { each } from '@antv/util';\nimport MaskBase from './base';\n\n/**\n * @ignore\n * 多个点构成的 Path 辅助框 Action\n */\nclass PathMask extends MaskBase {\n // 生成 mask 的路径\n protected getMaskPath() {\n const points = this.points;\n const path = [];\n if (points.length) {\n each(points, (point, index) => {\n if (index === 0) {\n path.push(['M', point.x, point.y]);\n } else {\n path.push(['L', point.x, point.y]);\n }\n });\n path.push(['L', points[0].x, points[0].y]);\n }\n return path;\n }\n\n protected getMaskAttrs() {\n return {\n path: this.getMaskPath(),\n };\n }\n\n /**\n * 添加一个点\n */\n public addPoint() {\n this.resize();\n }\n}\n\nexport default PathMask;\n"]}
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../src/interaction/action/mask/path.ts"],"names":[],"mappings":";;;;AAAA,mCAAkC;AAClC,wDAA8B;AAE9B;;;;GAIG;AACH,SAAgB,WAAW,CAAC,MAAM;IAChC,IAAM,IAAI,GAAG,EAAE,CAAC;IAChB,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,IAAA,WAAI,EAAC,MAAM,EAAE,UAAC,KAAK,EAAE,KAAK;YACxB,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACpC;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACpC;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5C;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAbD,kCAaC;AAED,SAAgB,YAAY,CAAC,MAAM;IACjC,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC;KAC1B,CAAC;AACJ,CAAC;AAJD,oCAIC;AAED;;;GAGG;AACH;IAAuB,oCAAQ;IAA/B;;IAcA,CAAC;IAbW,8BAAW,GAArB;QACE,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IACS,+BAAY,GAAtB;QACE,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,2BAAQ,GAAf;QACE,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IACH,eAAC;AAAD,CAAC,AAdD,CAAuB,cAAQ,GAc9B;AAED,kBAAe,QAAQ,CAAC","sourcesContent":["import { each } from '@antv/util';\nimport MaskBase from './base';\n\n/**\n * 生成 mask 的路径\n * @param points\n * @returns\n */\nexport function getMaskPath(points) {\n const path = [];\n if (points.length) {\n each(points, (point, index) => {\n if (index === 0) {\n path.push(['M', point.x, point.y]);\n } else {\n path.push(['L', point.x, point.y]);\n }\n });\n path.push(['L', points[0].x, points[0].y]);\n }\n return path;\n}\n\nexport function getMaskAttrs(points) {\n return {\n path: getMaskPath(points),\n };\n}\n\n/**\n * @ignore\n * 多个点构成的 Path 辅助框 Action\n */\nclass PathMask extends MaskBase {\n protected getMaskPath() {\n return getMaskPath(this.points);\n }\n protected getMaskAttrs() {\n return getMaskAttrs(this.points);\n }\n\n /**\n * 添加一个点\n */\n public addPoint() {\n this.resize();\n }\n}\n\nexport default PathMask;\n"]}
@@ -1,5 +1,17 @@
1
1
  import { Region } from '../../../interface';
2
2
  import MaskBase from './base';
3
+ export declare function getRegion(points: any): Region;
4
+ /**
5
+ * 添加图形
6
+ * @param points
7
+ * @returns
8
+ */
9
+ export declare function getMaskAttrs(start: any, end: any): {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ };
3
15
  /**
4
16
  * @ignore
5
17
  * 矩形的辅助框 Action