From 303734daaa2eb4f151eb02bde81f55e7258f499f Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 14 Mar 2022 22:22:03 +0100 Subject: [PATCH] default zoom, reduce by one --- .../src/main/kotlin/dev/adamko/kafkatorio/webmap/map.kt | 5 +---- .../src/main/kotlin/dev/adamko/kafkatorio/webmap/state.kt | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/map.kt b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/map.kt index 21ee00b..bd3717e 100644 --- a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/map.kt +++ b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/map.kt @@ -25,8 +25,7 @@ fun createFactorioMap() = Maps { margin = 10.px configureLeafletMap { - setView(LatLng(0, 0), 1) - + setView(center = LatLng(0, 0), zoom = 0) L.tileLayer( """http://localhost:9073/tiles/s1/z{z}/x{x}/y{y}.png""" @@ -38,10 +37,8 @@ fun createFactorioMap() = Maps { minZoom = -2 maxZoom = 6 - // NOTE: offset the zoom, so 1 meter = 1 tile maxNativeZoom = 3 minNativeZoom = -1 -// zoomOffset = 1 noWrap = true updateWhenIdle = false diff --git a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state.kt b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state.kt index 041eff0..451c401 100644 --- a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state.kt +++ b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state.kt @@ -99,7 +99,10 @@ class PlayerState( val name = update.name ?: playerDetails.name return when { - position != null && surfaceIndex != null && colour != null && name != null -> + position != null + && surfaceIndex != null + && colour != null + && name != null -> PlayerDetailsState.Known( index = playerDetails.index, position = position, @@ -108,7 +111,7 @@ class PlayerState( name = name, ) - else -> + else -> PlayerDetailsState.Unknown( index = playerDetails.index, position = position,