class SizeUtilsService {
  // 获取属性值 margin and padding
  private static getSpacingSize(view: HTMLElement, pOrmName: string): number {
    const padding = (document.defaultView as any).getComputedStyle(view, null)[pOrmName] || "0";
    return Number(padding.replace("px", ""));
  }
  // 获取元素高度
  getViewHeight(view: any): number {
    return view.clientHeight;
  }
  // 获取全部的padding和margin的
  getAllPaddingSize(view: any): number {
    const pt = SizeUtilsService.getSpacingSize(view, "padding-top");
    const pb = SizeUtilsService.getSpacingSize(view, "padding-bottom");
    return pt + pb;
  }
  // 获取全部的margin值
  getAllMarginSize(view: any): number {
    const mt = SizeUtilsService.getSpacingSize(view, "margin-top");
    const mb = SizeUtilsService.getSpacingSize(view, "margin-bottom");
    return mt + mb;
  }
}
const sizeUtilsService = new SizeUtilsService();
export default sizeUtilsService;
