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

Function boundingRects

src/elements/element.bar.js:73–101  ·  view source on GitHub ↗
(bar)

Source from the content-addressed store, hash-verified

71}
72
73function boundingRects(bar) {
74 const bounds = getBarBounds(bar);
75 const width = bounds.right - bounds.left;
76 const height = bounds.bottom - bounds.top;
77 const border = parseBorderWidth(bar, width / 2, height / 2);
78 const radius = parseBorderRadius(bar, width / 2, height / 2);
79
80 return {
81 outer: {
82 x: bounds.left,
83 y: bounds.top,
84 w: width,
85 h: height,
86 radius
87 },
88 inner: {
89 x: bounds.left + border.l,
90 y: bounds.top + border.t,
91 w: width - border.l - border.r,
92 h: height - border.t - border.b,
93 radius: {
94 topLeft: Math.max(0, radius.topLeft - Math.max(border.t, border.l)),
95 topRight: Math.max(0, radius.topRight - Math.max(border.t, border.r)),
96 bottomLeft: Math.max(0, radius.bottomLeft - Math.max(border.b, border.l)),
97 bottomRight: Math.max(0, radius.bottomRight - Math.max(border.b, border.r)),
98 }
99 }
100 };
101}
102
103function inRange(bar, x, y, useFinalPosition) {
104 const skipX = x === null;

Callers 1

drawMethod · 0.85

Calls 3

getBarBoundsFunction · 0.85
parseBorderWidthFunction · 0.85
parseBorderRadiusFunction · 0.70

Tested by

no test coverage detected