Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

267
Visualizações
Applying pan limits to d3.js SVG viewbox when zoomed using translateExtent

Trying to limit the panning on my svg viewbox to the bottom right corner of the svg when zoomed. I have seen a few similar questions on here already but am still yet to find a working answer.

In my code below you'll see that the zooming is working but with extent and translateExtent the panning ceases to work. As soon as I comment these 2 functions out the panning works but the limits are wrong (they are the coordinates of the bottom right hand corner of the svg but this causes the whole svg to be out of view). I understand the current extent and translateExtent values are probably incorrect but I have played around with loads of different values and have failed to see any logical consistency to work with. For example setting the translateExtent to, say, [[0,0], [3000, 3000]] I'd expect the panning to be far greater than normal and be able to pan way off screen, however panning just stops working altogether?

I'm clearly misunderstanding something here. Please can someone tell me where I'm going wrong! Thanks.

Live code here: https://jsfiddle.net/9b7w4z58/1/

Image below illustrates how I intend the svg to look when panned fully.

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda