all files / export/ pdf-event-marker.js

100% Statements 44/44
100% Branches 20/20
100% Functions 4/4
100% Lines 44/44
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60   118×   922× 922× 922× 922×   19×   922× 922× 902×   922× 922× 922× 922× 378× 378× 378× 378× 378× 378× 34× 34× 29× 29× 29× 29× 29× 29× 29×         344× 344× 334× 334× 334× 334× 334× 334× 334×              
define(["require", "exports", "@syncfusion/ej2-pdf-export", "../base/utils", "@syncfusion/ej2-base"], function (require, exports, ej2_pdf_export_1, utils_1, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var EventMarker = (function () {
        function EventMarker(parent) {
            this.parent = parent;
        }
        EventMarker.prototype.drawEventMarker = function (page, startPoint, cumulativeWidth, detail, eventMarker, cumulativeHeight) {
            var taskGraphics = page.graphics;
            var pageSize = page.getClientSize();
            var font = new ej2_pdf_export_1.PdfStandardFont(ej2_pdf_export_1.PdfFontFamily.Helvetica, 10);
            if (!ej2_base_1.isNullOrUndefined(this.parent.pdfExportModule['helper']['exportProps'].ganttStyle) &&
                this.parent.pdfExportModule['helper']['exportProps'].ganttStyle.font) {
                font = this.parent.pdfExportModule['helper']['exportProps'].ganttStyle.font;
            }
            var strSize;
            if (!ej2_base_1.isNullOrUndefined(eventMarker.label)) {
                strSize = font.measureString(eventMarker.label);
            }
            var triangle = 8;
            var eventLine = new ej2_pdf_export_1.PdfPen(new ej2_pdf_export_1.PdfColor(0, 0, 0));
            eventLine.dashStyle = ej2_pdf_export_1.PdfDashStyle.Dash;
            if (detail.startDate <= eventMarker.date && eventMarker.date <= detail.endDate) {
                var enventFormat = new ej2_pdf_export_1.PdfStringFormat();
                enventFormat.alignment = ej2_pdf_export_1.PdfTextAlignment.Center;
                var eventBrush = new ej2_pdf_export_1.PdfSolidBrush(new ej2_pdf_export_1.PdfColor(253, 191, 100));
                var left = this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(eventMarker.date, true), false, true);
                var diff = 10;
                if (this.parent.pdfExportModule.gantt.taskbar.isAutoFit()) {
                    taskGraphics.drawLine(eventLine, new ej2_pdf_export_1.PointF(startPoint.x + (left - cumulativeWidth) + diff, cumulativeHeight), new ej2_pdf_export_1.PointF(startPoint.x + (left - cumulativeWidth) + diff, pageSize.height));
                    if (!ej2_base_1.isNullOrUndefined(eventMarker.label) && eventMarker.label.length > 0) {
                        taskGraphics.save();
                        taskGraphics.translateTransform(startPoint.x + (left - cumulativeWidth) + 7 + diff, cumulativeHeight + utils_1.pixelToPoint(50) + strSize.height / 2);
                        taskGraphics.rotateTransform(45);
                        taskGraphics.drawRectangle(null, eventBrush, 0, 0, triangle, triangle);
                        taskGraphics.restore();
                        taskGraphics.drawRectangle(null, eventBrush, startPoint.x + (left - cumulativeWidth) + 7 + diff, cumulativeHeight + utils_1.pixelToPoint(50), strSize.width + 10, strSize.height * 2);
                        taskGraphics.drawString(eventMarker.label, font, null, ej2_pdf_export_1.PdfBrushes.Black, startPoint.x +
                            (left - cumulativeWidth) + 12 + diff, cumulativeHeight + utils_1.pixelToPoint(50) + utils_1.pixelToPoint(strSize.height / 2), strSize.width, strSize.height, enventFormat);
                    }
                }
                else {
                    taskGraphics.drawLine(eventLine, new ej2_pdf_export_1.PointF(startPoint.x + utils_1.pixelToPoint(left - cumulativeWidth) + diff, cumulativeHeight), new ej2_pdf_export_1.PointF(startPoint.x + utils_1.pixelToPoint(left - cumulativeWidth) + diff, pageSize.height));
                    if (!ej2_base_1.isNullOrUndefined(eventMarker.label) && eventMarker.label.length > 0) {
                        taskGraphics.save();
                        taskGraphics.translateTransform(startPoint.x + utils_1.pixelToPoint(left - cumulativeWidth) + 7 + diff, cumulativeHeight + utils_1.pixelToPoint(50) + strSize.height / 2);
                        taskGraphics.rotateTransform(45);
                        taskGraphics.drawRectangle(null, eventBrush, 0, 0, triangle, triangle);
                        taskGraphics.restore();
                        taskGraphics.drawRectangle(null, eventBrush, startPoint.x + utils_1.pixelToPoint(left - cumulativeWidth) + 7 + diff, cumulativeHeight + utils_1.pixelToPoint(50), strSize.width + 10, strSize.height * 2);
                        taskGraphics.drawString(eventMarker.label, font, null, ej2_pdf_export_1.PdfBrushes.Black, startPoint.x + utils_1.pixelToPoint(left - cumulativeWidth) + 12 + diff, cumulativeHeight + utils_1.pixelToPoint(50) + utils_1.pixelToPoint(strSize.height / 2), strSize.width, strSize.height, enventFormat);
                    }
                }
            }
        };
        return EventMarker;
    }());
    exports.EventMarker = EventMarker;
});