mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2025-04-25 17:59:34 +00:00
Resolve color picker problem
This commit is contained in:
parent
e00a5c5325
commit
e724cbe757
1 changed files with 17 additions and 14 deletions
|
@ -103,17 +103,10 @@ function PreferenceSubscreenGeneralClick() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Exits the preference screen.
|
||||
* Exits the preference screen. Block exit when the color picker is active.
|
||||
* @returns {boolean} - Returns false if the color picker is active and input is not valid
|
||||
*/
|
||||
function PreferenceSubscreenGeneralExit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up elements that are not needed anymore
|
||||
* If the selected color is invalid, the player cannot leave the screen.
|
||||
*/
|
||||
function PreferenceSubscreenGeneralUnload() {
|
||||
if (PreferenceSubscreenGeneralColorPicker) return false;
|
||||
|
||||
const color = ElementValue("InputCharacterLabelColor");
|
||||
|
@ -122,12 +115,22 @@ function PreferenceSubscreenGeneralUnload() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (color !== Player.LabelColor) {
|
||||
Player.LabelColor = color;
|
||||
const elems = /** @type {HTMLElement[]} */(Array.from(document.querySelectorAll(`[style*="--label-color"][data-sender="${Player.MemberNumber}"]`)));
|
||||
elems.forEach(e => e.style.setProperty("--label-color", color));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up elements that are not needed anymore
|
||||
* If the selected color is invalid, the player cannot leave the screen.
|
||||
*/
|
||||
function PreferenceSubscreenGeneralUnload() {
|
||||
const color = ElementValue("InputCharacterLabelColor");
|
||||
if (CommonIsColor(color)) {
|
||||
if (color !== Player.LabelColor) {
|
||||
Player.LabelColor = color;
|
||||
const elems = /** @type {HTMLElement[]} */(Array.from(document.querySelectorAll(`[style*="--label-color"][data-sender="${Player.MemberNumber}"]`)));
|
||||
elems.forEach(e => e.style.setProperty("--label-color", color));
|
||||
}
|
||||
}
|
||||
PreferenceMessage = "";
|
||||
ElementRemove("InputCharacterLabelColor");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue