This commit is contained in:
Alex Yatskov 2016-04-22 21:01:39 -07:00
parent 77e404bbda
commit 85594f4def

View File

@ -26,8 +26,9 @@ class Popup {
showAt(pos, content) { showAt(pos, content) {
this.inject(); this.inject();
this.popup.style.left = pos.x + 'px'; this.popup.style.left = pos.x + 'px';
this.popup.style.top = pos.y + 'px'; this.popup.style.top = pos.y + 'px';
this.popup.style.visibility = 'visible';
this.setContent(content); this.setContent(content);
} }
@ -48,14 +49,17 @@ class Popup {
posY = elementRect.top - popupRect.height - this.offset; posY = elementRect.top - popupRect.height - this.offset;
} }
this.popup.style.left = pos.x + 'px'; this.popup.style.left = pos.x + 'px';
this.popup.style.top = pos.y + 'px'; this.popup.style.top = pos.y + 'px';
this.popup.style.visibility = 'visible';
this.setContent(content); this.setContent(content);
} }
hide() { hide() {
this.remove(); if (this.popup !== null) {
this.popup.style.visibility = 'hidden';
}
} }
setContent(content) { setContent(content) {
@ -76,11 +80,4 @@ class Popup {
document.body.appendChild(this.popup); document.body.appendChild(this.popup);
} }
remove() {
if (this.popup !== null) {
this.popup.parentNode.removeChild(this.popup);
this.popup = null;
}
}
} }