mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 10:01:23 +01:00
options available through button again
This commit is contained in:
parent
70e77714b9
commit
f75327772f
3 changed files with 12 additions and 8 deletions
|
|
@ -8,7 +8,6 @@ import {defineSvg} from "./modules/define-svg";
|
|||
import {clearLegend} from "./modules/legend";
|
||||
// @ts-expect-error js-module
|
||||
import {Rulers} from "./modules/measurers";
|
||||
// @ts-expect-error js-module
|
||||
import {applyStoredOptions} from "./modules/ui/options";
|
||||
import {addGlobalListeners} from "./scripts/listeners";
|
||||
import {checkForUpdates} from "./scripts/updater";
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ if (stored("disable_click_arrow_tooltip")) {
|
|||
}
|
||||
|
||||
// Show options pane on trigger click
|
||||
function showOptions(event: MouseEvent) {
|
||||
export function showOptions(event: MouseEvent) {
|
||||
if (!stored("disable_click_arrow_tooltip")) {
|
||||
clearMainTip();
|
||||
localStorage.setItem("disable_click_arrow_tooltip", "true");
|
||||
|
|
@ -563,8 +563,8 @@ function changeZoomExtent(value: string) {
|
|||
if (Number(zoomExtentMin.value) > Number(zoomExtentMax.value)) {
|
||||
[zoomExtentMin.value, zoomExtentMax.value] = [zoomExtentMax.value, zoomExtentMin.value];
|
||||
}
|
||||
const min = Math.max(Number(zoomExtentMin.value, 0.01);
|
||||
const max = Math.min(Number(zoomExtentMax.value, 200);
|
||||
const min = Math.max(Number(zoomExtentMin.value), 0.01);
|
||||
const max = Math.min(Number(zoomExtentMax.value), 200);
|
||||
zoomExtentMin.value = min.toString();
|
||||
zoomExtentMax.value = max.toString();
|
||||
const scale = minmax(Number(value), 0.01, 200);
|
||||
|
|
@ -609,7 +609,7 @@ export function applyStoredOptions() {
|
|||
.getItem("winds")!
|
||||
.split(",")
|
||||
.map(w => Number(w));
|
||||
if (stored("military") options.military = JSON.parse(stored("military")!); // MARKER: !
|
||||
if (stored("military")) options.military = JSON.parse(stored("military")!); // MARKER: !
|
||||
|
||||
if (stored("tooltipSize")) changeTooltipSize(stored("tooltipSize")!);
|
||||
if (stored("regions")) changeStatesNumber(stored("regions")!);
|
||||
|
|
@ -633,7 +633,7 @@ export function applyStoredOptions() {
|
|||
changeDialogsTheme(themeColor, transparency);
|
||||
|
||||
setRendering(shapeRendering.value);
|
||||
options.stateLabelsMode = stateLabelsModeInput.value;
|
||||
options.stateLabelsMode = stateLabelsModeInput.value as "auto" | "short" | "full"; // MARKER: as conversion
|
||||
}
|
||||
|
||||
// randomize options if randomization is allowed (not locked or options='default')
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ import {addOnLoadListener} from "./loading";
|
|||
import {assignLockBehavior} from "./options/lock";
|
||||
import {addTooptipListers} from "./tooltips";
|
||||
import {assignSpeakerBehavior} from "./speaker";
|
||||
// @ts-ignore
|
||||
import {addResizeListener} from "modules/ui/options";
|
||||
import {addResizeListener, hideOptions, showOptions} from "modules/ui/options";
|
||||
// @ts-ignore
|
||||
import {addDragToUpload} from "modules/io/load";
|
||||
import {addHotkeyListeners} from "scripts/hotkeys";
|
||||
|
|
@ -25,6 +24,7 @@ export function addGlobalListeners() {
|
|||
assignSpeakerBehavior();
|
||||
addDragToUpload();
|
||||
addFindAll();
|
||||
addOptionsListeners();
|
||||
}
|
||||
|
||||
function registerServiceWorker() {
|
||||
|
|
@ -54,3 +54,8 @@ function addInstallationPrompt() {
|
|||
function addBeforeunloadListener() {
|
||||
window.onbeforeunload = () => "Are you sure you want to navigate away?";
|
||||
}
|
||||
|
||||
function addOptionsListeners() {
|
||||
document.querySelector<HTMLButtonElement>("#optionsTrigger")!.on("click", (evt) => showOptions(evt as MouseEvent));
|
||||
document.querySelector<HTMLButtonElement>("#optionsHide")!.on("click", (evt) => hideOptions(evt as MouseEvent));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue