api.resize() method -> checkIfToResize(): why not resize if (verticalScrollPresent)?
On line 145 of gridster.component.ts (within the checkIfToResize() method):
checkIfToResize(): boolean {
const clientWidth = this.el.clientWidth;
const offsetWidth = this.el.offsetWidth;
const scrollWidth = this.el.scrollWidth;
const clientHeight = this.el.clientHeight;
const offsetHeight = this.el.offsetHeight;
const scrollHeight = this.el.scrollHeight;
const verticalScrollPresent = clientWidth < offsetWidth && scrollHeight > offsetHeight
&& scrollHeight - offsetHeight < offsetWidth - clientWidth;
const horizontalScrollPresent = clientHeight < offsetHeight
&& scrollWidth > offsetWidth && scrollWidth - offsetWidth < offsetHeight - clientHeight;
if (verticalScrollPresent) {
return false;
}
return !horizontalScrollPresent;
}
Can you help me understand why we wouldn't want the grid to resize, in the case that the vertical scrollbar is present? This doesn't seem like a safe assumption to me, and I'm seeing examples of the onResize() method not getting called in cases where it should.
I guess my thought is that if I explicitly call the api's resize() method, it should always resize. Because I told it to. I guess for now, I'm going to have to create a template variable/ViewChild reference, and explicitly call the GridsterComponent's onResize() method.
Hi @jasonhendee ,
The checks there are made so it will not enter in a infinite cycle because the method is called again from calculateLayout, when the size of the screen and size of the grid is really close to have or not to have a scrollbar.
Yes on the api resize() call should make it to always resize. Will try to add it as soon as possible.
Thanks,
Thank you! I'll keep an eye out for that enhancement, but the ViewChild reference will work for now.
Hi @jasonhendee ,
Fixed in 3.13.0
Thanks,