all files / pdfviewer/drawing/ dom-util.js

20.69% Statements 6/29
0% Branches 0/4
33.33% Functions 1/3
20.69% Lines 6/29
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 40 41                                                                      
define(["require", "exports", "@syncfusion/ej2-drawings", "@syncfusion/ej2-drawings"], function (require, exports, ej2_drawings_1, ej2_drawings_2) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    function renderAdornerLayer(bounds, commonStyle, cavas, index, pdfViewer) {
        var divElement = ej2_drawings_1.createHtmlElement('div', {
            'id': pdfViewer.element.id + index + '_diagramAdornerLayer',
            'style': 'width:' + bounds.width + 'px;height:' + bounds.height + 'px;' + commonStyle
        });
        if (!ej2_drawings_1.getDiagramElement(divElement.id)) {
            var nextElement = pdfViewer.viewerBase.getElement('_pageDiv_' + index);
            var pageBound = nextElement.getBoundingClientRect();
            var svgAdornerSvg = createSvg(pdfViewer.element.id + index + '_diagramAdorner_svg', pageBound.width, pageBound.height);
            svgAdornerSvg.setAttribute('class', 'e-adorner-layer' + index);
            svgAdornerSvg.setAttribute('style', 'pointer-events:none;');
            pdfViewer.adornerSvgLayer = ej2_drawings_2.createSvgElement('g', { 'id': pdfViewer.element.id + index + '_diagramAdorner' });
            pdfViewer.adornerSvgLayer.setAttribute('style', ' pointer-events: all; ');
            svgAdornerSvg.appendChild(pdfViewer.adornerSvgLayer);
            divElement.appendChild(svgAdornerSvg);
            divElement.style.width = pageBound.width + 'px';
            divElement.style.height = pageBound.height + 'px';
            if (nextElement) {
                nextElement.insertBefore(divElement, nextElement.childNodes[0]);
            }
            else {
                cavas.parentElement.appendChild(divElement);
            }
            var svgSelector = ej2_drawings_2.createSvgElement('g', { 'id': pdfViewer.element.id + index + '_SelectorElement' });
            pdfViewer.adornerSvgLayer.appendChild(svgSelector);
            ej2_drawings_2.setAttributeSvg(svgAdornerSvg, { style: 'pointer-events:none;' });
        }
        pdfViewer.viewerBase.applyElementStyles(divElement, index);
    }
    exports.renderAdornerLayer = renderAdornerLayer;
    function createSvg(id, width, height) {
        var svgObj = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
        ej2_drawings_2.setAttributeSvg(svgObj, { 'id': id, 'width': width, 'height': height });
        return svgObj;
    }
    exports.createSvg = createSvg;
});