feat(ui): add persistent 75 percent text size option
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
<a class="btn btn-outline-secondary" href="hilfe">Hilfe</a>
|
<a class="btn btn-outline-secondary" href="hilfe">Hilfe</a>
|
||||||
<label for="text-scale">Textgröße</label>
|
<label for="text-scale">Textgröße</label>
|
||||||
<select id="text-scale" @bind="fontScale" @bind:after="ApplyTextScale">
|
<select id="text-scale" @bind="fontScale" @bind:after="ApplyTextScale">
|
||||||
<option value="100">Normal</option><option value="125">Groß (125 %)</option>
|
<option value="75">Klein (75 %)</option><option value="100">Normal</option><option value="125">Groß (125 %)</option>
|
||||||
<option value="150">Sehr groß (150 %)</option><option value="200">200 %</option>
|
<option value="150">Sehr groß (150 %)</option><option value="200">200 %</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public partial class MainLayout
|
|||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
var value = await JS.InvokeAsync<int>("duempelkasReading.get");
|
var value = await JS.InvokeAsync<int>("duempelkasReading.get");
|
||||||
fontScale = value is 125 or 150 or 200 ? value : 100;
|
fontScale = value is 75 or 125 or 150 or 200 ? value : 100;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ window.duempelkasDialog = {
|
|||||||
window.duempelkasReading = {
|
window.duempelkasReading = {
|
||||||
get() { let value = 100; try { value = Number(localStorage.getItem('duempelkas-text-scale')) || 100; } catch (_) {} return this.set(value, false); },
|
get() { let value = 100; try { value = Number(localStorage.getItem('duempelkas-text-scale')) || 100; } catch (_) {} return this.set(value, false); },
|
||||||
set(value, persist = true) {
|
set(value, persist = true) {
|
||||||
const scale = [100,125,150,200].includes(Number(value)) ? Number(value) : 100;
|
const scale = [75,100,125,150,200].includes(Number(value)) ? Number(value) : 100;
|
||||||
document.documentElement.style.setProperty('--app-font-size', (16 * scale / 100) + 'px');
|
document.documentElement.style.setProperty('--app-font-size', (16 * scale / 100) + 'px');
|
||||||
if (persist) { try { localStorage.setItem('duempelkas-text-scale', String(scale)); } catch (_) {} }
|
if (persist) { try { localStorage.setItem('duempelkas-text-scale', String(scale)); } catch (_) {} }
|
||||||
return scale;
|
return scale;
|
||||||
|
|||||||
Reference in New Issue
Block a user