Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Mar 11, 2019
1 parent 03fbdcc commit cc4edd1
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 306 deletions.
11 changes: 9 additions & 2 deletions web/client/components/map/openlayers/MeasurementSupport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ class MeasurementSupport extends React.Component {
this.helpTooltipElement.classList.remove('hidden');
};

/** trigger the action for updating the state.
* if invalid coords are passed to this they needs to be repushed to the state.
* @param {object} props to be used for calculating measures and other info
* @param {boolean} updatedByUI used for updating the state
*/
updateMeasurementResults = (props, updatedByUI) => {
if (!this.sketchFeature) {
return;
Expand Down Expand Up @@ -405,9 +410,11 @@ class MeasurementSupport extends React.Component {
areaUnit: props.measurement.areaUnit,
updatedByUI
},
// this should not change if the changes comes from ui i.e. olFeatureUpdateByUI
// feature should not change if the changes comes from ui
!updatedByUI ? {
feature: set("geometry.coordinates", this.drawing ? props.measurement.geomType === 'Polygon' ? [dropRight(feature.geometry.coordinates[0], feature.geometry.coordinates[0].length <= 2 ? 0 : 1)] : dropRight(feature.geometry.coordinates) : feature.geometry.coordinates, feature)
feature: set("geometry.coordinates", this.drawing ?
props.measurement.geomType === 'Polygon' ? [dropRight(feature.geometry.coordinates[0], feature.geometry.coordinates[0].length <= 2 ? 0 : 1)] : dropRight(feature.geometry.coordinates) :
feature.geometry.coordinates, feature)
} : {}
);
// checks for invalid coords that needs to be re-added
Expand Down
Loading

0 comments on commit cc4edd1

Please sign in to comment.