fix Recover node bug

1123
ZhangGe6 4 years ago
parent 75a92c8263
commit 2be1a4b604

@ -172,10 +172,12 @@ grapher.Graph = class {
edgePathGroupDefs.appendChild(marker("arrowhead-vee-select")); edgePathGroupDefs.appendChild(marker("arrowhead-vee-select"));
// <==== 显示 边上的箭头 // <==== 显示 边上的箭头
// console.log(this._modelNodeName2State)
for (const nodeId of this.nodes.keys()) { for (const nodeId of this.nodes.keys()) {
const node = this.node(nodeId); const node = this.node(nodeId);
if (this.children(nodeId).length == 0) { if (this.children(nodeId).length == 0) {
if (this._modelNodeName2State.get(node.label.modelNodeName) == 'Exist') { if (this._modelNodeName2State.get(node.label.modelNodeName) == 'Exist') {
// console.log("build", node.label.modelNodeName)
node.label.build(document, nodeGroup); node.label.build(document, nodeGroup);
} }
} }

@ -348,7 +348,7 @@ sidebar.NodeSidebar = class {
} }
if (title === 'Recover Node') { if (title === 'Recover Node') {
buttonElement.addEventListener('click', () => { buttonElement.addEventListener('click', () => {
this._host._view._graph.reset_node(this._modelNodeName) this._host._view._graph.recover_node(this._modelNodeName)
}); });
} }
if (title === 'Enter') { if (title === 'Enter') {
@ -658,7 +658,7 @@ class NodeAttributeView {
this._element.appendChild(this._expander); this._element.appendChild(this._expander);
} }
const value = this._attribute.value; const value = this._attribute.value;
console.log(this._attribute.name, value, type) // console.log(this._attribute.name, value, type)
switch (type) { switch (type) {
case 'graph': { case 'graph': {
const line = this._host.document.createElement('div'); const line = this._host.document.createElement('div');

@ -480,6 +480,7 @@ view.View = class {
this.lastViewGraph = this._graph; this.lastViewGraph = this._graph;
// if (this.lastViewGraph) { // if (this.lastViewGraph) {
// // console.log(this.lastViewGraph._addedNode) // // console.log(this.lastViewGraph._addedNode)
// // console.log(this.lastViewGraph._modelNodeName2State)
// } // }
const graph = this.activeGraph; const graph = this.activeGraph;
// console.log(graph.nodes) // console.log(graph.nodes)
@ -1230,10 +1231,10 @@ view.Graph = class extends grapher.Graph {
this._modelNodeName2ViewNode.get(node_name).element.style.opacity = 0.3; this._modelNodeName2ViewNode.get(node_name).element.style.opacity = 0.3;
} }
reset_node(node_name) { recover_node(node_name) {
this._modelNodeName2State.set(node_name, 'Existed'); this._modelNodeName2State.set(node_name, 'Exist');
this._modelNodeName2ViewNode.get(node_name).element.style.opacity = 1; this._modelNodeName2ViewNode.get(node_name).element.style.opacity = 1;
// console.log(this._modelNodeName2State)
} }
delete_node_with_children(node_name) { delete_node_with_children(node_name) {
@ -1270,7 +1271,7 @@ view.Graph = class extends grapher.Graph {
this._modelNodeName2State.set(node.label.modelNodeName, 'Exist') this._modelNodeName2State.set(node.label.modelNodeName, 'Exist')
} }
console.log(this._renameMap) // console.log(this._renameMap)
// reset node inputs/outputs // reset node inputs/outputs
for (const changed_node_name of this._renameMap.keys()) { for (const changed_node_name of this._renameMap.keys()) {
var node = this._modelNodeName2ModelNode.get(changed_node_name) var node = this._modelNodeName2ModelNode.get(changed_node_name)

Loading…
Cancel
Save