Reputation: 63
Anyone know how you can disable the scale on the mapbox map. I've been trying but i just can't get to wrap my head around it, and there seems to be no documentation on how you can do it on their site.
below is the code for my map widget. am using Jetpack compose Android and running mapbox sdk 11.7.1
on android studio ladybug
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.mapbox.maps.extension.compose.MapEffect
import com.mapbox.maps.extension.compose.MapboxMap
import com.mapbox.maps.extension.compose.animation.viewport.rememberMapViewportState
import com.mapbox.maps.plugin.PuckBearing
import com.mapbox.maps.plugin.locationcomponent.createDefault2DPuck
import com.mapbox.maps.plugin.locationcomponent.location
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
MapViewActivity()
}
}
}
@Composable
fun MapViewActivity() {
val mapViewportState = rememberMapViewportState()
MapboxMap(
Modifier.fillMaxSize(),
mapViewportState = mapViewportState,
) {
MapEffect(Unit) { mapView ->
mapView.location.updateSettings {
locationPuck = createDefault2DPuck(withBearing = true)
pulsingEnabled = true
enabled = true
puckBearing = PuckBearing.COURSE
puckBearingEnabled = true
}
mapViewportState.transitionToFollowPuckState()
}
}}
Upvotes: 0
Views: 102
Reputation: 449
Just add scaleBar = { }
.
Like this:
MapboxMap(
Modifier
.fillMaxSize(),
mapViewportState = mapViewportState,
scaleBar = { }
)
Upvotes: 0
Reputation: 81
I disabled the scalebar the following way:
mapView.scalebar.enabled = false
But I am using Mapbox version "11.1.0"
Upvotes: 0