Skip to content

Commit

Permalink
修复存在两 graph 对象的情况下,触摸弹起事件被覆写导致无法响应框选结束的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
little-snow-fox committed Feb 11, 2025
1 parent 28cf541 commit c2ca129
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/x6-plugin-selection/src/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
const { ui, selection, translateBy, snapped } = options

const allowTranslating =
(showNodeSelectionBox !== true || (pointerEvents && this.getPointerEventsValue(pointerEvents) === 'none')) &&
(showNodeSelectionBox !== true ||
(pointerEvents &&
this.getPointerEventsValue(pointerEvents) === 'none')) &&
!this.translating &&
!selection

Expand Down Expand Up @@ -386,11 +388,7 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
const client = this.graph.snapToGrid(e.clientX, e.clientY)
this.notifyBoxEvent('box:mousedown', e, client.x, client.y)
// this.delegateDocumentEvents(Private.documentEvents, e.data)
this.addEventListeners(
this.graph.container,
Private.documentEvents,
evt.data,
)
this.addEventListeners(this.graph.container, Private.documentEvents, e.data)
}

protected startTranslating(evt: Dom.MouseDownEvent) {
Expand Down Expand Up @@ -830,7 +828,9 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
)
}

protected getPointerEventsValue(pointerEvents: 'none' | 'auto' | ((cells: Cell[]) => 'none' | 'auto')) {
protected getPointerEventsValue(
pointerEvents: 'none' | 'auto' | ((cells: Cell[]) => 'none' | 'auto'),
) {
return typeof pointerEvents === 'string'
? pointerEvents
: pointerEvents(this.cells)
Expand Down

0 comments on commit c2ca129

Please sign in to comment.