Add layout event

This commit is contained in:
trading_peter 2023-09-02 00:13:59 +02:00
parent 3af695daab
commit 7420945748
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@tp/tp-popup", "name": "@tp/tp-popup",
"version": "1.0.5", "version": "1.0.6",
"description": "", "description": "",
"main": "tp-popup.js", "main": "tp-popup.js",
"scripts": { "scripts": {

View File

@ -195,11 +195,13 @@ class TpPopup extends EventHelpers(Position(DomQuery(LitElement))) {
this._cleanupEvents(); this._cleanupEvents();
this.listen(document, 'mousedown', '_docClick'); this.listen(document, 'mousedown', '_docClick');
this.scrollTarget.addEventListener('scroll', this.fit, { passive: true }); this.scrollTarget.addEventListener('scroll', this.fit, { passive: true });
this.scrollTarget.addEventListener('layout', this.fit, { passive: true });
} }
_cleanupEvents() { _cleanupEvents() {
this.unlisten(document, 'mousedown', '_docClick'); this.unlisten(document, 'mousedown', '_docClick');
this.scrollTarget.removeEventListener('scroll', this.fit, { passive: true }); this.scrollTarget.removeEventListener('scroll', this.fit, { passive: true });
this.scrollTarget.removeEventListener('layout', this.fit, { passive: true });
} }
} }