Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions documentation/docs/05-changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## CHANGELOG
### v.1.4.2
*??/??/2018*

##### New Features
- Add `OnUpdated` event to `AbstractMap`. Enables subscribers to get a notification when the map location and/or zoom gets updated.
### v.1.4.1
*04/17/2018*

Expand Down
16 changes: 16 additions & 0 deletions sdkproject/Assets/Mapbox/Unity/Map/AbstractMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,18 @@ public void SetWorldRelativeScale(float scale)
{
_worldRelativeScale = scale;
}

/// <summary>
/// Event delegate, gets called after map is initialized
/// <seealso cref="OnUpdated"/>
/// </summary>
public event Action OnInitialized = delegate { };
/// <summary>
/// Event delegate, gets called after map is updated.
/// <c>UpdateMap</c> will trigger this event.
/// <seealso cref="OnInitialized"/>
/// </summary>
public event Action OnUpdated = delegate { };

void Awake()
{
Expand Down Expand Up @@ -502,6 +513,11 @@ public virtual void UpdateMap(Vector2d latLon, float zoom)
_mapScaleFactor.y = 1;
Root.localScale = _mapScaleFactor;
}

if (OnUpdated != null)
{
OnUpdated();
}
}
/// <summary>
/// Resets the map.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ void Awake()
}
_directions = MapboxAccess.Instance.Directions;
_map.OnInitialized += Query;
_map.OnUpdated += Query;
}

void OnDestroy()
{
_map.OnInitialized -= Query;
_map.OnUpdated -= Query;
}

void Query()
Expand Down Expand Up @@ -121,4 +123,4 @@ GameObject CreateGameObject(MeshData data)
}
}

}
}