Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions packages/menu/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ const tableMenuHook: VxeGlobalHooksHandles.HookOptions = {
evnt.preventDefault()
$xetable.updateZindex()
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
let top = evnt.clientY + scrollTop
let left = evnt.clientX + scrollLeft
const bodyRect = document.body.getBoundingClientRect()
let top = evnt.clientY + scrollTop - bodyRect.top
let left = evnt.clientX + scrollLeft - bodyRect.left
const handleVisible = () => {
internalData._currMenuParams = params
Object.assign(ctxMenuStore, {
Expand Down
5 changes: 3 additions & 2 deletions packages/tools/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ export function getOffsetPos (elem: any, container: any) {

export function getAbsolutePos (elem: any) {
const bounding = elem.getBoundingClientRect()
const boundingTop = bounding.top
const boundingLeft = bounding.left
const bodyRect = document.body.getBoundingClientRect()
const boundingTop = bounding.top - bodyRect.top
const boundingLeft = bounding.left - bodyRect.left
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
}
Expand Down