Add "Include the Godot logo?" checkbox

This commit is contained in:
Adam Scott
2025-04-29 15:15:28 -04:00
parent d47cff7123
commit ce1ed06fa5
2 changed files with 15 additions and 1 deletions

View File

@@ -40,6 +40,11 @@
<h3>Fine tuning</h3>
<div class="toolbar-item toolbar-item--oneline">
<label for="include-godot-logo">Include the Godot logo?</label>
<input type="checkbox" id="include-godot-logo" checked="true">
</div>
<div class="toolbar-item toolbar-item--oneline">
<label for="clear-color">Clear color</label>
<input type="color" id="clear-color" value="#000000" />

View File

@@ -31,6 +31,7 @@ class PreviewGenerator {
* @type Image
*/
this.godotLogo = null;
this.includeGodotLogo = true;
// State parameters.
@@ -134,6 +135,11 @@ class PreviewGenerator {
this._debounceUpdateAndRender();
});
const includeGodotLogo_input = document.getElementById("include-godot-logo");
includeGodotLogo_input.addEventListener("input", () => {
this._debounceUpdateAndRender();
});
const clearColor_input = document.getElementById("clear-color");
clearColor_input.addEventListener("input", () => {
this._debounceUpdateAndRender();
@@ -345,7 +351,7 @@ class PreviewGenerator {
this.ctx.fillRect(paddingSize, this.previewHeight - breaklineOffset - breaklineHeight, breaklineWidth, breaklineHeight);
// Render the Godot logo.
if (this.godotLogo) {
if (this.godotLogo && this.includeGodotLogo) {
const logoWidth = 0.36 * this.previewWidth;
const logoHeight = this.godotLogo.height * (logoWidth / this.godotLogo.width);
@@ -377,6 +383,9 @@ class PreviewGenerator {
this._updateFilename();
const includeGodotLogo_input = document.getElementById("include-godot-logo");
this.includeGodotLogo = includeGodotLogo_input.checked;
const clearColor_input = document.getElementById("clear-color");
this.clearColor = clearColor_input.value;