Skip to content

Commit

Permalink
feat: remove related Line, when there is only one Block (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
orzyyyy committed Apr 14, 2019
1 parent 20d366e commit 397f376
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/canvas/core.tsx
Expand Up @@ -161,6 +161,12 @@ export default class Canvas extends Component<CanvasProps, CanvasState> {
handleRightClick = ({ key, event, group }: ContextMenuProps) => {
preventDefault(event);
delete dataCollector[group][key];
for (const lineKey of Object.keys(dataCollector.LineGroup)) {
const { fromKey, toKey } = dataCollector.LineGroup[lineKey];
if (group === 'BlockGroup' && (fromKey === key || toKey === key)) {
delete dataCollector.LineGroup[lineKey];
}
}
this.setState({});
};

Expand Down

0 comments on commit 397f376

Please sign in to comment.