dom.js 769 B

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