Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/x6-plugin-selection/src/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
collection.on('reseted', this.onReseted, this)
collection.on('updated', this.onCollectionUpdated, this)
collection.on('node:change:position', this.onNodePositionChanged, this)
collection.on('cell:changed', this.onCellChanged, this)
collection.on('node:change:angle', this.onCellChanged, this)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用 cell:changed 确实会执行过于频繁。不过导致 box 修改的事件应该不止 angle/size 修改。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiawenqi @NewByVector @OpportunityLiu 这个 PR 还有后续吗?看 PR 的视频效果,提升是很明显的。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这么写 edge 不是没处理吗?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OpportunityLiu 之前 cell 也不包含 edge 啊~

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

动画

edge 自己的事件不是在监听吗,只是不能通过框选选中而已啊

collection.on('node:change:size', this.onCellChanged, this)
}

protected stopListening() {
Expand All @@ -101,7 +102,8 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
collection.off('reseted', this.onReseted, this)
collection.off('updated', this.onCollectionUpdated, this)
collection.off('node:change:position', this.onNodePositionChanged, this)
collection.off('cell:changed', this.onCellChanged, this)
collection.off('node:change:angle', this.onCellChanged, this)
collection.off('node:change:size', this.onCellChanged, this)
}

protected onRemove() {
Expand Down