All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.butterfaces-dist-js.butterfaces-tooltip.js Maven / Gradle / Ivy

There is a newer version: 3.5.0
Show newest version
///
var ButterFaces;
(function (ButterFaces) {
    var Tooltip = /** @class */ (function () {
        function Tooltip(popoverMaxWidthByBootstrap, popoverMaxHeightByButterFaces) {
            if (popoverMaxWidthByBootstrap === void 0) { popoverMaxWidthByBootstrap = 276; }
            if (popoverMaxHeightByButterFaces === void 0) { popoverMaxHeightByButterFaces = 110; }
            this.popoverMaxWidthByBootstrap = popoverMaxWidthByBootstrap;
            this.popoverMaxHeightByButterFaces = popoverMaxHeightByButterFaces;
            console.log("ButterFaces.Tooltip.constructor - popoverMaxWidthByBootstrap is " + this.popoverMaxHeightByButterFaces + ", popoverMaxHeightByButterFaces is " + this.popoverMaxWidthByBootstrap);
        }
        Tooltip.prototype.calculateTooltipPosition = function (popover, source) {
            var offsetBottom = $(window).height() - $(source).offset().top - $(source).outerHeight();
            var offsetRight = $(window).width() - $(source).offset().left - $(source).outerWidth();
            console.log("ButterFaces.Tooltip.calculateTooltipPosition - offsetBottom is " + offsetBottom);
            console.log("ButterFaces.Tooltip.calculateTooltipPosition - offsetRight is " + offsetRight);
            if (offsetBottom < this.popoverMaxHeightByButterFaces) {
                if (offsetRight < this.popoverMaxWidthByBootstrap) {
                    console.log("ButterFaces.Tooltip.calculateTooltipPosition - offset right (" + offsetRight + ") is smaller than popoverMaxWidthByBootstrap (" + this.popoverMaxWidthByBootstrap + ") -> position is top or left");
                    if ($(source).offset().left < this.popoverMaxWidthByBootstrap) {
                        console.log("ButterFaces.Tooltip.calculateTooltipPosition - left offset is smaller than popoverMaxWidthByBootstrap (" + this.popoverMaxWidthByBootstrap + ") -> position is top");
                        return "top";
                    }
                    console.log("ButterFaces.Tooltip.calculateTooltipPosition - left offset is NOT smaller than popoverMaxWidthByBootstrap (" + this.popoverMaxWidthByBootstrap + ") -> position is left");
                    return "left";
                }
                console.log("ButterFaces.Tooltip.calculateTooltipPosition - offsetRight (" + offsetRight + ") is greater than popoverMaxWidthByBootstrap (" + this.popoverMaxWidthByBootstrap + ") -> position is right");
                return "right";
            }
            console.log("ButterFaces.Tooltip.calculateTooltipPosition - offsetBottom (" + offsetBottom + ") is greater than popoverMaxHeightByButterFaces (" + this.popoverMaxHeightByButterFaces + ") -> position is bottom");
            return "bottom";
        };
        return Tooltip;
    }());
    ButterFaces.Tooltip = Tooltip;
})(ButterFaces || (ButterFaces = {}));

//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJ1dHRlcmZhY2VzLXRvb2x0aXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsa0VBQWtFO0FBRWxFLElBQVUsV0FBVyxDQXNDcEI7QUF0Q0QsV0FBVSxXQUFXO0lBQ2pCO1FBS0ksaUJBQVksMEJBQWdDLEVBQUUsNkJBQW1DO1lBQXJFLDJDQUFBLEVBQUEsZ0NBQWdDO1lBQUUsOENBQUEsRUFBQSxtQ0FBbUM7WUFDN0UsSUFBSSxDQUFDLDBCQUEwQixHQUFHLDBCQUEwQixDQUFDO1lBQzdELElBQUksQ0FBQyw2QkFBNkIsR0FBRyw2QkFBNkIsQ0FBQztZQUVuRSxPQUFPLENBQUMsR0FBRyxDQUFDLGtFQUFrRSxHQUFHLElBQUksQ0FBQyw2QkFBNkIsR0FBRyxxQ0FBcUMsR0FBRyxJQUFJLENBQUMsMEJBQTBCLENBQUMsQ0FBQztRQUNuTSxDQUFDO1FBRU0sMENBQXdCLEdBQS9CLFVBQWdDLE9BQVksRUFBRSxNQUFXO1lBRXJELElBQUksWUFBWSxHQUFHLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxNQUFNLEVBQUUsR0FBRyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsTUFBTSxFQUFFLENBQUMsR0FBRyxHQUFHLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FB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