-
Notifications
You must be signed in to change notification settings - Fork 227
Description
If you are using TransformBasedTileProvider(didn't test with other stuff) and set a new coordinate via MapInformation.SetInformation VectorLayerModule doesn't update the position of tiles.
For StaticApiLayerModule, if you move the MapInformation latitude and longitude a bit, the tile will update its position. If you move far, the tiles respawn. This is ok!
For VectorLayerModule, if you move the MapInformation latitude and longitude a bit, the tile will not update its position. If you move far, the tiles respawn. This is not ok!
I "think" StaticApiLayerModule works fine cause of MapboxMapVisualizer ->Load -> ShowTile calls for IMapInformation.PositionObjectFor, Load is called every frame and that updates the tile position. VectorLayerModule doesn't have that sort of update. The crude way to fix this is to add the same IMapInformation.PositionObjectFor inside VectorLayerVisualizer -> SetActive
public void SetActive(CanonicalTileId canonicalTileId, bool isActive, IMapInformation mapInformation)
{
if (isActive)
{
if (_results.TryGetValue(canonicalTileId, out var visuals))
{
foreach (var entity in visuals)
{
if (_stackList.TryGetValue(entity.StackId, out var stack))
{
var isVisible = stack.IsZinSupportedRange(_mapInformation.AbsoluteZoom);
entity.GameObject.SetActive(isVisible);
_mapInformation.PositionObjectFor(entity.GameObject, canonicalTileId);
}
}
}
}
else
{
UnregisterTile(canonicalTileId);
}
}
But it would update every frame, which could impact performance. I think a better approach would be to tie most of the calls to IMapInformation.PositionObjectFor via IMapInformation.LatitudeLongitudeChanged and IMapInformation.WorldScaleChanged, so they don't happen every single frame. (Sorry, don't have time to write a full PR with this idea)