Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LiveDuo committed Mar 27, 2024
1 parent 22548f5 commit 303e23a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/client/vanilla/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ const getImageUrl = (standaloneServer: boolean, imageSrc: string) => {
}

const isEventOnElement = (element: HTMLElement, event: React.MouseEvent<HTMLElement>) => {
if (!element) return
if (!element) return false
const rect = element.getBoundingClientRect()
const isX = rect.top < event.clientY && rect.bottom > event.clientY
const isY = rect.left < event.clientX && rect.right > event.clientX
return isX && isY
}

const isElementTopHalf = (element: HTMLElement, event: React.MouseEvent<HTMLElement>) => {
if (!element) return
if (!element) return false
const rect = element.getBoundingClientRect()
return rect.top + (rect.bottom - rect.top) / 2 > event.clientY
}
Expand Down

0 comments on commit 303e23a

Please sign in to comment.