googleway icon indicating copy to clipboard operation
googleway copied to clipboard

Clear Markers retains view

Open dcooley opened this issue 2 years ago • 2 comments

For me, the first marker (let's say a house in Massachusetts) I add, the map will zoom to it, then I clear markers, then I add a second marker (let's say a house in California), the map will not zoom to that house, but will be on a zoom and extent that shows the first marker and the second (even though the markers were cleared). The map seems to remember the markers even if they are cleared

Originally posted by @kaheil in https://github.com/SymbolixAU/googleway/issues/130#issuecomment-1135234056


The underlying issue is, the clear_() methods should also remove / update the bounds to only the currently visible layers.

dcooley avatar May 24 '22 00:05 dcooley

@kaheil the immediate solution I think is to set add_markers(, ... , focus_layer = TRUE). Using focus_layer will re-center the map to only what's included in the data for this layer.

dcooley avatar May 24 '22 00:05 dcooley

@kaheil the immediate solution I think is to set add_markers(, ... , focus_layer = TRUE). Using focus_layer will re-center the map to only what's included in the data for this layer.

this fixed the issue! thanks so much!

kaheil avatar May 25 '22 12:05 kaheil