Skip to content

Commit da20386

Browse files
author
hikki
committed
v3.2
1 parent affd866 commit da20386

File tree

1 file changed

+40
-38
lines changed

1 file changed

+40
-38
lines changed

resources/assets/component.js

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,51 +1804,53 @@ window.ComponentCascadeLine = class {
18041804
object.submit_block = false;
18051805
});
18061806
}));*/
1807-
object.nodeMigrateExec(event,node,node_data,aim_node,aim_node_data);
1807+
if(event === 'exchange')object.nodeExchangeExec(node,node_data,aim_node,aim_node_data);
1808+
if(event === 'migrate')object.nodeMigrateExec(node,node_data,aim_node,aim_node_data);
18081809
this.PLANE_BODY.append(M);
18091810
}
18101811

1811-
nodeMigrateExec(event,node,node_data,aim_node,aim_node_data){
1812-
if(event === 'exchange'){
1813-
/*node*/
1814-
let tmp_key = node_data.key;
1815-
let tmp_val = node_data.val;
1816-
node_data.key = aim_node_data.key;
1817-
node_data.val = aim_node_data.val;
1818-
let index = node_data.nodes.indexOf(aim_node_data.key);
1819-
if(index !== -1) node_data.nodes.splice(index,1,tmp_key);
1820-
/*node parent*/
1821-
let parentNode = node_data.parentNodes.slice(0).pop();
1822-
if(parentNode !== undefined){
1823-
for (let index in this.dimensional_data[node_data.stack - 1]){
1824-
if(!this.dimensional_data[node_data.stack - 1].hasOwnProperty(index))continue;
1825-
let d = this.dimensional_data[node_data.stack - 1][index];
1826-
if(d.key === parentNode){
1827-
d.nodes.splice(d.nodes.indexOf(tmp_key),1,aim_node_data.key);
1828-
break;
1829-
}
1830-
}
1831-
}
1832-
/*aim node*/
1833-
aim_node_data.key = tmp_key;
1834-
aim_node_data.val = tmp_val;
1835-
let aimParentNode = aim_node_data.parentNodes.slice(0).pop();
1836-
for (let index in this.dimensional_data[aim_node_data.stack - 1]){
1837-
if(!this.dimensional_data[aim_node_data.stack - 1].hasOwnProperty(index))continue;
1838-
let d = this.dimensional_data[aim_node_data.stack - 1][index];
1839-
if(d.key === aimParentNode){
1840-
d.nodes.splice(d.nodes.indexOf(node_data.key),1,aim_node_data.key);
1812+
nodeMigrateExec(node,node_data,aim_node,aim_node_data){
1813+
1814+
}
1815+
1816+
nodeExchangeExec(node,node_data,aim_node,aim_node_data){
1817+
/*node*/
1818+
let tmp_key = node_data.key;
1819+
let tmp_val = node_data.val;
1820+
node_data.key = aim_node_data.key;
1821+
node_data.val = aim_node_data.val;
1822+
let index = node_data.nodes.indexOf(aim_node_data.key);
1823+
if(index !== -1) node_data.nodes.splice(index,1,tmp_key);
1824+
/*node parent*/
1825+
let parentNode = node_data.parentNodes.slice(0).pop();
1826+
if(parentNode !== undefined){
1827+
for (let index in this.dimensional_data[node_data.stack - 1]){
1828+
if(!this.dimensional_data[node_data.stack - 1].hasOwnProperty(index))continue;
1829+
let d = this.dimensional_data[node_data.stack - 1][index];
1830+
if(d.key === parentNode){
1831+
d.nodes.splice(d.nodes.indexOf(tmp_key),1,aim_node_data.key);
18411832
break;
18421833
}
18431834
}
1844-
this.resetChildrenParent(node_data);
1845-
1846-
node.querySelector('span').textContent = node_data.val;
1847-
node.setAttribute('data-id',node_data.key);
1848-
aim_node.querySelector('span').textContent = aim_node_data.val;
1849-
aim_node.setAttribute('data-id',aim_node_data.key);
1850-
return;
18511835
}
1836+
/*aim node*/
1837+
aim_node_data.key = tmp_key;
1838+
aim_node_data.val = tmp_val;
1839+
let aimParentNode = aim_node_data.parentNodes.slice(0).pop();
1840+
for (let index in this.dimensional_data[aim_node_data.stack - 1]){
1841+
if(!this.dimensional_data[aim_node_data.stack - 1].hasOwnProperty(index))continue;
1842+
let d = this.dimensional_data[aim_node_data.stack - 1][index];
1843+
if(d.key === aimParentNode){
1844+
d.nodes.splice(d.nodes.indexOf(node_data.key),1,aim_node_data.key);
1845+
break;
1846+
}
1847+
}
1848+
this.resetChildrenParent(node_data);
1849+
1850+
node.querySelector('span').textContent = node_data.val;
1851+
node.setAttribute('data-id',node_data.key);
1852+
aim_node.querySelector('span').textContent = aim_node_data.val;
1853+
aim_node.setAttribute('data-id',aim_node_data.key);
18521854
}
18531855

18541856
resetChildrenParent(node_data){

0 commit comments

Comments
 (0)