bonham / trackmanager

GNU General Public License v3.0
2 stars 0 forks source link

FilteredMap change triggers should be more explicit #66

Closed bonham closed 2 years ago

bonham commented 2 years ago

Current implementation is hard to understand: ( Especially with shift klick )

What happens when klicking track on map:

  1. Select Interaction will process the klick
  2. add track to select collection ( could be second track when using shift-klick )
  3. visually highlight the selected tracks
  4. Callback function selectTrackAndScroll ( from store ) will be called and mutate $store.state.selectedTrack
  5. FilteredTrackList will listen and manage selection in list
  6. FilteredMap will listen and again mutate select collection -> bad ( clear and set track )
  7. In above step we implicitely manage that we can not select multiple tracks -> not elegant

Possible solutions: FilteredMap should not watch on changes of selectTrack directly, but instead only update selection collection on request ( e.g. new state in store ) Maybe FilteredMap should be entirely passive and parent SelectTracksPage should watch and send commands? not sure

General problem pattern is: FilteredMap has a hard time to distinguish between changes coming from map interaction or from store by external trigger Possible solution: use more states for selected tracks: one for filteredList and a separate one for selected tracks ( that could be only inside FilteredMap )