implement new file
This commit is contained in:
parent
d91b77015f
commit
8515e21ea9
19
index.html
19
index.html
|
|
@ -9,9 +9,9 @@
|
|||
<body>
|
||||
<nav id="top-menu" class="menu-bar">
|
||||
<div data-section="File" data-alt="f">
|
||||
<button data-alt="n" data-button="file:new">New</button>
|
||||
<button data-alt="o" data-button="file:load">Open</button>
|
||||
<button data-alt="s" data-button="file:save">Save</button>
|
||||
<button data-alt="n" data-button="file:new" disabled data-enable-on="config:end">New</button>
|
||||
<button data-alt="o" data-button="file:load" disabled data-enable-on="config:end">Open</button>
|
||||
<button data-alt="s" data-button="file:save" disabled data-enable-on="config:end">Save</button>
|
||||
<div data-section="Configuiration" data-alt="c">
|
||||
<button data-alt="d" data-button="load-configuration" data-configuration="default">Default</button>
|
||||
<button data-alt="e" data-button="load-configuration" data-configuration="e2ee">E2EE</button>
|
||||
|
|
@ -57,10 +57,17 @@
|
|||
<span data-resize="bottom-menu"></span>
|
||||
</aside>
|
||||
<main>
|
||||
<div data-state="initialization">
|
||||
<div data-state="initialization" class="m2">
|
||||
Select configuration file:
|
||||
<button data-button="load-configuration" data-configuration="default">Default (2026-07-06)</button>
|
||||
<input type="file" data-input="configuration" accept=".ncpf.json" />
|
||||
<div class="m1">
|
||||
<button data-button="load-configuration" data-configuration="default">Default</button>
|
||||
</div>
|
||||
<div class="m1">
|
||||
<button data-button="load-configuration" data-configuration="e2ee">E2EE</button>
|
||||
</div>
|
||||
<div class="m1">
|
||||
<button data-button="load-configuration">Select file...</button>
|
||||
</div>
|
||||
</div>
|
||||
<div data-state="planning">
|
||||
<header class="status-bar">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { awaitEvent, emitEvent, listenTo } from "./events.js";
|
||||
import { checkEquivalence, findFullEntry, stripEntryToMinimums } from "./ncpf-utils.js";
|
||||
import {
|
||||
clearPlanner,
|
||||
getPlannerDom,
|
||||
getPlannerMultiblockSize,
|
||||
getPlannerMultiblockType,
|
||||
|
|
@ -14,7 +15,10 @@ import { DevError, UserError } from "./errors.js";
|
|||
|
||||
registerLoadCallback(() => {
|
||||
listenTo("file:load", () => showOpenFileDialog(({ data, filename }) => loadFile(data, filename)));
|
||||
listenTo("file:new", () => {});
|
||||
listenTo("file:new", () => {
|
||||
clearPlanner();
|
||||
resetSolver();
|
||||
});
|
||||
listenTo("file:save", () => saveFile());
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,12 @@ window.addEventListener("load", () => {
|
|||
emitEvent(elem.dataset.form + ":submit", e);
|
||||
});
|
||||
});
|
||||
getElements("enable-on", "*").forEach(elem => {
|
||||
elem.disabled = true;
|
||||
awaitEvent(elem.dataset.enableOn).then(() => {
|
||||
elem.disabled = false;
|
||||
});
|
||||
});
|
||||
|
||||
listenTo("config:end", () => setState(STATE.planning));
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,15 @@ const zoomOptions = [ 0.5, 1, 2, 3, 4, 5 ];
|
|||
const zoomDefault = 2;
|
||||
const zoomStorageKey = "zoom-size";
|
||||
|
||||
const defaultMultiblockSize = [9, 7, 9]; // width (screen x), height (xy grids), depth (screen y)
|
||||
const defaultMultiblockType = "nuclearcraft:overhaul_sfr";
|
||||
const maxMultiblockSize = {
|
||||
["nuclearcraft:overhaul_sfr"]: [26, 26, 26],
|
||||
}
|
||||
|
||||
let suppressHover = false;
|
||||
let multiblockSize = [9, 7, 9]; // width (screen x), height (xy grids), depth (screen y)
|
||||
let multiblockType = "nuclearcraft:overhaul_sfr";
|
||||
let multiblockSize = [...defaultMultiblockSize];
|
||||
let multiblockType = defaultMultiblockType;
|
||||
|
||||
registerLoadCallback(() => {
|
||||
listenTo("config:end", buildPlanner);
|
||||
|
|
@ -257,9 +263,9 @@ export function getSelectedCells() {
|
|||
return [...document.querySelectorAll("#planner [data-selected]")];
|
||||
}
|
||||
|
||||
export function clearPlanner(size, type) {
|
||||
multiblockSize = size;
|
||||
multiblockType = type;
|
||||
export function clearPlanner(size = null, type = null) {
|
||||
multiblockSize = size ?? [...defaultMultiblockSize];
|
||||
multiblockType = type ?? defaultMultiblockType;
|
||||
buildPlanner();
|
||||
}
|
||||
export function loadPlanner(size, type, textures) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue