Skip to content

Commit b7e9654

Browse files
author
hikki
committed
v3.2
1 parent 34155ed commit b7e9654

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

resources/assets/component.js

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,23 @@ window.ComponentCascadeLine = class {
18101810
}
18111811

18121812
nodeMigrateExec(node,node_data,aim_node,aim_node_data){
1813+
let parents = aim_node_data.parentNodes.slice(0);
1814+
parents.push(aim_node_data.key);
1815+
node_data.parentNodes = parents;
1816+
let stack = aim_node_data.stack + 1;
1817+
let diffStack = stack - node_data.stack;
1818+
let index = parseInt(node.getAttribute('data-k'));
1819+
this.dimensional_data[node_data.stack].splice(index,1);
1820+
if(!Array.isArray(this.dimensional_data[stack]))this.dimensional_data[stack] = [];
1821+
this.dimensional_data[stack].push(node_data);
1822+
1823+
this.resetChildrenDimensional(node_data,node_data.stack + 1,diffStack);
1824+
node_data.stack = stack;
1825+
console.log(this.dimensional_data)
18131826

1827+
/*aim node*/
1828+
if(!Array.isArray(aim_node_data.nodes))aim_node_data.nodes = [];
1829+
aim_node_data.nodes.push(node_data.key);
18141830
}
18151831

18161832
nodeExchangeExec(node,node_data,aim_node,aim_node_data){
@@ -1853,11 +1869,11 @@ window.ComponentCascadeLine = class {
18531869
aim_node.setAttribute('data-id',aim_node_data.key);
18541870
}
18551871

1856-
resetChildrenParent(node_data){
1857-
let stack = node_data.stack;
1858-
let nodes = node_data.nodes;
1859-
let parents = node_data.parentNodes.slice(0);
1860-
parents.push(node_data.key);
1872+
resetChildrenParent(node){
1873+
let stack = node.stack;
1874+
let nodes = node.nodes;
1875+
let parents = node.parentNodes.slice(0);
1876+
parents.push(node.key);
18611877
stack++;
18621878
this.dimensional_data[stack].forEach((d)=>{
18631879
if(nodes.indexOf(d.key) !== -1){
@@ -1868,4 +1884,26 @@ window.ComponentCascadeLine = class {
18681884
}
18691885
});
18701886
}
1887+
1888+
resetChildrenDimensional(node,stack,diffStack){
1889+
let nodes = node.nodes;
1890+
let parents = node.parentNodes.slice(0);
1891+
parents.push(node.key);
1892+
if(!Array.isArray(this.dimensional_data[stack]))return;
1893+
let indexes = [];
1894+
this.dimensional_data[stack].forEach((d,index)=>{
1895+
if(Array.isArray(nodes) && nodes.indexOf(d.key) !== -1){
1896+
indexes.push(index);
1897+
d.parentNodes = parents;
1898+
d.stack = stack + diffStack;
1899+
if(!Array.isArray(this.dimensional_data[d.stack]))this.dimensional_data[d.stack] = [];
1900+
this.dimensional_data[d.stack].push(d);
1901+
this.resetChildrenDimensional(d,stack+1,diffStack);
1902+
}
1903+
});
1904+
indexes.reverse();
1905+
indexes.forEach((d)=>{
1906+
this.dimensional_data[stack].splice(d,1);
1907+
});
1908+
}
18711909
};

0 commit comments

Comments
 (0)