resolve PR comments
This commit is contained in:
parent
89f699df74
commit
f78d911c1e
1 changed files with 6 additions and 23 deletions
29
js/atree.js
29
js/atree.js
|
@ -987,8 +987,6 @@ function render_AT(UI_elem, list_elem, tree) {
|
||||||
let icon = ability.display.icon;
|
let icon = ability.display.icon;
|
||||||
if (icon === undefined) {
|
if (icon === undefined) {
|
||||||
icon = "node";
|
icon = "node";
|
||||||
} else if (icon == "node_4") {
|
|
||||||
icon = "node_warrior" // temp fix
|
|
||||||
}
|
}
|
||||||
let node_img = document.createElement('img');
|
let node_img = document.createElement('img');
|
||||||
node_img.src = '../media/atree/'+icon+'.png';
|
node_img.src = '../media/atree/'+icon+'.png';
|
||||||
|
@ -1111,17 +1109,17 @@ function atree_render_connection(atree_connectors_map) {
|
||||||
|
|
||||||
// toggle the state of a node.
|
// toggle the state of a node.
|
||||||
function atree_set_state(node_wrapper, new_state) {
|
function atree_set_state(node_wrapper, new_state) {
|
||||||
console.log(node_wrapper.elem.children[0])
|
let icon = node_wrapper.ability.display.icon;
|
||||||
|
if (icon === undefined) {
|
||||||
|
icon = "node";
|
||||||
|
}
|
||||||
if (new_state) {
|
if (new_state) {
|
||||||
console.log("on")
|
|
||||||
node_wrapper.active = true;
|
node_wrapper.active = true;
|
||||||
node_wrapper.elem.children[0].src = node_wrapper.elem.children[0].src.substring(0, node_wrapper.elem.children[0].src.length - 4) + "_selected.png";
|
node_wrapper.elem.children[0].src = "../media/atree/" + icon + "_selected.png";
|
||||||
console.log(node_wrapper.elem.children[0].src)
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("off")
|
|
||||||
node_wrapper.active = false;
|
node_wrapper.active = false;
|
||||||
node_wrapper.elem.children[0].src = node_wrapper.elem.children[0].src.substring(0, node_wrapper.elem.children[0].src.length - 13) + ".png";
|
node_wrapper.elem.children[0].src = "../media/atree/" + icon + ".png";
|
||||||
}
|
}
|
||||||
let atree_connectors_map = node_wrapper.all_connectors_ref;
|
let atree_connectors_map = node_wrapper.all_connectors_ref;
|
||||||
for (const parent of node_wrapper.parents) {
|
for (const parent of node_wrapper.parents) {
|
||||||
|
@ -1136,21 +1134,6 @@ function atree_set_state(node_wrapper, new_state) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// refresh all connector to default state, then try to calculate the connector for all node
|
|
||||||
function atree_update_connector() {
|
|
||||||
atree_connectors_map.forEach((v) => {
|
|
||||||
if (v.length != 0) {
|
|
||||||
let connector_elem = document.createElement("img");
|
|
||||||
connector_elem.style = "width: 100%; height: 100%;";
|
|
||||||
connector_elem.src = '../media/atree/connect_' + v[0].type + '.png'
|
|
||||||
v[0].replaceChildren(connector_elem);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
atree_map.forEach((v) => {
|
|
||||||
atree_compute_highlight(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function atree_set_edge(atree_connectors_map, parent, child, state) {
|
function atree_set_edge(atree_connectors_map, parent, child, state) {
|
||||||
const connectors = child.connectors.get(parent);
|
const connectors = child.connectors.get(parent);
|
||||||
const parent_row = parent.ability.display.row;
|
const parent_row = parent.ability.display.row;
|
||||||
|
|
Loading…
Reference in a new issue