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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