Fix formatting

This commit is contained in:
Niklas von Hertzen 2017-12-12 22:23:48 +08:00
parent 7bb4a6f08f
commit ab966ff311
2 changed files with 19 additions and 16 deletions

View File

@ -141,7 +141,8 @@ const parseColorStops = (args: Array<string>, firstColorStopIndex: number, lineL
return { return {
color, color,
// $FlowFixMe // $FlowFixMe
stop: lineLength === 0 ? 0 : stop ? stop.getAbsoluteValue(lineLength) / lineLength : null stop:
lineLength === 0 ? 0 : stop ? stop.getAbsoluteValue(lineLength) / lineLength : null
}; };
}); });
@ -340,20 +341,23 @@ const findCorner = (bounds: Bounds, x: number, y: number, closest: boolean): Poi
]; ];
// $FlowFixMe // $FlowFixMe
return corners.reduce((stat, corner) => { return corners.reduce(
const d = distance(x - corner.x, y - corner.y); (stat, corner) => {
if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) { const d = distance(x - corner.x, y - corner.y);
return { if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
optimumCorner: corner, return {
optimumDistance: d optimumCorner: corner,
}; optimumDistance: d
} };
}
return stat; return stat;
}, { },
optimumDistance: closest ? Infinity : -Infinity, {
optimumCorner: null optimumDistance: closest ? Infinity : -Infinity,
}).optimumCorner; optimumCorner: null
}
).optimumCorner;
}; };
const calculateRadius = ( const calculateRadius = (

View File

@ -214,8 +214,7 @@ export default class CanvasRenderer implements RenderTarget<HTMLCanvasElement> {
font.fontWeight, font.fontWeight,
font.fontSize, font.fontSize,
font.fontFamily font.fontFamily
] ].join(' ');
.join(' ');
textBounds.forEach(text => { textBounds.forEach(text => {
this.ctx.fillStyle = color.toString(); this.ctx.fillStyle = color.toString();