Remove `as?` from Kotlin/JS
authorLanius Trolling <lanius@laniustrolling.dev>
Thu, 7 Mar 2024 12:49:26 +0000 (07:49 -0500)
committerLanius Trolling <lanius@laniustrolling.dev>
Thu, 7 Mar 2024 12:49:26 +0000 (07:49 -0500)
src/mapMain/kotlin/info/mechyrdia/mapviewer/render.kt

index 7eff1b56eca45d95516957995a9a6b680753c1e3..50be7303eb9b420f52ecca3134ff417dd15af32c 100644 (file)
@@ -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)