victory-native
Version:
A charting library for React Native with a focus on performance and customization.
22 lines (21 loc) • 625 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHorizontalBarRect = void 0;
const getHorizontalBarRect = (point, baselineX, barThickness) => {
const { x, y } = point;
if (typeof x !== "number" ||
typeof y !== "number" ||
!Number.isFinite(x) ||
!Number.isFinite(y)) {
return null;
}
const xStart = Math.min(baselineX, x);
const width = Math.abs(x - baselineX);
return {
x: xStart,
y: y - barThickness / 2,
width,
height: barThickness,
};
};
exports.getHorizontalBarRect = getHorizontalBarRect;