You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

d3-geo-zoom

Package Overview
Dependencies
4
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-geo-zoom

Zoom and Pan D3 Geo projections


Version published
Maintainers
1
Created

Readme

Source

d3.geoZoom

NPM package Build Size NPM Downloads

Apply zoom and pan user interactions to D3 spherical map projections in the same fashion as d3-zoom for regular cartesian coordinates. Generally used with Azimuthal projections, but also works for other projection types as long as scaling and rotation is supported.

Heavily based in previous work by Jason Davies' Rotate the World and Mike Bostock's Versor Dragging. Makes use of Fil's versors package for translating mouse coordinates to the sphere.

See the included examples (canvas and svg).

Quick start

import d3GeoZoom from 'd3-geo-zoom';

or using a script tag

<script src="//unpkg.com/d3-geo-zoom"></script>

then

d3.geoZoom()
    .projection(<mapProjection>)
    .onMove(<callbackFn>)
    (<mapDomNode>);

API reference

MethodDescriptionDefault
projection([object])Getter/setter for the D3 projection object whose position settings are modified according to the zoom/pan user interactions. The projection should support the scale and rotate methods.-
northUp([boolean])Getter/setter for whether to maintain a north pointing upwards orientation or allow free rotation in all directions.false
scaleExtent([array])Getter/setter for the scale extent ([min, max]) to restrict the zoom interaction to.[0.1, 1000]
onMove([fn({ scale, rotation })])Callback function for when the projection object is updated due to a user interaction. This is a convenient place to bind the render function that redraws the map component elements according to the current projection settings. The callback function includes a single object parameter that contains the new scale and rotation values.-

Keywords

FAQs

Package last updated on 08 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc