feat: add Jordan places migration scripts and enhance map controller with style-load safety and camera controls
This commit is contained in:
@@ -47,6 +47,7 @@ class IntaleqMapController {
|
||||
/// [setUserMarker]. Reset to null on style reload (native symbol is
|
||||
/// destroyed) so the next update re-adds it.
|
||||
mgl.Symbol? _userSymbol;
|
||||
Marker? _pendingUserMarker;
|
||||
bool _userSymbolBusy = false;
|
||||
bool _isStyleLoaded = false;
|
||||
CameraUpdate? _pendingCameraUpdate;
|
||||
@@ -369,15 +370,21 @@ class IntaleqMapController {
|
||||
/// dropped, and the next tick supplies fresh coordinates). The puck is
|
||||
/// re-created automatically after a style reload.
|
||||
Future<void> setUserMarker(Marker marker) async {
|
||||
if (!_isStyleLoaded || _userSymbolBusy) return;
|
||||
if (!_isStyleLoaded) return;
|
||||
_pendingUserMarker = marker;
|
||||
if (_userSymbolBusy) return;
|
||||
_userSymbolBusy = true;
|
||||
try {
|
||||
await _loadBitmapIfNeeded(marker.icon);
|
||||
final symbol = _userSymbol;
|
||||
if (symbol == null) {
|
||||
_userSymbol = await _raw.addSymbol(marker.toSymbolOptions());
|
||||
} else {
|
||||
await _raw.updateSymbol(symbol, marker.toSymbolOptions());
|
||||
while (_pendingUserMarker != null) {
|
||||
final m = _pendingUserMarker!;
|
||||
_pendingUserMarker = null;
|
||||
await _loadBitmapIfNeeded(m.icon);
|
||||
final symbol = _userSymbol;
|
||||
if (symbol == null) {
|
||||
_userSymbol = await _raw.addSymbol(m.toSymbolOptions());
|
||||
} else {
|
||||
await _raw.updateSymbol(symbol, m.toSymbolOptions());
|
||||
}
|
||||
}
|
||||
} catch (_) {
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user