mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Avoid reflow caused by restriction editor checking its dimensions
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user