MCPcopy
hub / github.com/chartjs/Chart.js / parseBorderRadius

Function parseBorderRadius

src/elements/element.bar.js:54–71  ·  view source on GitHub ↗
(bar, maxW, maxH)

Source from the content-addressed store, hash-verified

52}
53
54function parseBorderRadius(bar, maxW, maxH) {
55 const {enableBorderRadius} = bar.getProps(['enableBorderRadius']);
56 const value = bar.options.borderRadius;
57 const o = toTRBLCorners(value);
58 const maxR = Math.min(maxW, maxH);
59 const skip = bar.borderSkipped;
60
61 // If the value is an object, assume the user knows what they are doing
62 // and apply as directed.
63 const enableBorder = enableBorderRadius || isObject(value);
64
65 return {
66 topLeft: skipOrLimit(!enableBorder || skip.top || skip.left, o.topLeft, 0, maxR),
67 topRight: skipOrLimit(!enableBorder || skip.top || skip.right, o.topRight, 0, maxR),
68 bottomLeft: skipOrLimit(!enableBorder || skip.bottom || skip.left, o.bottomLeft, 0, maxR),
69 bottomRight: skipOrLimit(!enableBorder || skip.bottom || skip.right, o.bottomRight, 0, maxR)
70 };
71}
72
73function boundingRects(bar) {
74 const bounds = getBarBounds(bar);

Callers 1

boundingRectsFunction · 0.70

Calls 4

toTRBLCornersFunction · 0.85
isObjectFunction · 0.85
skipOrLimitFunction · 0.85
getPropsMethod · 0.80

Tested by

no test coverage detected