Kitware / paraviewweb

Web framework for building interactive visualization relying on VTK or ParaView to produce visualization data
http://kitware.github.io/paraviewweb/
BSD 3-Clause "New" or "Revised" License
160 stars 50 forks source link

fix(SizeHelper) allow listening to element size changes #520

Closed yasushi-saito closed 2 years ago

yasushi-saito commented 3 years ago

The current SizeHelper reacts only to explicit window size changes and not to layout changes inside the window. This change adds a new function onSizeChangeForElement that uses ResizeObserver to detect when the size of a DOM element a changes.

ResizeObserver is supported by all modern browsers now (https://caniuse.com/#feat=resizeobserver).

An aside: I'm not sure if element size caching in SizeHelper is adding much value. If we remove it, the code will become simpler.