Skip to content

Commit

Permalink
#2411 - Fix uncaught referenceError - cannot access 'clientX' before …
Browse files Browse the repository at this point in the history
…initialization
  • Loading branch information
yuleicul committed Apr 14, 2023
1 parent 536717d commit a4d7caf
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,17 @@ class StructEditor extends Component {
})

this.editor.event.cursor.add((csr) => {
let clientX, clientY

switch (csr.status) {
case 'enable':
this.editorRef.current.classList.add(classes.enableCursor)
const { left, top, right, bottom } =
this.editorRef.current.getBoundingClientRect()
const { clientX, clientY } = csr.cursorPosition

clientX = csr.cursorPosition.clientX
clientY = csr.cursorPosition.clientY

const handShouldBeShown =
clientX >= left &&
clientX <= right &&
Expand Down

0 comments on commit a4d7caf

Please sign in to comment.