862 B
862 B
Drag Plugin
The drag plugin allows for modifying the planet's projection's rotation with the mouse. It supports dragging vertically with hard stops at the north and south poles, and dragging horizontally without restriction.
API
planetaryjs.plugins.drag([config])
Valid keys for config are:
onDragStart,onDragEnd,onDrag,afterDrag: hooks to thed3.behavior.dragobject'sdragstart,dragend, anddragevents; each defaults to a no-op.onDragfires at the start of thedragevent,afterDragat the end. The planet instance is available asthisinside the each of the functions.
JavaScript
planetaryjs.plugins.drag({
onDrag: function() {
console.log("The planet was dragged!", this, d3.event);
}
});