dom.js 619 B

1234567891011121314151617181920
  1. /**
  2. * get the element's bounding size
  3. * @param ele dom element
  4. * @returns the element width and height
  5. */
  6. export function getContainerSize(ele) {
  7. if (!ele) {
  8. return { width: 0, height: 0 };
  9. }
  10. var style = getComputedStyle(ele);
  11. return {
  12. width: (ele.clientWidth || parseInt(style.width, 10)) -
  13. parseInt(style.paddingLeft, 10) -
  14. parseInt(style.paddingRight, 10),
  15. height: (ele.clientHeight || parseInt(style.height, 10)) -
  16. parseInt(style.paddingTop, 10) -
  17. parseInt(style.paddingBottom, 10),
  18. };
  19. }
  20. //# sourceMappingURL=dom.js.map