Skip to content

Commit 1f87a82

Browse files
committed
wip
1 parent 5304522 commit 1f87a82

File tree

1 file changed

+5
-6
lines changed
  • front/src/common/IntervalsDataViz

1 file changed

+5
-6
lines changed

front/src/common/IntervalsDataViz/data.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -662,14 +662,11 @@ export function getClosestOperationalPoint(
662662
* @returns The entity modified in adquation
663663
*/
664664

665-
// The modification of the linestring modifies the entity real properties only during initialization.
666665
export function entityDoUpdate<T extends EditorEntity>(entity: T, sourceLine: LineString): T {
667666
const newProps: EditorEntity['properties'] = { id: entity.properties.id };
668-
if (entity.properties.length === 0) {
669-
newProps.length = getLineStringDistance(entity.geometry as LineString);
670-
return { ...entity, properties: newProps };
671-
}
672-
if (entity.geometry.type === 'LineString' && !isNil(entity.properties)) {
667+
// The modification of the linestring modifies the entity real properties only during initialization.
668+
const isInitialized = sourceLine.coordinates.length === 0;
669+
if (entity.geometry.type === 'LineString' && !isNil(entity.properties) && isInitialized) {
673670
Object.keys(entity.properties).forEach((name) => {
674671
const value = (entity.properties as { [key: string]: unknown })[name];
675672
// is a LM ?
@@ -679,6 +676,8 @@ export function entityDoUpdate<T extends EditorEntity>(entity: T, sourceLine: Li
679676
newProps[name] = value;
680677
}
681678
});
679+
newProps.length = getLineStringDistance(entity.geometry as LineString);
680+
return { ...entity, properties: newProps };
682681
}
683682
return entity;
684683
}

0 commit comments

Comments
 (0)