-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix misalignment when scrollbar scrolls to the edge #389
fix: fix misalignment when scrollbar scrolls to the edge #389
Conversation
f3bc8f1
to
0756e16
Compare
7ae3d52
to
f865ec3
Compare
packages/gantt/src/root.component.ts
Outdated
@@ -80,6 +91,23 @@ export class NgxGanttRootComponent implements OnInit, OnDestroy { | |||
}); | |||
} | |||
|
|||
ngAfterViewInit() { | |||
setTimeout(() => { | |||
this.updateScrollBarOffset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方法的调用放到上面 this.dom.initialize(this.elementRef); 这里下面,这个是有一定是能获取到 mainContainer 的
packages/gantt/src/root.component.ts
Outdated
updateScrollBarOffset() { | ||
if (this.mainTemplate?.elementRef) { | ||
const ganttMainContainer = | ||
this.mainTemplate.elementRef.nativeElement.previousElementSibling.querySelector('.gantt-main').firstChild; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不用这样获取,直接 this.dom.mainContainer 就能获取到,上面的判断也不需要
@@ -235,6 +249,16 @@ export class NgxGanttComponent extends GanttUpper implements OnInit, OnChanges, | |||
this.viewportItems = [...this.viewportItems]; | |||
} | |||
|
|||
private updateScrollBarOffset() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要重新算一遍,直接拿 root 里的就行
@@ -2,7 +2,7 @@ | |||
<div class="gantt-header"> | |||
<gantt-table-header #tableHeader [columns]="columns"></gantt-table-header> | |||
<div class="gantt-container-header"> | |||
<gantt-calendar-header></gantt-calendar-header> | |||
<gantt-calendar-header [style.padding-right.px]="verticalScrollbarWidth"></gantt-calendar-header> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下面说了不用再在 gantt 组件里计算滚动条了直接用 [style.padding-right.px]="ganttRoot.verticalScrollbarWidth" 就可以
f326282
to
b8531a0
Compare
No description provided.