@antv/component 0.9.1 → 0.9.2
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/esm/slider/constant.d.ts +7 -5
- package/esm/slider/constant.js +7 -5
- package/esm/slider/constant.js.map +1 -1
- package/esm/slider/foreground.d.ts +8 -1
- package/esm/slider/foreground.js +13 -15
- package/esm/slider/foreground.js.map +1 -1
- package/esm/slider/slider.d.ts +13 -0
- package/esm/slider/slider.js +58 -39
- package/esm/slider/slider.js.map +1 -1
- package/esm/util/event.d.ts +2 -2
- package/esm/util/event.js +1 -2
- package/esm/util/event.js.map +1 -1
- package/esm/util/mask.js +0 -8
- package/esm/util/mask.js.map +1 -1
- package/esm/util/util.d.ts +4 -1
- package/esm/util/util.js +5 -2
- package/esm/util/util.js.map +1 -1
- package/lib/slider/constant.d.ts +7 -5
- package/lib/slider/constant.js +8 -6
- package/lib/slider/constant.js.map +1 -1
- package/lib/slider/foreground.d.ts +8 -1
- package/lib/slider/foreground.js +12 -14
- package/lib/slider/foreground.js.map +1 -1
- package/lib/slider/slider.d.ts +13 -0
- package/lib/slider/slider.js +56 -37
- package/lib/slider/slider.js.map +1 -1
- package/lib/util/event.d.ts +2 -2
- package/lib/util/event.js +1 -2
- package/lib/util/event.js.map +1 -1
- package/lib/util/mask.js +0 -8
- package/lib/util/mask.js.map +1 -1
- package/lib/util/util.d.ts +4 -1
- package/lib/util/util.js +7 -4
- package/lib/util/util.js.map +1 -1
- package/package.json +1 -1
- package/src/slider/constant.ts +7 -8
- package/src/slider/foreground.ts +14 -21
- package/src/slider/slider.ts +56 -35
- package/src/util/event.ts +2 -3
- package/src/util/mask.ts +1 -10
- package/src/util/util.ts +5 -2
package/src/util/mask.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IGroup, IShape, LooseObject, Point } from '@antv/g-base';
|
|
2
2
|
|
|
3
3
|
export function createMask(group: IGroup, maskType: string, maskAttrs: LooseObject) {
|
|
4
4
|
const maskShape = group.addShape({
|
|
@@ -18,15 +18,6 @@ export function updateMask(shape: IShape, maskAttrs: LooseObject) {
|
|
|
18
18
|
return shape;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// export function overBBoxLimit(bbox: BBox, curPoint: Point) {
|
|
22
|
-
// const { minX, maxX, minY, maxY } = bbox;
|
|
23
|
-
// const { x, y } = curPoint;
|
|
24
|
-
// if (Math.min(minX, maxX) > x || Math.max(minX, maxX) < x || Math.min(minY, maxY) > y || Math.max(minY, maxY) < y) {
|
|
25
|
-
// return true;
|
|
26
|
-
// }
|
|
27
|
-
// return false;
|
|
28
|
-
// }
|
|
29
|
-
|
|
30
21
|
export function getRectMaskAttrs(start: Point, end: Point) {
|
|
31
22
|
const x = Math.min(start.x, end.x);
|
|
32
23
|
const y = Math.min(start.y, end.y);
|
package/src/util/util.ts
CHANGED
|
@@ -265,7 +265,10 @@ export function getTextWidth(text: string, font: string) {
|
|
|
265
265
|
return width;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
/**
|
|
269
|
+
* @description 文字超出最大宽度时,换行处理
|
|
270
|
+
*/
|
|
271
|
+
export function clipTextTwoLines(str: string, maxWidth: number, font: string) {
|
|
269
272
|
// 日期字段根据空格拆为两组:'2022-10-12 08:23' => ['2022-10-12', '08:23']
|
|
270
273
|
if (Date.parse(str)) {
|
|
271
274
|
return str.split(' ').join('\n');
|
|
@@ -274,7 +277,7 @@ export function clipText(str: string, maxWidth: number, font: string) {
|
|
|
274
277
|
function mapStr(str: string, callback: (i: number) => void) {
|
|
275
278
|
for (let i = 0; i < str.length; i++) {
|
|
276
279
|
const curStr = str.slice(0, i + 1);
|
|
277
|
-
const curWidth = getTextWidth(curStr,
|
|
280
|
+
const curWidth = getTextWidth(curStr, font);
|
|
278
281
|
if (curWidth > maxWidth) {
|
|
279
282
|
callback(i);
|
|
280
283
|
return;
|