mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix compiled code using symbols
This commit is contained in:
parent
f50da9718f
commit
7bb4a6f08f
@ -339,19 +339,21 @@ const findCorner = (bounds: Bounds, x: number, y: number, closest: boolean): Poi
|
|||||||
{x: bounds.width, y: bounds.height}
|
{x: bounds.width, y: bounds.height}
|
||||||
];
|
];
|
||||||
|
|
||||||
let optimumDistance = closest ? Infinity : -Infinity;
|
|
||||||
let optimumCorner = null;
|
|
||||||
|
|
||||||
for (let corner of corners) {
|
|
||||||
const d = distance(x - corner.x, y - corner.y);
|
|
||||||
if (closest ? d < optimumDistance : d > optimumDistance) {
|
|
||||||
optimumDistance = d;
|
|
||||||
optimumCorner = corner;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
return optimumCorner;
|
return corners.reduce((stat, corner) => {
|
||||||
|
const d = distance(x - corner.x, y - corner.y);
|
||||||
|
if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
|
||||||
|
return {
|
||||||
|
optimumCorner: corner,
|
||||||
|
optimumDistance: d
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return stat;
|
||||||
|
}, {
|
||||||
|
optimumDistance: closest ? Infinity : -Infinity,
|
||||||
|
optimumCorner: null
|
||||||
|
}).optimumCorner;
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateRadius = (
|
const calculateRadius = (
|
||||||
|
Loading…
Reference in New Issue
Block a user