feat: resizable character panel and full-height sprite

- Change sprite to use full height instead of full width for better scaling
- Add draggable divider between character panel and terminal
- Persist panel width preference in config (min: 200px, max: 600px)

Closes #10
This commit is contained in:
2026-01-23 18:05:55 -08:00
committed by Naomi Carrigan
parent ad9c914fb1
commit 13c96a973a
6 changed files with 75 additions and 14 deletions
+50 -3
View File
@@ -24,6 +24,35 @@
let updateNotification: UpdateNotification;
let achievementPanelOpen = $state(false);
// Resizable panel state
let panelWidth = $state(320); // Default width in pixels
let isResizing = $state(false);
const MIN_PANEL_WIDTH = 200;
const MAX_PANEL_WIDTH = 600;
function startResize(event: MouseEvent) {
isResizing = true;
event.preventDefault();
document.addEventListener("mousemove", handleResize);
document.addEventListener("mouseup", stopResize);
}
function handleResize(event: MouseEvent) {
if (!isResizing) return;
const newWidth = event.clientX;
panelWidth = Math.max(MIN_PANEL_WIDTH, Math.min(MAX_PANEL_WIDTH, newWidth));
}
function stopResize() {
if (isResizing) {
isResizing = false;
document.removeEventListener("mousemove", handleResize);
document.removeEventListener("mouseup", stopResize);
// Save the panel width to config
configStore.updateConfig({ character_panel_width: panelWidth });
}
}
// Global keyboard shortcuts
function handleGlobalKeydown(event: KeyboardEvent) {
// Don't trigger shortcuts when typing in inputs (except for specific ones)
@@ -105,6 +134,11 @@
await window.setAlwaysOnTop(true);
}
// Load saved panel width
if (config.character_panel_width) {
panelWidth = config.character_panel_width;
}
// Initialize notification settings sync
initNotificationSync();
@@ -134,13 +168,22 @@
<main class="flex-1 flex overflow-hidden">
<!-- Left panel: Character display -->
<div
class="character-panel w-1/3 flex flex-col items-center justify-center border-r border-[var(--border-color)] bg-[var(--bg-secondary)]/50"
class="character-panel flex flex-col items-center justify-center bg-[var(--bg-secondary)]/50"
style="width: {panelWidth}px; min-width: {MIN_PANEL_WIDTH}px; max-width: {MAX_PANEL_WIDTH}px;"
>
<AnimeGirl />
</div>
<!-- Resize handle -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="resize-handle w-1 cursor-col-resize bg-[var(--border-color)] hover:bg-[var(--accent-primary)] transition-colors flex-shrink-0"
class:bg-[var(--accent-primary)]={isResizing}
onmousedown={startResize}
></div>
<!-- Right panel: Terminal and input -->
<div class="terminal-panel flex-1 flex flex-col">
<div class="terminal-panel flex-1 flex flex-col min-w-0">
<Terminal />
<InputBar />
</div>
@@ -169,7 +212,11 @@
}
.character-panel {
min-width: 320px;
background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}
.resize-handle:hover,
.resize-handle:active {
width: 4px;
}
</style>