Skip to content

Commit

Permalink
#9422 Zoom level issue on OpenLayers (#9429)
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap authored Sep 12, 2023
1 parent 1e14979 commit d741dac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function SelectInput({
function VisibilityLimitsForm({
title,
layer,
zoom,
zoom: zoomProp,
projection,
resolutions = getResolutions(),
defaultLimitsType,
Expand All @@ -104,6 +104,8 @@ function VisibilityLimitsForm({
onChange
}) {

const zoom = Math.round(zoomProp || 0);

const [limitsType, setLimitsType] = useState(defaultLimitsType || limitsTypesOptions[0].value);

const {
Expand Down
7 changes: 6 additions & 1 deletion web/client/components/map/openlayers/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,12 @@ class OpenlayersMap extends React.Component {
projection: normalizeSRS(projection),
center: [center.x, center.y],
zoom: zoom,
minZoom: limits.minZoom
minZoom: limits.minZoom,
// allow to zoom to level 0 and see world wrapping
multiWorld: true,
// does not allow intermediary zoom levels
// we need this at true to set correctly the scale box
constrainResolution: true
}, newOptions || {});
return new View(viewOptions);
};
Expand Down

0 comments on commit d741dac

Please sign in to comment.