Skip to content

Commit

Permalink
feat: prevent trigger context menu when map moved
Browse files Browse the repository at this point in the history
  • Loading branch information
SSShooter committed Jan 4, 2025
1 parent 87d1665 commit 6666fba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/plugin/contextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default function (mind: MindElixirInstance, option: Options) {
mind.container.oncontextmenu = function (e) {
e.preventDefault()
if (!mind.editable) return
if (dragMoveHelper.moved) return
// console.log(e.pageY, e.screenY, e.clientY)
const target = e.target as HTMLElement
if (isTopic(target)) {
Expand Down
7 changes: 5 additions & 2 deletions src/utils/dragMoveHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export default {
}
},
clear() {
this.moved = false
this.mousedown = false
// delay to avoid trigger contextmenu
setTimeout(() => {
this.moved = false
this.mousedown = false
}, 0)
},
}

0 comments on commit 6666fba

Please sign in to comment.