service2.js: Reintroduce window resize event listening

This is an emergency solution to track host element position changing.
This commit is contained in:
Simon Rozman 2024-05-23 12:16:54 +02:00
parent cb0f55a976
commit 9258cecc73

View File

@ -9,6 +9,14 @@
*/
let besServices = []
// TODO: Window resize may cause host element(s) to move. That needs correction panel and status icon
// repositioning. Also, should any parent element of our service host element move, we should reposition
// correction panel and status icon. How to do this? Alas there is no PlacementObserver to monitor host
// element movements.
window.addEventListener('resize', () =>
besServices.forEach(service => service.onReposition())
)
/*************************************************************************
*
* Base class for all grammar-checking services
@ -135,6 +143,14 @@ class BesService {
}, 500)
}
/**
* Called to report repositioning
*/
onReposition() {
this.setCorrectionPanelSize()
this.setStatusDivPosition()
}
/**
* Called to report resizing
*/