Skip to content

Commit

Permalink
fix: just hide today line and support safari browser
Browse files Browse the repository at this point in the history
  • Loading branch information
HandsomeButterball committed Sep 1, 2020
1 parent c7d2eb2 commit 02b2157
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="gantt-calendar-today-overlay" [style.width.px]="view.width" *ngIf="ganttUpper.showTodayLine">
<div class="gantt-calendar-today-overlay" [style.width.px]="view.width">
<span class="today-rect"> </span>
<span class="today-line"> </span>
<span class="today-line" *ngIf="ganttUpper.showTodayLine"> </span>
</div>

<svg class="gantt-calendar-overlay-main" [attr.width]="view.width" [attr.height]="headerHeight">
Expand All @@ -11,7 +11,6 @@
<ng-container *ngFor="let point of view.secondaryDatePoints; trackBy: trackBy">
<text
class="secondary-text"
*ngIf="!point.additions?.isToday"
[class.secondary-text-weekend]="point.additions?.isWeekend"
[attr.x]="point.x"
[attr.y]="point.y"
Expand Down
18 changes: 11 additions & 7 deletions packages/gantt/src/components/calendar/calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ export class GanttCalendarComponent implements OnInit, AfterViewInit, OnChanges,
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0] as HTMLElement;
const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0] as HTMLElement;

if (rect && line && isNumber(x)) {
rect.style.left = `${x - todayWidth / 2}px`;
rect.style.top = `${headerHeight - todayHeight}px`;
line.style.left = `${x}px`;
line.style.top = `${headerHeight}px`;
line.style.bottom = `${-mainHeight}px`;
rect.innerHTML = today.toString();
if (isNumber(x)) {
if (rect) {
rect.style.left = `${x - todayWidth / 2}px`;
rect.style.top = `${headerHeight - todayHeight}px`;
rect.innerHTML = today.toString();
}
if (line) {
line.style.left = `${x}px`;
line.style.top = `${headerHeight}px`;
line.style.bottom = `${-mainHeight}px`;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/gantt/src/components/links/links.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<svg [attr.width]="ganttUpper.view.width" class="gantt-links-overlay-main" height="100%">
<svg [attr.width]="ganttUpper.view.width" class="gantt-links-overlay-main">
<ng-container *ngFor="let link of links; let i = index; trackBy: trackBy">
<path [attr.d]="link.path" fill="transparent" stroke-width="2" [attr.stroke]="link.color" pointer-events="none"></path>
<g>
Expand Down
2 changes: 1 addition & 1 deletion packages/gantt/src/components/links/links.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
height: 100%;
svg {
overflow: visible;
z-index: 1;
z-index: 2;
position: absolute;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/gantt/src/gantt-print.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class GanttPrintService {
cloneCalendarOverlay.setAttribute('style', `background: transparent`);

if (cloneLinksOverlay) {
cloneLinksOverlay.setAttribute('height', `${printHeight}`);
cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
}

Expand Down

0 comments on commit 02b2157

Please sign in to comment.