[🔨] Made default value of canResize true

This commit is contained in:
ThinLiquid 2023-10-18 16:01:16 +01:00
parent 8b9e11183d
commit b774939e23
No known key found for this signature in database
GPG key ID: D5085759953E6CAA
6 changed files with 9 additions and 11 deletions

View file

@ -30,8 +30,7 @@ export default class EditorApp implements App {
title: this.name, title: this.name,
icon, icon,
width: 500, width: 500,
height: 400, height: 400
canResize: true
}) })
if (data != null) { if (data != null) {

View file

@ -16,8 +16,7 @@ export default class FilesApp implements App {
title: this.name, title: this.name,
icon, icon,
width: 500, width: 500,
height: 400, height: 400
canResize: true
}) })
win.content.style.display = 'flex' win.content.style.display = 'flex'

View file

@ -13,8 +13,7 @@ export default class MusicApp implements App {
title: this.name, title: this.name,
icon, icon,
width: 700, width: 700,
height: 300, height: 300
canResize: true
}) })
win.content.innerHTML = 'hi' win.content.innerHTML = 'hi'

View file

@ -13,8 +13,7 @@ export default class SettingsApp implements App {
title: this.name, title: this.name,
icon, icon,
width: 700, width: 700,
height: 300, height: 300
canResize: true
}) })
win.content.style.padding = '10px' win.content.style.padding = '10px'

View file

@ -44,7 +44,7 @@ export interface FlowWindowConfig {
width?: number width?: number
height?: number height?: number
canResize: boolean canResize?: boolean
minWidth?: number minWidth?: number
minHeight?: number minHeight?: number

View file

@ -88,12 +88,14 @@ export class FlowWindow {
this.focus() this.focus()
} }
if (config.canResize === undefined) config.canResize = true
this.element.style.width = `${config.width ?? 300}px` this.element.style.width = `${config.width ?? 300}px`
this.element.style.height = `${config.height ?? 200}px` this.element.style.height = `${config.height ?? 200}px`
this.header = document.createElement('window-header') this.header = document.createElement('window-header')
this.header.innerHTML = `<img src="${config.icon}"></img> <div class="title">${config.title}</div><div style="flex:1;"></div><i id="min" class='bx bx-minus'></i><i id="close" class='bx bx-x'></i>` this.header.innerHTML = `<img src="${config.icon}"></img> <div class="title">${config.title}</div><div style="flex:1;"></div><i id="min" class='bx bx-minus'></i><i id="close" class='bx bx-x'></i>`
if (config.canResize) { if (!config.canResize) {
this.header.innerHTML = `<img src="${config.icon}"></img> <div class="title">${config.title}</div><div style="flex:1;"></div><i id="min" class='bx bx-minus'></i><i id="max" class='bx bx-checkbox'></i><i id="close" class='bx bx-x'></i>` this.header.innerHTML = `<img src="${config.icon}"></img> <div class="title">${config.title}</div><div style="flex:1;"></div><i id="min" class='bx bx-minus'></i><i id="max" class='bx bx-checkbox'></i><i id="close" class='bx bx-x'></i>`
} }
@ -103,7 +105,7 @@ export class FlowWindow {
(this.header.querySelector('#min') as HTMLElement).onclick = () => this.toggleMin() (this.header.querySelector('#min') as HTMLElement).onclick = () => this.toggleMin()
if (config.canResize) { if (!config.canResize) {
(this.header.querySelector('#max') as HTMLElement).onclick = () => this.toggleMax() (this.header.querySelector('#max') as HTMLElement).onclick = () => this.toggleMax()
} }