Skip to content

fix: improve centering on pins selected from search (MIN-209)

Closes MIN-209

Objective:

Improve centering on pins selected from search by zooming to visible pins on map selected from search

Solution:

Manually click the location button which zooms to currently visible pins

Why we've decided on that solution:

I initially implemented a solution for predicting the coordinates of a points layer (effectively all pins visible on a map with a given ID), but unfortunately, a new issue arose.

The pointToProjection function (transforming points in cartesian space into a geographic representation) relies on data from mapSize for the currently open submap (so the processed data with the help of the function I prepared is always incorrect).

For this reason, it became an alternative to bypass this situation by defining the last position of the open map (to be determined before it was opened). But here, too, it is not a simple matter, because it is impossible to define this position when the map is not open, so another unpredictable side-effect arises. Furthermore, when setting this submap position, we cannot easily determine the correct zoom. Based on the data of the pins themselves, we can only extract the x/y centre point and that's it.

The whole problem grows with the next steps. A potential solution in this artful direction would have been too costly in terms of time relative to the business impact achieved.

In making our decision, we took into account the complexity of solving such a simple problem, taking into account the possible side-effects (in each case), as well as the time we could devote to implementing this improvement. We therefore opted for a simpler solution, which is a shortcut that leads us towards achieving our business goal, despite the fact that it is technically poorly executed.

Merge request reports