Skip to content

Commit ccd846e

Browse files
committed
Fix fullscreen behavior and layout on smaller views
1 parent da401a6 commit ccd846e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/app.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,14 @@ export class NeuralNetwork extends LitElementWw {
216216
private async _onFullscreenToggle() {
217217
if (this.isFullscreen) {
218218
await this.ownerDocument.exitFullscreen();
219+
this.style.height = "500px"
220+
this.style.width = "min(100%,796px)"
219221
this.requestUpdate()
220222
} else {
221223
try {
222224
await this.requestFullscreen();
225+
this.style.height = "100%"
226+
this.style.width = "100%"
223227
this.requestUpdate()
224228
} catch (error) {
225229
console.error(msg("Failed to enter fullscreen mode."));
@@ -236,8 +240,8 @@ export class NeuralNetwork extends LitElementWw {
236240
super.firstUpdated(_changedProperties)
237241
setTimeout(() => {
238242
const dim: DOMRect = this.getBoundingClientRect()
239-
this.style.height = dim.height - 4 +"px"
240-
this.style.width = dim.width - 4 +"px"
243+
this.style.height = Math.max(dim.height - 4, 500) +"px"
244+
this.style.width = "min(100%," + (dim.width - 4) + "px)"
241245
});
242246
}
243247

@@ -503,7 +507,6 @@ export class NeuralNetwork extends LitElementWw {
503507
flex-direction: row;
504508
overflow: hidden;
505509
background-color: var(--sl-color-neutral-0);
506-
507510
}
508511
509512
#loadingPage {

0 commit comments

Comments
 (0)