Skip to content

Commit

Permalink
fix thumb drag position after scrolling the outer container, closes #342
Browse files Browse the repository at this point in the history
  • Loading branch information
MurhafSousli committed Jan 28, 2021
1 parent 07afb7c commit 30158e9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ThumbXDirective extends ThumbAdapter {
}

get dragStartOffset(): number {
return this.clientRect.left;
return this.clientRect.left + this.document.defaultView!.pageXOffset || 0;
}

get size(): number {
Expand Down Expand Up @@ -115,7 +115,7 @@ export class ThumbYDirective extends ThumbAdapter {
}

get dragStartOffset(): number {
return this.clientRect.top;
return this.clientRect.top + this.document.defaultView!.pageYOffset || 0;
}

get size(): number {
Expand All @@ -125,7 +125,7 @@ export class ThumbYDirective extends ThumbAdapter {
constructor(protected cmp: NgScrollbar,
protected track: TrackYDirective,
protected element: ElementRef,
@Inject(DOCUMENT) protected document: any) {
@Inject(DOCUMENT) protected document: Document) {
super(cmp, track, element.nativeElement, document);
}

Expand Down

0 comments on commit 30158e9

Please sign in to comment.