UNPKG

victory-native

Version:

[![Victory Native](https://oss.nearform.com/api/banner?badge=victory&text=victory+native&bg=9c2f1e)](https://commerce.nearform.com/open-source/victory-native/)

38 lines (37 loc) 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createRoundedRectPath = void 0; const createRoundedRectPath = (x, y, barWidth, barHeight, roundedCorners, yValue) => { const corners = Object.assign({}, roundedCorners); if (Number(yValue) < 0) { [ corners.topLeft, corners.topRight, corners.bottomLeft, corners.bottomRight, ] = [ corners.bottomLeft, corners.bottomRight, corners.topLeft, corners.topRight, ]; } const topLeft = Math.min((Math.ceil(barWidth) / 2, corners.topLeft) || 0); const topRight = Math.min((Math.ceil(barWidth) / 2, corners.topRight) || 0); const bottomLeft = Math.min((Math.ceil(barWidth) / 2, corners.bottomLeft) || 0); const bottomRight = Math.min((Math.ceil(barWidth) / 2, corners.bottomRight) || 0); const nonUniformRoundedRect = { rect: { x: x - barWidth / 2, y: y, width: barWidth, height: barHeight, }, topLeft: { x: topLeft, y: topLeft }, topRight: { x: topRight, y: topRight }, bottomRight: { x: bottomRight, y: bottomRight }, bottomLeft: { x: bottomLeft, y: bottomLeft }, }; return nonUniformRoundedRect; }; exports.createRoundedRectPath = createRoundedRectPath;