Skip to content

Mouse position when not on canvas #1442

Answered by drcmda
MitchellWT asked this question in Q&A
Discussion options

You must be logged in to vote

this is an easy fix:

function App() {
  const ref = useRef()
  return (
    <div className="outerDiv" ref={ref}>
      <nav className="nav"> ...

      <Canvas className="canvas" onCreated={state => {
        state.events.connect(ref.current)
      }}>

dom events dont work like what you want, if you have a layer on top of another, the inner layer wont get hit. but you can place events on a layer that includes both.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@MitchellWT
Comment options

@drcmda
Comment options

@MitchellWT
Comment options

@drcmda
Comment options

Answer selected by MitchellWT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants