Closed ChrisMBarr closed 11 months ago
Yea, that doesn't look great, I have to look into this!
It's good you have a found a workaround, maybe you can also use cd.detectChanges()
with BreakpointObserver
instead, like this https://stackblitz.com/edit/finitelooper-ng16-q6hwhx?file=tsconfig.json,src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.module.ts
I've not heard of BreakpointObserver
until now, that's neat!
However I think this resize issue happens on any resize, not just at breakpoints. The gallery shows/shrinks as the page resizes and it just feels weird and jerky. However, it is much more noticeable when doing a large size jump, like a mobile/desktop breakpoint
The auto-height is relatively a new feature in this plugin, it didn't receive enough feedback to improve. I will consider using the ResizeObserver
in the future to detect when item size is changed, it's much more efficient but using it the way the gallery is built at the moment would cause a kind of infinite size change detection because of the height transition animation.
I would like the ability to:
If there were no resize animation on window resizing, some of my issues here would just go away, or at least not be visible or apparent
You can change the transition actually, try this out
gallery {
--g-height-transition: none;
}
What is the expected behavior?
When I set
[autoHeight]="true"
and I resize my window, the gallery height should animate to the correct height.What is the current behavior?
When I set
[autoHeight]="true"
and I resize my window, the gallery height is not always updated until I click on it. If I resize multiple times, it seems to store up all the past heights it encountered and "replay" them. See a screen recording hereWhat are the steps to reproduce?
I set up my HTML with this
And then in my TS file I just provided the
imagesArr
with an array ofImageItem
objects with only asrc
and athumb
pathStackBlitz: Code | Demo
Like in my screen recording, try opening up dev tools and toggling the device toolbar on and off. You will see the resize weirdness happen
What is the use-case or motivation for changing an existing behavior?
To make images appear correctly when the browser is resized
Which versions are you using for the following packages?
Angular:
16.2.1
Angular CDK:16.2.1
Angular CLI:16.2.0
Typescript:5.1.6
Gallery:11.0.0
Anything else?
I have found a temporary workaround, which I hate, but it does work to fix the issue.