tvcharts 0.7.71 → 0.7.72
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.
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
function findIntersectionPoint(A, B, rectangle) {
|
|
26
|
+
function findIntersectionPoint(A, B, rectangle, bias) {
|
|
27
|
+
if (bias === void 0) {
|
|
28
|
+
bias = 'start';
|
|
29
|
+
}
|
|
27
30
|
var xA = A[0],
|
|
28
31
|
yA = A[1];
|
|
29
32
|
var xB = B[0],
|
|
@@ -32,10 +35,18 @@ function findIntersectionPoint(A, B, rectangle) {
|
|
|
32
35
|
top = rectangle.top,
|
|
33
36
|
right = rectangle.right,
|
|
34
37
|
bottom = rectangle.bottom;
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
if (yA.toFixed(3) === yB.toFixed(3)) {
|
|
39
|
+
if (xA === xB) {
|
|
40
|
+
var isEndBias = bias === 'end';
|
|
41
|
+
return [isEndBias ? right : left, yA];
|
|
42
|
+
}
|
|
38
43
|
return [xA > xB ? right : left, yA];
|
|
44
|
+
} else if (xA.toFixed(3) === xB.toFixed(3)) {
|
|
45
|
+
if (yA === yB) {
|
|
46
|
+
var isEndBias = bias === 'end';
|
|
47
|
+
return [xA, isEndBias ? top : bottom];
|
|
48
|
+
}
|
|
49
|
+
return [xA, yA > yB ? top : bottom];
|
|
39
50
|
}
|
|
40
51
|
// 计算射线的方向向量
|
|
41
52
|
var direction = [xB - xA, yB - yA];
|
|
@@ -99,7 +110,7 @@ function getDrawLine(params) {
|
|
|
99
110
|
case 'both':
|
|
100
111
|
{
|
|
101
112
|
var pointC = findIntersectionPoint(startPoint, endPoint, rect);
|
|
102
|
-
var pointB = findIntersectionPoint(endPoint, startPoint, rect);
|
|
113
|
+
var pointB = findIntersectionPoint(endPoint, startPoint, rect, 'end');
|
|
103
114
|
return [pointC, pointB];
|
|
104
115
|
}
|
|
105
116
|
default:
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ declare function findIntersectionPoint(A: number[], B: number[], rectangle: {
|
|
|
4
4
|
top: number;
|
|
5
5
|
right: number;
|
|
6
6
|
bottom: number;
|
|
7
|
-
}): [number, number];
|
|
7
|
+
}, bias?: 'start' | 'end'): [number, number];
|
|
8
8
|
declare function getArrowPoints(fromX: number, fromY: number, toX: number, toY: number, arrowAngle?: number): number[];
|
|
9
9
|
interface LineType {
|
|
10
10
|
startPoint: number[];
|