Skip to content

Commit

Permalink
fix(core): zIndex problem in overlapMode(#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
wumail authored and boyongjiong committed Nov 1, 2023
1 parent d7778cc commit ae41283
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 29 deletions.
40 changes: 20 additions & 20 deletions packages/core/src/view/Anchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ class Anchor extends Component<IProps, IState> {
anchorData, nodeModel, graphModel,
} = this.props;
const { overlapMode } = graphModel;
// nodeModel.setSelected(true);
graphModel.selectNodeById(nodeModel.id);
if (overlapMode !== OverlapMode.INCREASE && nodeModel.autoToFront) {
if (nodeModel.autoToFront) {
graphModel.toFront(nodeModel.id);
}
graphModel.eventCenter.emit(EventType.ANCHOR_DRAGSTART, {
Expand Down Expand Up @@ -346,25 +345,26 @@ class Anchor extends Component<IProps, IState> {
{this.getAnchorShape()}
</g>
{this.isShowLine()
&& (this.customTrajectory
? this.customTrajectory(
{ sourcePoint: { x: startX, y: startY },
targetPoint: {
x: endX, y: endY,
&& (this.customTrajectory
? this.customTrajectory(
{
sourcePoint: { x: startX, y: startY },
targetPoint: {
x: endX, y: endY,
},
...edgeStyle,
},
...edgeStyle,
},
)
: (
<Line
x1={startX}
y1={startY}
x2={endX}
y2={endY}
{...edgeStyle}
pointer-events="none"
/>
))}
)
: (
<Line
x1={startX}
y1={startY}
x2={endX}
y2={endY}
{...edgeStyle}
pointer-events="none"
/>
))}
</g>
);
}
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/view/edge/BaseEdge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,7 @@ export default class BaseEdge extends Component<IProps> {
*/
toFront() {
const { graphModel, model } = this.props;
const { overlapMode } = graphModel;
if (overlapMode !== OverlapMode.INCREASE) {
graphModel.toFront(model.id);
}
graphModel.toFront(model.id);
}
/**
* 不建议重写,如果要自定义边的形状,请重写getEdge方法。
Expand Down
9 changes: 4 additions & 5 deletions packages/core/src/view/node/BaseNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,11 @@ export default abstract class BaseNode extends Component<IProps, IState> {
}
};
/**
* 节点置顶,可以被某些不需要置顶的节点重写,如group节点。
* @overridable 支持重写, 节点置顶,可以被某些不需要置顶的节点重写,如group节点。
*/
toFront() {
const { model, graphModel } = this.props;
const { overlapMode } = graphModel;
if (overlapMode !== OverlapMode.INCREASE && model.autoToFront) {
if (model.autoToFront) {
graphModel.toFront(model.id);
}
}
Expand Down Expand Up @@ -416,7 +415,7 @@ export default abstract class BaseNode extends Component<IProps, IState> {
if (!isHitable) {
nodeShape = (
<g className={`${this.getStateClassName()} ${className}`} {...restAttributes}>
{ nodeShapeInner }
{nodeShapeInner}
</g>
);
} else {
Expand All @@ -435,7 +434,7 @@ export default abstract class BaseNode extends Component<IProps, IState> {
onContextMenu={this.handleContextMenu}
{...restAttributes}
>
{ nodeShapeInner }
{nodeShapeInner}
</g>
);
}
Expand Down

0 comments on commit ae41283

Please sign in to comment.