Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
add window resizing (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
black-backdoor authored Jan 12, 2025
1 parent 04825e4 commit 5c160f0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/components/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ class AppWindow extends HTMLElement {
}
:host {
display: flex;
flex-direction: column;
position: absolute;
min-width: 200px;
min-height: 120px;
display: flex;
flex-direction: column;
resize: both;
overflow: hidden;
border: 1px var(--color-border) solid;
border-radius: 8px 8px 0 0;
}
Expand Down Expand Up @@ -133,8 +135,10 @@ class AppWindow extends HTMLElement {
:host(.fullscreen) {
top: 0px !important;
left: 0px !important;
width: 100% !important;
height: calc(100vh - var(--taskbar-height)) !important;
width: 100vw !important;
/* height: 100vh - 50px (taskbar height) */
height: calc(100vh - 50px) !important;
border-radius: 0;
z-index: 3900;
}
Expand Down Expand Up @@ -332,7 +336,7 @@ function handleWindowDrag(windowElement) {
if(x < 0) x = 0; // don't let the window go outside the left edge of the screen
if(y < 0) y = 0; // don't let the window go outside the top edge of the screen

if(y > (desktop.offsetHeight - 50)) y = desktop.offsetHeight - 50; // don't let the window go outside the bottom edge of the screen
if(y > (desktop.offsetHeight - 100)) y = desktop.offsetHeight - 100; // don't let the window go outside the bottom edge of the screen
if(x > (desktop.offsetWidth - 100)) x = desktop.offsetWidth - 100; // don't let the window go outside the right edge of the screen

windowElement.style.left = x + 'px';
Expand Down
3 changes: 2 additions & 1 deletion src/css/taskbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
bottom: 0;
width: 100vw;
height: 55px;
padding: 8px;
padding: 8px;
z-index: 5000;
}


Expand Down
9 changes: 7 additions & 2 deletions src/css/window-defaults.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ body.window-dragging iframe {

/* WEBSITE */
app-window.website {
width: 600px;
height: 400px;
--color-background--body: var(--color-background--head);
}

@media screen and (min-width: 600px) {
app-window.website {
width: 600px;
height: 400px;
}
}

app-window.website iframe {
Expand Down
2 changes: 1 addition & 1 deletion src/js/state/menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import state from '/modules/state.js';

(() => {
const update = () => {
const configShow = state.get('menubar', true);
const configShow = state.get('menubar', false);
const configFloating = state.get('menubar.floating', true);

const menubar = document.querySelector('.menubar');
Expand Down

0 comments on commit 5c160f0

Please sign in to comment.