This commit is contained in:
2024-04-15 00:36:56 +02:00
parent 5548d30da8
commit e06119ba8c
2 changed files with 10 additions and 6 deletions

View File

@ -107,7 +107,6 @@ export class UserAPI {
pause: () => void; pause: () => void;
stop: () => void; stop: () => void;
silence: () => void; silence: () => void;
onMouseMove: (e: MouseEvent) => void;
mouseX: () => number; mouseX: () => number;
mouseY: () => number; mouseY: () => number;
noteX: () => number; noteX: () => number;
@ -478,8 +477,15 @@ export class UserAPI {
: (this.app.selectedExample as string); : (this.app.selectedExample as string);
} }
this.patternCache.clear(); this.patternCache.clear();
this.stop(); if (this.app.isPlaying) {
this.play(); } else {
this.app.setButtonHighlighting("play", true);
this.app.isPlaying = !this.app.isPlaying;
this.app.clock.start();
this.app.api.MidiConnection.sendStartMessage();
}
// this.app.clock.start();
}; };
_stopDocExample = () => { _stopDocExample = () => {
@ -616,7 +622,6 @@ export class UserAPI {
this.cueTimes[functionName] = this.app.clock.pulses_since_origin; this.cueTimes[functionName] = this.app.clock.pulses_since_origin;
}; };
onmousemove = (e: MouseEvent) => { onmousemove = (e: MouseEvent) => {
this.app._mouseX = e.pageX; this.app._mouseX = e.pageX;
this.app._mouseY = e.pageY; this.app._mouseY = e.pageY;

View File

@ -54,8 +54,7 @@ export const makeExampleFactory = (application: Editor): Function => {
<button class="py-1 text-base px-4 hover:bg-brightmagenta bg-magenta text-selection_foreground inline-block" onclick="navigator.clipboard.writeText(app.api.codeExamples['${codeId}'])">📎 Copy</button> <button class="py-1 text-base px-4 hover:bg-brightmagenta bg-magenta text-selection_foreground inline-block" onclick="navigator.clipboard.writeText(app.api.codeExamples['${codeId}'])">📎 Copy</button>
</summary> </summary>
<pre><code class="hljs language-javascript">${code.trim()}</code></pre> <pre><code class="hljs language-javascript">${code.trim()}</code></pre>
</details> </details> `;
`;
}; };
return make_example; return make_example;
}; };