Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Map controls breaks auto zoom

Hi!

I have an application with a map,connected to zip codes and cities. When I choose a city, the map auto zooms to the best fit of the selection. So far so good.

I have also made some navigation buttons in the application, so one can pan and zoom as one wants.

The problem arises when combining these two. If I for example zooms in using my button, when I then select a city, the map doesn't auto zoom. I will have to reload the data to get the auto zoom to work again. Then the auto zoom works again, until I click any of my navigation buttons.

Anyone know what's wrong?

I'm sorry, but due to the content of the data I can't share the application.

Thanks and regards

1 Solution

Accepted Solutions
Not applicable
Author

I think it may have to be due to the fact that I overwrite the variables used in the auto zoom. When the variables are declared in the load script, they are a string. But with the button, I say for example; zoom = zoom +1.

Edit: It was as I suspected. Instead, I created a variable var_zoom_offset, and replaced var_zoom with var_zoom + var_zoom_offset in the expressions, and added and subtracted from the offset with the buttons.

View solution in original post

1 Reply
Not applicable
Author

I think it may have to be due to the fact that I overwrite the variables used in the auto zoom. When the variables are declared in the load script, they are a string. But with the button, I say for example; zoom = zoom +1.

Edit: It was as I suspected. Instead, I created a variable var_zoom_offset, and replaced var_zoom with var_zoom + var_zoom_offset in the expressions, and added and subtracted from the offset with the buttons.