(geo, projection)
| 67 | |
| 68 | // zoom for scoped projections |
| 69 | function 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 |
| 111 | function zoomNonClipped(geo, projection) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…