Skip to content
Snippets Groups Projects

Socket update

Merged L4929 requested to merge socket-update into development
5 files
+ 82
78
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -152,6 +152,7 @@ class DrawTools extends Component {
@@ -152,6 +152,7 @@ class DrawTools extends Component {
} // end if (e.layerType === "textbox")
} // end if (e.layerType === "textbox")
this.makeGeoJSON(e.layerType, e.layer);
this.makeGeoJSON(e.layerType, e.layer);
 
e.layer.remove();
}; // end _onCreated
}; // end _onCreated
// turn layer to GeoJSON data
// turn layer to GeoJSON data
@@ -159,7 +160,8 @@ class DrawTools extends Component {
@@ -159,7 +160,8 @@ class DrawTools extends Component {
// setting the format in which the data will be sent
// setting the format in which the data will be sent
let geoJSON = {
let geoJSON = {
data: layer.toGeoJSON(),
data: layer.toGeoJSON(),
mapDrawingId: layer.options.id
mapDrawingId: layer.options.id,
 
drawingIsActive: true
};
};
// setting properties
// setting properties
@@ -179,7 +181,7 @@ class DrawTools extends Component {
@@ -179,7 +181,7 @@ class DrawTools extends Component {
geoJSON.data.properties.color = layer.options.color;
geoJSON.data.properties.color = layer.options.color;
// send item to database, and receive an ID for the layer
// send item to database, and receive an ID for the layer
this.props.sendGeoJSON(geoJSON, false);
this.props.sendGeoJSON(geoJSON);
};
};
_onEditDeleteStart = () => {
_onEditDeleteStart = () => {
@@ -209,6 +211,7 @@ class DrawTools extends Component {
@@ -209,6 +211,7 @@ class DrawTools extends Component {
} else {
} else {
this.makeGeoJSON(null, layer);
this.makeGeoJSON(null, layer);
}
}
 
return true;
});
});
};
};
@@ -223,14 +226,16 @@ class DrawTools extends Component {
@@ -223,14 +226,16 @@ class DrawTools extends Component {
idsToDelete.map(layer => {
idsToDelete.map(layer => {
let geoJSON = {
let geoJSON = {
data: layer.toGeoJSON(),
data: layer.toGeoJSON(),
mapDrawingId: layer.options.id
mapDrawingId: layer.options.id,
 
drawingIsActive: false
};
};
this.props.sendGeoJSON(geoJSON, true);
this.props.sendGeoJSON(geoJSON);
 
return true;
});
});
};
};
shouldComponentUpdate() {
shouldComponentUpdate(nextProps, nextState) {
// disable re-rendering when edit mode is active
// disable re-rendering when edit mode is active
return !this.state.editModeActive;
return !this.state.editModeActive;
}
}
@@ -326,9 +331,9 @@ class DrawTools extends Component {
@@ -326,9 +331,9 @@ class DrawTools extends Component {
className="editable"
className="editable"
interactive={true}
interactive={true}
>
>
<div class="editable">
<div className="editable">
<div
<div
contenteditable="true"
contentEditable="true"
placeholder="Click out to save"
placeholder="Click out to save"
>
>
{text}
{text}
@@ -388,6 +393,7 @@ class DrawTools extends Component {
@@ -388,6 +393,7 @@ class DrawTools extends Component {
/>
/>
);
);
}
}
 
return null;
})}
})}
</FeatureGroup>
</FeatureGroup>
);
);
Loading