Skip to content

Commit d949c29

Browse files
committed
fix scroll bars
1 parent e131293 commit d949c29

4 files changed

Lines changed: 54 additions & 3 deletions

File tree

src-tauri/capabilities/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"core:window:allow-minimize",
1111
"core:window:allow-toggle-maximize",
1212
"core:window:allow-close",
13-
"core:window:allow-start-dragging"
13+
"core:window:allow-start-dragging",
14+
"core:window:allow-start-resize-dragging"
1415
]
1516
}

src/app.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@
2727
padding: 0;
2828
}
2929

30-
html, body {
30+
html {
3131
height: 100%;
3232
overflow: hidden;
3333
}
3434

3535
body {
36+
height: 100%;
37+
overflow: hidden;
38+
display: flex;
39+
flex-direction: column;
3640
font-family: 'Barlow', 'Trebuchet MS', Arial, sans-serif;
3741
font-weight: 400;
3842
background: var(--bg-base);
@@ -44,7 +48,8 @@ body {
4448
}
4549

4650
#svelte {
47-
height: 100%;
51+
flex: 1;
52+
min-height: 0;
4853
overflow: hidden;
4954
display: flex;
5055
flex-direction: column;

src/lib/WindowResize.svelte

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script>
2+
import { getCurrentWindow } from '@tauri-apps/api/window';
3+
4+
const appWindow = getCurrentWindow();
5+
6+
async function startResize(direction) {
7+
await appWindow.startResizeDragging(direction);
8+
}
9+
</script>
10+
11+
<!-- Invisible resize handles around the window perimeter -->
12+
<div class="resize-n" onmousedown={() => startResize('North')}></div>
13+
<div class="resize-s" onmousedown={() => startResize('South')}></div>
14+
<div class="resize-e" onmousedown={() => startResize('East')}></div>
15+
<div class="resize-w" onmousedown={() => startResize('West')}></div>
16+
<div class="resize-nw" onmousedown={() => startResize('NorthWest')}></div>
17+
<div class="resize-ne" onmousedown={() => startResize('NorthEast')}></div>
18+
<div class="resize-sw" onmousedown={() => startResize('SouthWest')}></div>
19+
<div class="resize-se" onmousedown={() => startResize('SouthEast')}></div>
20+
21+
<style>
22+
/* All handles are fixed-position, zero-size in the non-resize axis,
23+
and sit on top of everything via z-index. */
24+
div[class^="resize-"] {
25+
position: fixed;
26+
z-index: 9999;
27+
}
28+
29+
/* Edges */
30+
.resize-n { top: 0; left: 4px; right: 4px; height: 4px; cursor: n-resize; }
31+
.resize-s { bottom: 0; left: 4px; right: 4px; height: 4px; cursor: s-resize; }
32+
.resize-e { right: 0; top: 4px; bottom: 4px; width: 4px; cursor: e-resize; }
33+
.resize-w { left: 0; top: 4px; bottom: 4px; width: 4px; cursor: w-resize; }
34+
35+
/* Corners */
36+
.resize-nw { top: 0; left: 0; width: 8px; height: 8px; cursor: nw-resize; }
37+
.resize-ne { top: 0; right: 0; width: 8px; height: 8px; cursor: ne-resize; }
38+
.resize-sw { bottom: 0; left: 0; width: 8px; height: 8px; cursor: sw-resize; }
39+
.resize-se { bottom: 0; right: 0; width: 8px; height: 8px; cursor: se-resize; }
40+
</style>

src/routes/+layout.svelte

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { getAnalyticsConsent, identifyUser } from "$lib/analytics.js";
99
import AnalyticsConsentModal from "$lib/AnalyticsConsentModal.svelte";
1010
import TitleBar from "$lib/TitleBar.svelte";
11+
import WindowResize from "$lib/WindowResize.svelte";
1112
import '../app.css';
1213
1314
let isLoading = $state(true);
@@ -137,6 +138,7 @@
137138
}
138139
</script>
139140
141+
<WindowResize />
140142
<TitleBar />
141143
142144
{#if isLoading}
@@ -348,6 +350,7 @@
348350
.app-layout {
349351
display: flex;
350352
flex: 1;
353+
min-height: 0;
351354
overflow: hidden;
352355
background: var(--bg-base);
353356
}
@@ -546,6 +549,7 @@
546549
/* ── MAIN AREA ── */
547550
.main {
548551
flex: 1;
552+
min-width: 0;
549553
display: flex;
550554
flex-direction: column;
551555
overflow: hidden;
@@ -600,6 +604,7 @@
600604
/* ── CONTENT AREA ── */
601605
.content-area {
602606
flex: 1;
607+
min-height: 0;
603608
overflow-y: auto;
604609
padding: 28px 32px;
605610
scrollbar-width: thin;

0 commit comments

Comments
 (0)