Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 32 additions & 28 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -949,39 +949,43 @@
window.addEventListener("resize", togglePlayOnlyMode);
});

(function () {
function setAppHeight() {
const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
}

window.addEventListener('resize', setAppHeight);
document.addEventListener('fullscreenchange', setAppHeight);
setAppHeight();
})();

(function () {
function resizeCanvasesToScreen() {
const canvases = document.querySelectorAll("canvas");
const width = window.innerWidth;
const height = window.innerHeight;
</script>

canvases.forEach(c => {
c.width = width;
c.height = height;
c.style.width = "100%";
c.style.height = "100%";
});
}
<script>
// Canvas and viewport height management
(function () {
function setAppHeight() {
const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
}

window.addEventListener("resize", resizeCanvasesToScreen);
document.addEventListener("fullscreenchange", resizeCanvasesToScreen);
window.addEventListener('resize', setAppHeight);
document.addEventListener('fullscreenchange', setAppHeight);
setAppHeight();
})();

(function () {
function resizeCanvasesToScreen() {
const canvases = document.querySelectorAll("canvas");
const width = window.innerWidth;
const height = window.innerHeight;

canvases.forEach(c => {
c.width = width;
c.height = height;
c.height = height;
c.style.width = "100%";
c.style.height = "100%";
});
}

setTimeout(resizeCanvasesToScreen, 150);
})();
window.addEventListener("resize", resizeCanvasesToScreen);
document.addEventListener("fullscreenchange", resizeCanvasesToScreen);

</script>
setTimeout(resizeCanvasesToScreen, 150);
})();

</script>

</body>

Expand Down
7 changes: 7 additions & 0 deletions js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,7 @@ class Activity {
}

this.logo.runLogoCommands(null, env);
document.getElementById("stop").style.display = "inline-block";
} else {
if (currentDelay !== 0) {
// Keep playing at full speed.
Expand Down Expand Up @@ -2144,6 +2145,7 @@ class Activity {
}

this.logo.doStopTurtles();
document.getElementById("stop").style.display = "none";

const widgetTitle = document.getElementsByClassName("wftTitle");
for (let i = 0; i < widgetTitle.length; i++) {
Expand Down Expand Up @@ -7306,6 +7308,11 @@ class Activity {
* Inits everything. The main function.
*/
this.init = async () => {
// Hide stop button on startup
const stopBtn = document.getElementById("stop");
if (stopBtn) {
stopBtn.style.display = "none";
}
this._clientWidth = document.body.clientWidth;
this._clientHeight = document.body.clientHeight;
this._innerWidth = window.innerWidth;
Expand Down
9 changes: 9 additions & 0 deletions js/turtle-singer.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ class Singer {
}
});
this.activeVoices.clear();

const stopBtn = document.getElementById("stop");
if (stopBtn) {
stopBtn.style.display = "none";
}
}

// ========= Class variables ==============================================
Expand Down Expand Up @@ -2152,6 +2157,10 @@ class Singer {
}

if (notes.length > 0) {
const stopBtn = document.getElementById("stop");
if (stopBtn) {
stopBtn.style.display = "inline-block";
}
const len = notes[0].length;
if (typeof notes[0] === "number") {
tur.singer.currentOctave = frequencyToPitch(notes[0])[1];
Expand Down
Loading