Skip to content

Commit

Permalink
fix: 框选时鼠标移出容器
Browse files Browse the repository at this point in the history
  • Loading branch information
jifeng authored and zhangtengjin committed Apr 2, 2024
1 parent 83f30c5 commit 9ba00ce
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib/components/topology/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,14 @@ class Topology extends React.Component<ITopologyProps, ITopologyState> {
handleMouseDown = (
e: React.MouseEvent<HTMLDivElement | SVGCircleElement>
) => {
const { boxSelectionInfo } = this.state
/**
* 框选时鼠标如果移出容器后触发mouseUp,重新移回容器首次mouseDown不执行操作,之后自动触发mouseUp,完成框选
*/
if (boxSelectionInfo?.status === 'drag') {
return
}

/**
* 不在节点上时方可触发框选
*/
Expand Down Expand Up @@ -1186,6 +1194,13 @@ class Topology extends React.Component<ITopologyProps, ITopologyState> {
};

clearMouseEventData = () => {
const { boxSelectionInfo } = this.state
/**
* 框选时鼠标如果移出容器不清除数据
*/
if (boxSelectionInfo?.status === 'drag') {
return
}
this.dragCanvasPo = null;
this.setContext({ activeLine: null, linking: false, impactNode: null });
};
Expand Down

0 comments on commit 9ba00ce

Please sign in to comment.