From c00d2ef560fa8e4b8e17aeecc58bb237d05bfbf6 Mon Sep 17 00:00:00 2001 From: zhangwen <1062680993@qq.com> Date: Thu, 27 Aug 2020 00:58:54 +0800 Subject: [PATCH] fix: fix print style --- .../src/components/links/links.component.ts | 56 +++++++++++++++++++ packages/gantt/src/gantt-print.service.ts | 2 + packages/gantt/src/gantt.component.scss | 1 + 3 files changed, 59 insertions(+) diff --git a/packages/gantt/src/components/links/links.component.ts b/packages/gantt/src/components/links/links.component.ts index 1e546994..a4be0b84 100644 --- a/packages/gantt/src/components/links/links.component.ts +++ b/packages/gantt/src/components/links/links.component.ts @@ -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}`; } } @@ -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; diff --git a/packages/gantt/src/gantt-print.service.ts b/packages/gantt/src/gantt-print.service.ts index 8664889b..fb077666 100644 --- a/packages/gantt/src/gantt-print.service.ts +++ b/packages/gantt/src/gantt-print.service.ts @@ -73,6 +73,7 @@ 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; @@ -80,6 +81,7 @@ export class GanttPrintService { 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`); diff --git a/packages/gantt/src/gantt.component.scss b/packages/gantt/src/gantt.component.scss index 736fd392..a73ec82f 100644 --- a/packages/gantt/src/gantt.component.scss +++ b/packages/gantt/src/gantt.component.scss @@ -53,6 +53,7 @@ left: 0; right: 0; overflow: auto; + background-color: $gantt-container-background-color; .gantt-main-items { overflow: hidden;