fix the bug of `output missing` after delete-refresh-reset, gonna to polish the layout

1123
ZhangGe6 4 years ago
parent 1b1615bfa2
commit 8c24c0dcec

@ -209,6 +209,7 @@ sidebar.NodeSidebar = class {
this._addButton('Recover'); this._addButton('Recover');
this._addButton('Download'); this._addButton('Download');
this._addButton('RefreshGraph'); this._addButton('RefreshGraph');
this._addButton('Reset');
// console.log(this._host._view._graph._nodes) // console.log(this._host._view._graph._nodes)
// console.log(node) // console.log(node)
@ -342,6 +343,15 @@ sidebar.NodeSidebar = class {
this._host._view._updateGraph(); this._host._view._updateGraph();
}); });
} }
if (title === 'Reset') {
// console.log('pressed')
buttonElement.addEventListener('click', () => {
this._host._view._graph.resetGraph();
this._host._view._updateGraph();
});
}
} }
toggleInput(name) { toggleInput(name) {

@ -1026,11 +1026,11 @@ view.Graph = class extends grapher.Graph {
} }
for (const output of graph.outputs) { for (const output of graph.outputs) {
// My code // // My code
if (this._modelNodeName2State.get(output.name) == 'Deleted') { // if (this._modelNodeName2State.get(output.name) == 'Deleted') {
// console.log(this._modelNodeName2State.get(node.name)) // // console.log(this._modelNodeName2State.get(node.name))
continue; // continue;
} // }
const viewOutput = this.createOutput(output); const viewOutput = this.createOutput(output);
for (const argument of output.arguments) { for (const argument of output.arguments) {
@ -1074,6 +1074,17 @@ view.Graph = class extends grapher.Graph {
} }
} }
resetGraph() {
for (const nodeId of this.nodes.keys()) {
const node = this.node(nodeId);
console.log(node.label.modelNodeName)
this._modelNodeName2State.set(node.label.modelNodeName, 'Exist')
}
console.log(this._modelNodeName2State)
}
build(document, origin) { build(document, origin) {
for (const argument of this._arguments.values()) { for (const argument of this._arguments.values()) {

Loading…
Cancel
Save