I ended up working on the same problem. Here's an example (see code) where you pan left/right to rotate the projection (with wraparound), and up/down to translate (clamped by max absolute latitude), with zoom as well. Ensures that projection always fits within viewbox.
I learned a lot about zoom behavior, and projection center() and rotate() interaction.
Google maps on apple products work like this. Scrol left, and you will leave one Australia, then find another and another and another
hope this code can solve your problem
var projection = d3.geo.equirectangular() .center([0, 5]) .scale(90) .translate([width / 2, height / 2]) .rotate([0, 0]) .precision(9);
- Zooming and Panning a Mercator Map centered on the Pacific using d3.js
- How can I detect panning and zooming by the user with d3 zoomBehavior?
- How to plot points on a map projection in D3.js and filter the data using range sliders?
- Connecting data and pop up in the map using D3
- Having trouble panning and zooming on my d3 map
- D3 Zoom & Pan - How to enable zooming & panning anywhere on the chart and restrict showing circle within the range while panning & zooming
- How to save the state of the Map view using angularjs and in JSON format?
- D3.js Zooming and panning a collapsible tree diagram
- Displaying map using d3.js and geojson
- D3.JS time-series line chart with real-time data, panning and zooming
- how to add legend to a pie chart using D3js? And how to centralise the pie chart?
- D3 Canvas graph zooming and panning slow redraw in Webview
- How can i get the startAngle and endAngle of each arc in the sunburst example using d3.js?
- How do I create a minimap of an SVG using D3 v5 and show the current viewport dimensions?
- D3.js: Zooming the x-axis and data with mouse wheel scroll
- The difference between select using merge and selectAll in D3 update mode
- Draw a map with D3.js: How to get the right scale() and translate()?
- How to mirror this linear gradient across the x-axis and adjust it upon zooming
- Map zooming with D3 and Datamaps
- Trying to find a way to get the row and column names of csv in html/js by using d3 , any other ways?
- How to get the boundaries of currently visible time scale (after panning and zooming)?
- My cities are being plotted with the wrong projection (quite small and to the left). Using d3.geo.albersUSA()
- How to drag and rotate orthographic map (globe) using d3.js
- How do you translate HTML elements along with SVG elements when zooming and panning with D3
- Plotting Name of States on Map using Node js and D3 in real time
- How can I add images in the nodes of a D3 Sankey diagram, using the rcv and networkD3 packages in R?
- Venue/Indoor Map using D3.js and Geojson
- zooming and panning - upgrading d3 code to d3.v4
- How can I offset the source and target points of a bezier curve using D3's link generator?
More Query from same tag
- Collapsible Tree Hierarchy d3
- How to use D3 hierarchical edge bundling graph with Plotly
- d3.js how to fit multiple polygon in a div
- How to draw a JSON list in D3.js?
- brush selection in scatterplot matrix example in d3.js is offset?
- On call(chart), how to debug "Cannot call method 'getPropertyValue' of null"
- How to get points from a D3 SVG bezier curve with given step size?
- Update Size of D3 Charts Through Updated Variables
- How can I convert this D3 multi-series line chart x-axis to use sequential numbers instead of date values?
- D3.js nodes not appearing on page load
- how to plot customized JSON data on c3js pie chart?
- How to listen frequent SSE in D3?
- Calculate the height in pixels that corresponds to a value on the axis of D3 graph
- How can I continue displaying a tooltip when it hovers over text in a d3 map
- d3 transition on tooltip not working
- Locale for axis nvd3.js
- Do I have to re-join the whole data set even if only one property in one item changed?
- TreeMap not working with JSON
- Rotate D3 symbol
- How to as mouseover to Line Graph Interactive in D3
- Setting Max Length of Links in D3 Tree Layout
- D3.JS add class to each country
- How to set domain to avoid overlapping dots and axis in d3 plot?
- Code to add mouseover functionality to line chart
- Replacing d3.csv to d3.csv.parse
- How to display parent elements in a nested treemap?
- Using a scale in d3.js to fill up a vertical bar with 3 colors