swiety85 / angular2gridster

Angular implementation of well known Gridster (no jQuery, no external libraries, only Angular and Rx.js).
https://swiety85.github.io/angular2gridster/
MIT License
203 stars 75 forks source link

reloading grids sometimes makes heights size 1 #382

Open pianojet opened 3 years ago

pianojet commented 3 years ago

There's a feature I'm working on for my job that uses gridster for my clients to layout form components. There is an old java system that we port X/Y/W/H over, and translate to the gridster grid in the NG app.

Sometimes the gridster item height isn't correct because the browser rendering component is too tall to fit (compared to the old system rendering), so on reflow I dynamically calculate the grid height of each item given the bounding-client-rect of the item.

... this is essentially the following (which isn't an official feature yet, is it?): https://github.com/swiety85/angular2gridster/blob/master/projects/angular2gridster/src/lib/gridster.component.ts#L242

This works fine most of the time, say, 97% of the time.

Once in a while, though, clients report that heights become only 1 cell large. X/Y seems fine.

My own user-error notwithstanding, any clues about why could this be? Adjusting window size/zoom during reflow doesn't seem to hurt it... maybe adjustments that happen like that only at the "right time" could do it?

Anyone know of other phenomena I could look into and test?