Skip to content

Commit

Permalink
Fix compiled code using symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh committed Dec 12, 2017
1 parent f50da97 commit 7bb4a6f
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/Gradient.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,19 +339,21 @@ const findCorner = (bounds: Bounds, x: number, y: number, closest: boolean): Poi
{x: bounds.width, y: bounds.height}
];

let optimumDistance = closest ? Infinity : -Infinity;
let optimumCorner = null;

for (let corner of corners) {
// $FlowFixMe
return corners.reduce((stat, corner) => {
const d = distance(x - corner.x, y - corner.y);
if (closest ? d < optimumDistance : d > optimumDistance) {
optimumDistance = d;
optimumCorner = corner;
if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
return {
optimumCorner: corner,
optimumDistance: d
};
}
}

// $FlowFixMe
return optimumCorner;
return stat;
}, {
optimumDistance: closest ? Infinity : -Infinity,
optimumCorner: null
}).optimumCorner;
};

const calculateRadius = (
Expand Down

0 comments on commit 7bb4a6f

Please sign in to comment.