Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Zoom only allowed in HTML #958

Open
cfergus opened this Issue · 3 comments

2 participants

Colin Fergus Mike Bostock
Colin Fergus

The zoom functionality of D3 fails when the root document is an SVG document.
Most examples are embedded within HTML, but is this a requisite of D3?

Suggest either allowing zoom in svg documents, or adding documentation that zoom can only be used in html embedded SVG.

This code tries to reference HTML elements, which causes the failure.
https://github.com/mbostock/d3/blob/master/d3.v2.js#L1439

Mike Bostock
Owner

Ironically, that code is only there to fix a browser bug where scrolling events are interpreted inconsistently, and the only way to observe them accurately is to dispatch them to a scrollable context and measure how much the context scrolls. Fix one thing, and break another?

But in general, I would say that D3 is only intended to work in an HTML document with embedded SVG. Trying to put D3 inside an SVG document directly is quite rare, so you're treading outside the area of normal development.

Colin Fergus

I usually tread in lands not-normal.
Totally understandable. Shall I look for a suitable place in the documentation to make mention of this characteristic, or shall I be considered an outlier?
(also, I will take this opportunity to declare D3 as brilliant)

Mike Bostock
Owner

Seems like an outlier to me, but maybe not. :) You're here, after all! Feel free to edit the wiki and close this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.