From b774939e238e5c4fea227cead45b132a6adf3417 Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Wed, 18 Oct 2023 16:01:16 +0100 Subject: [PATCH] =?UTF-8?q?[=F0=9F=94=A8]=20Made=20default=20value=20of=20?= =?UTF-8?q?canResize=20true?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/editor.ts | 3 +-- src/apps/files.ts | 3 +-- src/apps/music.ts | 3 +-- src/apps/settings.ts | 3 +-- src/types.ts | 2 +- src/wm.ts | 6 ++++-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/apps/editor.ts b/src/apps/editor.ts index eacf3bc..f3643f4 100644 --- a/src/apps/editor.ts +++ b/src/apps/editor.ts @@ -30,8 +30,7 @@ export default class EditorApp implements App { title: this.name, icon, width: 500, - height: 400, - canResize: true + height: 400 }) if (data != null) { diff --git a/src/apps/files.ts b/src/apps/files.ts index 48cc13d..6ddaa50 100644 --- a/src/apps/files.ts +++ b/src/apps/files.ts @@ -16,8 +16,7 @@ export default class FilesApp implements App { title: this.name, icon, width: 500, - height: 400, - canResize: true + height: 400 }) win.content.style.display = 'flex' diff --git a/src/apps/music.ts b/src/apps/music.ts index f31ad2b..acc1d89 100644 --- a/src/apps/music.ts +++ b/src/apps/music.ts @@ -13,8 +13,7 @@ export default class MusicApp implements App { title: this.name, icon, width: 700, - height: 300, - canResize: true + height: 300 }) win.content.innerHTML = 'hi' diff --git a/src/apps/settings.ts b/src/apps/settings.ts index 3354c83..04567db 100644 --- a/src/apps/settings.ts +++ b/src/apps/settings.ts @@ -13,8 +13,7 @@ export default class SettingsApp implements App { title: this.name, icon, width: 700, - height: 300, - canResize: true + height: 300 }) win.content.style.padding = '10px' diff --git a/src/types.ts b/src/types.ts index 93f499c..360d0a7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -44,7 +44,7 @@ export interface FlowWindowConfig { width?: number height?: number - canResize: boolean + canResize?: boolean minWidth?: number minHeight?: number diff --git a/src/wm.ts b/src/wm.ts index 189e1cb..4119596 100644 --- a/src/wm.ts +++ b/src/wm.ts @@ -88,12 +88,14 @@ export class FlowWindow { this.focus() } + if (config.canResize === undefined) config.canResize = true + this.element.style.width = `${config.width ?? 300}px` this.element.style.height = `${config.height ?? 200}px` this.header = document.createElement('window-header') this.header.innerHTML = `
${config.title}
` - if (config.canResize) { + if (!config.canResize) { this.header.innerHTML = `
${config.title}
` } @@ -103,7 +105,7 @@ export class FlowWindow { (this.header.querySelector('#min') as HTMLElement).onclick = () => this.toggleMin() - if (config.canResize) { + if (!config.canResize) { (this.header.querySelector('#max') as HTMLElement).onclick = () => this.toggleMax() }