Skip to content

Commit

Permalink
fix: particle offset bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pbullhove committed Apr 4, 2024
1 parent e9be6ab commit a811494
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web/src/Components/Bridging/Graphs/BridgeGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ type BridgeGraphProps = {
}

export function BridgeGraph({ yAxis, graphData, sizeFractions, bridges }: BridgeGraphProps) {
const [particleFromPercentage, setParticleFromPercentage] = useState<string>('')
const [particleToPercentage, setParticleToPercentage] = useState<string>('')
const [particleFromPercentage, setParticleFromPercentage] = useState<string>('30%')
const [particleToPercentage, setParticleToPercentage] = useState<string>('100%')
const particleRange = useContext(ParticleSizeContext)

useEffect(() => {
Expand All @@ -28,8 +28,8 @@ export function BridgeGraph({ yAxis, graphData, sizeFractions, bridges }: Bridge

function particleSizeOffsetPercentage(offsetSize: number) {
const index = sizeFractions.findIndex(size => size > offsetSize)
if (index === -1) return ''
const percentage = Math.round(index / sizeFractions.length) * 100
if (index === -1) return '0%'
let percentage = (index / sizeFractions.length) * 100
return `${percentage}%`
}

Expand Down

0 comments on commit a811494

Please sign in to comment.