visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.35k forks source link

[Bug] Polygon lines disappear after zooming out #2141

Closed orelHAnyvision closed 1 year ago

orelHAnyvision commented 1 year ago

Description

Im trying to create a polygon out of some given coordinates when I zoom out lines randomly disappear

Expected Behavior

Polygon should keep its shape on zoom in/out

Steps to Reproduce

<Map
      interactiveLayerIds={['lineLayer']}
      ref={mapRef as any}
      initialViewState={{
        ...defaultCoordinates,
        zoom: 10,
        pitch: 40
      }}
      mapStyle='mapbox://styles/mapbox/streets-v9'
      mapboxAccessToken='XXX'
      attributionControl={false}
    >
      <NavigationControl
        position='bottom-right'
        showCompass={false}
        visualizePitch
      />
      <GeolocateControl />
      <FullscreenControl position='bottom-right' />
      {markers.map(marker => (
        <Marker longitude={marker.location[0]} latitude={marker.location[1]}> </Marker>
      ))}
      <Source
        id='devicesPolygon'
        type='geojson'
        data={
          {
            type: 'Feature',
            geometry: {
              type: 'Polygon',
              coordinates: [
                [
                  [-0.2784185766806502, 51.42160464725217],
                  [0.19152843529769825, 51.64685837948534],
                  [-0.15773135757368095, 51.27696693652959]
                ]
              ]
            }
          } as any
        }
        tolerance={0.00001}
      >
        <Layer
          id='lineLayer'
          type='line'
          layout={{
            'line-cap': 'round',
            'line-join': 'round'
          }}
          paint={{
            'line-color': 'red',
            'line-width': 4
          }}
        />
      </Source>
     </Map>

Screenshot 2023-03-15 at 19 29 33 Screenshot 2023-03-15 at 19 29 21

Environment

Logs

No response

Pessimistress commented 1 year ago

This library does not draw anything. You need to report any rendering issue to the mapbox-gl repo.