Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve map_zoom setting when using search parameter #3001

Merged
merged 1 commit into from Oct 18, 2017

Conversation

pfirpfel
Copy link
Contributor

Fitting the map used to ignore the map_zoom parameter. This is annoying when dealing with small features as results. Those will set the map to an unreasonable high zoom level.

This change uses map_zoom as maximum zoom level when fitting the map to the search result.

To test the feature:
make build-gmf-apps examples-hosted-apps serve

Then visit:
http://localhost:3000/.build/examples-hosted/contribs/gmf/apps/desktop_alt/?search=bettingen (defaults to map_zoom == 5 because of the feature size)

http://localhost:3000/.build/examples-hosted/contribs/gmf/apps/desktop_alt/?search=bettingen&map_zoom=3

The example data doesn't have very small features to search for, but this should show the functionality.

@pfirpfel pfirpfel merged commit 109799a into camptocamp:master Oct 18, 2017
@@ -959,7 +964,11 @@ gmf.SearchController.prototype.fulltextsearch_ = function(query, resultIndex) {
const format = new ol.format.GeoJSON();
const feature = format.readFeature(data.features[resultIndex - 1]);
this.featureOverlay_.addFeature(feature);
this.map_.getView().fit(feature.getGeometry().getExtent());
const fitOptions = /** @type {olx.view.FitOptions} */ ({});
if (opt_zoom) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure that the zoom can be 0 but in the case the test will be false.
Should be changed to if (opt_zoom !== undefined) {

@pfirpfel pfirpfel deleted the search-param-zoom branch October 20, 2017 07:00
@sbrunner sbrunner modified the milestones: 2.2, 2.3 Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants