1.1 KiB
1.1 KiB
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]onZoomStart,onZoomEnd,onZoom,afterZoom: hooks to thed3.behavior.zoomobject'szoomstart,zoomend, andzoomevents; each defaults to a no-op.onZoomfires at the start of thezoomevent,afterZoomat the end. The planet instance is available asthisinside the each of the functions.
JavaScript
planetaryjs.plugins.zoom({
scaleExtent: [200, 1000],
onZoom: function() {
console.log("The planet was zoomed!", this, d3.event);
}
});