fix os logic
This commit is contained in:
@@ -7,6 +7,9 @@ const isMobile = (
|
||||
|
||||
let topZ = 100;
|
||||
const MAX_PADDING = { left: 8, top: 8, right: 8, bottom: 60 };
|
||||
const maximizeIcon = '▢';
|
||||
const restoreIcon = '🗗';
|
||||
|
||||
const startBtn = document.getElementById('start-btn');
|
||||
const startMenu = document.getElementById('start-menu');
|
||||
const windowsContainer = document.getElementById('windows');
|
||||
@@ -341,7 +344,7 @@ function handleWindowAction(payload) {
|
||||
win.dataset.state = 'normal';
|
||||
|
||||
bringToFront(win);
|
||||
|
||||
|
||||
btn.classList.add('focus');
|
||||
btn.classList.remove('minimized');
|
||||
|
||||
@@ -378,7 +381,6 @@ function applyMaximized(win) {
|
||||
|
||||
win.classList.add('max');
|
||||
win.dataset.state = 'maximized';
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -574,7 +576,7 @@ function wireWindowControls(win, taskbarBtn = null) {
|
||||
maximize.addEventListener('click', (evt) => {
|
||||
if(taskbarBtn != null) {
|
||||
taskbarBtn.classList.add('focus');
|
||||
maximize.innerHTML = win.dataset.state === 'normal' ? '🗗' : '▢';
|
||||
maximize.innerHTML = win.dataset.state === 'normal' ? restoreIcon : maximizeIcon;
|
||||
resetFocus(win.dataset.winid);
|
||||
}
|
||||
toggleMaximize();
|
||||
@@ -601,7 +603,7 @@ function wireWindowControls(win, taskbarBtn = null) {
|
||||
if (taskbarBtn !== null) {
|
||||
titlebar.addEventListener('dblclick', (evt) => {
|
||||
toggleMaximize();
|
||||
titlebar.querySelector('.maximize').innerHTML = win.dataset.state === 'maximized' ? '🗗' : '▢';
|
||||
titlebar.querySelector('.maximize').innerHTML = win.dataset.state === 'maximized' ? restoreIcon : maximizeIcon;
|
||||
saveOpenWindows()
|
||||
});
|
||||
}
|
||||
@@ -612,7 +614,7 @@ function wireWindowControls(win, taskbarBtn = null) {
|
||||
const delta = current - lastTap;
|
||||
if (delta < 300 && delta > 0) {
|
||||
// Double tap → maximize / restore
|
||||
titlebar.querySelector('.maximize').innerHTML = win.dataset.state === 'maximized' ? '🗗' : '▢';
|
||||
titlebar.querySelector('.maximize').innerHTML = win.dataset.state === 'maximized' ? restoreIcon : maximizeIcon;
|
||||
toggleMaximize();
|
||||
}
|
||||
lastTap = current;
|
||||
@@ -913,7 +915,7 @@ function makeDraggableWithSnap(win) {
|
||||
win.style.height = height + 'px';
|
||||
|
||||
win.classList.remove('max');
|
||||
win.querySelector('.maximize').innerHTML = '▢';
|
||||
win.querySelector('.maximize').innerHTML = maximizeIcon;
|
||||
|
||||
win.dataset.state = 'normal';
|
||||
win.dataset.snapped = '';
|
||||
@@ -930,15 +932,14 @@ function bringToFront(win) {
|
||||
if(tb) {
|
||||
tb.classList.add('focus');
|
||||
resetFocus(win.dataset.winid);
|
||||
|
||||
saveOpenWindows(); // <-- HIER
|
||||
saveOpenWindows();
|
||||
}
|
||||
const currentZ = parseInt(win.style.zIndex || 0);
|
||||
// Nur nach vorne holen, wenn nicht bereits ganz oben
|
||||
if (currentZ < topZ) {
|
||||
topZ += 1;
|
||||
win.style.zIndex = topZ;
|
||||
}
|
||||
saveOpenWindows();
|
||||
}
|
||||
|
||||
function resetFocus(exceptID) {
|
||||
@@ -975,6 +976,7 @@ function restoreWindow(win, payload, taskbarBtn = null) {
|
||||
}
|
||||
} else {
|
||||
win.style.display = 'flex';
|
||||
win.querySelector('.maximize').innerHTML = win.dataset.state === 'maximized' ? restoreIcon : maximizeIcon;
|
||||
}
|
||||
|
||||
if (state === 'maximized') {
|
||||
|
||||
Reference in New Issue
Block a user