mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

iOS: LineLayer only fully renders at certain zoom levels

Open jaggerharness opened this issue 1 year ago • 1 comments

Using the 0.5.1 release of the package, I've noticed that my LineLayers loaded from a GeoJSON source are only fully rendered in when I zoom in to a certain level. This issue is not impacting the Android builds of my application, only iOS.

In my onStyleLoaded callback I execute the following code:

await map?.style.addSource(GeoJsonSource(
      id: "source", data: json.encode(trailMapping), lineMetrics: true));

await map?.style.addLayer(LineLayer(
  id: 'layer-bg',
  sourceId: 'source',
  lineCap: LineCap.SQUARE,
  lineJoin: LineJoin.BEVEL,
  lineBlur: 0,
  lineColor: Colors.blue[800]?.value,
  lineTrimOffset: [0.0, 0.0],
  lineWidth: 24.0,
));

await map?.style.addLayer(LineLayer(
    id: 'layer-fg',
    sourceId: 'source',
    lineCap: LineCap.SQUARE,
    lineJoin: LineJoin.BEVEL,
    lineBlur: 0,
    lineColor: Colors.blue.value,
    lineTrimOffset: [0.0, 0.0],
    lineWidth: 16.0,
  ));

  await map?.style.addLayer(LineLayer(
    id: 'layer-actual',
    sourceId: 'source',
    lineCap: LineCap.SQUARE,
    lineJoin: LineJoin.BEVEL,
    lineBlur: 0,
    lineColor: Colors.orangeAccent.value,
    lineDasharray: [1.2, 1.8],
    lineTrimOffset: [0.0, 0.0],
    lineWidth: 3.0,
  ));

I have tested with multiple sized data sources and have been unable to find a workaround for the issue. Is it something I am missing or is there a workaround I can implement which will allow the layer to be visible at all zoom levels?

https://github.com/mapbox/mapbox-maps-flutter/assets/59837566/89314ef3-0663-46e6-b3f8-46228c37f40e

Flutter 3.16.8 • channel stable • https://github.com/flutter/flutter.git Framework • revision 67457e669f (3 weeks ago) • 2024-01-16 16:22:29 -0800 Engine • revision 6e2ea58a5c Tools • Dart 3.2.5 • DevTools 2.28.5

jaggerharness avatar Feb 06 '24 20:02 jaggerharness

I just tested using the 1.0.0-rc.1 release and am still experiencing the issue specifically on iOS devices. If this is a bug, I would be interested in investigating a fix for it with some direction on where to begin.

jaggerharness avatar Feb 21 '24 17:02 jaggerharness

Just revisited this issue and determined the problem was on my end due to how I was using lineTrimOffset. Closing this issue.

jaggerharness avatar Jul 30 '24 14:07 jaggerharness