diff --git a/modules/ui/fields/restrictions.js b/modules/ui/fields/restrictions.js index eb377eb10..c0104a4d8 100644 --- a/modules/ui/fields/restrictions.js +++ b/modules/ui/fields/restrictions.js @@ -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; diff --git a/modules/ui/init.js b/modules/ui/init.js index 48977559f..497201b0a 100644 --- a/modules/ui/init.js +++ b/modules/ui/init.js @@ -390,8 +390,12 @@ export function uiInit(context) { ui.onResize = function(withPan) { var map = context.map(); - var content = d3_select('#content'); - var mapDimensions = utilGetDimensions(content, true); + + // Recalc dimensions of map and sidebar.. (`true` = force recalc) + // This will call `getBoundingClientRect` and trigger reflow, + // but the values will be cached for later use. + var mapDimensions = utilGetDimensions(d3_select('#content'), true); + utilGetDimensions(d3_select('#sidebar'), true); if (withPan !== undefined) { map.redrawEnable(false);