diff --git a/resources/sys/wde/simple-scrollbar.js b/resources/sys/wde/simple-scrollbar.js index 2ff768f..a6e93ee 100644 --- a/resources/sys/wde/simple-scrollbar.js +++ b/resources/sys/wde/simple-scrollbar.js @@ -1,3 +1,4 @@ +//TODO Delete this file ;(function(root, factory) { if (typeof exports === 'object') { module.exports = factory(window, document) diff --git a/resources/wde.js b/resources/wde.js index 89d1cda..78e0655 100644 --- a/resources/wde.js +++ b/resources/wde.js @@ -3,6 +3,7 @@ document.addEventListener('DOMContentLoaded', function() { wde = new WebDesktopEnvironment if (!WebDesktopEnvironment.isMobile){ WebDesktopEnvironment.Open("finder", ["kek"]) + WebDesktopEnvironment.Open("personal-properties", ["kek"]) } @@ -13,9 +14,8 @@ class WebDesktopEnvironment{ static Applications = {}; static isMobile = false constructor(){ - this.wc = new WindowsCompositor WebDesktopEnvironment.isMobile = WebDesktopEnvironment.CheckMobile() - + let applications = document.createElement("div") applications.setAttribute('id', 'applications') document.body.appendChild(applications) @@ -27,8 +27,8 @@ class WebDesktopEnvironment{ mobileDesktop.setAttribute('id', 'mobile-desktop') document.body.appendChild(mobileDesktop) - - + + // let windowsLayer = document.createElement("div") // windowsLayer.setAttribute('id', 'windows-layer') @@ -46,20 +46,19 @@ class WebDesktopEnvironment{ WebDesktopEnvironment.Open("personal-properties", []) }) }) - }).then(()=>{ - }) .catch((error) => { WebDesktopEnvironment.Alert(error); }) - + } else{ document.body.style.setProperty('--zoom', 1) - + let windowsLayer = document.createElement("div") windowsLayer.setAttribute('id', 'windows-layer') document.body.appendChild(windowsLayer) } + this.wc = new WindowsCompositor } /** @@ -202,12 +201,15 @@ var getJSON = function(url, callback) { }; class WindowsCompositor{ + windowLayer = undefined movingElement = null constructor(){ - console.log("Windows Compositor is online :)"); + this.windowLayer = document.body.querySelector('#windows-layer') addEventListener("mousedown", (event) => { + this.bringWindowToFront(event.target.closest('.StandartApplicationWindow')) this.catchClick(event) + }) addEventListener("mouseup", (event) => { this.movingElement = null @@ -220,12 +222,19 @@ class WindowsCompositor{ } }) } + + /** + * @param {HTMLElement} window + */ + bringWindowToFront(window){ + console.log("kek") + this.windowLayer.insertBefore(this.windowLayer.lastChild, window) + } /** * @param {MouseEvent} event */ catchClick(event){ - switch (true) { case event.target.className == "WindowFrameTopBar": this.movingElement = event.target.parentElement