Merge branch 'UI_test' into atree

This commit is contained in:
hppeng 2022-06-26 05:45:13 -07:00
commit 8b4fb7cb32
3 changed files with 9 additions and 2 deletions

View file

@ -406,6 +406,8 @@
</div> </div>
<div class="col text-center"> <div class="col text-center">
<div id="summary-box"></div> <div id="summary-box"></div>
<div id="err-box"></div>
<div id="stack-box"></div>
<div id="str-warnings"></div> <div id="str-warnings"></div>
<div id="dex-warnings"></div> <div id="dex-warnings"></div>
<div id="int-warnings"></div> <div id="int-warnings"></div>

View file

@ -442,6 +442,11 @@ function init() {
builder_graph_init(); builder_graph_init();
} }
window.onerror = function(message, source, lineno, colno, error) {
document.getElementById('err-box').textContent = message;
document.getElementById('stack-box').textContent = error.stack;
};
(async function() { (async function() {
let load_promises = [ load_init(), load_ing_init(), load_tome_init() ]; let load_promises = [ load_init(), load_ing_init(), load_tome_init() ];
await Promise.all(load_promises); await Promise.all(load_promises);

View file

@ -725,6 +725,7 @@ class DisplayBuildWarningsNode extends ComputeNode {
let total_assigned = 0; let total_assigned = 0;
for (let i in skp_order){ //big bren for (let i in skp_order){ //big bren
const assigned = skillpoints[i] - base_totals[i] + min_assigned[i] const assigned = skillpoints[i] - base_totals[i] + min_assigned[i]
setText(skp_order[i] + "-skp-base", "Original: " + base_totals[i]);
setText(skp_order[i] + "-skp-assign", "Assign: " + assigned); setText(skp_order[i] + "-skp-assign", "Assign: " + assigned);
setValue(skp_order[i] + "-skp", skillpoints[i]); setValue(skp_order[i] + "-skp", skillpoints[i]);
let linebreak = document.createElement("br"); let linebreak = document.createElement("br");
@ -912,7 +913,6 @@ class SkillPointSetterNode extends ComputeNode {
if (input_map.size !== 1) { throw "SkillPointSetterNode accepts exactly one input (build)"; } if (input_map.size !== 1) { throw "SkillPointSetterNode accepts exactly one input (build)"; }
const [build] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element const [build] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element
for (const [idx, elem] of skp_order.entries()) { for (const [idx, elem] of skp_order.entries()) {
setText(elem + "-skp-base", "Original: " + build.base_skillpoints[idx]);
document.getElementById(elem+'-skp').value = build.total_skillpoints[idx]; document.getElementById(elem+'-skp').value = build.total_skillpoints[idx];
} }
// NOTE: DO NOT merge these loops for performance reasons!!! // NOTE: DO NOT merge these loops for performance reasons!!!
@ -932,7 +932,7 @@ class SkillPointSetterNode extends ComputeNode {
*/ */
class SumNumberInputNode extends InputNode { class SumNumberInputNode extends InputNode {
compute_func(input_map) { compute_func(input_map) {
const value = this.input_field.value; let value = this.input_field.value;
if (value === "") { value = 0; } if (value === "") { value = 0; }
let input_num = 0; let input_num = 0;