Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pmndrs/drei
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.79.4
Choose a base ref
...
head repository: pmndrs/drei
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v9.80.0
Choose a head ref
  • 5 commits
  • 6 files changed
  • 5 contributors

Commits on Jul 26, 2023

  1. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    eafb103 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7f1dfc1 View commit details
  3. Update QuadraticBezierLine.tsx (#1571)

    I added an export for Line2Props, so that a user can use this type when using useRef()
    frankbenji authored Jul 26, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e5ee5ff View commit details
  4. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b23f4b5 View commit details
  5. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fa5a47c View commit details
Showing with 8 additions and 9 deletions.
  1. +1 −1 README.md
  2. +1 −1 src/core/MeshTransmissionMaterial.tsx
  3. +1 −1 src/core/QuadraticBezierLine.tsx
  4. +1 −1 src/core/useEnvironment.tsx
  5. +1 −2 src/web/PresentationControls.tsx
  6. +3 −3 src/web/useCursor.tsx
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -2558,7 +2558,7 @@ A small hook that sets the css body cursor according to the hover state of a mes

```jsx
const [hovered, set] = useState()
useCursor(hovered, /*'pointer', 'auto'*/)
useCursor(hovered, /*'pointer', 'auto', document.body*/)
return (
<mesh onPointerOver={() => set(true)} onPointerOut={() => set(false)}>
```
2 changes: 1 addition & 1 deletion src/core/MeshTransmissionMaterial.tsx
Original file line number Diff line number Diff line change
@@ -430,14 +430,14 @@ export const MeshTransmissionMaterial = React.forwardRef(
state.gl.setRenderTarget(fboMain)
state.gl.render(state.scene, state.camera)

parent.material = ref.current
parent.material.thickness = thickness
parent.material.side = side
parent.material.buffer = fboMain.texture

// Set old state back
state.scene.background = oldBg
state.gl.setRenderTarget(null)
parent.material = ref.current
state.gl.toneMapping = oldTone
}
}
2 changes: 1 addition & 1 deletion src/core/QuadraticBezierLine.tsx
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ type Props = Omit<LineProps, 'points' | 'ref'> & {
segments?: number
}

type Line2Props = Object3DNode<Line2, typeof Line2> & {
export type Line2Props = Object3DNode<Line2, typeof Line2> & {
setPoints: (
start: Vector3 | [number, number, number],
end: Vector3 | [number, number, number],
2 changes: 1 addition & 1 deletion src/core/useEnvironment.tsx
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ export function useEnvironment({
? 'exr'
: files.startsWith('data:application/hdr')
? 'hdr'
: files.split('.').pop()?.toLowerCase()
: files.split('.').pop()?.split('?')?.shift()?.toLowerCase()
loader = isCubeMap ? CubeTextureLoader : extension === 'hdr' ? RGBELoader : extension === 'exr' ? EXRLoader : null

if (!loader) throw new Error('useEnvironment: Unrecognized file extension: ' + files)
3 changes: 1 addition & 2 deletions src/web/PresentationControls.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react'
import { MathUtils } from 'three'
import { useThree } from '@react-three/fiber'
import { a, useSpring } from '@react-spring/three'
import { a, SpringConfig, useSpring } from '@react-spring/three'
import { useGesture } from '@use-gesture/react'
import { SpringConfig } from '@react-spring/core'

export type PresentationControlProps = {
snap?: Boolean | SpringConfig
6 changes: 3 additions & 3 deletions src/web/useCursor.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react'

export function useCursor(hovered: boolean, onPointerOver = 'pointer', onPointerOut = 'auto') {
export function useCursor(hovered: boolean, onPointerOver = 'pointer', onPointerOut = 'auto', container: HTMLElement = document.body) {
React.useEffect(() => {
if (hovered) {
document.body.style.cursor = onPointerOver
return () => void (document.body.style.cursor = onPointerOut)
container.style.cursor = onPointerOver
return () => void (container.style.cursor = onPointerOut)
}
}, [hovered])
}