Better windows box saving + expand-shrink back to previous
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user