Skip to content

Conversation

@marcofugaro
Copy link
Contributor

Close #120, Close #127, Close #127

This PR changes the names of the Spline event listeners, allowing users to use the native onMouseDown, onMouseUp, onMouseHover, onKeyDown, onKeyUp events. Before these listeners were hijacked by Spline for usage with the Spline Events.

Before

export default function App() {
  function onMouseDown(e) {
    if (e.target.name === 'Cube') {
      console.log('I have been clicked!');
    }
  }

  return (
    <Spline
      scene="https://prod.spline.design/6Wq1Q7YGyM-iab9i/scene.splinecode"
      onMouseDown={onMouseDown}
    />
  );
}

After

export default function App() {
  function onSplineMouseDown(e) {
    if (e.target.name === 'Cube') {
      console.log('I have been clicked!');
    }
  }

  return (
    <Spline
      scene="https://prod.spline.design/6Wq1Q7YGyM-iab9i/scene.splinecode"
      onSplineMouseDown={onSplineMouseDown}
    />
  );
}

@lorenzrabs
Copy link

The exported code from spline is still using v3.1. Maybe create a notice on the docs to save someone else's time..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

event not work for both vanilla and React js mouseHover

3 participants