Merge pull request #9979 from mfo/US/fix-point-input

ETQ usager: fix comportement des marqueurs de la carte dans les blocs répétables
This commit is contained in:
Colin Darie 2024-02-09 10:03:50 +00:00 committed by GitHub
commit c4bdef3a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View file

@ -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(

View file

@ -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);
}