all files / circular-gauge/utils/ helper-tooltip.js

100% Statements 30/30
85.71% Branches 12/14
100% Functions 3/3
100% Lines 30/30
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39   369× 369× 369× 369× 369× 369× 369× 369×   254× 254× 254× 254×   254× 254× 254× 254×   254× 254× 254× 254×   254× 254× 254×   254×      
define(["require", "exports", "./helper-common", "@syncfusion/ej2-base"], function (require, exports, helper_common_1, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    function getMousePosition(pageX, pageY, element) {
        var elementRect = element.getBoundingClientRect();
        var pageXOffset = element.ownerDocument.defaultView.pageXOffset;
        var pageYOffset = element.ownerDocument.defaultView.pageYOffset;
        var clientTop = element.ownerDocument.documentElement.clientTop;
        var clientLeft = element.ownerDocument.documentElement.clientLeft;
        var positionX = elementRect.left + pageXOffset - clientLeft;
        var positionY = elementRect.top + pageYOffset - clientTop;
        return new helper_common_1.GaugeLocation((pageX - positionX), (pageY - positionY));
    }
    exports.getMousePosition = getMousePosition;
    function getElementSize(template, gauge, parent) {
        var elementSize;
        var element;
        var templateFn = helper_common_1.getTemplateFunction(template, gauge);
        var tooltipData = templateFn ? (gauge.isVue || gauge.isVue3) ? templateFn({}, gauge, null, gauge.element.id + 'Template')
            : templateFn({}, null, null, gauge.element.id + 'Template') : [];
        Eif (templateFn && tooltipData.length) {
            element = gauge.createElement('div', { id: gauge.element.id + '_Measure_Element' });
            gauge.element.appendChild(element);
            var templateElement = (gauge.isVue || gauge.isVue3) ? templateFn({}, gauge, null, gauge.element.id + 'Template')
                : templateFn({}, null, null, gauge.element.id + 'Template');
            var templateLength = templateElement.length;
            while (templateLength > 0) {
                element.appendChild(templateElement[0]);
                templateLength--;
            }
            parent.appendChild(element);
            elementSize = new helper_common_1.Size(parent.getBoundingClientRect().width, parent.getBoundingClientRect().height);
            ej2_base_1.remove(element);
        }
        return elementSize;
    }
    exports.getElementSize = getElementSize;
});