eckhchri / pcars-ds-liveview

Provides a html page for project cars dedicated server and display a map of the current race.
14 stars 1 forks source link

Overhaul of marker transition logic for smooth and not smooth transition #164

Open viper4gh opened 4 years ago

viper4gh commented 4 years ago

Normally markers use a smooth transition (transition with ease) to move to the next point on map. If you drag or zoom the map this smooth transition is suspended and is replaced by a hard transition, it jumps directly to the next point. This is needed because a smooth transition happens from source point A to destination point B and takes some time. If you drag the map in this time for example the pixel coordinates for A and B on your monitor have to be changed, but you can only set the new destination. Because of that we use the hard transition at the moment when you begin to drag or zoom the map. Further it is also used in some other cases where the markers have to be placed on another position on map, for example if the demo file playback jumps from the end to the beginning.

In current state we use a timer with a fixed value in milliseconds from config file to define how long the smooth transition is supended.

Better solution should be to count worker runs, because the interval between two worker runs can vary depending on the configured worker delay and response times of the API.

Further check again which google maps event handler can be used as trigger for suspending the smooth transition and which can be used to start the worker run counter for reactivating the smooth transition.

viper4gh commented 4 years ago

ToDo: Remove old code with StopTransitionDelay_StartTime etc.

There are still problems if you fast drag the map and release the mouse button. Then the markers move from an old position with smooth transition to the next one. Also if you zoom out a lot.

viper4gh commented 4 years ago

There are still sometimes problems if you zoom the map a lot.

viper4gh commented 4 years ago

Zoom seems to work now, too.