forked from Blendman974/faceclaw
Borderless modes have different padding inside the builtin apps
Most of the builtin apps had some padding between the window edge and their content, because they expect to be displayed with a line border on their edge. We added a customization option to remove the border, so, that padding is not always necessary. Make the layouts dynamically adjust, to omit the padding when it isn't needed.
This commit is contained in:
1 parent
e158452ba4
commit
a02b849200
115 files changed
+3600
-1583
No files matched your search
@@ -25,6 +25,7 @@ import { loadSoundEnabled, saveSoundEnabled } from "../../ui/sound-setting";
|
||||
import { type MenuItem } from "../../ui/menu";
|
||||
import { WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import type { Viewport } from "../../ui/viewport";
|
||||
import {
|
||||
directionalFallback,
|
||||
GESTURE_CLICK,
|
||||
@@ -155,6 +156,13 @@ type BlocksWindow = {
|
||||
title: string;
|
||||
viewportWidth: number;
|
||||
viewportHeight: number;
|
||||
/**
|
||||
* The viewport as the shell last sent it: besides the size above, what each
|
||||
* edge touches and the padding suggested there. The window menu's layers
|
||||
* lay out by it; the game's own layout is fixed art that keeps its place
|
||||
* (see LAYOUT_HEIGHT).
|
||||
*/
|
||||
viewport: Viewport;
|
||||
foreground: boolean;
|
||||
/** Whether this window is the shell's input target (pushed with each message). */
|
||||
focused: boolean;
|
||||
@@ -207,6 +215,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
title: message.title,
|
||||
viewportWidth: message.viewport.width,
|
||||
viewportHeight: message.viewport.height,
|
||||
viewport: message.viewport,
|
||||
foreground: false,
|
||||
focused: false,
|
||||
menu: null,
|
||||
@@ -295,7 +304,8 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
if (!window) break;
|
||||
window.viewportWidth = message.viewport.width;
|
||||
window.viewportHeight = message.viewport.height;
|
||||
window.menu?.resize({ width: window.viewportWidth, height: window.viewportHeight });
|
||||
window.viewport = message.viewport;
|
||||
window.menu?.resize(message.viewport);
|
||||
window.lastSubmittedFingerprint = "";
|
||||
if (window.foreground) renderAndSubmit(window, 0);
|
||||
break;
|
||||
@@ -357,7 +367,7 @@ function windowMenu(window: BlocksWindow): WindowMenu {
|
||||
title: () => window.title,
|
||||
items: () => (window.phase === "playing" ? [] : windowMenuItems(window)),
|
||||
claimsLongPress: () => window.phase === "playing",
|
||||
size: { width: window.viewportWidth, height: window.viewportHeight },
|
||||
size: window.viewport,
|
||||
paintBase: () => paintContent(window),
|
||||
isFocused: () => window.focused,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user