all files / renderer/ connector-line.js

97.37% Statements 592/608
91.27% Branches 575/630
100% Functions 28/28
97.53% Lines 592/607
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972   1272× 1272× 1272× 1272× 1272× 1272× 1272×       1272×             1272× 1272× 1272×     1272× 1272×   17320× 17320×     17320×   1278× 1278× 1278×   50964×       32608× 32608× 32608× 32608×     194×     32414×     32608× 32608× 32608×     194× 4206×   194× 4206×   194× 194×     32414× 32414×   32608× 32608× 32608× 32608×     194×       32414×     32608× 32608× 32608× 32608×   3029×     29579×   29579×   29579×   29579×   29579× 29579× 29579× 1078× 1078×     28501×   29579× 29579× 29579× 29579× 29579× 29579× 29579× 29579× 29579× 30×     29549×       2411× 2411× 2411× 2411× 12160× 12160× 12160×   2411× 2411× 12158× 12158× 24316× 24316× 24316×     2411× 2411× 2411× 12158×     50961× 49217× 572× 400×     172×     48645× 13672× 13500×   172× 96×   76× 76×     34973×   15056× 376× 140×     14916× 748× 180×   568× 204×     14532× 13612×   920× 884×   36× 36×     19917× 19908× 19836×   72× 36×   36× 36×       1744× 1744× 480× 384×   64×     320×     96× 96× 32×   64× 32×   32× 32×       1264×   1036× 720× 104×   616× 96× 52×     44×     520× 336× 332×           316× 316× 12×   304×     304× 32×     24×       456× 456×     228× 228× 224×                       12741× 108×         12633×         12741× 330×   12411×   12741× 330×   12411×   12741× 4010×   8731× 330×   8401× 8398×     12738× 12738× 12738×   10946×               1792× 1792× 1792× 1792× 1792×             1791×             12738×   11829×   909×     848× 311×     537×           28×     21×               25×     22×                             12741× 12741× 12741× 12741× 12741× 12741× 12741× 129× 129× 2242× 2242× 1996× 579×   1996× 764×   1996× 1996×         12741× 12741× 12741× 12741× 12741× 12741× 12741× 12741× 12741× 12741× 12741× 1659× 1659×     12741× 12741× 12741× 12741× 12741× 12741× 12741× 108× 2120× 1910× 460× 460×       108× 108× 2120× 1910× 580× 580×         12741×   12656× 12656× 12656× 12656× 12656× 12656×     12647×   12656×                                                                 12741× 12741× 12738× 12738× 12738× 12738× 12738× 12738×           12738×           12738×       12738× 12738× 12738× 12738× 12738× 12738× 12738× 3375× 3375× 3375×     3375× 3375× 3375×   3375×       12738× 8362× 8362× 8362× 8362× 8362× 8362× 8362× 8362×   8362×   8362×       12738× 186× 186× 186× 186× 186× 186×   186× 186× 186×   186×       12738× 80× 80× 80× 80× 80× 80× 80×   80×       12738× 16× 16× 16× 16× 16× 16× 16× 16×     16×   16×       12738× 85× 85× 85× 85× 85× 85× 85×   85×       12738× 249× 249× 249× 249× 249× 249× 249× 249×   249×       12738× 45× 45× 45× 45× 45× 45× 45×   45×       12738× 43× 43× 43× 43× 43× 43× 43× 43× 43×   43×       12738× 100× 100× 100× 100× 100× 100× 100× 100× 100×   100×       12738× 26× 26× 26× 26× 26× 26× 26× 26× 26×   26×       12738× 11× 11× 11× 11× 11× 11× 11× 11× 11×   11×       12738× 19× 19× 19× 19× 19× 19× 19× 19× 19× 19× 19× 19× 19×   19×       12738× 13× 13× 13× 13× 13× 13× 13× 13× 13× 13×   13×       12738× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93×   93×       12738× 35× 35× 35× 35× 35× 35× 35×   35×       12738× 12738×   12741×   25482× 25482× 25482× 25482× 25482× 25482× 25482× 25482× 25482× 944× 944×     24538×   500× 500×       24038× 372× 372×       23666× 23660× 23660×       25482×   1278× 1278× 1278× 1278×   15× 15× 15× 30× 30× 30× 30× 30× 30× 30× 30× 30× 30× 30× 30×   15× 15× 15×   24316× 24316× 24316× 24316× 24316× 24316× 24316× 24316× 22996×   1320× 306×   1014× 738×     276×   24316×   61099×     61099×     388× 8412×   388×   60711× 11426×     49285×     495× 495× 283×     212×   495× 495× 495× 8818× 8818× 5356× 5356×     3462×   8818× 8818× 2360× 4275× 4275×         8382× 8382× 2354×          
define(["require", "exports", "@syncfusion/ej2-base", "../base/css-constants", "../base/utils", "@syncfusion/ej2-svg-base"], function (require, exports, ej2_base_1, cls, utils_1, ej2_svg_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ConnectorLine = (function () {
        function ConnectorLine(ganttObj) {
            this.transform = '';
            this.connectorLinePath = '';
            this.arrowPath = '';
            this.taskLineValue = 0;
            this.expandedRecords = [];
            this.parent = ganttObj;
            this.dependencyViewContainer =
                ej2_base_1.createElement('div', {
                    className: cls.dependencyViewContainer
                });
            Object.assign(this.dependencyViewContainer.style, {
                width: '100%',
                height: '100%',
                zIndex: 2,
                position: 'absolute',
                pointerEvents: 'none'
            });
            this.renderer = new ej2_svg_base_1.SvgRenderer(this.parent.element.id);
            this.initPublicProp();
            this.svgObject = this.renderer.createSvg({
                id: this.parent.element.id + '_svg'
            });
            this.svgObject.setAttribute('height', '100%');
            this.svgObject.setAttribute('width', '100%');
        }
        ConnectorLine.prototype.getconnectorLineGap = function (data) {
            var width = 0;
            width = (data.milestoneChild ?
                ((this.parent.chartRowsModule.milestoneMarginTop / 2) + (this.parent.chartRowsModule.milestoneHeight / 2)) :
                ((this.parent.chartRowsModule.taskBarMarginTop / 2) + (this.parent.chartRowsModule.taskBarHeight / 2)));
            return width;
        };
        ConnectorLine.prototype.initPublicProp = function () {
            this.lineColor = this.parent.connectorLineBackground;
            this.lineStroke = (this.parent.connectorLineWidth) > 4 ? 4 : this.parent.connectorLineWidth;
            this.createConnectorLineTooltipTable();
        };
        ConnectorLine.prototype.getTaskbarMidpoint = function (isMilestone) {
            return Math.floor(isMilestone ?
                (this.parent.chartRowsModule.milestoneMarginTop + (this.parent.chartRowsModule.milestoneHeight / 2)) :
                (this.parent.chartRowsModule.taskBarMarginTop + (this.parent.chartRowsModule.taskBarHeight / 2))) + 1;
        };
        ConnectorLine.prototype.createConnectorLineObject = function (parentGanttData, childGanttData, predecessor, rowHeight) {
            Iif (rowHeight === void 0) { rowHeight = 0; }
            var connectorObj = {};
            var updatedRecords;
            if (this.parent.pdfExportModule && this.parent.pdfExportModule.isPdfExport && this.parent.pdfExportModule.helper.exportProps &&
                this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
                this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) {
                updatedRecords = this.parent.pdfExportModule.helper.beforeSinglePageExport['cloneFlatData'];
            }
            else {
                updatedRecords = this.parent.pdfExportModule && this.parent.pdfExportModule.isPdfExport ?
                    this.parent.flatData : this.expandedRecords;
            }
            var parentIndex;
            var childIndex;
            if (this.parent.pdfExportModule && this.parent.pdfExportModule.isPdfExport && this.parent.pdfExportModule.helper.exportProps &&
                this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
                this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) {
                var parentData = this.parent.flatData.filter(function (data) {
                    return data.ganttProperties.taskId.toString() === parentGanttData.ganttProperties.taskId.toString();
                })[0];
                var childData = this.parent.flatData.filter(function (data) {
                    return data.ganttProperties.taskId.toString() === childGanttData.ganttProperties.taskId.toString();
                })[0];
                parentIndex = parentData.index;
                childIndex = childData.index;
            }
            else {
                parentIndex = updatedRecords.indexOf(parentGanttData);
                childIndex = updatedRecords.indexOf(childGanttData);
            }
            var parentGanttRecord = parentGanttData.ganttProperties;
            var childGanttRecord = childGanttData.ganttProperties;
            var currentData;
            if (this.parent.pdfExportModule && this.parent.pdfExportModule.isPdfExport && this.parent.pdfExportModule.helper.exportProps &&
                this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
                this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) {
                currentData = this.parent.virtualScrollModule && this.parent.enableVirtualization ?
                    this.parent.pdfExportModule.helper.beforeSinglePageExport['cloneFlatData'] : this.parent.getExpandedRecords(this.parent.pdfExportModule.helper.beforeSinglePageExport['cloneFlatData']);
            }
            else {
                currentData = this.parent.virtualScrollModule && this.parent.enableVirtualization ?
                    this.parent.currentViewData : this.parent.expandedRecords;
            }
            connectorObj.parentIndexInCurrentView = currentData.indexOf(parentGanttData);
            connectorObj.childIndexInCurrentView = currentData.indexOf(childGanttData);
            var isVirtualScroll = this.parent.virtualScrollModule && this.parent.enableVirtualization;
            if ((!isVirtualScroll && (connectorObj.parentIndexInCurrentView === -1 || connectorObj.childIndexInCurrentView === -1)) ||
                connectorObj.parentIndexInCurrentView === -1 && connectorObj.childIndexInCurrentView === -1) {
                return null;
            }
            else {
                connectorObj.parentLeft = parentGanttRecord.isMilestone ?
                    parentGanttRecord.left - (this.parent.chartRowsModule.milestoneHeight / 2) : parentGanttRecord.left;
                connectorObj.childLeft = childGanttRecord.isMilestone ?
                    childGanttRecord.left - (this.parent.chartRowsModule.milestoneHeight / 2) : childGanttRecord.left;
                connectorObj.parentWidth = parentGanttRecord.width === 0 || parentGanttRecord.isMilestone ?
                    (Math.floor(this.parent.chartRowsModule.milestoneHeight)) : parentGanttRecord.width;
                connectorObj.childWidth = childGanttRecord.width === 0 || childGanttRecord.isMilestone ?
                    (Math.floor(this.parent.chartRowsModule.milestoneHeight)) : childGanttRecord.width;
                connectorObj.parentIndex = parentIndex;
                connectorObj.childIndex = childIndex;
                if (rowHeight === 0) {
                    var chartRows = this.parent.ganttChartModule.getChartRows();
                    connectorObj.rowHeight = !ej2_base_1.isNullOrUndefined(chartRows) && chartRows[0] && chartRows[0].offsetHeight;
                }
                else {
                    connectorObj.rowHeight = rowHeight;
                }
                connectorObj.type = predecessor.type;
                var parentId = this.parent.viewType === 'ResourceView' ? parentGanttRecord.taskId : parentGanttRecord.rowUniqueID;
                var childId = this.parent.viewType === 'ResourceView' ? childGanttRecord.taskId : childGanttRecord.rowUniqueID;
                connectorObj.connectorLineId = 'parent' + parentId + 'child' + childId;
                connectorObj.milestoneParent = parentGanttRecord.isMilestone ? true : false;
                connectorObj.milestoneChild = childGanttRecord.isMilestone ? true : false;
                connectorObj.parentEndPoint = connectorObj.parentLeft + connectorObj.parentWidth;
                connectorObj.childEndPoint = connectorObj.childLeft + connectorObj.childWidth;
                if (ej2_base_1.isNullOrUndefined(utils_1.isScheduledTask(parentGanttRecord)) || ej2_base_1.isNullOrUndefined(utils_1.isScheduledTask(childGanttRecord))) {
                    return null;
                }
                else {
                    return connectorObj;
                }
            }
        };
        ConnectorLine.prototype.renderConnectorLines = function (connectorLinesCollection) {
            var connectorLine;
            var ariaConnector = [];
            this.svgObject.innerHTML = '';
            for (var index = 0; index < connectorLinesCollection.length; index++) {
                connectorLine = this.getConnectorLineTemplate(connectorLinesCollection[index]);
                this.svgObject.appendChild(connectorLine);
                ariaConnector.push(connectorLinesCollection[index]);
            }
            var childNodes = this.parent.connectorLineModule.svgObject.childNodes;
            for (var i = 0; i < childNodes.length; i++) {
                var innerChild = childNodes[i].childNodes;
                for (var j = 0; j < innerChild.length; j++) {
                    var ariaString = 'Connector Line ' + this.parent.connectorLineModule.generateAriaLabel(ariaConnector[i]);
                    innerChild[j].setAttribute('aria-label', ariaString);
                    innerChild[j].setAttribute('role', 'img');
                }
            }
            this.parent.ganttChartModule.chartBodyContent.insertBefore(this.dependencyViewContainer, this.parent.ganttChartModule.chartBodyContent.lastChild);
            this.dependencyViewContainer.appendChild(this.svgObject);
            for (var i = 0; i < this.svgObject.children.length; i++) {
                this.svgObject.children[i].children[0].setAttribute('tabindex', '-1');
            }
        };
        ConnectorLine.prototype.getParentPosition = function (data) {
            if (data.parentIndex < data.childIndex) {
                if (data.type === 'FF') {
                    if ((data.childLeft + data.childWidth) >= (data.parentLeft + data.parentWidth)) {
                        return 'FFType2';
                    }
                    else {
                        return 'FFType1';
                    }
                }
                else if ((data.parentLeft < data.childLeft) && (data.childLeft > (data.parentLeft + data.parentWidth + 25))) {
                    if (data.type === 'FS') {
                        return 'FSType1';
                    }
                    if (data.type === 'SF') {
                        return 'SFType1';
                    }
                    else Eif (data.type === 'SS') {
                        return 'SSType2';
                    }
                }
                else if ((data.parentLeft < data.childLeft && (data.childLeft < (data.parentLeft + data.parentWidth)))
                    || (data.parentLeft === data.childLeft || data.parentLeft > data.childLeft)) {
                    if (data.parentLeft > (data.childLeft + data.childWidth + 25)) {
                        if (data.type === 'SF') {
                            return 'SFType2';
                        }
                    }
                    if (data.parentLeft > data.childLeft) {
                        if (data.type === 'SS') {
                            return 'SSType1';
                        }
                        if (data.type === 'SF') {
                            return 'SFType1';
                        }
                    }
                    if (data.type === 'FS') {
                        return 'FSType2';
                    }
                    else if (data.type === 'SS') {
                        return 'SSType2';
                    }
                    else Eif (data.type === 'SF') {
                        return 'SFType1';
                    }
                }
                else if ((data.parentLeft) < data.childLeft) {
                    if (data.type === 'FS') {
                        return 'FSType2';
                    }
                    else if (data.type === 'SS') {
                        return 'SSType2';
                    }
                    else Eif (data.type === 'SF') {
                        return 'SFType1';
                    }
                }
            }
            else Eif (data.parentIndex > data.childIndex) {
                if ((data.parentLeft < data.childLeft) && (data.childLeft > (data.parentLeft + data.parentWidth))) {
                    if (data.type === 'FS') {
                        if (30 >= (data.childLeft - (data.milestoneParent ?
                            (data.parentLeft + data.parentWidth + 4) : (data.parentLeft + data.parentWidth)))) {
                            return 'FSType3';
                        }
                        else {
                            return 'FSType4';
                        }
                    }
                    Eif (((data.childLeft + data.childWidth) > (data.parentLeft + data.parentWidth))) {
                        if (data.type === 'SS') {
                            return 'SSType4';
                        }
                        if (data.type === 'FF') {
                            return 'FFType4';
                        }
                        Eif (data.type === 'SF') {
                            return 'SFType4';
                        }
                    }
                }
                else if ((data.parentLeft < data.childLeft && (data.childLeft < (data.parentLeft + data.parentWidth)))
                    || (data.parentLeft === data.childLeft || data.parentLeft > data.childLeft)) {
                    if ((data.childLeft + data.childWidth) <= (data.parentLeft + data.parentWidth)) {
                        if (data.type === 'FF') {
                            return 'FFType3';
                        }
                        if (data.type === 'SF') {
                            if ((data.childLeft + data.childWidth + 25) < (data.parentLeft)) {
                                return 'SFType3';
                            }
                            else {
                                return 'SFType4';
                            }
                        }
                        if (data.type === 'SS') {
                            if (data.childLeft <= data.parentLeft) {
                                return 'SSType3';
                            }
                            else {
                                return 'SSType4';
                            }
                        }
                    }
                    else Eif ((data.childLeft + data.childWidth) > (data.parentLeft + data.parentWidth)) {
                        if (data.type === 'FF') {
                            return 'FFType4';
                        }
                        Iif (data.type === 'SF') {
                            return 'SFType4';
                        }
                        if (data.type === 'SS') {
                            if (data.childLeft <= data.parentLeft) {
                                return 'SSType3';
                            }
                            else {
                                return 'SSType4';
                            }
                        }
                    }
                    Eif (data.type === 'FS') {
                        return 'FSType3';
                    }
                }
                else Eif (data.parentLeft < data.childLeft) {
                    if (data.type === 'FS') {
                        return 'FSType3';
                    }
                    Eif (data.type === 'SS') {
                        return 'SSType4';
                    }
                    if (data.type === 'FF') {
                        return 'FFType4';
                    }
                    if (data.type === 'SF') {
                        return 'SFType4';
                    }
                }
            }
            return null;
        };
        ConnectorLine.prototype.getHeightValue = function () {
            if (this.parent.showOverAllocation && !this.parent.allowTaskbarOverlap) {
                return (this.parentRowIndexHeight) > (this.childRowIndexHeight) ?
                    ((this.parentRowIndexHeight) - (this.childRowIndexHeight)) :
                    ((this.childRowIndexHeight) - (this.parentRowIndexHeight));
            }
            else {
                return (this.parentRowIndexHeight) > (this.childRowIndexHeight) ?
                    ((this.parentRowIndexHeight) - (this.childRowIndexHeight)) :
                    ((this.childRowIndexHeight) - (this.parentRowIndexHeight));
            }
        };
        ConnectorLine.prototype.getInnerElementWidthSSType2 = function (data) {
            if (data.parentLeft === data.childLeft) {
                return 10;
            }
            return (data.childLeft - data.parentLeft);
        };
        ConnectorLine.prototype.getInnerElementLeftSSType2 = function (data) {
            if (data.parentLeft === data.childLeft) {
                return (data.parentLeft - 20);
            }
            return (data.parentLeft - 10);
        };
        ConnectorLine.prototype.getInnerChildWidthSSType2 = function (data) {
            if ((data.parentLeft + data.parentWidth) < data.childLeft) {
                return 10;
            }
            if (data.parentLeft === data.childLeft) {
                return 20;
            }
            if ((data.parentLeft + data.parentWidth) >= data.childLeft) {
                return 10;
            }
            return (data.childLeft - data.parentLeft);
        };
        ConnectorLine.prototype.calculateAdjustments = function (rowHeight, isMilestone, type) {
            var taskbarHeightValue = this.parent.renderBaseline ? 0.45 : ((!ej2_base_1.isNullOrUndefined(document.body.className) && document.body.className.includes('e-bigger')) ? 0.7 : 0.62);
            var defaultTaskbarHeight = Math.floor(this.parent.rowHeight * taskbarHeightValue);
            if (((ej2_base_1.isNullOrUndefined(this.parent.taskbarHeight) && rowHeight <= 36) || (!ej2_base_1.isNullOrUndefined(this.parent.taskbarHeight) &&
                this.parent.taskbarHeight <= defaultTaskbarHeight)) || !isMilestone) {
                return {
                    adjustY1: 0,
                    adjustX: 0,
                    adjustY2: 0,
                    adjustZ: 0
                };
            }
            else {
                var divisorY1 = ((type === 'FSType2' || type === 'FSType3' || type === 'FSType4' || type === 'SSType1' || type === 'SSType2' || type === 'SSType4' || type === 'SFType2')) ? 12 : 24;
                var adjustY1 = (rowHeight - 36) / divisorY1;
                var adjustX = -(rowHeight - 36) / 4;
                var adjustZ = -2 * (rowHeight - 36) / 24;
                if (rowHeight <= 36) {
                    return {
                        adjustY1: 0,
                        adjustX: 0,
                        adjustY2: 0,
                        adjustZ: 0
                    };
                }
                return {
                    adjustY1: adjustY1,
                    adjustX: adjustX,
                    adjustZ: adjustZ
                };
            }
        };
        ConnectorLine.prototype.shouldAdjustForBaseline = function (data, type) {
            if (!this.parent.renderBaseline || !(data.milestoneParent || data.milestoneChild) ||
                (data.milestoneParent && data.milestoneChild)) {
                return 0;
            }
            switch (type) {
                case 'FSType1':
                case 'FSType2':
                    if (data.milestoneParent) {
                        return -this.parent.chartRowsModule.milestoneMarginTop / 2;
                    }
                    else {
                        return this.parent.chartRowsModule.taskBarMarginTop;
                    }
                case 'FSType3':
                case 'FFType2':
                case 'SFType2':
                case 'SSType2':
                    if (data.milestoneParent) {
                        return this.parent.chartRowsModule.milestoneMarginTop / 2;
                    }
                    else {
                        return -this.parent.chartRowsModule.taskBarMarginTop;
                    }
                case 'FSType4':
                case 'FFType3':
                case 'SFType4':
                case 'FFType4':
                case 'SFType3':
                case 'SFType1':
                    if (data.milestoneParent) {
                        return -this.parent.chartRowsModule.milestoneMarginTop / 2;
                    }
                    else {
                        return this.parent.chartRowsModule.taskBarMarginTop;
                    }
                case 'SSType3':
                    Iif (data.milestoneParent) {
                        return -this.parent.chartRowsModule.taskBarMarginTop;
                    }
                    else {
                        return this.parent.chartRowsModule.taskBarMarginTop;
                    }
                case 'SSType1':
                case 'FFType1':
                    if (data.milestoneParent) {
                        return this.parent.chartRowsModule.taskBarMarginTop;
                    }
                    else {
                        return -this.parent.chartRowsModule.milestoneMarginTop / 2;
                    }
                default:
                    return 0;
            }
        };
        ConnectorLine.prototype.updateParentChildRowsHeight = function (data) {
            var lastRowIndex = this.parent.currentViewData.length - 1;
            var rowElements = this.parent.ganttChartModule.getChartRows();
            this.parentRowIndexHeight = data.parentIndexInCurrentView * data.rowHeight;
            this.childRowIndexHeight = data.childIndexInCurrentView * data.rowHeight;
            this.lastRowIndexHeight = lastRowIndex * data.rowHeight;
            var totalDisplayedRows = 0;
            if (!this.parent.allowTaskbarOverlap && this.parent.enableMultiTaskbar) {
                this.parentRowIndexHeight = this.childRowIndexHeight = this.lastRowIndexHeight = 0;
                for (var i = 0; i < lastRowIndex; i++) {
                    var rowElement = rowElements[i];
                    if (rowElement && rowElement.style.display !== 'none') {
                        if (totalDisplayedRows < data.parentIndexInCurrentView) {
                            this.parentRowIndexHeight += rowElements[i]['offsetHeight'];
                        }
                        if (totalDisplayedRows < data.childIndexInCurrentView) {
                            this.childRowIndexHeight += rowElements[i]['offsetHeight'];
                        }
                        this.lastRowIndexHeight += rowElements[i]['offsetHeight'];
                        totalDisplayedRows++;
                    }
                }
            }
        };
        ConnectorLine.prototype.getConnectorLineTemplate = function (data) {
            var setInnerChildWidthSSType2 = this.getInnerChildWidthSSType2(data);
            var setInnerElementWidthSSType2 = this.getInnerElementWidthSSType2(data);
            var setInnerElementLeftSSType2 = this.getInnerElementLeftSSType2(data);
            this.updateParentChildRowsHeight(data);
            var height = this.getHeightValue();
            var isMilestone = data.milestoneChild ? true : false;
            var connectorLine = this.getPosition(data, this.getParentPosition(data), height);
            var rowPosition = this.getPosition(data, this.getParentPosition(data), height);
            var rowPositionHeight = rowPosition.top;
            var isMilestoneValue = 0;
            if (this.parent.renderBaseline) {
                var modifiedValue = (this.parent.rowHeight / 36) * 5;
                isMilestoneValue = (data.milestoneParent && data.milestoneChild) ? 0 : data.milestoneParent ? -modifiedValue :
                    data.milestoneChild ? modifiedValue : 0;
            }
            var heightValue = connectorLine.height;
            var borderTopWidth = 0;
            var addTop = 0;
            var parentOverlapTopValue = 0;
            var childOverlapTopValue = 0;
            var count = 0;
            if (this.parent.showOverAllocation && !this.parent.allowTaskbarOverlap) {
                for (var i = 0; i < this.parent.currentViewData.length; i++) {
                    if (this.parent.getRowByIndex(i).style.display !== 'none') {
                        if (count < data.parentIndex) {
                            count++;
                            parentOverlapTopValue = parentOverlapTopValue + this.parent.getRowByIndex(i).offsetHeight;
                        }
                    }
                }
                count = 0;
                for (var j = 0; j < this.parent.currentViewData.length; j++) {
                    if (this.parent.getRowByIndex(j).style.display !== 'none') {
                        if (count < data.childIndex) {
                            count++;
                            childOverlapTopValue = childOverlapTopValue + this.parent.getRowByIndex(j).offsetHeight;
                        }
                    }
                }
            }
            if (this.parent.currentViewData[data.parentIndex] && this.parent.currentViewData[data.childIndex] &&
                this.parent.allowParentDependency) {
                var fromRecordIsParent = this.parent.currentViewData[data.parentIndex].hasChildRecords;
                var toRecordIsParent = this.parent.currentViewData[data.childIndex].hasChildRecords;
                var fromRecordIsManual = this.parent.currentViewData[data.parentIndex].ganttProperties.isAutoSchedule;
                var toRecordIsManual = this.parent.currentViewData[data.childIndex].ganttProperties.isAutoSchedule;
                var isValid = true;
                if (((fromRecordIsParent && fromRecordIsManual) && !toRecordIsParent) || ((toRecordIsParent && toRecordIsManual) &&
                    !fromRecordIsParent) || (fromRecordIsParent && fromRecordIsManual && toRecordIsManual && toRecordIsParent)
                    || (!fromRecordIsParent && !toRecordIsParent)) {
                    isValid = false;
                }
                if (isValid) {
                    Iif (((fromRecordIsParent && !fromRecordIsManual) && (toRecordIsParent && !toRecordIsManual))) {
                        addTop = -11;
                    }
                    else Eif (!((fromRecordIsParent && !fromRecordIsManual) && (toRecordIsParent && !toRecordIsManual))) {
                        if (data.childIndex > data.parentIndex) {
                            if (!fromRecordIsParent && toRecordIsParent) {
                                borderTopWidth = -11;
                            }
                            else {
                                borderTopWidth = 11;
                                addTop = -11;
                            }
                        }
                        else {
                            if ((fromRecordIsParent && !toRecordIsParent)) {
                                borderTopWidth = -11;
                            }
                            else {
                                borderTopWidth = 11;
                                addTop = -11;
                            }
                        }
                    }
                    if (this.parent.currentViewData[data.parentIndex].ganttProperties.isMilestone) {
                        Iif (data.parentIndex > data.childIndex) {
                            addTop = -11;
                            borderTopWidth = 12;
                        }
                        else Eif (data.type === 'SS' || data.type === 'FF') {
                            addTop = -5;
                        }
                    }
                    else if (this.parent.currentViewData[data.childIndex].ganttProperties.isMilestone) {
                        Eif (data.parentIndex > data.childIndex) {
                            addTop = 5;
                            borderTopWidth = -10;
                        }
                        else if (data.parentIndex < data.childIndex) {
                            if (data.type === 'SS' || data.type === 'FF') {
                                addTop = -10;
                            }
                        }
                    }
                    else {
                        Iif (data.parentIndex < data.childIndex && fromRecordIsManual && !toRecordIsManual) {
                            addTop = 0;
                            borderTopWidth = -11;
                        }
                        else if (data.childIndex < data.parentIndex && !fromRecordIsManual && toRecordIsManual) {
                            addTop = 0;
                            borderTopWidth = -11;
                        }
                    }
                    rowPositionHeight += addTop;
                }
            }
            var predType = this.getParentPosition(data);
            if (predType) {
                var type = this.getParentPosition(data);
                var rowHeight1 = this.parent.rowHeight;
                var adjustments = this.calculateAdjustments(rowHeight1, isMilestone, type);
                this.transform = this.parent.enableRtl ? "translate(" + (this.parent.enableTimelineVirtualization ? this.parent.timelineModule.wholeTimelineWidth : this.parent.timelineModule.totalTimelineWidth) + ", 0) scale(-1, 1)" : '';
                this.connectorId = 'ConnectorLine' + data.connectorLineId;
                this.groupObject = this.renderer.createGroup({
                    id: this.connectorId,
                    transform: this.transform,
                    style: 'pointer-events: stroke',
                    class: cls.connectorLineContainer
                });
                this.connectorPath = this.renderer.drawPath({
                    class: cls.connectorLineSVG,
                    d: this.connectorLinePath,
                    fill: 'transparent',
                    'stroke-width': this.lineStroke
                });
                this.arrowlinePath = this.renderer.drawPath({
                    d: this.arrowPath,
                    class: cls.connectorLineArrow
                });
                var outlineColor = (this.lineColor) && !(this.parent.enableCriticalPath) ? this.lineColor : '';
                this.connectorPath.style.stroke = outlineColor;
                this.arrowlinePath.style.fill = outlineColor;
                this.groupObject.appendChild(this.connectorPath);
                this.groupObject.appendChild(this.arrowlinePath);
                var adjustedValue = this.shouldAdjustForBaseline(data, predType);
                if (predType === 'FSType1') {
                    this.taskLineValue = data.milestoneChild ? 1 : 0;
                    this.x1 = data.parentEndPoint + (data.milestoneParent ? -1 : (data.milestoneChild ? -1 : 0));
                    this.x2 = data.milestoneParent ?
                        ((((data.childLeft - (data.parentLeft + data.parentWidth + 10)) + this.lineStroke) - 10) + 1) :
                        (((data.childLeft - (data.parentLeft + data.parentWidth + 10)) + this.lineStroke) - 10);
                    this.y1 = rowPositionHeight;
                    this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke;
                    this.connectorLinePath = 'M ' + this.x1 + ' ' + (this.y1 - adjustedValue) + ' L ' + ((this.x1 + this.x2) + adjustments['adjustZ']) + ' ' + (this.y1 - adjustedValue) + ' L ' + ((this.x1 + this.x2) + adjustments['adjustZ']) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x2 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1']);
                    this.arrowPath = 'M ' + ((this.x1 + this.x2 + 20) + adjustments['adjustX']) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x2 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x2 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + this.y2 + 4) + adjustments['adjustY1']) + ' Z';
                }
                if (predType === 'FSType2') {
                    this.x1 = data.parentLeft;
                    this.x2 = data.parentWidth + (data.milestoneParent ? -1 : 0);
                    this.x3 = this.x2 + (data.milestoneParent ? 11 : 10);
                    this.x4 = data.parentWidth - ((data.parentEndPoint - data.childLeft) + 20);
                    this.y1 = rowPositionHeight;
                    this.y2 = heightValue + borderTopWidth - this.getconnectorLineGap(data) - this.lineStroke;
                    this.y3 = this.getconnectorLineGap(data);
                    this.y4 = (!this.parent.allowTaskbarOverlap ? childOverlapTopValue :
                        (this.y1 + this.y2 - ((this.y1 + this.y2) % data.rowHeight)));
                    this.connectorLinePath = 'M ' + (this.x1 + this.x2) + ' ' + (this.y1 - adjustedValue) + ' ' + ' L ' + (this.x1 + this.x3) + ' ' + (this.y1 - adjustedValue) + ' L ' + (this.x1 + this.x3) + ' ' + this.y4 +
                        ' L ' + ((this.x1 + this.x4) + adjustments['adjustZ']) + ' ' + this.y4 + ' L ' + ((this.x1 + this.x4) + adjustments['adjustZ']) + ' ' + ((this.y1 + this.y2 + this.y3) + adjustments['adjustY1']) + ' L ' + ((this.x1 + this.x4 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + this.y2 + this.y3) + adjustments['adjustY1']);
                    this.arrowPath = 'M ' + ((this.x1 + this.x4 + 20) + adjustments['adjustX']) + ' ' + ((this.y1 + this.y2 + this.y3) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x4 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + this.y2 + this.y3 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x4 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + this.y2 + this.y3 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
                }
                if (predType === 'FSType3') {
                    this.taskLineValue = data.milestoneChild ? 1 : 0;
                    this.point1 = rowPositionHeight;
                    this.x1 = (data.childLeft + (data.milestoneChild ? -1 : 0) + (data.milestoneParent ? 1 : 0)) - 20;
                    this.x2 = (data.parentEndPoint - data.childLeft) + 30;
                    this.y1 = this.point1;
                    this.y2 = this.point1 + heightValue + borderTopWidth - this.getconnectorLineGap(data) - this.lineStroke +
                        this.taskLineValue;
                    this.y3 = this.getconnectorLineGap(data);
                    this.y4 = this.y2 - (this.y2 % data.rowHeight);
                    this.connectorLinePath = 'M ' + (this.x1 + 12) + ' ' + ((this.y1 - adjustedValue) + adjustments['adjustY1']) + ' L ' + this.x1 + ' ' + ((this.y1 - adjustedValue) + adjustments['adjustY1']) + ' L ' + this.x1 + ' ' + this.y4 +
                        ' L ' + (this.x1 + this.x2) + ' ' + this.y4 + ' L ' + (this.x1 + this.x2) + ' ' + (this.y2 + this.y3) + ' L ' + (this.x1 + this.x2 - 12) + ' ' + (this.y2 + this.y3);
                    this.arrowPath = 'M ' + ((this.x1 + 20) + adjustments['adjustX']) + ' ' + ((this.y1 - adjustedValue) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 - (4 + this.lineStroke) - adjustedValue) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + 4 + this.lineStroke - adjustedValue) + adjustments['adjustY1']) + ' Z';
                }
                if (predType === 'FSType4') {
                    this.point1 = rowPositionHeight;
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : 0;
                    this.x1 = data.parentEndPoint + (data.milestoneChild ? -1 : 0) + (data.milestoneParent ? 1 : 0);
                    this.x2 = data.childLeft - data.parentEndPoint - 20;
                    this.y1 = this.point1 + (data.milestoneChild ? -1 : 0);
                    this.y2 = this.point1 + heightValue + borderTopWidth - this.lineStroke + 1 + this.taskLineValue;
                    this.connectorLinePath = 'M ' + (this.x1 + this.x2 + 12) + ' ' + ((this.y1) + adjustments['adjustY1']) + ' L ' + (this.x1 + this.x2) + ' ' + ((this.y1) + adjustments['adjustY1']) + ' L ' + (this.x1 + this.x2) + ' ' + (this.y2 - adjustedValue) +
                        ' L ' + this.x1 + ' ' + (this.y2 - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x1 + this.x2 + 20) + adjustments['adjustX']) + ' ' + ((this.y1) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x2 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x2 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
                }
                if (predType === 'SSType4') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 2 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : 0;
                    this.point1 = heightValue + this.taskLineValue + borderTopWidth;
                    this.point2 = rowPositionHeight;
                    this.x1 = data.parentLeft - 10;
                    this.x2 = data.childLeft - data.parentLeft;
                    this.y1 = this.point2 + (data.milestoneChild ? 1 : 0);
                    this.y2 = (!data.milestoneChild ? (this.parent.chartRowsModule.milestoneMarginTop +
                        (this.parent.chartRowsModule.milestoneHeight / 2)) :
                        (this.parent.chartRowsModule.taskBarMarginTop + (this.parent.chartRowsModule.taskBarHeight / 2))) + this.point1;
                    this.connectorLinePath = 'M ' + ((this.x1 + this.x2) + adjustedX) + ' ' + (this.y1) + ' L ' + this.x1 + ' ' + (this.y1) +
                        ' L ' + this.x1 + ' ' + (this.y2) + ' L ' + (this.x1 + 10) + ' ' + (this.y2);
                    this.arrowPath = 'M ' + ((this.x1 + this.x2 + 8) + adjustedX) + ' ' + (this.y1) +
                        ' L ' + ((this.x1 + this.x2) + adjustedX) + ' ' + (this.y1 - (4 + this.lineStroke)) +
                        ' L ' + ((this.x1 + this.x2) + adjustedX) + ' ' + (this.y1 + 4 + this.lineStroke) + ' Z';
                }
                if (predType === 'SSType3') {
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : data.milestoneChild ? 1 : 0;
                    this.point1 = heightValue + this.taskLineValue + borderTopWidth - (this.lineStroke - 1);
                    this.x1 = data.childLeft - 20;
                    this.y1 = rowPositionHeight;
                    this.x2 = data.parentLeft - data.childLeft + 21;
                    this.y2 = this.y1 + this.point1;
                    this.connectorLinePath = 'M ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + (this.y1) + ' L ' + this.x1 + ' ' + (this.y1) +
                        ' L ' + this.x1 + ' ' + (this.y2 - adjustedValue) + ' L ' + (this.x1 + this.x2) + ' ' + (this.y2 - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x1 + 20) + adjustments['adjustX']) + ' ' + (this.y1) +
                        ' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + (this.y1 - (4 + this.lineStroke)) +
                        ' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + (this.y1 + 4 + this.lineStroke) + ' Z';
                }
                if (predType === 'SSType2') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 2 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : data.milestoneChild ? 1 : 0;
                    this.point1 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke;
                    this.x1 = setInnerElementLeftSSType2;
                    this.x2 = setInnerChildWidthSSType2 + 1;
                    this.y1 = rowPositionHeight;
                    this.y2 = this.y1 + this.point1;
                    this.connectorLinePath = 'M ' + (this.x1 + this.x2) + ' ' + (this.y1) + ' L ' + this.x1 + ' ' + (this.y1) + ' L ' + this.x1 + ' ' + (this.y2 + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + setInnerElementWidthSSType2) + adjustedX) + ' ' + (this.y2 + adjustments['adjustY1'] - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x1 + setInnerElementWidthSSType2 + 8) + adjustedX) + ' ' + ((this.y2) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + setInnerElementWidthSSType2) + adjustedX) + ' ' + ((this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + setInnerElementWidthSSType2) + adjustedX) + ' ' + ((this.y2 + 4 + this.lineStroke) + adjustments['adjustY1'] - adjustedValue) + ' Z';
                }
                if (predType === 'SSType1') {
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : data.milestoneChild ? 1 : 0;
                    this.point1 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke;
                    this.x1 = data.childLeft - 20;
                    this.x2 = data.parentLeft - data.childLeft + 21;
                    this.y1 = rowPositionHeight;
                    this.y2 = this.y1 + this.point1;
                    this.connectorLinePath = 'M ' + (this.x1 + this.x2) + ' ' + (this.y1) + ' L ' + this.x1 + ' ' + (this.y1) + ' L ' + this.x1 + ' ' + (this.y2 + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + (this.y2 + adjustments['adjustY1'] - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x1 + 20) + adjustments['adjustX']) + ' ' + ((this.y2) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + ((this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + ((this.y2 + 4 + this.lineStroke) + adjustments['adjustY1'] - adjustedValue) + ' Z';
                }
                if (predType === 'FFType1') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 11 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : (data.milestoneChild ? 1 : 0);
                    this.x1 = data.childEndPoint;
                    this.x2 = data.parentEndPoint + (data.milestoneParent ? -1 : 0);
                    this.x3 = data.milestoneParent ? 22 : 21;
                    this.x4 = data.milestoneChild ? 4 : 8;
                    this.y1 = rowPositionHeight;
                    this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke + 1;
                    this.connectorLinePath = 'M ' + this.x2 + ' ' + (this.y1) + ' L ' + (this.x2 + this.x3) + ' ' + (this.y1) + ' L ' + (this.x2 + this.x3) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + (this.x1 + this.x4) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1'] - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x1) + adjustedX) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + 8) + adjustedX) + ' ' + ((this.y1 + this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + 8) + adjustedX) + ' ' + ((this.y1 + this.y2 + 4 + this.lineStroke) + adjustments['adjustY1'] - adjustedValue) + ' Z';
                }
                if (predType === 'FFType2') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 11 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : (data.milestoneChild ? 1 : 0);
                    this.x1 = data.parentEndPoint;
                    this.x2 = data.childEndPoint + (data.milestoneParent ? 22 : 21);
                    this.x3 = data.childEndPoint + (data.milestoneChild ? 9 : 8);
                    this.y1 = rowPositionHeight;
                    this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke + 1;
                    var arrowX = this.parent.renderBaseline ? 0 : adjustedX;
                    this.connectorLinePath = 'M ' + this.x1 + ' ' + (this.y1) + ' L ' + this.x2 + ' ' + (this.y1) + ' L ' + this.x2 + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + this.x3 + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1'] - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x3 - 8) + arrowX) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + (this.x3 + arrowX) + ' ' + ((this.y1 + this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + (this.x3 + arrowX) + ' ' + ((this.y1 + this.y2 + 4 + this.lineStroke) + adjustments['adjustY1'] - adjustedValue) + ' Z';
                }
                if (predType === 'FFType3') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 11 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : 0;
                    this.x1 = data.childEndPoint;
                    this.x2 = this.x1 + (data.milestoneChild ? 4 : 8);
                    this.x3 = data.parentEndPoint - data.childEndPoint + (data.milestoneChild ? 16 : 10);
                    this.x4 = data.parentEndPoint + (data.milestoneParent ? -1 : 0);
                    this.y1 = rowPositionHeight;
                    this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke + 1;
                    this.connectorLinePath = 'M ' + this.x2 + ' ' + (this.y1) + ' L ' + (this.x2 + this.x3) + ' ' + (this.y1) + ' L ' + (this.x2 + this.x3) + ' ' + (this.y1 + this.y2 - adjustedValue) +
                        ' L ' + this.x4 + ' ' + (this.y1 + this.y2 - adjustedValue);
                    this.arrowPath = 'M ' + (this.x1 + adjustedX) + ' ' + (this.y1) +
                        ' L ' + ((this.x1 + 8) + adjustedX) + ' ' + (this.y1 - (4 + this.lineStroke)) +
                        ' L ' + ((this.x1 + 8) + adjustedX) + ' ' + (this.y1 + 4 + this.lineStroke) + ' Z';
                }
                if (predType === 'FFType4') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 11 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : 0;
                    this.x1 = data.parentEndPoint;
                    this.x2 = data.childEndPoint + (data.milestoneChild ? 7 : 8);
                    this.x3 = this.x2 + (data.milestoneChild ? 12 : 11);
                    this.y1 = rowPositionHeight;
                    this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke + 1;
                    var arrowX = this.parent.renderBaseline ? 0 : adjustedX;
                    this.connectorLinePath = 'M ' + this.x2 + ' ' + (this.y1) + ' L ' + this.x3 + ' ' + (this.y1) + ' L ' + this.x3 + ' ' + (this.y1 + this.y2 - adjustedValue) +
                        ' L ' + this.x1 + ' ' + (this.y1 + this.y2 - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x2 - 8) + arrowX) + ' ' + (this.y1) +
                        ' L ' + (this.x2 + arrowX) + ' ' + (this.y1 - (4 + this.lineStroke)) +
                        ' L ' + (this.x2 + arrowX) + ' ' + (this.y1 + 4 + this.lineStroke) + ' Z';
                }
                if (predType === 'SFType4') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 11 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : (data.milestoneChild ? -1 : 0);
                    this.point1 = (this.taskLineValue + heightValue + borderTopWidth - this.getconnectorLineGap(data) - (this.lineStroke - 1));
                    this.point2 = rowPositionHeight;
                    this.x1 = data.parentLeft - 10;
                    this.x2 = this.x1 + ((data.childEndPoint - data.parentLeft) + 18);
                    this.x3 = this.x2 + (data.milestoneChild ? 16 : 11);
                    this.y1 = this.point2;
                    this.y2 = this.y1 + this.point1;
                    this.y3 = this.getconnectorLineGap(data);
                    this.y4 = this.y2 - (this.y2 % data.rowHeight);
                    var arrowX = this.parent.renderBaseline ? 0 : adjustedX;
                    this.connectorLinePath = 'M ' + this.x2 + ' ' + ((this.y1) - adjustments['adjustY1']) + ' L ' + this.x3 + ' ' + ((this.y1) - adjustments['adjustY1']) + ' L ' + this.x3 + ' ' + this.y4 + ' L ' + this.x1 + ' ' + this.y4 +
                        ' L ' + this.x1 + ' ' + ((this.y2 + this.y3) - adjustedValue) + ' L ' + (this.x1 + 11) + ' ' + ((this.y2 + this.y3) - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x2 - 8) + arrowX) + ' ' + ((this.y1) - adjustments['adjustY1']) +
                        ' L ' + (this.x2 + arrowX) + ' ' + ((this.y1 - (4 + this.lineStroke)) - adjustments['adjustY1']) +
                        ' L ' + (this.x2 + arrowX) + ' ' + ((this.y1 + 4 + this.lineStroke) - adjustments['adjustY1']) + ' Z';
                }
                if (predType === 'SFType3') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 11 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : 0;
                    this.point1 = (data.parentLeft - (data.childEndPoint + (data.milestoneParent ? 23 : 20))) + 1;
                    this.point2 = rowPositionHeight;
                    this.x1 = data.childEndPoint;
                    this.x2 = this.x1 + (data.milestoneChild ? 9 : 8);
                    this.x3 = this.x2 + (data.milestoneChild ? 17 : 11);
                    this.y1 = this.point2;
                    this.y2 = this.y1 + heightValue + borderTopWidth - (this.lineStroke - 1) + this.taskLineValue;
                    this.connectorLinePath = 'M ' + this.x2 + ' ' + (this.y1) + ' L ' + this.x3 + ' ' + (this.y1) +
                        ' L ' + this.x3 + ' ' + (this.y2 - adjustedValue) + ' L ' + (this.x3 + this.point1) + ' ' + (this.y2 - adjustedValue);
                    this.arrowPath = 'M ' + ((this.x2 - 8) + adjustedX) + ' ' + (this.y1) +
                        ' L ' + (this.x2 + adjustedX) + ' ' + (this.y1 - (4 + this.lineStroke)) +
                        ' L ' + (this.x2 + adjustedX) + ' ' + (this.y1 + 4 + this.lineStroke) + ' Z';
                }
                if (predType === 'SFType1') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 11 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : data.milestoneChild ? 1 : 0;
                    this.point1 = heightValue + borderTopWidth - this.getconnectorLineGap(data) + this.taskLineValue - this.lineStroke;
                    this.point2 = this.getconnectorLineGap(data);
                    this.x1 = data.parentLeft - 10;
                    this.y1 = rowPositionHeight;
                    this.x2 = (data.childEndPoint - data.parentLeft) + 31;
                    this.y2 = this.y1 + this.point1;
                    this.x3 = (data.childEndPoint - data.parentLeft) + 18;
                    this.y3 = this.y2 - (this.y2 % data.rowHeight);
                    var arrowX = this.parent.renderBaseline ? 0 : adjustedX;
                    this.connectorLinePath = 'M ' + (this.x1 + 11) + ' ' + (this.y1 - adjustedValue) + ' L ' + this.x1 + ' ' + (this.y1 - adjustedValue) + ' L ' + this.x1 + ' ' + this.y3 +
                        ' L ' + (this.x1 + this.x2) + ' ' + this.y3 + ' L ' + (this.x1 + this.x2) + ' ' + ((this.y2 + this.point2) + adjustments['adjustY1']) + ' L ' + (this.x1 + this.x3) + ' ' + ((this.y2 + this.point2) + adjustments['adjustY1']);
                    this.arrowPath = 'M ' + ((this.x1 + this.x3 - 8) + arrowX) + ' ' + ((this.y2 + this.point2) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x3) + arrowX) + ' ' + ((this.y2 + this.point2 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
                        ' L ' + ((this.x1 + this.x3) + arrowX) + ' ' + ((this.y2 + this.point2 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
                }
                if (predType === 'SFType2') {
                    var adjustedX = adjustments['adjustX'] !== 0 ? adjustments['adjustX'] + 11 : adjustments['adjustX'];
                    this.taskLineValue = this.parent.renderBaseline ? this.taskLineValue : 0;
                    this.x1 = data.childEndPoint;
                    this.y1 = rowPositionHeight;
                    this.x2 = (data.parentLeft - data.childEndPoint);
                    this.y2 = this.y1 + heightValue + this.taskLineValue + borderTopWidth - this.lineStroke;
                    this.connectorLinePath = 'M ' + (this.x1 + this.x2 + 1) + ' ' + (this.y1) + ' L ' + (this.x1 + this.x2 - 10) + ' ' + (this.y1) +
                        ' L ' + (this.x1 + this.x2 - 10) + ' ' + (this.y2 + adjustments['adjustY1'] - adjustedValue) + ' L ' + (this.x1 + 8) + ' ' + (this.y2 + adjustments['adjustY1'] - adjustedValue);
                    this.arrowPath = 'M ' + (this.x1 + adjustedX) + ' ' + ((this.y2) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + 8) + adjustedX) + ' ' + ((this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1'] - adjustedValue) +
                        ' L ' + ((this.x1 + 8) + adjustedX) + ' ' + ((this.y2 + 4 + this.lineStroke) + adjustments['adjustY1'] - adjustedValue) + ' Z';
                }
                this.connectorPath.setAttribute('d', this.connectorLinePath);
                this.arrowlinePath.setAttribute('d', this.arrowPath);
            }
            return this.groupObject;
        };
        ConnectorLine.prototype.getPosition = function (data, type, heightValue) {
            var topPosition = 0;
            var lineHeight = 0;
            var isMilestoneParent = data.milestoneParent ? true : false;
            var isMilestone = data.milestoneChild ? true : false;
            var midPointParent = this.getTaskbarMidpoint(isMilestoneParent) - (this.lineStroke - 1);
            var midPoint = this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1);
            var isParentIndex = data.parentIndexInCurrentView !== -1;
            var isChildIndex = data.childIndexInCurrentView !== -1;
            if (type === 'SSType1' || type === 'SSType2' || type === 'FFType1' || type === 'FFType2' || type === 'SFType2') {
                topPosition = isParentIndex ? (this.parentRowIndexHeight) + midPointParent : 0;
                lineHeight = (isParentIndex && isChildIndex) ? heightValue : isChildIndex ?
                    (this.childRowIndexHeight) + midPointParent : (this.lastRowIndexHeight) + midPointParent;
            }
            else if (type === 'SSType3' || type === 'SSType4' || type === 'FSType4' || type === 'FFType3' ||
                type === 'FFType4' || type === 'SFType4' || type === 'SFType3') {
                topPosition = isChildIndex ? (this.childRowIndexHeight) + midPoint : 0;
                lineHeight = (isParentIndex && isChildIndex) ? heightValue : isParentIndex ?
                    (this.parentRowIndexHeight) + midPoint :
                    (this.lastRowIndexHeight) + midPoint;
            }
            else if (type === 'FSType3') {
                topPosition = isChildIndex ? (this.childRowIndexHeight) + midPointParent : 0;
                lineHeight = (isParentIndex && isChildIndex) ? heightValue : isParentIndex ?
                    (this.parentRowIndexHeight) + midPoint :
                    (this.lastRowIndexHeight) + midPointParent;
            }
            else if (type === 'SFType1' || type === 'FSType1' || type === 'FSType2') {
                topPosition = isParentIndex ? (this.parentRowIndexHeight) + midPoint : 0;
                lineHeight = (isParentIndex && isChildIndex) ? heightValue : isChildIndex ?
                    (this.childRowIndexHeight) + midPoint :
                    (this.lastRowIndexHeight) + midPoint;
            }
            return { top: topPosition, height: lineHeight };
        };
        ConnectorLine.prototype.createConnectorLineTooltipTable = function () {
            this.tooltipTable = ej2_base_1.createElement('table', { className: '.e-tooltiptable', styles: 'margin-top:0px', attrs: { 'cellspacing': '2px', 'cellpadding': '2px' } });
            var tooltipBody = ej2_base_1.createElement('tbody');
            tooltipBody.innerHTML = '';
            this.tooltipTable.appendChild(tooltipBody);
        };
        ConnectorLine.prototype.getConnectorLineTooltipInnerTd = function (fromTaskName, fromPredecessorText, toTaskName, toPredecessorText) {
            var _this = this;
            var tbody = document.createElement('tbody');
            var createRow = function (id, label, taskName, predecessorText) {
                var tr = document.createElement('tr');
                tr.id = id;
                var td1 = document.createElement('td');
                td1.style.padding = '2px';
                td1.textContent = _this.parent.localeObj.getConstant(label);
                var td2 = document.createElement('td');
                td2.textContent = taskName;
                var td3 = document.createElement('td');
                td3.style.padding = '2px';
                td3.textContent = _this.parent.localeObj.getConstant(predecessorText);
                tr.append(td1, td2, td3);
                return tr;
            };
            tbody.appendChild(createRow('fromPredecessor', 'from', fromTaskName, fromPredecessorText));
            tbody.appendChild(createRow('toPredecessor', 'to', toTaskName || '', toPredecessorText || ''));
            return tbody;
        };
        ConnectorLine.prototype.generateAriaLabel = function (data) {
            var type = data.type;
            var updatedRecords = this.expandedRecords;
            var fromName = updatedRecords[data.parentIndex].ganttProperties.taskName;
            var toName = updatedRecords[data.childIndex].ganttProperties.taskName;
            var start = this.parent.localeObj.getConstant('start');
            var finish = this.parent.localeObj.getConstant('finish');
            var value = '';
            if (type === 'FS') {
                value = fromName + ' ' + finish + ' to ' + toName + ' ' + start;
            }
            else if (type === 'FF') {
                value = fromName + ' ' + finish + ' to ' + toName + ' ' + finish;
            }
            else if (type === 'SS') {
                value = fromName + ' ' + start + ' to ' + toName + ' ' + start;
            }
            else {
                value = fromName + ' ' + start + ' to ' + toName + ' ' + finish;
            }
            return value;
        };
        ConnectorLine.prototype.getRecordByID = function (id) {
            Iif (ej2_base_1.isNullOrUndefined(id)) {
                return null;
            }
            if (this.parent.pdfExportModule && this.parent.pdfExportModule.isPdfExport && this.parent.pdfExportModule.helper.exportProps &&
                this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
                this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) {
                var a = this.parent.pdfExportModule.helper.beforeSinglePageExport['cloneFlatData'].filter(function (data) {
                    return data.ganttProperties.taskId.toString() === id.toString();
                })[0];
                return a;
            }
            else if (this.parent.viewType === 'ResourceView') {
                return this.parent.flatData[this.parent.getTaskIds().indexOf('T' + id.toString())];
            }
            else {
                return this.parent.getRecordByID(id);
            }
        };
        ConnectorLine.prototype.removePreviousConnectorLines = function (records) {
            var isObjectType;
            if (ej2_base_1.isObject(records) === true) {
                isObjectType = true;
            }
            else {
                isObjectType = false;
            }
            var length = isObjectType ? Object.keys(records).length : records.length;
            var keys = Object.keys(records);
            for (var i = 0; i < length; i++) {
                var data = void 0;
                if (isObjectType) {
                    var uniqueId = keys[i];
                    data = records[uniqueId];
                }
                else {
                    data = records[i];
                }
                var predecessors = data.ganttProperties && data.ganttProperties.predecessor;
                if (predecessors && predecessors.length > 0) {
                    for (var pre = 0; pre < predecessors.length; pre++) {
                        var lineId = 'parent' + predecessors[pre].from + 'child' + predecessors[pre].to;
                        this.removeConnectorLineById(lineId);
                    }
                }
            }
        };
        ConnectorLine.prototype.removeConnectorLineById = function (id) {
            var element = this.parent.connectorLineModule.dependencyViewContainer.querySelector('#ConnectorLine' + id.replace(/([.])/g, '\\$1'));
            if (!ej2_base_1.isNullOrUndefined(element)) {
                ej2_base_1.remove(element);
            }
        };
        return ConnectorLine;
    }());
    exports.ConnectorLine = ConnectorLine;
});