Skip to content

Commit 6c2d8b6

Browse files
committed
Fix double-clicking top bar not toggling maximize in linux
1 parent fbd2658 commit 6c2d8b6

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

frontend/src/components/window/TitleBar.svelte

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
const tooltip = getContext<TooltipState>("tooltip");
2020
2121
let menuBarLayout: Layout = [];
22+
let lastMouseDown = 0;
2223
2324
$: showFullscreenButton = $appWindow.platform === "Web" || $fullscreen.windowFullscreen || (isDesktop() && $appWindow.fullscreen);
2425
$: isFullscreen = isDesktop() ? $appWindow.fullscreen : $fullscreen.windowFullscreen;
@@ -41,7 +42,21 @@
4142
{/if}
4243
</LayoutRow>
4344
<!-- Window frame -->
44-
<LayoutRow class="window-frame" on:mousedown={() => !isFullscreen && editor.handle.appWindowDrag()} on:dblclick={() => !isFullscreen && editor.handle.appWindowMaximize()} />
45+
<LayoutRow
46+
class="window-frame"
47+
on:mousedown={() => {
48+
if (isFullscreen) return;
49+
50+
const now = Date.now();
51+
if (now - lastMouseDown < 500) {
52+
lastMouseDown = 0;
53+
editor.handle.appWindowMaximize();
54+
} else {
55+
lastMouseDown = now;
56+
editor.handle.appWindowDrag();
57+
}
58+
}}
59+
/>
4560
<!-- Window buttons -->
4661
<LayoutRow class="window-buttons" classes={{ fullscreen: showFullscreenButton, windows: $appWindow.platform === "Windows", linux: $appWindow.platform === "Linux" }}>
4762
{#if $appWindow.platform !== "Mac"}

0 commit comments

Comments
 (0)