Skip to content

Commit

Permalink
refactor(runtime): carry originalTarget in element event
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca committed Apr 7, 2024
1 parent b5feeca commit ecde4da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/g6/src/runtime/behavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ export class BehaviorController extends ExtensionController<BaseBehavior<CustomB
}

private forwardCanvasEvents = (event: FederatedPointerEvent | FederatedWheelEvent) => {
const target = eventTargetOf(event.target as DisplayObject);
const { target: originalTarget } = event;
const target = eventTargetOf(originalTarget as DisplayObject);
if (!target) return;
const { graph, canvas } = this.context;
const { type: targetType, element: targetElement } = target;
const { type, detail, button } = event;
const stdEvent = { ...event, target: targetElement, targetType };
const stdEvent = { ...event, target: targetElement, targetType, originalTarget };

if (type === CanvasEvent.POINTER_MOVE) {
if (this.currentTarget !== targetElement) {
Expand Down

0 comments on commit ecde4da

Please sign in to comment.