fix: 修复链队列问题
This commit is contained in:
parent
dbb69b9e21
commit
0ef21a6268
2
dist/sv.js
vendored
2
dist/sv.js
vendored
File diff suppressed because one or more lines are too long
@ -32,10 +32,18 @@ export const Util = {
|
|||||||
* @param list 移除列表
|
* @param list 移除列表
|
||||||
* @param fn 移除判断规则
|
* @param fn 移除判断规则
|
||||||
*/
|
*/
|
||||||
removeFromList<T>(list: T[], fn: (item: T) => boolean) {
|
removeFromList<T>(list: T[], fn: (item: T) => boolean): T[] {
|
||||||
|
const res: T[] = [];
|
||||||
|
|
||||||
for(let i = 0; i < list.length; i++) {
|
for(let i = 0; i < list.length; i++) {
|
||||||
fn(list[i]) && list.splice(i, 1) && i--;
|
if(fn(list[i])) {
|
||||||
|
let removeItem = list.splice(i, 1);
|
||||||
|
res.push(...removeItem);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,8 @@ export const Animations = {
|
|||||||
* @param animationConfig
|
* @param animationConfig
|
||||||
*/
|
*/
|
||||||
animate_append(model: Model, animationConfig: animationConfig) {
|
animate_append(model: Model, animationConfig: animationConfig) {
|
||||||
|
model.G6Item === null && console.log(model);
|
||||||
|
|
||||||
const G6Item = model.G6Item,
|
const G6Item = model.G6Item,
|
||||||
type = G6Item.getType(),
|
type = G6Item.getType(),
|
||||||
group = G6Item.getContainer(),
|
group = G6Item.getContainer(),
|
||||||
|
@ -79,14 +79,17 @@ export class ViewManager {
|
|||||||
freedGroup = layoutGroupTable.get(freedGroupName);
|
freedGroup = layoutGroupTable.get(freedGroupName);
|
||||||
|
|
||||||
freedList.forEach(fItem => {
|
freedList.forEach(fItem => {
|
||||||
removeModels.push(...freedGroup.element.splice(freedGroup.element.findIndex(item => item.id === fItem.id), 1));
|
removeModels.push(
|
||||||
removeModels.push(...freedGroup.link.splice(freedGroup.link.findIndex(item => item.element.id === fItem.id || item.target.id === fItem.id)));
|
...Util.removeFromList(freedGroup.element, item => item.id === fItem.id),
|
||||||
removeModels.push(...freedGroup.marker.splice(freedGroup.marker.findIndex(item => item.target.id === fItem.id)));
|
...Util.removeFromList(freedGroup.link, item => item.element.id === fItem.id || item.target.id === fItem.id),
|
||||||
|
...Util.removeFromList(freedGroup.marker, item => item.target.id === fItem.id),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(removeModels);
|
||||||
|
|
||||||
removeModels.map(model => {
|
removeModels.map(model => {
|
||||||
const index = freedGroup.modelList.findIndex(item => item.id === model.id);
|
Util.removeFromList(freedGroup.modelList, item => item.id === model.id);
|
||||||
freedGroup.modelList.splice(index, 1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return freedList;
|
return freedList;
|
||||||
|
Loading…
Reference in New Issue
Block a user