diff --git a/src/app.ts b/src/app.ts index 33b8bd1..79c0749 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1742,8 +1742,12 @@ export class App implements AppContext { }, }); this.tutorial = tutorial; - moreItem("m-tutorial", () => void tutorial.start()); - this.startTutorial = () => void tutorial.start(); + moreItem("m-tutorial", () => this.startTutorial()); + this.startTutorial = () => { + // (The question whether to start it, should it be up: answered.) + document.querySelector(".dialog.tutorial-ask")?.closest(".dialog-back")?.remove(); + void tutorial.start(); + }; // About: the README, in the app. Support links open in a new tab (no access back to this page). moreItem("m-about", () => showAbout()); // Feedback: a bug report, suggestion or discussion, posted on r/supergeometry (Reddit's page, in a new tab). @@ -2090,6 +2094,10 @@ export class App implements AppContext { this.tutorialAsked(); // (After what closing the window started - a new project, a file being opened - has had its turn.) setTimeout(() => { + // (The welcome window was closed by its own Tutorial button: the tutorial is running, there is nothing to + // ask - the question came up over it, where the tutorial lets nothing be tapped but its lit spot. Reported: + // "now i cant do the tutorial on PC. i cant click draw", in a private window - a first visit.) + if (this.tutorial?.running) return; const back = el("div", "dialog-back"); const box = el("div", "dialog tutorial-ask"); box.append(el("div", "panel-title", "New here?"), el("div", "tutorial-ask-text", "The tutorial builds a bolt and the nut that fits it with you, one tap at a time. It takes a few minutes.")); diff --git a/src/ui/tutorial.ts b/src/ui/tutorial.ts index e3ef5fc..4422450 100644 --- a/src/ui/tutorial.ts +++ b/src/ui/tutorial.ts @@ -205,14 +205,21 @@ export class Tutorial { if (e.type !== "pointermove" && e.cancelable) e.preventDefault(); }; + /** Running, or on its way (its new project being opened). */ get running(): boolean { - return this.on; + return this.on || this.starting; } + private starting = false; /** Begin: a new project (what is open is saved and stays in the list of projects), and the first thing to tap. */ async start(): Promise { - if (this.on) return; - await this.host.newProject(); + if (this.on || this.starting) return; + this.starting = true; + try { + await this.host.newProject(); + } finally { + this.starting = false; + } this.host.setUp(); this.host.closePanels(); // The same bolt on every screen: the view as near as makes its rod's 5 mm radius 52 px - a spot a finger