Skip to content

Commit 5897b13

Browse files
authored
automaticly change the background type when user actively change the value of color or panorama in example page (#208)
1 parent 9608aba commit 5897b13

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

examples/main.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ function reloadEars(skipSkinReload = false): void {
130130

131131
function reloadPanorama(): void {
132132
const input = document.getElementById("panorama_url") as HTMLInputElement;
133+
const backgroundTypeInput = document.getElementById("background_type") as HTMLSelectElement;
133134
const url = obtainTextureUrl("panorama_url");
135+
backgroundTypeInput.value = "panorama";
134136
if (url === "") {
135137
skinViewer.background = null;
136138
input?.setCustomValidity("");
@@ -439,7 +441,10 @@ function initializeControls(): void {
439441
const backgroundColor = document.getElementById("background_color") as HTMLInputElement;
440442

441443
backgroundType?.addEventListener("change", updateBackground);
442-
backgroundColor?.addEventListener("change", updateBackground);
444+
backgroundColor?.addEventListener("change", () => {
445+
backgroundType.value = "color";
446+
updateBackground();
447+
});
443448

444449
// Set panorama as default
445450
if (backgroundType) {

0 commit comments

Comments
 (0)