Skip to content

Commit

Permalink
fix: plugin-dnd horizontal scroll compatibility (#3912)
Browse files Browse the repository at this point in the history
  • Loading branch information
cluezhang committed Sep 15, 2023
1 parent 8b8df8c commit 9771f94
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/x6-plugin-dnd/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ export class Dnd extends View implements Graph.Plugin {
protected updateGraphPosition(clientX: number, clientY: number) {
const scrollTop =
document.body.scrollTop || document.documentElement.scrollTop
const scrollLeft =
document.body.scrollLeft || document.documentElement.scrollLeft
const delta = this.delta!
const nodeBBox = this.geometryBBox
const padding = this.padding || 5
const offset = {
left: clientX - delta.x - nodeBBox.width / 2 - padding,
left: clientX - delta.x - nodeBBox.width / 2 - padding + scrollLeft,
top: clientY - delta.y - nodeBBox.height / 2 - padding + scrollTop,
}

Expand Down

0 comments on commit 9771f94

Please sign in to comment.