Skip to content

Commit

Permalink
fix: fix print style
Browse files Browse the repository at this point in the history
  • Loading branch information
HandsomeButterball committed Aug 26, 2020
1 parent b4ba33c commit c00d2ef
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
56 changes: 56 additions & 0 deletions packages/gantt/src/components/links/links.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,35 @@ export class GanttLinksComponent implements OnInit, OnChanges, OnDestroy {
const x2 = x1 - dx;
const x3 = x4 + dx;

// const centerX = (x1 + x4) / 2;
// const centerY = (y1 + y4) / 2;

// const controlX = this.ganttUpper.styles.lineHeight / 2;
// const controlY =
// Math.sqrt(Math.pow(x4 - x1, 2) + Math.pow(y4 - y1, 2)) / Math.abs(x4 - x1) + this.ganttUpper.styles.lineHeight / 2;

// if (x1 >= x4) {
// if (y4 > y1) {
// return `M ${x1} ${y1}
// C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 + controlX} ${x1} ${y1 + controlY}
// L ${x1} ${y1 + controlY} ${centerX} ${centerY}

// M ${x4} ${y4}
// C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 - controlX} ${x4} ${y4 - controlY}
// L ${x4} ${y4 - controlY} ${centerX} ${centerY}
// `;
// } else {
// return `M ${x1} ${y1}
// C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${x1} ${y1 - controlY}
// L ${x1} ${y1 - controlY} ${centerX} ${centerY}

// M ${x4} ${y4}
// C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 + controlX} ${x4} ${y4 + controlY}
// L ${x4} ${y4 + controlY} ${centerX} ${centerY}
// `;
// }
// }

return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
}
}
Expand All @@ -185,6 +214,33 @@ export class GanttLinksComponent implements OnInit, OnChanges, OnDestroy {
}
});
}
// M 8288 417
// C 8470 417 8470 505 8652 505

// M1980 100
// C2037 100 2093 60 2150 60

// 曲线1
// point1 M1980 100
// point2 1980 120
// 控制点1 2000 100 控制点2 2000 120

// 直线 point1 1980 120 point2 1925 120

// M1980 100
// C2000 100 2000 120 1980 120
// L1980 120 1925 120

// M1870 140
// C1850 140 1850 120 1870 120
// L1870 120 1925 120

// M2303 60
// C2323 60 2323 80 2303 109
// L2303 109 2256 180
// M2210 300
// C2190 300 2190 280 2210 250
// L2210 250 2256 180

trackBy(index: number) {
return index;
Expand Down
2 changes: 2 additions & 0 deletions packages/gantt/src/gantt-print.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ export class GanttPrintService {
onclone: (cloneDocument: Document) => {
const ganttClass = root.className;
const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`) as HTMLElement;
const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container') as HTMLElement;
const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main') as HTMLElement;
const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main') as HTMLElement;

// change targetDom width
cloneGanttDom.style.width = `${printWidth}px`;
cloneGanttDom.style.height = `${printHeight}px`;
cloneGanttDom.style.overflow = `unset`;
cloneGanttContainerDom.style.backgroundColor = '#fff';
cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
cloneCalendarOverlay.setAttribute('style', `background: transparent`);

Expand Down
1 change: 1 addition & 0 deletions packages/gantt/src/gantt.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
left: 0;
right: 0;
overflow: auto;
background-color: $gantt-container-background-color;

.gantt-main-items {
overflow: hidden;
Expand Down

0 comments on commit c00d2ef

Please sign in to comment.