Working close button
This commit is contained in:
parent
10a7cf9301
commit
c1bed6e2cd
@ -32,12 +32,16 @@ class WebDesktopEnvironment{
|
|||||||
.then((html) => {
|
.then((html) => {
|
||||||
mobileDesktop.innerHTML = html
|
mobileDesktop.innerHTML = html
|
||||||
WebDesktopEnvironment.LoadApp("finder", () =>{
|
WebDesktopEnvironment.LoadApp("finder", () =>{
|
||||||
console.log("lel")
|
|
||||||
new FileView("/kek", mobileDesktop.querySelector(".FileTileView"), Finder.Click)
|
new FileView("/kek", mobileDesktop.querySelector(".FileTileView"), Finder.Click)
|
||||||
|
|
||||||
mobileDesktop.querySelector('#about-me').addEventListener('click', (event) => {
|
mobileDesktop.querySelector('#about-me').addEventListener('click', (event) => {
|
||||||
|
//TODO Do not allow launch second instance
|
||||||
WebDesktopEnvironment.Open("personal-properties", [])
|
WebDesktopEnvironment.Open("personal-properties", [])
|
||||||
})
|
})
|
||||||
|
mobileDesktop.querySelector('#mobile-dekstop-close').addEventListener('click', (event) => {
|
||||||
|
// console.log('close')
|
||||||
|
WebDesktopEnvironment.CloseFocusedWindow()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -137,6 +141,12 @@ class WebDesktopEnvironment{
|
|||||||
window.remove()
|
window.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CloseFocusedWindow() {
|
||||||
|
if (document.body.querySelector('#windows-layer').childElementCount > 1){
|
||||||
|
document.body.querySelector('#windows-layer').lastElementChild.remove()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} html
|
* @param {string} html
|
||||||
*/
|
*/
|
||||||
@ -189,6 +199,7 @@ class WindowsCompositor{
|
|||||||
//TODO refactor this to dynamic add/remove listeners
|
//TODO refactor this to dynamic add/remove listeners
|
||||||
constructor(){
|
constructor(){
|
||||||
this.windowLayer = document.body.querySelector('#windows-layer')
|
this.windowLayer = document.body.querySelector('#windows-layer')
|
||||||
|
if (!WebDesktopEnvironment.isMobile) {
|
||||||
addEventListener("mousedown", (event) => {
|
addEventListener("mousedown", (event) => {
|
||||||
this.xPosInit = event.offsetX
|
this.xPosInit = event.offsetX
|
||||||
this.yPosInit = event.offsetY
|
this.yPosInit = event.offsetY
|
||||||
@ -211,6 +222,7 @@ class WindowsCompositor{
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {HTMLElement} window
|
* @param {HTMLElement} window
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<div class="FileTileIcon NoClick" style="background-image: url('./res/sys/wde/icons/desktop.png');"></div>
|
<div class="FileTileIcon NoClick" style="background-image: url('./res/sys/wde/icons/desktop.png');"></div>
|
||||||
<div class="FileTileTitle NoClick">Home</div>
|
<div class="FileTileTitle NoClick">Home</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="Home" class="FileTile">
|
<div id="mobile-dekstop-close" class="FileTile">
|
||||||
<div class="FileTileIcon NoClick" style="background-image: url('./res/sys/wde/icons/trash.png');"></div>
|
<div class="FileTileIcon NoClick" style="background-image: url('./res/sys/wde/icons/trash.png');"></div>
|
||||||
<div class="FileTileTitle NoClick">Close</div>
|
<div class="FileTileTitle NoClick">Close</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user