Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map became much larger than restricted size #1941

Open
Psijic opened this issue Sep 29, 2023 · 0 comments
Open

Map became much larger than restricted size #1941

Psijic opened this issue Sep 29, 2023 · 0 comments

Comments

@Psijic
Copy link

Psijic commented Sep 29, 2023

I'm trying to make a small static map with a limited height and a marker on it. I set tile size 256 and in rare cases it shows well but often the map becomes much higher and overlaps other views. With tile size 512 I never see the proper map size.

    LaunchedEffect(mapView) {
        with(mapView) {
            setTileSource(MyTileSource(256))

            controller.setCenter(GeoPoint(markerPosition.latitude, markerPosition.longitude))
            controller.setZoom(17.0)
            val boundingBox = BoundingBox(
                markerPosition.latitude,
                markerPosition.longitude,
                markerPosition.latitude,
                markerPosition.longitude
            )
            setScrollableAreaLimitDouble(boundingBox)
            setMultiTouchControls(false)

            zoomController.setVisibility(CustomZoomButtonsController.Visibility.NEVER)

            val marker = Marker(this).apply {
                position = GeoPoint(markerPosition.latitude, markerPosition.longitude)
                icon = ContextCompat.getDrawable(context, R.drawable.marker_red)

                this.setOnMarkerClickListener { _, _ ->
                    onMarkerClick()
                    false
                }
            }

            overlays.add(marker)
        }
    }

    AndroidView(factory = { mapView }, modifier = Modifier.fillMaxWidth() .height(192.dp))

Version of osmdroid the issue relates to:

6.1.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant