Skip to content

Commit

Permalink
fix: 修复甘特图自定义taskbar时,拖拽taskbar报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ouliang committed Dec 6, 2024
1 parent 19a3211 commit 1ad2cab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/vtable-gantt/src/scenegraph/task-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class TaskBar {
cornerRadius: this._scene._gantt.parsedOptions.taskBarStyle.cornerRadius,
clip: true
});
barGroup.name = 'task-bar-group';
barGroupBox.appendChild(barGroup);
barGroupBox.clipGroupBox = barGroup;
let rootContainer;
Expand Down
17 changes: 11 additions & 6 deletions packages/vtable-gantt/src/state/state-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,12 +922,17 @@ function reCreateCustomNode(gantt: Gantt, taskBarGroup: Group, taskIndex: number
if (customLayoutObj) {
const rootContainer = customLayoutObj.rootContainer;
rootContainer.name = 'task-bar-custom-render';
const oldCustomIndex = taskBarGroup.children.findIndex((node: any) => {
return node.name === 'task-bar-custom-render';
});
const oldCustomNode = taskBarGroup.children[oldCustomIndex] as Group;
taskBarGroup.removeChild(oldCustomNode);
taskBarGroup.insertInto(rootContainer, oldCustomIndex);
const barGroup = taskBarGroup.children.find((node: any) => node.name === 'task-bar-group');
if (barGroup) {
const oldCustomIndex = barGroup.children.findIndex((node: any) => {
return node.name === 'task-bar-custom-render';
});
const oldCustomNode = barGroup.children[oldCustomIndex] as Group;
if (oldCustomNode) {
barGroup.removeChild(oldCustomNode);
barGroup.insertInto(rootContainer, oldCustomIndex);
}
}
}
}
}
Expand Down

0 comments on commit 1ad2cab

Please sign in to comment.