Repository navigation
fix(drawer): allow for drawer container to auto-resize while open - #8488
Conversation
| private _margins = {left: 0, right: 0}; | ||
|
|
||
| /** Used for debouncing reflows. */ | ||
| private _debouncer = new Subject<void>(); |
There was a problem hiding this comment.
maybe call it _doCheckSubject?
| }); | ||
|
|
||
| this._debouncer.pipe( | ||
| debounceTime(10), // Arbitrary debounce time, less than a frame at 60fps |
There was a problem hiding this comment.
is debounce what we want, doesn't audit make more sense here?
There was a problem hiding this comment.
I'd say so. audit just throttles the events, but what we want is to only measure once if multiple events happen very close to each other.
There was a problem hiding this comment.
If the drawer were animating open, wouldn't it just keep denouncing until the animation is over and then jump?
There was a problem hiding this comment.
AFAIK animations don't trigger change detection. ngDoCheck runs for every change detection cycle.
| constructor(@Optional() private _dir: Directionality, private _element: ElementRef, | ||
| private _renderer: Renderer2, private _ngZone: NgZone, | ||
| constructor(@Optional() private _dir: Directionality, | ||
| @Inject(MAT_DRAWER_DEFAULT_AUTOSIZE) defaultAutosize: boolean, |
There was a problem hiding this comment.
If we move this to the end of the parameter list and make it optional it won't be breaking for users who are extending this class
| issues. | ||
|
|
||
| ```html | ||
| <mat-sidenav-container [autosize]="true"> |
There was a problem hiding this comment.
can we make this an embedded example? (#7775 will make the rest of these embedded examples as well).
Maybe also add an example to the demo app so we can manually test
There was a problem hiding this comment.
I'm not sure what an embedded example would look like in this case, aside from a sidenav that resizes in a setTimeout, but that's not very representative of a real use case.
There was a problem hiding this comment.
You could have an icon drawer that expands to show full labels when the user hovers or clicks a button.
Or just have a button that toggles itself between shorter and longer width when clicked, not a practical use case but demonstrates how to use the feature and lets us manually test it
There was a problem hiding this comment.
Alright, I've added a live example.
8da8c0b to
1c685f4
Compare
|
Addressed the code-related feedback @mmalerba. |
1c685f4 to
8947aec
Compare
| @@ -0,0 +1,16 @@ | |||
| <mat-sidenav-container class="example-container" autosize> | |||
There was a problem hiding this comment.
Can you change these to the drawer variants? I only want people to use sidenav for fullscreen layouts
mmalerba
left a comment
There was a problem hiding this comment.
Looks good, just 1 nit. Feel free to add merge-ready after
8947aec to
08fa7d0
Compare
|
@crisbeto please rebase. Thanks! |
08fa7d0 to
61783b6
Compare
|
Rebased @tinayuangao. |
61783b6 to
1436eee
Compare
Adds the `autosize` input that allows users to opt-in to drawers that auto-resize, similarly to the behavior before angular#6189. The behavior is off by default, because it's unnecessary for most use cases and can cause performance issues. Fixes angular#6743.
1436eee to
ae04fcf
Compare
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds the
autosizeinput that allows users to opt-in to drawers that auto-resize, similarly to the behavior before #6189. The behavior is off by default, because it's unnecessary for most use cases and can cause performance issues.Fixes #6743.