Skip to content

Commit

Permalink
fix: 解决冲突
Browse files Browse the repository at this point in the history
  • Loading branch information
syb01094648 committed Nov 17, 2023
2 parents 3751194 + b1d988a commit 850426b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/components/map-control-group/sam-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,39 +239,33 @@ export const SamControl = () => {
data: featureCollection(newFeatures),
}));
// resetFeatures([...features, ...newFeature] as IFeatures);
} else {
message.warning(t('map_control_group.sam.tuXingJieXiCuoWu'));
}
});
}
} else {
message.error(t('map_control_group.sam.qingZaiQuYuNei'));
setPolygonSource(defaultPolygonSource);
}
}
},
{
wait: 1000,
maxWait: 1000,
wait: 2000,
maxWait: 2000,
},
);

useEffect(() => {
if (polygonLayer && hoverPolyonLayer) {
if (samOpen) {
polygonLayer.on('unmousemove', onMapHover);
hoverPolyonLayer.on('click', onMapClick);
} else {
setSource({ data: { type: 'FeatureCollection', features: [] } });
setMarker(undefined);
setPolygonSource(defaultPolygonSource);
polygonLayer.off('unmousemove', onMapHover);
hoverPolyonLayer.off('click', onMapClick);
}
}
return () => {
polygonLayer?.off('unmousemove', onMapHover);
hoverPolyonLayer?.off('click', onMapClick);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [samOpen, scene, onMapHover, onMapClick]);
Expand Down Expand Up @@ -325,7 +319,11 @@ export const SamControl = () => {
</Marker>
)}
<LineLayer {...options} source={source} />
<PolygonLayer {...layerOptions} source={polygonSource} />
<PolygonLayer
{...layerOptions}
source={polygonSource}
onClick={onMapClick}
/>
</>
);
};

0 comments on commit 850426b

Please sign in to comment.