Skip to content

Commit 3b964c9

Browse files
committed
[wip] draw rangeBox on map
1 parent 190c733 commit 3b964c9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/plots/geo/geo.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,19 @@ proto.updateProjection = function(fullLayout, geoLayout) {
181181
var lataxis = geoLayout.lataxis;
182182
var rangeBox = makeRangeBox(lonaxis.range, lataxis.range);
183183

184+
185+
this.rangeBox = rangeBox;
186+
184187
// fit projection 'scale' and 'translate' to set lon/lat ranges
185188
projection.fitExtent(extent, rangeBox);
186189

187190
var b = this.bounds = projection.getBounds(rangeBox);
188191
var s = this.fitScale = projection.scale();
189192
var t = projection.translate();
190193

194+
console.log('range', lonaxis.range, lataxis.range)
195+
console.log('bounds', b[0], b[1])
196+
191197
if(
192198
!isFinite(b[0][0]) || !isFinite(b[0][1]) ||
193199
!isFinite(b[1][0]) || !isFinite(b[1][1]) ||
@@ -249,7 +255,7 @@ proto.updateBaseLayers = function(fullLayout, geoLayout) {
249255
}
250256

251257
function isLineLayer(d) {
252-
return Boolean(constants.lineLayers[d]);
258+
return Boolean(constants.lineLayers[d]) || d === 'rangebox';
253259
}
254260

255261
function isFillLayer(d) {
@@ -266,6 +272,8 @@ proto.updateBaseLayers = function(fullLayout, geoLayout) {
266272
true;
267273
});
268274

275+
// layerData.push('rangebox');
276+
269277
var join = _this.framework.selectAll('.layer')
270278
.data(layerData, String);
271279

@@ -308,6 +316,13 @@ proto.updateBaseLayers = function(fullLayout, geoLayout) {
308316
var path = basePaths[d];
309317
var adj = constants.layerNameToAdjective[d];
310318

319+
if(d === 'rangebox') {
320+
path.datum(_this.rangeBox)
321+
.style('stroke', 'red')
322+
.style('stroke-width', '4px')
323+
return;
324+
}
325+
311326
if(d === 'frame') {
312327
path.datum(constants.sphereSVG);
313328
} else if(isLineLayer(d) || isFillLayer(d)) {

0 commit comments

Comments
 (0)