mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* move charts to toolkit * refactor imports * fix tests * change the behavior of the color mode hook and add the noWatermark prop * fix gas tracker test and fix toolkit build
13 lines
461 B
TypeScript
13 lines
461 B
TypeScript
import type { ChartMargin, ChartOffset } from '../types';
|
|
|
|
export function calculateInnerSize(rect: DOMRect | null, margin?: ChartMargin, offsets?: ChartOffset) {
|
|
if (!rect) {
|
|
return { innerWidth: 0, innerHeight: 0 };
|
|
}
|
|
|
|
return {
|
|
innerWidth: Math.max(rect.width - (offsets?.x || 0) - (margin?.left || 0) - (margin?.right || 0), 0),
|
|
innerHeight: Math.max(rect.height - (offsets?.y || 0) - (margin?.bottom || 0) - (margin?.top || 0), 0),
|
|
};
|
|
}
|