1

MapboxGL.ShapeSource我使用并在每个点上添加一个多边形MapboxGLView.PointAnnotation以使点可拖动。

但我面临问题

当我完成多边形的绘制时,我无法移动或拖动多边形

 Polygon Data => {"coordinates": [[73.66673886505973, 21.78762724903116], [73.66889536107317, 21.791363112441147], [73.66555869310983, 21.79017760900554]]}

这是我的代码

 <MapboxGL.Animated.ShapeSource
     id={'Polygon'}
     maxZoomLevel={17}
    onPress={(event: any) => {
      console.log('Shape is pressed ', event);
    }}
    shape={{
      type: 'Feature',
      geometry: {
        type: 'Polygon',
        coordinates: coordinates,
      },
    }}>

    <MapboxGL.FillLayer
      id="routefill"
      sourceID="Polygon"
      style={{fillColor: fillColor}}
    />
    <MapboxGL.LineLayer
      id="routeline"
      sourceID="Polygon"
      belowLayerID="routefill"
      style={{
        lineWidth: 5,
        // lineOpacity: 0.5,
        lineJoin: 'round',
        lineCap: 'round',
        lineDasharray: [2, 2],
        lineColor: strokeColor,
      }}
    />

   </MapboxGL.Animated.ShapeSource>

谁能帮助我如何使多边形可拖动

4

0 回答 0