office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
10 lines (8 loc) • 709 B
JavaScript
function areRectanglesEqual(rectangleOne, rectangleTwo) {
// I'm fixing it to 4 decimal places because it allows enough precision and will handle cases when something should be rounded,
// like .999999 should round to 1.
return (parseFloat(rectangleOne.top.toFixed(4)) === parseFloat(rectangleTwo.top.toFixed(4)) && parseFloat(rectangleOne.bottom.toFixed(4)) === parseFloat(rectangleTwo.bottom.toFixed(4)) && parseFloat(rectangleOne.left.toFixed(4)) === parseFloat(rectangleTwo.left.toFixed(4)) && parseFloat(rectangleOne.right.toFixed(4)) === parseFloat(rectangleTwo.right.toFixed(4)));
}
exports.areRectanglesEqual = areRectanglesEqual;
//# sourceMappingURL=Rectangle.test.js.map
;