Skip to content

Commit

Permalink
fix: fix line width default
Browse files Browse the repository at this point in the history
  • Loading branch information
drcmda committed Mar 12, 2024
1 parent 1c3202a commit 32bd7a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ Scroll controls create a HTML scroll container in front of the canvas. Everythin
You can listen and react to scroll with the `useScroll` hook which gives you useful data like the current scroll `offset`, `delta` and functions for range finding: `range`, `curve` and `visible`. The latter functions are especially useful if you want to react to the scroll offset, for instance if you wanted to fade things in and out if they are in or out of view.
```jsx
<ScrollControls pages={3} damping={0.1}>
;<ScrollControls pages={3} damping={0.1}>
{/* Canvas contents in here will *not* scroll, but receive useScroll! */}
<SomeModel />
<Scroll>
Expand Down Expand Up @@ -1596,7 +1596,7 @@ Radial gradient.

```jsx
import { GradientTexture, GradientType } from './GradientTexture'
<mesh>
;<mesh>
<planeGeometry />
<meshBasicMaterial>
<GradientTexture
Expand Down Expand Up @@ -1625,7 +1625,7 @@ Abstracts [THREE.EdgesGeometry](https://threejs.org/docs/#api/en/geometries/Edge
<boxGeometry />
<meshBasicMaterial />
<Edges
lineWidth={4}
linewidth={4}
scale={1.1}
threshold={15} // Display edges only when the angle between two faces exceeds this value (default=15 degrees)
color="white"
Expand Down Expand Up @@ -3726,7 +3726,7 @@ If you still experience flip flops despite the bounds you can define a limit of
PerformanceMonitor can also have children, if you wrap your app in it you get to use `usePerformanceMonitor` which allows individual components down the nested tree to respond to performance changes on their own.

```jsx
<PerformanceMonitor>
;<PerformanceMonitor>
<Effects />
</PerformanceMonitor>
Expand Down Expand Up @@ -3756,16 +3756,20 @@ type HudProps = {
```

```jsx
{ /* Renders on top of the default scene with a perspective camera */ }
<Hud>
{
/* Renders on top of the default scene with a perspective camera */
}
;<Hud>
<PerspectiveCamera makeDefault position={[0, 0, 10]} />
<mesh>
<ringGeometry />
</mesh>
</Hud>
{ /* Renders on top of the previous HUD with an orthographic camera */ }
<Hud renderPriority={2}>
{
/* Renders on top of the previous HUD with an orthographic camera */
}
;<Hud renderPriority={2}>
<OrthographicCamera makeDefault position={[0, 0, 10]} />
<mesh>
<boxGeometry />
Expand Down
4 changes: 2 additions & 2 deletions src/core/Line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type LineProps = {
export const Line: ForwardRefComponent<LineProps, Line2 | LineSegments2> = /* @__PURE__ */ React.forwardRef<
Line2 | LineSegments2,
LineProps
>(function Line({ points, color = 0xffffff, vertexColors, linewidth = 1, lineWidth, segments, dashed, ...rest }, ref) {
>(function Line({ points, color = 0xffffff, vertexColors, linewidth, lineWidth, segments, dashed, ...rest }, ref) {
const size = useThree((state) => state.size)
const line2 = React.useMemo(() => (segments ? new LineSegments2() : new Line2()), [segments])
const [lineMaterial] = React.useState(() => new LineMaterial())
Expand Down Expand Up @@ -84,7 +84,7 @@ export const Line: ForwardRefComponent<LineProps, Line2 | LineSegments2> = /* @_
color={color}
vertexColors={Boolean(vertexColors)}
resolution={[size.width, size.height]}
linewidth={linewidth ?? lineWidth}
linewidth={linewidth ?? lineWidth ?? 1}
dashed={dashed}
transparent={itemSize === 4}
{...rest}
Expand Down

0 comments on commit 32bd7a4

Please sign in to comment.