Skip to content

Commit

Permalink
Merge pull request #3187 from Geoportail-Luxembourg/fix_reverse
Browse files Browse the repository at this point in the history
If a map is initializated with an height of 0 then force the map refr…
  • Loading branch information
rmichaelis authored Aug 28, 2024
2 parents 75959ae + d11f40e commit 3291cd0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions geoportal/jsapi/src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,11 @@ class Map extends OpenLayersMap {
'public.lu', 'etat.lu', 'inondations.lu', 'visit-fouhren.lu', 'visit-hoscheid.lu', 'visitjunglinster.lu', 'visitreisdorf.lu', 'visitrosportmompach.lu',
'mae.lu', 'gouvernement.lu', 'meteolux.lu', 'luxemburg.infomax.online'];

/**
* @private
*/
this.resizeObserver_ = undefined;

/**
* @private
* @type {boolean}
Expand Down Expand Up @@ -713,6 +718,31 @@ class Map extends OpenLayersMap {
options.callback.call(this);
}.bind(this));
}
/**
* @private
* @type {function()}
*/
this.cbResize_ = function(entries) {
for (let entry of entries) {
if (entry.contentRect.width > 0 &&
entry.contentRect.height > 0) {
this.updateSize();
if (this.resizeObserver_ !== undefined) {
this.resizeObserver_.unobserve(this.getTargetElement());
this.resizeObserver_ = undefined;
}
}
}
}
try {
if (this.getTargetElement().clientHeight == 0 ||
this.getTargetElement().clientWidth == 0) {
this.resizeObserver_ = new ResizeObserver(this.cbResize_.bind(this));
this.resizeObserver_.observe(this.getTargetElement())
}
} catch(e) {
console.log(e);
}
}

/**
Expand Down

0 comments on commit 3291cd0

Please sign in to comment.