-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix incorrect edge zindex when ends has hight zindex (#6500)
* refactor: correct var name * refactor: compute element zindex when add and update data stage * refactor: adjust zIndex logic * chore: commit changeset --------- Co-authored-by: antv <[email protected]>
- Loading branch information
Showing
114 changed files
with
2,638 additions
and
2,401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@antv/g6': patch | ||
--- | ||
|
||
fix element z-index logic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/g6/__tests__/bugs/model-add-edge-in-combo.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { createGraph } from '@@/utils'; | ||
|
||
describe('add edge in combo', () => { | ||
it('add edge in combo without zIndex', async () => { | ||
const graph = createGraph({ | ||
data: { | ||
nodes: [ | ||
{ id: 'node-1', combo: 'combo-1', style: { x: 100, y: 100 } }, | ||
{ id: 'node-2', combo: 'combo-1', style: { x: 200, y: 200 } }, | ||
], | ||
combos: [{ id: 'combo-1' }], | ||
}, | ||
}); | ||
|
||
await graph.draw(); | ||
|
||
expect(graph.getComboData('combo-1').style?.zIndex).toBe(0); | ||
expect(graph.getNodeData('node-1').style?.zIndex).toBe(1); | ||
|
||
graph.addEdgeData([{ id: 'edge', source: 'node-1', target: 'node-2' }]); | ||
await graph.draw(); | ||
|
||
expect(graph.getEdgeData('edge').style?.zIndex).toBe(0); | ||
// @ts-expect-error skip the type check | ||
expect(graph.context.element?.getElement('edge')?.style.zIndex).toBe(0); | ||
}); | ||
|
||
it('add edge in combo with zIndex', async () => { | ||
const graph = createGraph({ | ||
data: { | ||
nodes: [ | ||
{ id: 'node-1', combo: 'combo-1', style: { x: 100, y: 100 } }, | ||
{ id: 'node-2', combo: 'combo-1', style: { x: 200, y: 200 } }, | ||
{ id: 'node-3', style: { x: 300, y: 300, zIndex: 5 } }, | ||
], | ||
combos: [{ id: 'combo-1' }], | ||
}, | ||
}); | ||
|
||
await graph.draw(); | ||
|
||
expect(graph.getComboData('combo-1').style?.zIndex).toBe(0); | ||
|
||
await graph.frontElement('combo-1'); | ||
|
||
expect(graph.getComboData('combo-1').style?.zIndex).toBe(5 + 1); | ||
expect(graph.getNodeData('node-1').style?.zIndex).toBe(5 + 1 + 1); | ||
|
||
graph.addEdgeData([{ id: 'edge', source: 'node-1', target: 'node-2' }]); | ||
await graph.draw(); | ||
|
||
expect(graph.getEdgeData('edge').style?.zIndex).toBe(5 + 1); | ||
// @ts-expect-error skip the type check | ||
expect(graph.context.element?.getElement('edge')?.style.zIndex).toBe(5 + 1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.