Added adjustable font size

This commit is contained in:
ebolam
2022-09-23 11:12:09 -04:00
parent b2082a509a
commit 4285e153e4
2 changed files with 37 additions and 0 deletions

View File

@@ -109,6 +109,7 @@ map2.set(5, 'Temperature')
map2.set(6, 'Repetition Penalty')
var calc_token_usage_timeout;
var game_text_scroll_timeout;
var font_size_cookie_timout;
var var_processing_time = 0;
var finder_last_input;
//-----------------------------------Server to UI Functions-----------------------------------------------
@@ -2303,6 +2304,14 @@ function save_preset() {
}
//--------------------------------------------General UI Functions------------------------------------
function set_font_size(element) {
new_font_size = element.value;
var r = document.querySelector(':root');
r.style.setProperty("--game_screen_font_size_adjustment", new_font_size);
clearTimeout(font_size_cookie_timout);
font_size_cookie_timout = setTimeout(function() {setCookie("font_size", new_font_size)}, 2000);
}
function push_selection_to_memory() {
document.getElementById("memory").value += "\n" + getSelectionText();
document.getElementById("memory").onchange();
@@ -4175,6 +4184,14 @@ function process_cookies() {
Change_Theme(getCookie("theme", "Monochrome"));
//set font size
new_font_size = getCookie("font_size", 1);
var r = document.querySelector(':root');
r.style.setProperty("--game_screen_font_size_adjustment", new_font_size);
document.getElementById('font_size_cur').value = new_font_size;
document.getElementById('font_size').value = new_font_size;
load_tweaks();
}

View File

@@ -275,6 +275,26 @@
<span class="setting_minlabel"><span style="top: -4px; position: relative;"></span></span>
<span class="setting_maxlabel"><span style="top: -4px; position: relative;"></span></span>
</div>
<div class="setting_container">
<!---Top Row---->
<span class="setting_label">
<span>Font Size:&nbsp;</span><span class="helpicon material-icons-outlined" title="Change the font size of the game text">help_icon</span>
</span>
<input autocomplete="off" class="setting_value" id="font_size_cur"
value="1" item_id="font_size"
inputmode="decimal"
onchange="document.getElementById(this.getAttribute('item_id')).value = this.value; set_font_size(this)">
<!---Bottom Row---->
<span class="setting_item">
<input type="range" min="0.1" max="2" step="0.05"
value="1" id="font_size" class="setting_item_input "
oninput="document.getElementById(this.id+'_cur').value = this.value;set_font_size(this);"
onclick="">
</span>
<!---Slider Labels--->
<span class="setting_minlabel"><span style="position: relative;">0.1</span></span>
<span class="setting_maxlabel"><span style="position: relative;">2</span></span>
</div>
</div>
<div class="collapsable_header" onclick="toggle_setting_category(this);">
<h4 style="width:var(--flyout_menu_width);"><span class="material-icons-outlined cursor">expand_more</span> Images</h4>