D3 zoom setting

Hello everybody,

create a map in which to perform an indoor localization and to do so I chose D3.js (version 5) and I have to implement it in Angular, I have to set the zoom of the map, but the translate values never return to 0 when using the mouse wheel to zoom. could you tell me where am I wrong? I googled for 3 days but I don’t know where to turn …

I am attaching a pastebin with the code to help you understand:

Which line of your code are you expecting to handle resetting the translate values to 0?

1 Like

Hello and thank you for your time! :facepunch: I don’t have a reset value for the zoom, what you see written is basically the basic method to manage a zoom in d3 alemno as far as you can find on the net, you can help to understand where I’m wrong and tell me how to correct my error ?

Can you setup a demo? The code in Pastebin doesn’t appear to be complete.

I can’t really understand how it works. But one theory is that you may need to reset these values. .attr("viewBox", `0 0 ${this.scala.b} ${this.scala.h}`).

1 Like

Hi dlaub3, you’re right sorry that variable is a obtained measurement, practically I have to do an indoor localization and that measurement would be the real area (with any unit of measurement) converted into pixels, I updated the pastebin with the complete application code try to make you understand the problem better …

Pastebin update:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.