Opened 3 years ago
Closed 3 years ago
#33637 closed Cleanup/optimization (fixed)
Regression in feature zoom for MapWidget
Reported by: | Claude Paroz | Owned by: | Claude Paroz |
---|---|---|---|
Component: | GIS | Version: | 4.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When I rewrote MapWidget for OpenLayers 3 in [2ebfda38e], the code to autozoom to the initial feature (if present) was changed from:
this.map.zoomToExtent(feat.geometry.getBounds()); if (this.options.geom_name === 'Point') { this.map.zoomTo(this.options.point_zoom); }
to:
this.map.getView().fit(extent, this.map.getSize(), {maxZoom: this.options.default_zoom});
As a result, the zoom is often the default_zoom
, which is mostly not adequate at all (not enough zoom). If we simply remove the maxZoom, the zoom is too high for points (hence the point_zoom
in the initial version). I think instead of maxZoom
, a minResolution
(see https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#fit) would be more appropriate.
We would probably need to reintroduce some point_zoom
variable, as providing a hard-coded value is not an option.
Change History (4)
comment:1 by , 3 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Bug → Cleanup/optimization |
comment:2 by , 3 years ago
Has patch: | set |
---|
I finally opted for a hard-coded value, as IMO a resolution of 1
should be accurate for most (all?) layer types.
comment:3 by , 3 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Using
minResolution
sounds reasonable.