-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from MurhafSousli/dev
v7.2.1-beta.0
- Loading branch information
Showing
9 changed files
with
763 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
projects/ngx-scrollbar/src/lib/utils/hide-native-scrollbar.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
import { Directive, Input } from '@angular/core'; | ||
import { DomSanitizer } from '@angular/platform-browser'; | ||
import { Directive, ElementRef, OnDestroy } from '@angular/core'; | ||
import { Subscription } from 'rxjs'; | ||
import { NativeScrollbarSizeFactory } from './native-scrollbar-size-factory'; | ||
|
||
@Directive({ | ||
selector: '[hideNativeScrollbar]', | ||
host: { | ||
'[attr.style]': 'sanitizer.bypassSecurityTrustStyle(nativeScrollbarSize)' | ||
} | ||
selector: '[hideNativeScrollbar]' | ||
}) | ||
export class HideNativeScrollbar { | ||
export class HideNativeScrollbar implements OnDestroy { | ||
|
||
@Input('hideNativeScrollbar') size: number; | ||
private readonly _subscriber = Subscription.EMPTY; | ||
|
||
get nativeScrollbarSize(): string { | ||
return `--native-scrollbar-size: -${this.size}px`; | ||
constructor(el: ElementRef, private hideNativeScrollbar: NativeScrollbarSizeFactory) { | ||
this._subscriber = hideNativeScrollbar.scrollbarSize.subscribe((size: number) => { | ||
(el.nativeElement as HTMLElement).style.setProperty('--native-scrollbar-size', `-${ size }px`); | ||
}); | ||
} | ||
|
||
constructor(public sanitizer: DomSanitizer) { | ||
ngOnDestroy() { | ||
this._subscriber.unsubscribe(); | ||
} | ||
} |