tweaking map scale/zoom
This commit is contained in:
parent
0f0d968a6a
commit
11cbb89821
4 changed files with 17 additions and 17 deletions
|
|
@ -4,4 +4,4 @@ import dev.adamko.kafkatorio.events.schema.PlayerData
|
|||
import io.kvision.maps.Maps
|
||||
import io.kvision.maps.externals.leaflet.geo.LatLng
|
||||
|
||||
fun PlayerData.latLng(): LatLng = Maps.L.latLng((position.y * -1) / 2 to position.x / 2)
|
||||
fun PlayerData.latLng(): LatLng = Maps.L.latLng((position.y * -1) to position.x)
|
||||
|
|
|
|||
|
|
@ -27,22 +27,28 @@ fun createFactorioMap() = Maps {
|
|||
configureLeafletMap {
|
||||
setView(LatLng(0, 0), 1)
|
||||
|
||||
// DefaultTileLayers.OpenStreetMap.addTo(this)
|
||||
|
||||
L.tileLayer(
|
||||
"""http://localhost:9073/tiles/s1/z{z}/x{x}/y{y}.png"""
|
||||
) {
|
||||
attribution = "kafkatorio"
|
||||
tileSize = 256
|
||||
tms = true
|
||||
// minZoom = -2
|
||||
// maxZoom = 1
|
||||
maxNativeZoom = 4
|
||||
minNativeZoom = 0
|
||||
|
||||
minZoom = -2
|
||||
maxZoom = 6
|
||||
|
||||
// NOTE: offset the zoom, so 1 meter = 1 tile
|
||||
maxNativeZoom = 3
|
||||
minNativeZoom = -1
|
||||
zoomOffset = 1
|
||||
|
||||
noWrap = true
|
||||
updateWhenIdle = true
|
||||
updateWhenIdle = false
|
||||
updateWhenZooming = true
|
||||
}.addTo(this)
|
||||
|
||||
|
||||
L.scale {
|
||||
metric = true
|
||||
imperial = false
|
||||
|
|
@ -50,6 +56,7 @@ fun createFactorioMap() = Maps {
|
|||
|
||||
|
||||
options.crs = CRS.Simple
|
||||
options.zoomSnap = 0.1
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue