Better windows box saving + expand-shrink back to previous

This commit is contained in:
STEINNI
2025-10-08 17:31:07 +00:00
parent 93de6045e3
commit b3f6c38c27
2 changed files with 39 additions and 27 deletions
+13 -6
View File
@@ -14,13 +14,22 @@ class EICDomContent extends View {
get expanded() { return this.el.hasAttribute('expanded'); }
_saveWindowBox(){
const box = this.el.getBoundingClientRect()
this.savedWindowBox = {
width: `${box.width}px`,
height: `${box.height}px`,
left: `${box.x}px`,
top: `${box.y}px`,
}
}
//TODO: memorize size & position
/**
*
*/
expand() {
this._saveWindowBox()
this.el.setAttribute('expanded','');
this.el.dispatchEvent(new CustomEvent('expanded'));
this.el.style.left = 'auto';
@@ -31,17 +40,15 @@ class EICDomContent extends View {
this.DOMContentResized()
}
//TODO: restore to previous memorize size & position
/**
*
*/
shrink() {
this.el.removeAttribute('expanded');
this.el.dispatchEvent(new CustomEvent('shrinked'));
this.el.style.left = this.el.getBoundingClientRect().x;
this.el.style.top = this.el.getBoundingClientRect().y;
Object.assign(this.el.style, this.savedWindowBox)
// this.el.style.left = this.el.getBoundingClientRect().x;
// this.el.style.top = this.el.getBoundingClientRect().y;
this.DOMContentResized();
}