Avoid reflow caused by restriction editor checking its dimensions

This commit is contained in:
Bryan Housel
2018-11-10 00:40:45 -05:00
parent 05a5563a41
commit 4a3d5e2316
2 changed files with 14 additions and 3 deletions
+8 -1
View File
@@ -235,7 +235,14 @@ export function uiFieldRestrictions(field, context) {
var filter = utilFunctor(true);
var projection = geoRawMercator();
var d = utilGetDimensions(selection);
// Reflow warning: `utilGetDimensions` calls `getBoundingClientRect`
// Instead of asking the restriction-container for its dimensions,
// we can ask the #sidebar, which can have its dimensions cached.
// width: calc as sidebar - padding
// height: hardcoded (from `80_app.css`)
// var d = utilGetDimensions(selection);
var sdims = utilGetDimensions(d3_select('#sidebar'));
var d = [ sdims[0] - 50, 370 ];
var c = geoVecScale(d, 0.5);
var z = 22;