export class HTMLShapeGeometry {
    constructor(top, left, height, width) {
        this.top = top;
        this.left = left;
        this.height = height;
        this.width = width;
    }
    get topWithPadding() {
        var _a;
        return this.top - ((_a = this.topPadding) !== null && _a !== void 0 ? _a : 0);
    }
    get heightWithPadding() {
        var _a, _b;
        return this.height + ((_a = this.topPadding) !== null && _a !== void 0 ? _a : 0) + ((_b = this.bottomPadding) !== null && _b !== void 0 ? _b : 0);
    }
    get right() {
        var _a;
        return this.left + this.width + ((_a = this.rightPadding) !== null && _a !== void 0 ? _a : 0);
    }
    get bottom() {
        var _a;
        return this.top + this.height + ((_a = this.bottomPadding) !== null && _a !== void 0 ? _a : 0);
    }
}
export class HTMLUtilities {
    static getGeometry(id, parentId) {
        let element = document.getElementById(id);
        if (!element)
            return;
        return this.getGeometryFromElement(element, parentId);
    }
    static getGeometryFromElement(elem, parentId) {
        let element = elem;
        let top = 0, left = 0;
        do {
            top += element.offsetTop || 0;
            left += element.offsetLeft || 0;
            if (parentId && element.offsetParent && element.offsetParent.id === parentId) {
                break;
            }
            else {
                element = element.offsetParent;
            }
        } while (element);
        return new HTMLShapeGeometry(top, left, elem.offsetHeight, elem.offsetWidth);
    }
}
//# sourceMappingURL=HTMLUtilities.js.map