MCPcopy Index your code
hub / github.com/plotly/plotly.js / zoomScoped

Function zoomScoped

src/plots/geo/zoom.js:69–108  ·  view source on GitHub ↗
(geo, projection)

Source from the content-addressed store, hash-verified

67
68// zoom for scoped projections
69function zoomScoped(geo, projection) {
70 var zoom = initZoom(geo, projection);
71
72 function handleZoomstart() {
73 d3.select(this).style(zoomstartStyle);
74 }
75
76 function handleZoom() {
77 projection
78 .scale(d3.event.scale)
79 .translate(d3.event.translate);
80 geo.render(true);
81
82 var center = projection.invert(geo.midPt);
83 geo.graphDiv.emit('plotly_relayouting', {
84 'geo.projection.scale': projection.scale() / geo.fitScale,
85 'geo.center.lon': center[0],
86 'geo.center.lat': center[1]
87 });
88 }
89
90 function syncCb(set) {
91 var center = projection.invert(geo.midPt);
92
93 set('center.lon', center[0]);
94 set('center.lat', center[1]);
95 }
96
97 function handleZoomend() {
98 d3.select(this).style(zoomendStyle);
99 sync(geo, projection, syncCb);
100 }
101
102 zoom
103 .on('zoomstart', handleZoomstart)
104 .on('zoom', handleZoom)
105 .on('zoomend', handleZoomend);
106
107 return zoom;
108}
109
110// zoom for non-clipped projections
111function zoomNonClipped(geo, projection) {

Callers

nothing calls this directly

Calls 1

initZoomFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…