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

layerPositionedContent renders layers in reverse order #2524

Open
jeffbarge opened this issue Nov 20, 2024 · 2 comments
Open

layerPositionedContent renders layers in reverse order #2524

jeffbarge opened this issue Nov 20, 2024 · 2 comments
Assignees
Labels
bug 🪲 Something isn't working

Comments

@jeffbarge
Copy link

Environment

  • Android OS version: 14
  • Devices affected: Moto 5g
  • Maps SDK Version: 11.7.1

Observed behavior and steps to reproduce

When using a Composable function with more than 1 layer, and adding to the map via layerPositionedContent, the first layer added renders on top, which is backwards from when adding the same composable to the mapContent.

Example:

    @Composable
    private fun PolylineBase() {
        val lineSource = rememberGeoJsonSourceState {
            data = GeoJSONData(
                Feature.fromGeometry(
                    LineString.fromLngLats(
                listOf(
                    Point.fromLngLat(0.0, 0.0), Point.fromLngLat(1.0, 1.0))
            )))
        }

        LineLayer(sourceState = lineSource) {
            lineColor = ColorValue(
                Color(0xFF999999)
            )
            lineWidth = DoubleValue(12.0)
            lineBorderWidth = DoubleValue(2.0)
            lineBorderColor = ColorValue(Color(0xFF333333))
        }

        val geoJsonSource = rememberGeoJsonSourceState {
            data = GeoJSONData(Point.fromLngLat(0.0, 0.0))
        }

        SymbolLayer(
            sourceState = geoJsonSource
        ) {
            iconAnchor = IconAnchorValue.BOTTOM
            textField = FormattedValue("Hello Helsinki")
            textColor = ColorValue(Color.Red)
            textColorTransition = Transition(durationMillis = 1000)
            textSize = DoubleValue(20.0)
            textAllowOverlap = BooleanValue(true)
        }
    }

Note that the text from the SymbolLayer renders beneath the LineLayer, even though it was added last.

mapboxBorken

Expected behavior

The last Layer added should render on top. This is the behavior when adding layers to MapContent.

Notes / preliminary analysis

Additional links and references

@jeffbarge jeffbarge added the bug 🪲 Something isn't working label Nov 20, 2024
@jush
Copy link
Member

jush commented Nov 20, 2024

Thanks for the issue. We'll let you know once we've fixed it.

(internal ticket: MAPSAND-1924)

@pengdev
Copy link
Member

pengdev commented Dec 10, 2024

Hi @jeffbarge I can not reproduce the issue on my device, can you share the full code snippet with the way you add this composable to the map?

@pengdev pengdev self-assigned this Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants