Skip to content

Commit a99be61

Browse files
committed
fix(ui): reset node zIndex after drag to prevent edges rendering above nodes
G6's drag-element behavior calls frontElement() on drag start, which permanently elevates the dragged node's zIndex. When hover-activate later fires, computeZIndex propagates this elevated value to connected edges, causing them to render on top of non-neighbor nodes. Reset zIndex to 0 on drag end to prevent escalation.
1 parent 739ca32 commit a99be61

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/graph/core.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,22 @@ class GraphCoreManager {
249249
plugins: plugins,
250250
});
251251

252-
this.cache.graph.on("node:dragend", async () => {
252+
this.cache.graph.on("node:dragend", async (event) => {
253253
/**
254254
* Persist all positions on every drag event
255+
* and reset zIndex elevated by G6's frontElement during drag
255256
*/
256257
if (this.cache.EVENT_LOCKS.DRAG_END_RUNNING) return;
257258

258259
this.cache.ui.debug("DRAG END");
259260
this.cache.EVENT_LOCKS.DRAG_END_RUNNING = true;
260261
await this.cache.lm.persistNodePositions();
262+
263+
const draggedId = event?.target?.id;
264+
if (draggedId) {
265+
await this.cache.graph.setElementZIndex(draggedId, 0);
266+
}
267+
261268
this.cache.EVENT_LOCKS.DRAG_END_RUNNING = false;
262269
});
263270

0 commit comments

Comments
 (0)