Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 4f0bc3e

Browse files
fix: UX quirks in fullscreen on inactivity
1 parent 493f662 commit 4f0bc3e

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

studio/src/app/pages/editor/app-editor/app-editor.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ export class AppEditor {
244244
async inactivity($event: CustomEvent) {
245245
this.presenting = !$event.detail;
246246

247-
await this.editorEventsHandler.selectDeck();
247+
if (!this.presenting) {
248+
await this.hideToolbar();
249+
}
248250

249251
// Wait a bit for the display/repaint of the footer
250252
setTimeout(async () => {
@@ -315,6 +317,21 @@ export class AppEditor {
315317
}
316318

317319
private hideToolbar(): Promise<void> {
320+
return new Promise<void>(async (resolve) => {
321+
const toolbar: HTMLAppEditorToolbarElement = this.el.querySelector('app-editor-toolbar');
322+
323+
if (!toolbar) {
324+
resolve();
325+
return;
326+
}
327+
328+
await toolbar.hideToolbar();
329+
330+
resolve();
331+
});
332+
}
333+
334+
private onSlideChangeHideToolbar(): Promise<void> {
318335
return new Promise<void>(async (resolve) => {
319336
const toolbar: HTMLAppEditorToolbarElement = this.el.querySelector('app-editor-toolbar');
320337

@@ -367,6 +384,12 @@ export class AppEditor {
367384
return;
368385
}
369386

387+
// Need to move a bit the mouse first to detect that we want to edit, otherwise we might select the deck with a click without displaying the toolbar footer
388+
if (this.fullscreen && this.presenting) {
389+
resolve();
390+
return;
391+
}
392+
370393
const element: HTMLElement = $event.target as HTMLElement;
371394

372395
await this.touchToolbar(element);
@@ -467,9 +490,9 @@ export class AppEditor {
467490
<deckgo-deck embedded={true} style={this.style}
468491
onMouseDown={(e: MouseEvent) => this.deckTouched(e)}
469492
onTouchStart={(e: TouchEvent) => this.deckTouched(e)}
470-
onSlideNextDidChange={() => this.hideToolbar()}
471-
onSlidePrevDidChange={() => this.hideToolbar()}
472-
onSlideToChange={() => this.hideToolbar()}
493+
onSlideNextDidChange={() => this.onSlideChangeHideToolbar()}
494+
onSlidePrevDidChange={() => this.onSlideChangeHideToolbar()}
495+
onSlideToChange={() => this.onSlideChangeHideToolbar()}
473496
onMouseInactivity={($event: CustomEvent) => this.inactivity($event)}>
474497
{this.slides}
475498
{this.background}

0 commit comments

Comments
 (0)