Skip to content

Commit d5d352c

Browse files
committed
no longer need to add fitExtend from d3 v4
1 parent f46e4af commit d5d352c

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

src/plots/geo/geo.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,6 @@ proto.render = function() {
660660

661661
// Helper that wraps d3[geo + /* Projection name /*]() which:
662662
//
663-
// - adds 'fitExtent' (available in d3 v4)
664663
// - adds 'getPath', 'getBounds' convenience methods
665664
// - scopes logic related to 'clipAngle'
666665
// - adds 'isLonLatOverEdges' method
@@ -716,31 +715,6 @@ function getProjection(geoLayout) {
716715
return projection.getPath().bounds(object);
717716
};
718717

719-
// adapted from d3 v4:
720-
// https://github.com/d3/d3-geo/blob/master/src/projection/fit.js
721-
projection.fitExtent = function(extent, object) {
722-
var w = extent[1][0] - extent[0][0];
723-
var h = extent[1][1] - extent[0][1];
724-
var clip = projection.clipExtent && projection.clipExtent();
725-
726-
projection
727-
.scale(150)
728-
.translate([0, 0]);
729-
730-
if(clip) projection.clipExtent(null);
731-
732-
var b = projection.getBounds(object);
733-
var k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1]));
734-
var x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2;
735-
var y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
736-
737-
if(clip) projection.clipExtent(clip);
738-
739-
return projection
740-
.scale(k * 150)
741-
.translate([x, y]);
742-
};
743-
744718
projection.precision(constants.precision);
745719

746720
if(clipAngle) {

0 commit comments

Comments
 (0)