Zoom to Bounding Box + Bounded Zoom

87 views
Skip to first unread message

Danilo Tuler

unread,
Apr 3, 2016, 1:50:20 AM4/3/16
to d3-js
Hi,

I'm trying to combine the example at

With a bounded zoom/translate technic, like the one below

But what I find out is that setting zoom.translate inside the zoom event, event for the original value, make it not work like expected.
I took the first example, and just added the line below

Try zooming in first (using wheel or whatever), and the click on a state

Why is that? Is this a bug?

Thanks,
Danilo

Killian

unread,
May 3, 2016, 4:47:12 AM5/3/16
to d3-js
Hi Danilo,

I'm trying to do the exact same thing, that being combining "Zooming to Bounding Box" and "Constrained Zoom".  As it turns out, I happen to have the very same problem as yours.
So I'm curious to know if you somehow managed to work it out or maybe came up with a smooth workaround ?

Thanks in advance for your reply,
Killian.

Mike Tahani

unread,
May 3, 2016, 4:35:50 PM5/3/16
to d3...@googlegroups.com

I had this in a draft from a couple weeks ago, but I don’t remember the reasoning. I’ll revisit it later, but for now, the quick fix is to remove zoom.translate(d3.event.translate) from zoomed().

Mike T


--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Killian

unread,
May 4, 2016, 4:19:12 AM5/4/16
to d3-js
Hi Mike,

Thanks a lot for the reply. Actually I already tried to remove the "zoom.translate(d3.event.translate)" part but this brings other problems. I'm curious to see this draft if you can find it back. 

Please let me know,
Killian.
Reply all
Reply to author
Forward
0 new messages