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 | 1×
1×
1×
1×
1137×
1137×
1137×
1137×
1137×
1137×
1137×
1137×
1137×
1137×
1137×
1137×
1137×
1×
17718×
17718×
17718×
1×
1143×
1143×
1143×
1×
13752×
1×
32056×
32056×
32056×
194×
31862×
32056×
32056×
32056×
194×
4206×
194×
4206×
194×
194×
31862×
31862×
32056×
32056×
32056×
32056×
194×
31862×
32056×
32056×
32056×
32056×
3036×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
29020×
38×
28982×
1×
2430×
2430×
2430×
12036×
12036×
2430×
2430×
2430×
12036×
12036×
24072×
24072×
24072×
2430×
2430×
2430×
12036×
1×
261312×
252289×
3980×
2600×
1380×
248309×
68800×
67400×
1400×
640×
760×
760×
179509×
79280×
2400×
1000×
78280×
4480×
1080×
3400×
1160×
76040×
70780×
5260×
5020×
240×
240×
100229×
100220×
99800×
420×
180×
240×
240×
9023×
9020×
2260×
1780×
200×
1580×
480×
480×
160×
320×
160×
160×
160×
6760×
5300×
3600×
640×
2960×
480×
220×
260×
2480×
1660×
1660×
1700×
1700×
60×
1640×
1640×
200×
40×
160×
2260×
2260×
1460×
1460×
1440×
20×
20×
12×
1×
13069×
81×
12988×
1×
13069×
367×
12702×
1×
13069×
367×
12702×
1×
13069×
4019×
9050×
367×
8683×
8680×
3×
1×
13065×
13065×
13065×
11192×
1873×
1873×
1873×
1873×
1873×
1×
1872×
1×
13069×
13069×
13069×
13069×
13069×
13069×
13069×
13069×
13069×
13069×
13069×
13069×
1522×
13069×
13069×
13069×
13069×
13069×
13069×
13069×
81×
1316×
1118×
325×
325×
81×
81×
1316×
1118×
364×
364×
81×
81×
13069×
12977×
12977×
12977×
12977×
12977×
12977×
12934×
12977×
43×
15×
28×
28×
11×
1×
10×
10×
17×
9×
8×
8×
43×
1×
1×
1×
42×
1×
1×
1×
41×
41×
8×
8×
13069×
13065×
13065×
13065×
13065×
13065×
13065×
13065×
13065×
13065×
13065×
13065×
13065×
13065×
13065×
3370×
3370×
3370×
3370×
3370×
3370×
3370×
13065×
8529×
8529×
8529×
8529×
8529×
8529×
8529×
8529×
8529×
8529×
13065×
195×
195×
195×
195×
195×
195×
195×
195×
195×
195×
13065×
79×
79×
79×
79×
79×
79×
79×
79×
13065×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
13065×
85×
85×
85×
85×
85×
85×
85×
85×
13065×
298×
298×
298×
298×
298×
298×
298×
298×
298×
13065×
54×
54×
54×
54×
54×
54×
54×
54×
13065×
69×
69×
69×
69×
69×
69×
69×
69×
69×
69×
13065×
130×
130×
130×
130×
130×
130×
130×
130×
130×
130×
13065×
32×
32×
32×
32×
32×
32×
32×
32×
32×
32×
13065×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
13065×
21×
21×
21×
21×
21×
21×
21×
21×
21×
21×
21×
21×
21×
21×
13065×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
13065×
114×
114×
114×
114×
114×
114×
114×
114×
114×
114×
114×
114×
114×
13065×
50×
50×
50×
50×
50×
50×
50×
50×
13065×
13065×
13069×
1×
26138×
26138×
26138×
458×
458×
458×
458×
458×
458×
458×
458×
42×
42×
416×
8×
8×
408×
10×
10×
398×
398×
398×
26138×
1×
1143×
1143×
1143×
1143×
1×
19×
19×
19×
19×
19×
1×
24072×
24072×
24072×
24072×
24072×
24072×
24072×
24072×
22578×
1494×
380×
1114×
800×
314×
24072×
1×
265721×
265721×
388×
8412×
388×
265333×
1×
466×
466×
268×
198×
466×
466×
466×
8388×
8388×
5306×
5306×
3082×
8388×
8388×
2097×
3785×
3785×
1×
7848×
7848×
2112×
1×
1×
| 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) {
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.getExpandedRecords(this.parent.currentViewData);
}
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;
connectorObj.rowHeight = !ej2_base_1.isNullOrUndefined(this.parent.ganttChartModule.getChartRows()) &&
this.parent.ganttChartModule.getChartRows()[0] &&
this.parent.ganttChartModule.getChartRows()[0].offsetHeight;
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 = [];
for (var index = 0; index < connectorLinesCollection.length; index++) {
connectorLine = connectorLine + this.getConnectorLineTemplate(connectorLinesCollection[index]);
ariaConnector.push(connectorLinesCollection[index]);
}
this.svgObject.innerHTML = connectorLine;
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 if (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') {
Eif (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 (data) {
if (this.parent.showOverAllocation && !this.parent.allowTaskbarOverlap) {
return (data.parentIndex * this.parent.rowHeight) > (data.childIndex * this.parent.rowHeight) ?
((data.parentIndex * this.parent.rowHeight) - (data.childIndex * this.parent.rowHeight)) :
((data.childIndex * this.parent.rowHeight) - (data.parentIndex * this.parent.rowHeight));
}
else {
return (data.parentIndex * data.rowHeight) > (data.childIndex * data.rowHeight) ?
((data.parentIndex * data.rowHeight) - (data.childIndex * data.rowHeight)) :
((data.childIndex * data.rowHeight) - (data.parentIndex * data.rowHeight));
}
};
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.getConnectorLineTemplate = function (data) {
var setInnerChildWidthSSType2 = this.getInnerChildWidthSSType2(data);
var setInnerElementWidthSSType2 = this.getInnerElementWidthSSType2(data);
var setInnerElementLeftSSType2 = this.getInnerElementLeftSSType2(data);
var height = this.getHeightValue(data);
var isMilestoneParent = data.milestoneParent ? true : false;
var isMilestone = data.milestoneChild ? true : false;
var isVirtual = this.parent.virtualScrollModule && this.parent.enableVirtualization;
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) {
isMilestoneValue = (data.milestoneParent && data.milestoneChild) ? 0 : data.milestoneParent ? -5 : data.milestoneChild ? 5 : 0;
}
var heightValue = isVirtual ? connectorLine.height : (height + isMilestoneValue);
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;
}
}
}
Eif (!this.parent.enableVirtualization) {
heightValue = Math.abs(parentOverlapTopValue - childOverlapTopValue);
}
}
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) {
if (((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;
}
}
}
}
if (this.getParentPosition(data)) {
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.setAttribute('style', "stroke: " + outlineColor);
this.arrowlinePath.setAttribute('style', "fill: " + outlineColor);
this.groupObject.appendChild(this.connectorPath);
this.groupObject.appendChild(this.arrowlinePath);
if (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight :
((!this.parent.allowTaskbarOverlap ? parentOverlapTopValue :
(data.parentIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1) - isMilestoneValue));
this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke;
this.connectorLinePath = 'M ' + this.x1 + ' ' + (this.y1) + ' L ' + ((this.x1 + this.x2) + adjustments['adjustZ']) + ' ' + (this.y1) + ' 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 (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ?
rowPositionHeight : ((!this.parent.allowTaskbarOverlap ? parentOverlapTopValue :
(data.parentIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1) - isMilestoneValue));
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) + ' ' + ' L ' + (this.x1 + this.x3) + ' ' + (this.y1) + ' 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 (this.getParentPosition(data) === 'FSType3') {
this.taskLineValue = data.milestoneChild ? 1 : 0;
this.point1 = (this.parent.enableVirtualization ? rowPositionHeight :
((!this.parent.allowTaskbarOverlap ? childOverlapTopValue :
(data.childIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestoneParent) - (this.lineStroke - 1) - isMilestoneValue));
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.parent.renderBaseline ?
(data.milestoneChild && !(data.milestoneParent) ? 11 :
data.milestoneParent && !(data.milestoneChild) ? -12 : 0) : 0);
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) + adjustments['adjustY1']) + ' L ' + this.x1 + ' ' + ((this.y1) + 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) + adjustments['adjustY1']) +
' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + ((this.y1 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
}
if (this.getParentPosition(data) === 'FSType4') {
this.point1 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
childOverlapTopValue : (data.childIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1)));
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.parent.renderBaseline ? (data.milestoneChild && !(data.milestoneParent) ? -12 :
data.milestoneParent && !(data.milestoneChild) ? 11 : 0) : 0);
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 +
' L ' + this.x1 + ' ' + this.y2;
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 (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
childOverlapTopValue : (data.childIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1)));
this.x1 = data.parentLeft - 10;
this.x2 = data.childLeft - data.parentLeft;
this.y1 = this.point2 + (data.milestoneChild ? 1 : 0);
this.y2 = this.y1 + this.point1 + (this.parent.renderBaseline ? (data.milestoneParent && !(data.milestoneChild) ? 10 :
data.milestoneChild && !(data.milestoneParent) ? -13 : 0) : 0);
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 (this.getParentPosition(data) === '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 = (data.milestoneChild ? 1 : 0) + (this.parent.enableVirtualization ? rowPositionHeight :
((!this.parent.allowTaskbarOverlap ? childOverlapTopValue : (data.childIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1)));
this.x2 = data.parentLeft - data.childLeft + 21;
this.y2 = this.y1 + this.point1 + (this.parent.renderBaseline ? (data.milestoneChild && !(data.milestoneParent) ? -11 :
data.milestoneParent && !(data.milestoneChild) ? 10 : 0) : 0);
this.connectorLinePath = 'M ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + (this.y1) + ' L ' + this.x1 + ' ' + (this.y1) +
' L ' + this.x1 + ' ' + this.y2 + ' L ' + (this.x1 + this.x2) + ' ' + this.y2;
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 (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
parentOverlapTopValue : (data.parentIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestoneParent) - (this.lineStroke - 1)));
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']) +
' L ' + ((this.x1 + setInnerElementWidthSSType2) + adjustedX) + ' ' + (this.y2 + adjustments['adjustY1']);
this.arrowPath = 'M ' + ((this.x1 + setInnerElementWidthSSType2 + 8) + adjustedX) + ' ' + ((this.y2) + adjustments['adjustY1']) +
' L ' + ((this.x1 + setInnerElementWidthSSType2) + adjustedX) + ' ' + ((this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
' L ' + ((this.x1 + setInnerElementWidthSSType2) + adjustedX) + ' ' + ((this.y2 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
}
if (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
parentOverlapTopValue : (data.parentIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestoneParent) - (this.lineStroke - 1)));
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']) +
' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + (this.y2 + adjustments['adjustY1']);
this.arrowPath = 'M ' + ((this.x1 + 20) + adjustments['adjustX']) + ' ' + ((this.y2) + adjustments['adjustY1']) +
' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + ((this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
' L ' + ((this.x1 + 12) + adjustments['adjustX']) + ' ' + ((this.y2 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
}
if (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
parentOverlapTopValue : (data.parentIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestoneParent) - (this.lineStroke - 1)));
this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke;
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']) +
' L ' + (this.x1 + this.x4) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1']);
this.arrowPath = 'M ' + ((this.x1) + adjustedX) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1']) +
' L ' + ((this.x1 + 8) + adjustedX) + ' ' + ((this.y1 + this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
' L ' + ((this.x1 + 8) + adjustedX) + ' ' + ((this.y1 + this.y2 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
}
if (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight :
((!this.parent.allowTaskbarOverlap ? parentOverlapTopValue :
(data.parentIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(data.milestoneParent) - (this.lineStroke - 1)));
this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke;
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']) +
' L ' + this.x3 + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1']);
this.arrowPath = 'M ' + ((this.x3 - 8) + arrowX) + ' ' + ((this.y1 + this.y2) + adjustments['adjustY1']) +
' L ' + (this.x3 + arrowX) + ' ' + ((this.y1 + this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
' L ' + (this.x3 + arrowX) + ' ' + ((this.y1 + this.y2 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
}
if (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
childOverlapTopValue : (data.childIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1)));
this.y2 = heightValue + this.taskLineValue + borderTopWidth - this.lineStroke + (this.parent.renderBaseline ?
(data.milestoneParent && !(data.milestoneChild) ? 10 : data.milestoneChild && !(data.milestoneParent) ? -11 : 0) : 0);
this.connectorLinePath = 'M ' + this.x2 + ' ' + (this.y1) + ' L ' + (this.x2 + this.x3) + ' ' + (this.y1) + ' L ' + (this.x2 + this.x3) + ' ' + (this.y1 + this.y2) +
' L ' + this.x4 + ' ' + (this.y1 + this.y2);
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 (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
childOverlapTopValue : (data.childIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1)));
this.y2 = heightValue + this.taskLineValue + borderTopWidth + (this.parent.renderBaseline ?
(data.milestoneParent && !(data.milestoneChild) ? 10 :
data.milestoneChild && !(data.milestoneParent) ? -12 : 0) : 0) - 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) +
' L ' + this.x1 + ' ' + (this.y1 + this.y2);
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 (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
childOverlapTopValue : (data.childIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1) - isMilestoneValue));
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 + (data.milestoneChild ? 2 : 0) + (this.parent.renderBaseline ? (data.milestoneParent ? -5 : 0) : 0);
this.y2 = this.y1 + this.point1 + (this.parent.renderBaseline ? (data.milestoneChild && !(data.milestoneParent) ? -9 :
data.milestoneParent && !(data.milestoneChild) ? 9 : 0) : 0);
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)) + ' L ' + (this.x1 + 11) + ' ' + ((this.y2 + this.y3));
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 (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight : ((!this.parent.allowTaskbarOverlap ?
childOverlapTopValue : (data.childIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1)));
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.parent.renderBaseline ? (data.milestoneChild && !(data.milestoneParent) ? -12 :
data.milestoneParent && !(data.milestoneChild) ? 10 : 0) : 0);
this.connectorLinePath = 'M ' + this.x2 + ' ' + (this.y1) + ' L ' + this.x3 + ' ' + (this.y1) +
' L ' + this.x3 + ' ' + this.y2 + ' L ' + (this.x3 + this.point1) + ' ' + this.y2;
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 (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight :
((!this.parent.allowTaskbarOverlap ? parentOverlapTopValue :
(data.parentIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestone) - (this.lineStroke - 1) - isMilestoneValue));
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) + ' L ' + this.x1 + ' ' + (this.y1) + ' 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 (this.getParentPosition(data) === '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 = (this.parent.enableVirtualization ? rowPositionHeight :
((!this.parent.allowTaskbarOverlap ? parentOverlapTopValue :
(data.parentIndex * data.rowHeight)) + addTop +
this.getTaskbarMidpoint(isMilestoneParent) - (this.lineStroke - 1)));
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']) + ' L ' + (this.x1 + 8) + ' ' + (this.y2 + adjustments['adjustY1']);
this.arrowPath = 'M ' + (this.x1 + adjustedX) + ' ' + ((this.y2) + adjustments['adjustY1']) +
' L ' + ((this.x1 + 8) + adjustedX) + ' ' + ((this.y2 - (4 + this.lineStroke)) + adjustments['adjustY1']) +
' L ' + ((this.x1 + 8) + adjustedX) + ' ' + ((this.y2 + 4 + this.lineStroke) + adjustments['adjustY1']) + ' Z';
}
this.connectorPath.setAttribute('d', this.connectorLinePath);
this.arrowlinePath.setAttribute('d', this.arrowPath);
}
return this.groupObject.outerHTML;
};
ConnectorLine.prototype.getPosition = function (data, type, heightValue) {
var topPosition = 0;
var lineHeight = 0;
if (this.parent.virtualScrollModule && this.parent.enableVirtualization) {
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;
var lastRowIndex = this.parent.currentViewData.length - 1;
if (type === 'SSType1' || type === 'SSType2' || type === 'FFType1' || type === 'FFType2' || type === 'SFType2') {
topPosition = isParentIndex ? (data.parentIndexInCurrentView * data.rowHeight) + midPointParent : 0;
lineHeight = (isParentIndex && isChildIndex) ? heightValue : isChildIndex ?
(data.childIndexInCurrentView * data.rowHeight) + midPointParent : (lastRowIndex * data.rowHeight) + midPointParent;
}
else if (type === 'SSType3' || type === 'SSType4' || type === 'FSType4' || type === 'FFType3' ||
type === 'FFType4' || type === 'SFType4' || type === 'SFType3') {
topPosition = isChildIndex ? (data.childIndexInCurrentView * data.rowHeight) + midPoint : 0;
lineHeight = (isParentIndex && isChildIndex) ? heightValue : isParentIndex ?
(data.parentIndexInCurrentView * data.rowHeight) + midPoint :
(lastRowIndex * data.rowHeight) + midPoint;
}
else if (type === 'FSType3') {
topPosition = isChildIndex ? (data.childIndexInCurrentView * data.rowHeight) + midPointParent : 0;
lineHeight = (isParentIndex && isChildIndex) ? heightValue : isParentIndex ?
(data.parentIndexInCurrentView * data.rowHeight) + midPoint :
(lastRowIndex * data.rowHeight) + midPointParent;
}
else Eif (type === 'SFType1' || type === 'FSType1' || type === 'FSType2') {
topPosition = isParentIndex ? (data.parentIndexInCurrentView * data.rowHeight) + midPoint : 0;
lineHeight = (isParentIndex && isChildIndex) ? heightValue : isChildIndex ?
(data.childIndexInCurrentView * data.rowHeight) + midPoint :
(lastRowIndex * data.rowHeight) + 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 innerTd = '<tr id="fromPredecessor"><td style="padding: 2px;">' + this.parent.localeObj.getConstant('from') + '</td><td> ';
innerTd = innerTd + fromTaskName + ' </td><td style="padding: 2px;"> ' + this.parent.localeObj.getConstant(fromPredecessorText) + ' </td> </tr>';
innerTd = innerTd + '<tr id="toPredecessor"><td style="padding: 2px;">' + this.parent.localeObj.getConstant('to') + '</td><td> ' + toTaskName;
innerTd = innerTd + ' </td><td style="padding: 2px;"> ' + this.parent.localeObj.getConstant(toPredecessorText) + ' </td></tr></tbody><table>';
return innerTd;
};
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 {
return this.parent.viewType === 'ResourceView' ? this.parent.flatData[this.parent.getTaskIds().indexOf('T' + id.toString())] :
this.parent.flatData[this.parent.ids.indexOf(id.toString())];
}
};
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;
});
|