fix(cartes): PointInput should not add point to all map on page
This commit is contained in:
parent
6a0b17a3ef
commit
4209eec021
2 changed files with 12 additions and 5 deletions
|
@ -147,16 +147,20 @@ function useExternalEvents(
|
|||
|
||||
const onFeatureCreate = useCallback(
|
||||
({ detail }) => {
|
||||
const { geometry, properties } = detail;
|
||||
|
||||
if (geometry) {
|
||||
const { feature } = detail;
|
||||
const { geometry, properties } = feature;
|
||||
if (
|
||||
feature &&
|
||||
feature.geometry &&
|
||||
detail.featureCollection == featureCollection
|
||||
) {
|
||||
createFeatures({
|
||||
features: [{ type: 'Feature', geometry, properties }],
|
||||
external: true
|
||||
});
|
||||
}
|
||||
},
|
||||
[createFeatures]
|
||||
[createFeatures, featureCollection]
|
||||
);
|
||||
|
||||
const onFeatureUpdate = useCallback(
|
||||
|
|
|
@ -23,7 +23,10 @@ export function PointInput({
|
|||
};
|
||||
const addPoint = () => {
|
||||
if (feature) {
|
||||
fire(document, 'map:feature:create', feature);
|
||||
fire(document, 'map:feature:create', {
|
||||
feature,
|
||||
featureCollection
|
||||
});
|
||||
setValue('');
|
||||
setFeature(null);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue