Skip to content

Commit

Permalink
fix: hide elems when visible is false (#3007)
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector authored Dec 6, 2022
1 parent 2070828 commit 057d520
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/x6/src/model/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,14 @@ export class Model extends Basecoat<Model.EventArgs> {
disconnectConnectedEdges(cell: Cell | string, options: Edge.SetOptions = {}) {
const cellId = typeof cell === 'string' ? cell : cell.id
this.getConnectedEdges(cell).forEach((edge) => {
const sourceCell = edge.getSourceCell()
const targetCell = edge.getTargetCell()
const sourceCellId = edge.getSourceCellId()
const targetCellId = edge.getTargetCellId()

if (sourceCell && sourceCell.id === cellId) {
if (sourceCellId === cellId) {
edge.setSource({ x: 0, y: 0 }, options)
}

if (targetCell && targetCell.id === cellId) {
if (targetCellId === cellId) {
edge.setTarget({ x: 0, y: 0 }, options)
}
})
Expand Down
5 changes: 5 additions & 0 deletions packages/x6/src/renderer/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ export class Scheduler extends Disposable {
const zIndex = view.cell.getZIndex()
const pivot = this.addZPivot(zIndex)
this.container.insertBefore(view.container, pivot)

if (!view.cell.isVisible()) {
this.toggleVisible(view.cell, false)
}

viewItem.state = Scheduler.ViewState.MOUNTED
}
}
Expand Down

0 comments on commit 057d520

Please sign in to comment.