@visactor/vrender-components 0.18.7-alpha.0 → 0.18.7-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.
@@ -4,13 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.autoLimit = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), util_1 = require("./util");
7
+ const vutils_1 = require("@visactor/vutils");
8
8
 
9
9
  function autoLimit(labels, config) {
10
10
  const {limitLength: limitLength, verticalLimitLength: verticalLimitLength, ellipsis: ellipsis = "...", orient: orient, axisLength: axisLength} = config;
11
11
  !(0, vutils_1.isEmpty)(labels) && (0, vutils_1.isValidNumber)(limitLength) && labels.forEach((label => {
12
12
  var _a;
13
- const angle = label.attribute.angle, hasAngle = !(0, vutils_1.isNil)(angle), isHorizontal = !hasAngle || 0 === angle || angle === Math.PI, isVertical = hasAngle && (angle === Math.PI / 2 || angle === 2 * Math.PI / 3), isX = "top" === orient || "bottom" === orient;
13
+ const angle = label.attribute.angle, hasAngle = !(0, vutils_1.isNil)(angle), cos = hasAngle ? Math.cos(angle) : 1, sin = hasAngle ? Math.sin(angle) : 0, isHorizontal = !hasAngle || (0,
14
+ vutils_1.isNumberClose)(sin, 0), isVertical = hasAngle && (0, vutils_1.isNumberClose)(cos, 0), isX = "top" === orient || "bottom" === orient;
14
15
  if (isX) {
15
16
  if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) return;
16
17
  if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) return;
@@ -24,21 +25,15 @@ function autoLimit(labels, config) {
24
25
  }
25
26
  }
26
27
  let limitLabelLength = null;
27
- if (isHorizontal || isVertical) limitLabelLength = isX || "vertical" === direction ? verticalLimitLength : limitLength; else {
28
- const {x1: x, y1: y} = label.AABBBounds, width = isX ? axisLength : limitLength, height = isX ? limitLength : axisLength, intersection = (0,
29
- util_1.borderPoint)({
30
- width: width,
31
- height: height,
32
- left: 0,
33
- top: 0
34
- }, {
35
- x: x,
36
- y: y
37
- }, label.attribute.angle);
38
- if (intersection) {
39
- const {x: _x, y: _y} = intersection;
40
- limitLabelLength = Math.floor(Math.sqrt((_x - x) ** 2 + (_y - y) ** 2));
41
- } else limitLabelLength = Math.abs(limitLength / Math.sin(angle));
28
+ if (isHorizontal || isVertical) limitLabelLength = isX ? isHorizontal ? verticalLimitLength : limitLength : "vertical" === direction || isVertical ? verticalLimitLength : limitLength; else {
29
+ const cos = Math.cos(angle), sin = Math.sin(angle);
30
+ if (isX) {
31
+ const {x1: x1, x2: x2} = label.AABBBounds;
32
+ limitLabelLength = cos > 0 && x1 <= axisLength && cos * limitLength / Math.abs(sin) + x1 > axisLength ? (axisLength - x1) / cos : cos < 0 && x2 >= 0 && cos * limitLength / Math.abs(sin) + x2 < 0 ? -x2 / cos : Math.abs(limitLength / sin);
33
+ } else {
34
+ const {y1: y1, y2: y2} = label.AABBBounds;
35
+ limitLabelLength = sin > 0 && y2 >= 0 && y2 - sin * limitLength / Math.abs(cos) < 0 ? y2 / sin : sin < 0 && y1 <= axisLength && y1 - sin * limitLength / Math.abs(cos) > axisLength ? -(axisLength - y1) / sin : Math.abs(limitLength / cos);
36
+ }
42
37
  }
43
38
  (0, vutils_1.isValidNumber)(label.attribute.maxLineWidth) && (limitLabelLength = (0,
44
39
  vutils_1.isValidNumber)(limitLabelLength) ? Math.min(label.attribute.maxLineWidth, limitLabelLength) : label.attribute.maxLineWidth),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/overlap/auto-limit.ts"],"names":[],"mappings":";;;AAIA,6CAAiE;AACjE,iCAAqC;AAUrC,SAAgB,SAAS,CAAC,MAAe,EAAE,MAAmB;IAC5D,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC1F,IAAI,IAAA,gBAAO,EAAC,MAAM,CAAC,IAAI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AgB,GAAG,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC;SACjF;QAED,IAAI,IAAA,sBAAa,EAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE;YAC/C,gBAAgB,GAAG,IAAA,sBAAa,EAAC,gBAAgB,CAAC;gBAChD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,gBAAgB,CAAC;gBAC1D,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC;SAClC;QACD,KAAK,CAAC,aAAa,CAAC;YAClB,YAAY,EAAE,gBAAgB;YAC9B,QAAQ,EAAE,MAAA,KAAK,CAAC,SAAS,CAAC,QAAQ,mCAAI,QAAQ;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAvED,8BAuEC","file":"auto-limit.js","sourcesContent":["/**\n * 自动省略\n */\nimport type { IText } from '@visactor/vrender-core';\nimport { isEmpty, isNil, isValidNumber } from '@visactor/vutils';\nimport { borderPoint } from './util';\n\ntype LimitConfig = {\n orient: string;\n limitLength: number;\n axisLength: number;\n verticalLimitLength?: number;\n ellipsis?: string;\n};\n\nexport function autoLimit(labels: IText[], config: LimitConfig) {\n const { limitLength, verticalLimitLength, ellipsis = '...', orient, axisLength } = config;\n if (isEmpty(labels) || !isValidNumber(limitLength)) {\n return;\n }\n\n labels.forEach(label => {\n const angle = label.attribute.angle;\n\n const hasAngle = !isNil(angle);\n const isHorizontal = !hasAngle || angle === 0 || angle === Math.PI;\n const isVertical = hasAngle && (angle === Math.PI / 2 || angle === (Math.PI * 2) / 3);\n const isX = orient === 'top' || orient === 'bottom';\n\n if (isX) {\n if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {\n return;\n }\n if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) {\n return;\n }\n }\n\n const direction = label.attribute.direction;\n if (!isX) {\n if (direction === 'vertical' && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {\n return;\n }\n\n if (direction !== 'vertical') {\n if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) {\n return;\n }\n if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {\n return;\n }\n }\n }\n\n // 如果水平并且文本未发生旋转,则不配置 maxLineWidth\n let limitLabelLength = null;\n\n if (!isHorizontal && !isVertical) {\n const { x1: x, y1: y } = label.AABBBounds;\n\n const width = isX ? axisLength : limitLength;\n const height = isX ? limitLength : axisLength;\n\n const intersection = borderPoint({ width, height, left: 0, top: 0 }, { x, y }, label.attribute.angle);\n if (intersection) {\n const { x: _x, y: _y } = intersection;\n limitLabelLength = Math.floor(Math.sqrt((_x - x) ** 2 + (_y - y) ** 2));\n } else {\n limitLabelLength = Math.abs(limitLength / Math.sin(angle));\n }\n } else if (isX) {\n limitLabelLength = verticalLimitLength;\n } else {\n limitLabelLength = direction === 'vertical' ? verticalLimitLength : limitLength;\n }\n\n if (isValidNumber(label.attribute.maxLineWidth)) {\n limitLabelLength = isValidNumber(limitLabelLength)\n ? Math.min(label.attribute.maxLineWidth, limitLabelLength)\n : label.attribute.maxLineWidth;\n }\n label.setAttributes({\n maxLineWidth: limitLabelLength,\n ellipsis: label.attribute.ellipsis ?? ellipsis\n });\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/axis/overlap/auto-limit.ts"],"names":[],"mappings":";;;AAIA,6CAAgF;AAUhF,SAAgB,SAAS,CAAC,MAAe,EAAE,MAAmB;IAC5D,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC1F,IAAI,IAAA,gBAAO,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,sBAAa,EAAC,WAAW,CAAC,EAAE;QAClD,OAAO;KACR;IAED,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE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":["/**\n * 自动省略\n */\nimport type { IText } from '@visactor/vrender-core';\nimport { isEmpty, isNil, isNumberClose, isValidNumber } from '@visactor/vutils';\n\ntype LimitConfig = {\n orient: string;\n limitLength: number;\n axisLength: number;\n verticalLimitLength?: number;\n ellipsis?: string;\n};\n\nexport function autoLimit(labels: IText[], config: LimitConfig) {\n const { limitLength, verticalLimitLength, ellipsis = '...', orient, axisLength } = config;\n if (isEmpty(labels) || !isValidNumber(limitLength)) {\n return;\n }\n\n labels.forEach(label => {\n const angle = label.attribute.angle;\n\n const hasAngle = !isNil(angle);\n const cos = hasAngle ? Math.cos(angle) : 1;\n const sin = hasAngle ? Math.sin(angle) : 0;\n const isHorizontal = !hasAngle || isNumberClose(sin, 0);\n const isVertical = hasAngle && isNumberClose(cos, 0);\n const isX = orient === 'top' || orient === 'bottom';\n\n if (isX) {\n if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {\n return;\n }\n if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) {\n return;\n }\n }\n\n const direction = label.attribute.direction;\n if (!isX) {\n if (direction === 'vertical' && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {\n return;\n }\n\n if (direction !== 'vertical') {\n if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) {\n return;\n }\n if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {\n return;\n }\n }\n }\n\n // 如果水平并且文本未发生旋转,则不配置 maxLineWidth\n let limitLabelLength = null;\n\n if (!isHorizontal && !isVertical) {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n if (isX) {\n const { x1, x2 } = label.AABBBounds;\n\n if (cos > 0 && x1 <= axisLength && (cos * limitLength) / Math.abs(sin) + x1 > axisLength) {\n limitLabelLength = (axisLength - x1) / cos;\n } else if (cos < 0 && x2 >= 0 && (cos * limitLength) / Math.abs(sin) + x2 < 0) {\n limitLabelLength = -x2 / cos;\n } else {\n limitLabelLength = Math.abs(limitLength / sin);\n }\n } else {\n const { y1, y2 } = label.AABBBounds;\n\n if (sin > 0 && y2 >= 0 && y2 - (sin * limitLength) / Math.abs(cos) < 0) {\n limitLabelLength = y2 / sin;\n } else if (sin < 0 && y1 <= axisLength && y1 - (sin * limitLength) / Math.abs(cos) > axisLength) {\n limitLabelLength = -(axisLength - y1) / sin;\n } else {\n limitLabelLength = Math.abs(limitLength / cos);\n }\n }\n } else if (isX) {\n limitLabelLength = isHorizontal ? verticalLimitLength : limitLength;\n } else {\n limitLabelLength = direction === 'vertical' || isVertical ? verticalLimitLength : limitLength;\n }\n\n if (isValidNumber(label.attribute.maxLineWidth)) {\n limitLabelLength = isValidNumber(limitLabelLength)\n ? Math.min(label.attribute.maxLineWidth, limitLabelLength)\n : label.attribute.maxLineWidth;\n }\n label.setAttributes({\n maxLineWidth: limitLabelLength,\n ellipsis: label.attribute.ellipsis ?? ellipsis\n });\n });\n}\n"]}
@@ -1,15 +1,3 @@
1
1
  import type { IText } from '@visactor/vrender-core';
2
2
  export declare function genRotateBounds(items: IText[]): void;
3
3
  export declare function itemIntersect(item1: IText, item2: IText): boolean;
4
- export declare function borderPoint(rect: {
5
- left: number;
6
- top: number;
7
- width: number;
8
- height: number;
9
- }, pt: {
10
- x: number;
11
- y: number;
12
- }, angle: number): {
13
- x: number;
14
- y: number;
15
- };
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.borderPoint = exports.itemIntersect = exports.genRotateBounds = void 0;
5
+ }), exports.itemIntersect = exports.genRotateBounds = void 0;
6
6
 
7
7
  const vutils_1 = require("@visactor/vutils");
8
8
 
@@ -40,43 +40,5 @@ function itemIntersect(item1, item2) {
40
40
  vutils_1.isRotateAABBIntersect)(item1.rotatedBounds, item2.rotatedBounds, !0));
41
41
  }
42
42
 
43
- function borderPoint(rect, pt, angle) {
44
- if (pt.x < rect.left) return null;
45
- if (pt.x > rect.left + rect.width) return null;
46
- if (pt.y < rect.top) return null;
47
- if (pt.y > rect.top + rect.height) return null;
48
- const dx = Math.cos(angle), dy = Math.sin(angle);
49
- if (dx < 1e-16) {
50
- const y = (rect.left - pt.x) * dy / dx + pt.y;
51
- if (y >= rect.top && y <= rect.top + rect.height) return {
52
- x: rect.left,
53
- y: y
54
- };
55
- }
56
- if (dx > 1e-16) {
57
- const y = (rect.left + rect.width - pt.x) * dy / dx + pt.y;
58
- if (y >= rect.top && y <= rect.top + rect.height) return {
59
- x: rect.left + rect.width,
60
- y: y
61
- };
62
- }
63
- if (dy < 1e-16) {
64
- const x = (rect.top - pt.y) * dx / dy + pt.x;
65
- if (x >= rect.left && x <= rect.left + rect.width) return {
66
- x: x,
67
- y: rect.top
68
- };
69
- }
70
- if (dy > 1e-16) {
71
- const x = (rect.top + rect.height - pt.y) * dx / dy + pt.x;
72
- if (x >= rect.left && x <= rect.left + rect.width) return {
73
- x: x,
74
- y: rect.top + rect.height
75
- };
76
- }
77
- return null;
78
- }
79
-
80
- exports.genRotateBounds = genRotateBounds, exports.itemIntersect = itemIntersect,
81
- exports.borderPoint = borderPoint;
43
+ exports.genRotateBounds = genRotateBounds, exports.itemIntersect = itemIntersect;
82
44
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/overlap/util.ts"],"names":[],"mappings":";;;AACA,6CAA0E;AAE1E,SAAS,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,GAAW,EAAE,OAAe,EAAE,OAAe;IACjF,OAAO;QACL,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO;QAC1E,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,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CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE;YACjD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;SAC5C;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AA1DD,kCA0DC","file":"util.js","sourcesContent":["import type { IText } from '@visactor/vrender-core';\nimport { isRectIntersect, isRotateAABBIntersect } from '@visactor/vutils';\n\nfunction rotate(x: number, y: number, deg: number, originX: number, originY: number) {\n return {\n x: (x - originX) * Math.cos(deg) + (y - originY) * Math.sin(deg) + originX,\n y: (x - originX) * Math.sin(deg) + (originY - y) * Math.cos(deg) + originY\n };\n}\n\n// 计算水平情况下的包围盒\nfunction genNormalBounds(item: IText) {\n const bounds = item.AABBBounds;\n\n return {\n x1: bounds.x1,\n x2: bounds.x2,\n y1: bounds.y1,\n y2: bounds.y2,\n centerX: item.attribute.x,\n centerY: item.attribute.y,\n angle: item.attribute.angle\n };\n}\n\nexport function genRotateBounds(items: IText[]) {\n items.forEach(item => {\n if (item.rotatedBounds || !item.attribute.angle) {\n return;\n }\n // 计算水平情况下的包围盒\n const bounds = genNormalBounds(item);\n // 旋转\n const rotatedCenter = rotate(bounds.centerX, bounds.centerY, bounds.angle, item.attribute.x, item.attribute.y);\n const deltaX = rotatedCenter.x - bounds.centerX;\n const deltaY = rotatedCenter.y - bounds.centerY;\n bounds.x1 += deltaX;\n bounds.x2 += deltaX;\n bounds.y1 += deltaY;\n bounds.y2 += deltaY;\n bounds.centerX += deltaX;\n bounds.centerY += deltaY;\n item.rotatedBounds = bounds;\n });\n}\n\nexport function itemIntersect(item1: IText, item2: IText) {\n return (\n isRectIntersect(item1.AABBBounds, item2.AABBBounds, false) &&\n (item1.rotatedBounds && item2.rotatedBounds\n ? isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, true)\n : true)\n );\n}\n\n// 计算矩形内的点与矩形边的交点\nexport function borderPoint(\n rect: { left: number; top: number; width: number; height: number },\n pt: { x: number; y: number },\n angle: number\n) {\n // catch cases where point is outside rectangle\n if (pt.x < rect.left) {\n return null;\n }\n if (pt.x > rect.left + rect.width) {\n return null;\n }\n if (pt.y < rect.top) {\n return null;\n }\n if (pt.y > rect.top + rect.height) {\n return null;\n }\n\n const dx = Math.cos(angle);\n const dy = Math.sin(angle);\n\n if (dx < 1.0e-16) {\n // left border\n const y = ((rect.left - pt.x) * dy) / dx + pt.y;\n\n if (y >= rect.top && y <= rect.top + rect.height) {\n return { x: rect.left, y: y };\n }\n }\n\n if (dx > 1.0e-16) {\n // right border\n const y = ((rect.left + rect.width - pt.x) * dy) / dx + pt.y;\n\n if (y >= rect.top && y <= rect.top + rect.height) {\n return { x: rect.left + rect.width, y: y };\n }\n }\n\n if (dy < 1.0e-16) {\n // top border\n const x = ((rect.top - pt.y) * dx) / dy + pt.x;\n\n if (x >= rect.left && x <= rect.left + rect.width) {\n return { x: x, y: rect.top };\n }\n }\n\n if (dy > 1.0e-16) {\n // bottom border\n const x = ((rect.top + rect.height - pt.y) * dx) / dy + pt.x;\n if (x >= rect.left && x <= rect.left + rect.width) {\n return { x: x, y: rect.top + rect.height };\n }\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"sources":["../src/axis/overlap/util.ts"],"names":[],"mappings":";;;AACA,6CAA0E;AAE1E,SAAS,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,GAAW,EAAE,OAAe,EAAE,OAAe;IACjF,OAAO;QACL,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO;QAC1E,CAA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M,CAAC;QACpB,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC;QACpB,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;QACzB,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAnBD,0CAmBC;AAED,SAAgB,aAAa,CAAC,KAAY,EAAE,KAAY;IACtD,OAAO,CACL,IAAA,wBAAe,EAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC;QAC1D,CAAC,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa;YACzC,CAAC,CAAC,IAAA,8BAAqB,EAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC;YACvE,CAAC,CAAC,IAAI,CAAC,CACV,CAAC;AACJ,CAAC;AAPD,sCAOC","file":"util.js","sourcesContent":["import type { IText } from '@visactor/vrender-core';\nimport { isRectIntersect, isRotateAABBIntersect } from '@visactor/vutils';\n\nfunction rotate(x: number, y: number, deg: number, originX: number, originY: number) {\n return {\n x: (x - originX) * Math.cos(deg) + (y - originY) * Math.sin(deg) + originX,\n y: (x - originX) * Math.sin(deg) + (originY - y) * Math.cos(deg) + originY\n };\n}\n\n// 计算水平情况下的包围盒\nfunction genNormalBounds(item: IText) {\n const bounds = item.AABBBounds;\n\n return {\n x1: bounds.x1,\n x2: bounds.x2,\n y1: bounds.y1,\n y2: bounds.y2,\n centerX: item.attribute.x,\n centerY: item.attribute.y,\n angle: item.attribute.angle\n };\n}\n\nexport function genRotateBounds(items: IText[]) {\n items.forEach(item => {\n if (item.rotatedBounds || !item.attribute.angle) {\n return;\n }\n // 计算水平情况下的包围盒\n const bounds = genNormalBounds(item);\n // 旋转\n const rotatedCenter = rotate(bounds.centerX, bounds.centerY, bounds.angle, item.attribute.x, item.attribute.y);\n const deltaX = rotatedCenter.x - bounds.centerX;\n const deltaY = rotatedCenter.y - bounds.centerY;\n bounds.x1 += deltaX;\n bounds.x2 += deltaX;\n bounds.y1 += deltaY;\n bounds.y2 += deltaY;\n bounds.centerX += deltaX;\n bounds.centerY += deltaY;\n item.rotatedBounds = bounds;\n });\n}\n\nexport function itemIntersect(item1: IText, item2: IText) {\n return (\n isRectIntersect(item1.AABBBounds, item2.AABBBounds, false) &&\n (item1.rotatedBounds && item2.rotatedBounds\n ? isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, true)\n : true)\n );\n}\n"]}
package/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.18.7-alpha.0";
1
+ export declare const version = "0.18.7-alpha.1";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
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.18.7-alpha.0", __exportStar(require("./core/base"), exports),
20
+ }), exports.version = void 0, exports.version = "0.18.7-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.18.7-alpha.0\";\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"]}
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.18.7-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"]}
@@ -1,12 +1,10 @@
1
- import { isEmpty, isNil, isValidNumber } from "@visactor/vutils";
2
-
3
- import { borderPoint } from "./util";
1
+ import { isEmpty, isNil, isNumberClose, isValidNumber } from "@visactor/vutils";
4
2
 
