Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

413
Views
¿Cómo puedo vincular los botones de zoom para reaccionar al árbol d3?

Estoy tratando de descubrir cómo vincular los botones de zoom para reaccionar al árbol d3, sin embargo, no he encontrado un enfoque que funcione mientras se mantiene la posición.

La posición se restablece cada vez que actualizo el nivel de zoom, lo que significa que si hago una panorámica en algún lugar y ajusto el nivel de zoom, salta a la mitad del árbol.

Quiero algo como esto https://jsfiddle.net/vbabenko/jcsqqu6j/9/

 const TreeWrapper: FC<any> = ({ data }) => { const [zoomLevel, setZoomLevel] = useState(1); const scaleExtent = { min: 0.5, max: 3 }; const zoomIn = () => zoomLevel < scaleExtent.max && setZoomLevel((prevLevel) => prevLevel + 0.25); const zoomOut = () => zoomLevel > scaleExtent.min && setZoomLevel((prevLevel) => prevLevel - 0.25); return ( <Card title={null}> <button onClick={zoomIn} type="button"> + </button> <button onClick={zoomOut} type="button"> - </button> <Tree zoom={zoomLevel} scaleExtent={scaleExtent} translate={translate} zoom={zoomLevel} zoomable={true} initialDepth={1} collapsible={true} separation={{ siblings: 2, nonSiblings: 2 }} renderCustomNodeElement={(rd3tProps) => renderForeignObjectNode({ ...rd3tProps, foreignObjectProps }) } orientation="vertical" data={data} /> </Card> ); };
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!