More things work now
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 34s
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 34s
This commit is contained in:
@@ -23,7 +23,6 @@ let currentId = 0;
|
||||
function SetupHandle(id, handle) {
|
||||
|
||||
// Update window info with handle info
|
||||
console.log(id);
|
||||
let win = GetWindowWithId(id);
|
||||
|
||||
let currentWindowId = "window-wrapper-" + id;
|
||||
@@ -189,7 +188,6 @@ function GetPosition(id) {
|
||||
}
|
||||
|
||||
function ResetPosition(id, pos) {
|
||||
console.log("The id: ", id)
|
||||
let win = GetWindowWithId(id);
|
||||
let data = { x: win.x, y: win.y };
|
||||
|
||||
@@ -202,9 +200,6 @@ function ResetPosition(id, pos) {
|
||||
|
||||
|
||||
function CreateWindow(type, data = {}) {
|
||||
console.log("Creating window")
|
||||
console.log(windows.value);
|
||||
|
||||
let finalData = { ...{ type, id: currentId }, ...defWindows[type], ...data }
|
||||
currentId++;
|
||||
|
||||
@@ -217,25 +212,19 @@ function CreateWindow(type, data = {}) {
|
||||
}
|
||||
if (!contains) {
|
||||
windows.value.push(finalData);
|
||||
|
||||
console.log(windows.value)
|
||||
setTimeout(() => {
|
||||
SetOnTop(finalData.id);
|
||||
if (finalData.create) finalData.create();
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function CreateChildWindow(parentId, type, data = {}) {
|
||||
console.log("Creating child window")
|
||||
console.log(parentId, type, data);
|
||||
let finalData = { ...{ type }, ...defWindows[type], ...data }
|
||||
|
||||
const newId = currentId;
|
||||
let parent = GetWindowWithId(parentId);
|
||||
console.log(parent);
|
||||
if (parent.children) parent.children.push(finalData.type);
|
||||
else parent.children = [finalData.type];
|
||||
if (parent.children) parent.children.push(newId); // We will create the child window right now
|
||||
else parent.children = [newId];
|
||||
CreateWindow(type, data);
|
||||
console.log(windows.value);
|
||||
}
|
||||
|
||||
function GetFirstWindowId(type) {
|
||||
@@ -250,26 +239,29 @@ function ClearAll() {
|
||||
});
|
||||
}
|
||||
|
||||
function ClearWindows(data) {
|
||||
for (let i = 0; i < windows.value.length; i++) {
|
||||
ClearWindow(windows.value[i].type);
|
||||
}
|
||||
// reload.value += 1;
|
||||
}
|
||||
|
||||
function ClearWindowsWithType(type) {
|
||||
const index = windows.value.findIndex(w => w.type === type);
|
||||
if (index !== -1) ClearWindow(windows.value[index].id)
|
||||
// reload.value += 1;
|
||||
}
|
||||
|
||||
function ClearWindow(id) {
|
||||
function clearWindowById(id){
|
||||
let win = GetWindowWithId(id);
|
||||
console.log(win);
|
||||
if (!win) return;
|
||||
if (win.children) for (let i = 0; i < win.children.length; i++) ClearWindow(win.children[i].id);
|
||||
const index = windows.value.findIndex(w => w.type === id)
|
||||
if (win.children) for (let i = 0; i < win.children.length; i++) clearWindowById(win.children[i]);
|
||||
const index = windows.value.findIndex(w => w.id === id)
|
||||
if (index !== -1) windows.value.splice(index, 1)
|
||||
}
|
||||
|
||||
function ClearWindow(selector) {
|
||||
if(selector.type !== undefined) {
|
||||
const type = selector.type;
|
||||
for(let i = 0; i < windows.value.length; i++) {
|
||||
if(windows.value[i].type == type) {
|
||||
clearWindowById(windows.value[i].id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(selector.id !== undefined) {
|
||||
const id = selector.id;
|
||||
clearWindowById(id);
|
||||
}
|
||||
|
||||
// reload.value += 1;
|
||||
}
|
||||
|
||||
@@ -300,6 +292,13 @@ function SetOnTop(id) {
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function Top(element) {
|
||||
try {
|
||||
currentIndex += 1;
|
||||
element.value.style.zIndex = currentIndex;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
export {
|
||||
windows,
|
||||
SetupHandle,
|
||||
@@ -311,7 +310,6 @@ export {
|
||||
SetMovable,
|
||||
ResetPosition,
|
||||
WindowMap,
|
||||
ClearWindows,
|
||||
CreateWindow,
|
||||
CreateChildWindow,
|
||||
GetFirstWindowId,
|
||||
@@ -320,7 +318,7 @@ export {
|
||||
SaveWindowPos,
|
||||
GetPosition,
|
||||
ClearWindow,
|
||||
ClearWindowsWithType,
|
||||
ClearAll,
|
||||
Top,
|
||||
getComponent
|
||||
}
|
||||
Reference in New Issue
Block a user