From 5d8502d04d69a34be7afcbe2d629ebecfb4b5e53 Mon Sep 17 00:00:00 2001 From: Lanius Trolling Date: Thu, 7 Mar 2024 07:49:26 -0500 Subject: [PATCH] Remove `as?` from Kotlin/JS --- src/mapMain/kotlin/info/mechyrdia/mapviewer/render.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mapMain/kotlin/info/mechyrdia/mapviewer/render.kt b/src/mapMain/kotlin/info/mechyrdia/mapviewer/render.kt index 7eff1b5..50be730 100644 --- a/src/mapMain/kotlin/info/mechyrdia/mapviewer/render.kt +++ b/src/mapMain/kotlin/info/mechyrdia/mapviewer/render.kt @@ -57,8 +57,11 @@ private fun CoroutineScope.openPtr(target: MapObjectPtr, currentSectorId: String setCurrentLocation(target) - if (panToSelection) - (mapPan as? SectorMapPan)?.moveCameraToSelection(galaxyMap.sectors.getValue(currentSectorId!!), selection!!) + if (panToSelection) { + val sectorMapPan = mapPan + if (sectorMapPan is SectorMapPan) + sectorMapPan.moveCameraToSelection(galaxyMap.sectors.getValue(currentSectorId!!), selection!!) + } } else { if (target == GalaxyPtr && currentSectorId != null) renderGalaxy(galaxyMap.sectors.getValue(currentSectorId).location) -- 2.25.1