998 B
998 B
Zoom Plugin
The zoom plugin allows for modifying the planet's projection's scale with the mouse wheel.
API
planetaryjs.plugins.zoom([config])
Valid keys for config are:
initialScale: the value to initialize thed3.behavior.zoomobject's scale to; defaults to the scale of the planet's projection at the time the planet is initializedscaleExtent: the value to use for thed3.behavior.zoomobject'sscaleExtentproperty, which defines how far in and out the planet can be zoomed; defaults to[50, 2000]onZoom,onZoomStart,onZoomEnd: hooks to thed3.behavior.zoomobject'szoom,zoomstart, andzoomendevents; each defaults to a no-op
JavaScript
planetaryjs.plugins.zoom({
scaleExtent: [200, 1000],
onZoom: function() {
console.log("The planet was zoomed!", d3.event);
}
});