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

Function getPositionedStyle

src/helpers/helpers.dom.ts:53–63  ·  view source on GitHub ↗
(styles: CSSStyleDeclaration, style: string, suffix?: string)

Source from the content-addressed store, hash-verified

51
52const positions = ['top', 'right', 'bottom', 'left'];
53function getPositionedStyle(styles: CSSStyleDeclaration, style: string, suffix?: string): ChartArea {
54 const result = {} as ChartArea;
55 suffix = suffix ? '-' + suffix : '';
56 for (let i = 0; i < 4; i++) {
57 const pos = positions[i];
58 result[pos] = parseFloat(styles[style + '-' + pos + suffix]) || 0;
59 }
60 result.width = result.left + result.right;
61 result.height = result.top + result.bottom;
62 return result;
63}
64
65const useOffsetPos = (x: number, y: number, target: HTMLElement | EventTarget) =>
66 (x > 0 || y > 0) && (!target || !(target as HTMLElement).shadowRoot);

Callers 3

getRelativePositionFunction · 0.85
getContainerSizeFunction · 0.85
getMaximumSizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…