Skip to content

Commit 17c17b2

Browse files
committed
Fix leaking metrobody
1 parent 44285b9 commit 17c17b2

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

Scripts/WindowManager.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,23 @@ function titlify(title) {
5050
* Creates an instance of a Dialog that allows the Dialog be resized and moved around.
5151
* @author Lasse Lauwerys
5252
* @param {HTMLElement | Application} object This is a dialog element from the HTML structure, or an object that defines the properties of the window.
53+
* @param {boolean} create
5354
*/
54-
function Dialog(object) {
55+
function Dialog(object, create) {
5556

5657
this._x = 0;
5758
this._y = 0;
5859
this._width = 0;
5960
this._height = 0;
6061
this._isMinWidth = false;
6162
this._isMinHeight = false;
62-
63+
6364
this.z = 0;
6465
this.minWidth = 100;
6566
this.minHeight = 200;
66-
67+
6768
if (!object) return;
69+
if (!create) create = false;
6870
/*const*/var dialog = this;
6971

7072
/** @type {HTMLElement} */
@@ -103,7 +105,7 @@ function Dialog(object) {
103105
// This adds application shortcuts to the app drawer, which currently rests on the desktop. I will make another drawer for mobile and make a pop-up drawer from the dock with the option to pin apps to it. I probably won't have enough time to implement an in-browser file manager, the localStorage API is limited to 5-10MB and using persistent storage requires browser specific APIs that don't work consistently yet.
104106
document.getElementById("applist").appendChild(this.createOpenButton());
105107
document.getElementById("metroapplist").appendChild(this.createOpenButton());
106-
this.initWithObject(object);
108+
if (create || object instanceof HTMLElement) this.initWithObject(object);
107109
}
108110

109111
Dialog.prototype.initWithObject = function (object) {

Styles/desktop.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ section#desktop[flipped] article#metrobody {
164164
animation: forwards 1s ease-in flip;
165165
}
166166

167+
#desktop:not([flipped]) #metroapplist {
168+
display: none;
169+
}
170+
167171
#desktop[flipped] > #windows {
168172
animation: forwards 1s ease-in flip;
169173
}

0 commit comments

Comments
 (0)