Skip to content

Commit

Permalink
chore: fix floating window
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Mar 13, 2023
1 parent 2f55c22 commit 7baf7b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/content-script/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async function prepareForSelectionTools() {
setTimeout(() => {
const selection = window.getSelection()?.toString()
if (selection) {
const position = { x: e.pageX + 15, y: e.pageY - 15 }
const position = { x: e.clientX + 15, y: e.clientY - 15 }
toolbarContainer = createElementAtPosition(position.x, position.y)
toolbarContainer.className = 'toolbar-container'
render(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/create-element-at-position.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export function createElementAtPosition(x = 0, y = 0, zIndex = 2147483647) {
const element = document.createElement('div')
element.style.position = 'absolute'
element.style.position = 'fixed'
element.style.zIndex = zIndex
element.style.left = x + 'px'
element.style.top = y + 'px'
Expand Down

0 comments on commit 7baf7b5

Please sign in to comment.