5
3
  export function autoLimit(labels, config) {
6
4
  const {limitLength: limitLength, verticalLimitLength: verticalLimitLength, ellipsis: ellipsis = "...", orient: orient, axisLength: axisLength} = config;
7
5
  !isEmpty(labels) && isValidNumber(limitLength) && labels.forEach((label => {
8
6
  var _a;
9
- const angle = label.attribute.angle, hasAngle = !isNil(angle), isHorizontal = !hasAngle || 0 === angle || angle === Math.PI, isVertical = hasAngle && (angle === Math.PI / 2 || angle === 2 * Math.PI / 3), isX = "top" === orient || "bottom" === orient;
7
+ const angle = label.attribute.angle, hasAngle = !isNil(angle), cos = hasAngle ? Math.cos(angle) : 1, sin = hasAngle ? Math.sin(angle) : 0, isHorizontal = !hasAngle || isNumberClose(sin, 0), isVertical = hasAngle && isNumberClose(cos, 0), isX = "top" === orient || "bottom" === orient;
10
8
  if (isX) {
11
9
  if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) return;
12
10
  if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) return;
@@ -20,20 +18,15 @@ export function autoLimit(labels, config) {
20
18
  }
21
19
  }
22
20
  let limitLabelLength = null;
23
- if (isHorizontal || isVertical) limitLabelLength = isX || "vertical" === direction ? verticalLimitLength : limitLength; else {
24
- const {x1: x, y1: y} = label.AABBBounds, intersection = borderPoint({
25
- width: isX ? axisLength : limitLength,
26
- height: isX ? limitLength : axisLength,
27
- left: 0,
28
- top: 0
29
- }, {
30
- x: x,
31
- y: y
32
- }, label.attribute.angle);
33
- if (intersection) {
34
- const {x: _x, y: _y} = intersection;
35
- limitLabelLength = Math.floor(Math.sqrt((_x - x) ** 2 + (_y - y) ** 2));
36
- } else limitLabelLength = Math.abs(limitLength / Math.sin(angle));
21
+ if (isHorizontal || isVertical) limitLabelLength = isX ? isHorizontal ? verticalLimitLength : limitLength : "vertical" === direction || isVertical ? verticalLimitLength : limitLength; else {
22
+ const cos = Math.cos(angle), sin = Math.sin(angle);
23
+ if (isX) {
24
+ const {x1: x1, x2: x2} = label.AABBBounds;
25
+ limitLabelLength = cos > 0 && x1 <= axisLength && cos * limitLength / Math.abs(sin) + x1 > axisLength ? (axisLength - x1) / cos : cos < 0 && x2 >= 0 && cos * limitLength / Math.abs(sin) + x2 < 0 ? -x2 / cos : Math.abs(limitLength / sin);
26
+ } else {
27
+ const {y1: y1, y2: y2} = label.AABBBounds;
28
+ limitLabelLength = sin > 0 && y2 >= 0 && y2 - sin * limitLength / Math.abs(cos) < 0 ? y2 / sin : sin < 0 && y1 <= axisLength && y1 - sin * limitLength / Math.abs(cos) > axisLength ? -(axisLength - y1) / sin : Math.abs(limitLength / cos);
29
+ }
37
30
  }
38
31
  isValidNumber(label.attribute.maxLineWidth) && (limitLabelLength = isValidNumber(limitLabelLength) ? Math.min(label.attribute.maxLineWidth, limitLabelLength) : label.attribute.maxLineWidth),
39
32
  label.setAttributes({
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/overlap/auto-limit.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAUrC,MAAM,UAAU,SAAS,CAAC,MAAe,EAAE,MAAmB;IAC5D,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC1F,IAA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M;YACL,gBAAgB,GAAG,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC;SACjF;QAED,IAAI,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE;YAC/C,gBAAgB,GAAG,aAAa,CAAC,gBAAgB,CAAC;gBAChD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,gBAAgB,CAAC;gBAC1D,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC;SAClC;QACD,KAAK,CAAC,aAAa,CAAC;YAClB,YAAY,EAAE,gBAAgB;YAC9B,QAAQ,EAAE,MAAA,KAAK,CAAC,SAAS,CAAC,QAAQ,mCAAI,QAAQ;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","file":"auto-limit.js","sourcesContent":["/**\n * 自动省略\n */\nimport type { IText } from '@visactor/vrender-core';\nimport { isEmpty, isNil, isValidNumber } from '@visactor/vutils';\nimport { borderPoint } from './util';\n\ntype LimitConfig = {\n orient: string;\n limitLength: number;\n axisLength: number;\n verticalLimitLength?: number;\n ellipsis?: string;\n};\n\nexport function autoLimit(labels: IText[], config: LimitConfig) {\n const { limitLength, verticalLimitLength, ellipsis = '...', orient, axisLength } = config;\n if (isEmpty(labels) || !isValidNumber(limitLength)) {\n return;\n }\n\n labels.forEach(label => {\n const angle = label.attribute.angle;\n\n const hasAngle = !isNil(angle);\n const isHorizontal = !hasAngle || angle === 0 || angle === Math.PI;\n const isVertical = hasAngle && (angle === Math.PI / 2 || angle === (Math.PI * 2) / 3);\n const isX = orient === 'top' || orient === 'bottom';\n\n if (isX) {\n if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {\n return;\n }\n if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) {\n return;\n }\n }\n\n const direction = label.attribute.direction;\n if (!isX) {\n if (direction === 'vertical' && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {\n return;\n }\n\n if (direction !== 'vertical') {\n if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) {\n return;\n }\n if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {\n return;\n }\n }\n }\n\n // 如果水平并且文本未发生旋转,则不配置 maxLineWidth\n let limitLabelLength = null;\n\n if (!isHorizontal && !isVertical) {\n const { x1: x, y1: y } = label.AABBBounds;\n\n const width = isX ? axisLength : limitLength;\n const height = isX ? limitLength : axisLength;\n\n const intersection = borderPoint({ width, height, left: 0, top: 0 }, { x, y }, label.attribute.angle);\n if (intersection) {\n const { x: _x, y: _y } = intersection;\n limitLabelLength = Math.floor(Math.sqrt((_x - x) ** 2 + (_y - y) ** 2));\n } else {\n limitLabelLength = Math.abs(limitLength / Math.sin(angle));\n }\n } else if (isX) {\n limitLabelLength = verticalLimitLength;\n } else {\n limitLabelLength = direction === 'vertical' ? verticalLimitLength : limitLength;\n }\n\n if (isValidNumber(label.attribute.maxLineWidth)) {\n limitLabelLength = isValidNumber(limitLabelLength)\n ? Math.min(label.attribute.maxLineWidth, limitLabelLength)\n : label.attribute.maxLineWidth;\n }\n label.setAttributes({\n maxLineWidth: limitLabelLength,\n ellipsis: label.attribute.ellipsis ?? ellipsis\n });\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/axis/overlap/auto-limit.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAUhF,MAAM,UAAU,SAAS,CAAC,MAAe,EAAE,MAAmB;IAC5D,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC1F,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE;QAClD,OAAO;KACR;IAED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* 自动省略\n */\nimport type { IText } from '@visactor/vrender-core';\nimport { isEmpty, isNil, isNumberClose, isValidNumber } from '@visactor/vutils';\n\ntype LimitConfig = {\n orient: string;\n limitLength: number;\n axisLength: number;\n verticalLimitLength?: number;\n ellipsis?: string;\n};\n\nexport function autoLimit(labels: IText[], config: LimitConfig) {\n const { limitLength, verticalLimitLength, ellipsis = '...', orient, axisLength } = config;\n if (isEmpty(labels) || !isValidNumber(limitLength)) {\n return;\n }\n\n labels.forEach(label => {\n const angle = label.attribute.angle;\n\n const hasAngle = !isNil(angle);\n const cos = hasAngle ? Math.cos(angle) : 1;\n const sin = hasAngle ? Math.sin(angle) : 0;\n const isHorizontal = !hasAngle || isNumberClose(sin, 0);\n const isVertical = hasAngle && isNumberClose(cos, 0);\n const isX = orient === 'top' || orient === 'bottom';\n\n if (isX) {\n if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {\n return;\n }\n if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) {\n return;\n }\n }\n\n const direction = label.attribute.direction;\n if (!isX) {\n if (direction === 'vertical' && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {\n return;\n }\n\n if (direction !== 'vertical') {\n if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) {\n return;\n }\n if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {\n return;\n }\n }\n }\n\n // 如果水平并且文本未发生旋转,则不配置 maxLineWidth\n let limitLabelLength = null;\n\n if (!isHorizontal && !isVertical) {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n if (isX) {\n const { x1, x2 } = label.AABBBounds;\n\n if (cos > 0 && x1 <= axisLength && (cos * limitLength) / Math.abs(sin) + x1 > axisLength) {\n limitLabelLength = (axisLength - x1) / cos;\n } else if (cos < 0 && x2 >= 0 && (cos * limitLength) / Math.abs(sin) + x2 < 0) {\n limitLabelLength = -x2 / cos;\n } else {\n limitLabelLength = Math.abs(limitLength / sin);\n }\n } else {\n const { y1, y2 } = label.AABBBounds;\n\n if (sin > 0 && y2 >= 0 && y2 - (sin * limitLength) / Math.abs(cos) < 0) {\n limitLabelLength = y2 / sin;\n } else if (sin < 0 && y1 <= axisLength && y1 - (sin * limitLength) / Math.abs(cos) > axisLength) {\n limitLabelLength = -(axisLength - y1) / sin;\n } else {\n limitLabelLength = Math.abs(limitLength / cos);\n }\n }\n } else if (isX) {\n limitLabelLength = isHorizontal ? verticalLimitLength : limitLength;\n } else {\n limitLabelLength = direction === 'vertical' || isVertical ? verticalLimitLength : limitLength;\n }\n\n if (isValidNumber(label.attribute.maxLineWidth)) {\n limitLabelLength = isValidNumber(limitLabelLength)\n ? Math.min(label.attribute.maxLineWidth, limitLabelLength)\n : label.attribute.maxLineWidth;\n }\n label.setAttributes({\n maxLineWidth: limitLabelLength,\n ellipsis: label.attribute.ellipsis ?? ellipsis\n });\n });\n}\n"]}
@@ -1,15 +1,3 @@
1
1
  import type { IText } from '@visactor/vrender-core';
2
2
  export declare function genRotateBounds(items: IText[]): void;
3
3
  export declare function itemIntersect(item1: IText, item2: IText): boolean;
4
- export declare function borderPoint(rect: {
5
- left: number;
6
- top: number;
7
- width: number;
8
- height: number;
9
- }, pt: {
10
- x: number;
11
- y: number;
12
- }, angle: number): {
13
- x: number;
14
- y: number;
15
- };
@@ -32,41 +32,4 @@ export function genRotateBounds(items) {
32
32
  export function itemIntersect(item1, item2) {
33
33
  return isRectIntersect(item1.AABBBounds, item2.AABBBounds, !1) && (!item1.rotatedBounds || !item2.rotatedBounds || isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, !0));
34
34
  }
35
-
36
- export function borderPoint(rect, pt, angle) {
37
- if (pt.x < rect.left) return null;
38
- if (pt.x > rect.left + rect.width) return null;
39
- if (pt.y < rect.top) return null;
40
- if (pt.y > rect.top + rect.height) return null;
41
- const dx = Math.cos(angle), dy = Math.sin(angle);
42
- if (dx < 1e-16) {
43
- const y = (rect.left - pt.x) * dy / dx + pt.y;
44
- if (y >= rect.top && y <= rect.top + rect.height) return {
45
- x: rect.left,
46
- y: y
47
- };
48
- }
49
- if (dx > 1e-16) {
50
- const y = (rect.left + rect.width - pt.x) * dy / dx + pt.y;
51
- if (y >= rect.top && y <= rect.top + rect.height) return {
52
- x: rect.left + rect.width,
53
- y: y
54
- };
55
- }
56
- if (dy < 1e-16) {
57
- const x = (rect.top - pt.y) * dx / dy + pt.x;
58
- if (x >= rect.left && x <= rect.left + rect.width) return {
59
- x: x,
60
- y: rect.top
61
- };
62
- }
63
- if (dy > 1e-16) {
64
- const x = (rect.top + rect.height - pt.y) * dx / dy + pt.x;
65
- if (x >= rect.left && x <= rect.left + rect.width) return {
66
- x: x,
67
- y: rect.top + rect.height
68
- };
69
- }
70
- return null;
71
- }
72
35
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/overlap/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,SAAS,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,GAAW,EAAE,OAAe,EAAE,OAAe;IACjF,OAAO;QACL,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO;QAC1E,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO;KAC3E,CAAC;AACJ,CAAC;AAGD,SAAS,eAAe,CAAC,IAAW;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;IAE/B,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,EAAE;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G,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;SAC5C;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC","file":"util.js","sourcesContent":["import type { IText } from '@visactor/vrender-core';\nimport { isRectIntersect, isRotateAABBIntersect } from '@visactor/vutils';\n\nfunction rotate(x: number, y: number, deg: number, originX: number, originY: number) {\n return {\n x: (x - originX) * Math.cos(deg) + (y - originY) * Math.sin(deg) + originX,\n y: (x - originX) * Math.sin(deg) + (originY - y) * Math.cos(deg) + originY\n };\n}\n\n// 计算水平情况下的包围盒\nfunction genNormalBounds(item: IText) {\n const bounds = item.AABBBounds;\n\n return {\n x1: bounds.x1,\n x2: bounds.x2,\n y1: bounds.y1,\n y2: bounds.y2,\n centerX: item.attribute.x,\n centerY: item.attribute.y,\n angle: item.attribute.angle\n };\n}\n\nexport function genRotateBounds(items: IText[]) {\n items.forEach(item => {\n if (item.rotatedBounds || !item.attribute.angle) {\n return;\n }\n // 计算水平情况下的包围盒\n const bounds = genNormalBounds(item);\n // 旋转\n const rotatedCenter = rotate(bounds.centerX, bounds.centerY, bounds.angle, item.attribute.x, item.attribute.y);\n const deltaX = rotatedCenter.x - bounds.centerX;\n const deltaY = rotatedCenter.y - bounds.centerY;\n bounds.x1 += deltaX;\n bounds.x2 += deltaX;\n bounds.y1 += deltaY;\n bounds.y2 += deltaY;\n bounds.centerX += deltaX;\n bounds.centerY += deltaY;\n item.rotatedBounds = bounds;\n });\n}\n\nexport function itemIntersect(item1: IText, item2: IText) {\n return (\n isRectIntersect(item1.AABBBounds, item2.AABBBounds, false) &&\n (item1.rotatedBounds && item2.rotatedBounds\n ? isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, true)\n : true)\n );\n}\n\n// 计算矩形内的点与矩形边的交点\nexport function borderPoint(\n rect: { left: number; top: number; width: number; height: number },\n pt: { x: number; y: number },\n angle: number\n) {\n // catch cases where point is outside rectangle\n if (pt.x < rect.left) {\n return null;\n }\n if (pt.x > rect.left + rect.width) {\n return null;\n }\n if (pt.y < rect.top) {\n return null;\n }\n if (pt.y > rect.top + rect.height) {\n return null;\n }\n\n const dx = Math.cos(angle);\n const dy = Math.sin(angle);\n\n if (dx < 1.0e-16) {\n // left border\n const y = ((rect.left - pt.x) * dy) / dx + pt.y;\n\n if (y >= rect.top && y <= rect.top + rect.height) {\n return { x: rect.left, y: y };\n }\n }\n\n if (dx > 1.0e-16) {\n // right border\n const y = ((rect.left + rect.width - pt.x) * dy) / dx + pt.y;\n\n if (y >= rect.top && y <= rect.top + rect.height) {\n return { x: rect.left + rect.width, y: y };\n }\n }\n\n if (dy < 1.0e-16) {\n // top border\n const x = ((rect.top - pt.y) * dx) / dy + pt.x;\n\n if (x >= rect.left && x <= rect.left + rect.width) {\n return { x: x, y: rect.top };\n }\n }\n\n if (dy > 1.0e-16) {\n // bottom border\n const x = ((rect.top + rect.height - pt.y) * dx) / dy + pt.x;\n if (x >= rect.left && x <= rect.left + rect.width) {\n return { x: x, y: rect.top + rect.height };\n }\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"sources":["../src/axis/overlap/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,SAAS,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,GAAW,EAAE,OAAe,EAAE,OAAe;IACjF,OAAO;QACL,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO;QAC1E,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO;KAC3E,CAAC;AACJ,CAAC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AAC,aAAa,GAAG,MAAM,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAY,EAAE,KAAY;IACtD,OAAO,CACL,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC;QAC1D,CAAC,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa;YACzC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC;YACvE,CAAC,CAAC,IAAI,CAAC,CACV,CAAC;AACJ,CAAC","file":"util.js","sourcesContent":["import type { IText } from '@visactor/vrender-core';\nimport { isRectIntersect, isRotateAABBIntersect } from '@visactor/vutils';\n\nfunction rotate(x: number, y: number, deg: number, originX: number, originY: number) {\n return {\n x: (x - originX) * Math.cos(deg) + (y - originY) * Math.sin(deg) + originX,\n y: (x - originX) * Math.sin(deg) + (originY - y) * Math.cos(deg) + originY\n };\n}\n\n// 计算水平情况下的包围盒\nfunction genNormalBounds(item: IText) {\n const bounds = item.AABBBounds;\n\n return {\n x1: bounds.x1,\n x2: bounds.x2,\n y1: bounds.y1,\n y2: bounds.y2,\n centerX: item.attribute.x,\n centerY: item.attribute.y,\n angle: item.attribute.angle\n };\n}\n\nexport function genRotateBounds(items: IText[]) {\n items.forEach(item => {\n if (item.rotatedBounds || !item.attribute.angle) {\n return;\n }\n // 计算水平情况下的包围盒\n const bounds = genNormalBounds(item);\n // 旋转\n const rotatedCenter = rotate(bounds.centerX, bounds.centerY, bounds.angle, item.attribute.x, item.attribute.y);\n const deltaX = rotatedCenter.x - bounds.centerX;\n const deltaY = rotatedCenter.y - bounds.centerY;\n bounds.x1 += deltaX;\n bounds.x2 += deltaX;\n bounds.y1 += deltaY;\n bounds.y2 += deltaY;\n bounds.centerX += deltaX;\n bounds.centerY += deltaY;\n item.rotatedBounds = bounds;\n });\n}\n\nexport function itemIntersect(item1: IText, item2: IText) {\n return (\n isRectIntersect(item1.AABBBounds, item2.AABBBounds, false) &&\n (item1.rotatedBounds && item2.rotatedBounds\n ? isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, true)\n : true)\n );\n}\n"]}
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.18.7-alpha.0";
1
+ export declare const version = "0.18.7-alpha.1";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.18.7-alpha.0";
1
+ export const version = "0.18.7-alpha.1";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.18.7-alpha.0\";\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"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.18.7-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-components",
3
- "version": "0.18.7-alpha.0",
3
+ "version": "0.18.7-alpha.1",
4
4
  "description": "components library for dp visualization",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index.js",
@@ -12,8 +12,8 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@visactor/vrender-core": "0.18.7-alpha.0",
16
- "@visactor/vrender-kits": "0.18.7-alpha.0",
15
+ "@visactor/vrender-core": "0.18.7-alpha.1",
16
+ "@visactor/vrender-kits": "0.18.7-alpha.1",
17
17
  "@visactor/vutils": "~0.18.1",
18
18
  "@visactor/vscale": "~0.17.3"
19
19
  },
@@ -29,8 +29,8 @@
29
29
  "vite": "3.2.6",
30
30
  "typescript": "4.9.5",
31
31
  "@internal/bundler": "0.0.1",
32
- "@internal/ts-config": "0.0.1",
33
- "@internal/eslint-config": "0.0.1"
32
+ "@internal/eslint-config": "0.0.1",
33
+ "@internal/ts-config": "0.0.1"
34
34
  },
35
35
  "keywords": [
36
36
  "VisActor",