From cc62ff3892270b8bb5dd2161001a6619dc876237 Mon Sep 17 00:00:00 2001
From: Jussi Surma-Aho <L4929@student.jamk.fi>
Date: Mon, 24 Jun 2019 13:24:28 +0300
Subject: [PATCH] repeatMode for circle and rectangle changed to false

---
 src/components/DrawTools.js | 131 ++++++++++++++++++------------------
 1 file changed, 64 insertions(+), 67 deletions(-)

diff --git a/src/components/DrawTools.js b/src/components/DrawTools.js
index 0fbf85c..2f21335 100644
--- a/src/components/DrawTools.js
+++ b/src/components/DrawTools.js
@@ -1,79 +1,76 @@
-import React, {Component} from 'react';
-import { EditControl } from "react-leaflet-draw"
-import {
-	FeatureGroup,
-} from 'react-leaflet'
+import React, { Component } from "react";
+import { EditControl } from "react-leaflet-draw";
+import { FeatureGroup } from "react-leaflet";
 
 class DrawTools extends Component {
-	constructor(props){
-	  super(props);
-	  this.state = {
-		  geoJSONAll: [] // property for all GeoJSON data in the map
-	  }
+  constructor(props) {
+    super(props);
+    this.state = {
+      geoJSONAll: [] // property for all GeoJSON data in the map
+    };
   }
-  
-	_onCreated = (e) => {
-		let type = e.layerType; // from the example; isn't used right now, but may be relevant in the future
-		let layer = e.layer;
+
+  _onCreated = e => {
+    let type = e.layerType; // from the example; isn't used right now, but may be relevant in the future
+    let layer = e.layer;
     this.makeGeoJSON(e.layer);
-	}
+  };
 
   // turn layer to GeoJSON data and add it to an array of all GeoJSON data of the current map
-	makeGeoJSON = (e) => {
+  makeGeoJSON = e => {
     let geoJSON = e.toGeoJSON();
     let newGeoJSONAll = this.state.geoJSONAll;
     newGeoJSONAll.push(geoJSON);
-    this.setState({geoJSONAll: newGeoJSONAll});
+    this.setState({ geoJSONAll: newGeoJSONAll });
     console.log(JSON.stringify(geoJSON, null, 4)); // printing GeoJSON data of the previous object create
-    console.log("newGeoJSONAll.length: " + newGeoJSONAll.length);
-	}
-	
-	render() {
-		return (
-			// "It's important to wrap EditControl component into FeatureGroup component from react-leaflet. The elements you draw will be added to this FeatureGroup layer, when you hit edit button only items in this layer will be edited."
-			<FeatureGroup> 
-				<EditControl
-					position='topright'
-					onCreated={this._onCreated}
-					draw={{
-						circle: {
-							repeatMode: true, // allows using the tool again after finishing the previous shape
-							shapeOptions: {
-								color: '#f9f10c',
-								opacity: 100
-							}
-						},
-						rectangle: {
-							repeatMode: true
-						},
-						polygon: {
-							repeatMode: true,
-							allowIntersection: false, // Restricts shapes to simple polygons
-							drawError: {
-								color: '#e1e100', // Color the shape will turn when intersects
-								message: '<strong>Oh snap!<strong> you can\'t draw that!' // Message that will show when intersect
-							},
-							shapeOptions: {
-								color: '#ed2572',
-								opacity: 100
-							}
-						},
-						polyline: {
-							repeatMode: true,
-							shapeOptions: {
-								color: '#ed2572',
-								opacity: 100
-							}
-						},
-						marker: {
-							repeatMode: true
-						},
-						circlemarker: false
-					}}
-				/>
-			</FeatureGroup>
-		)
-	}
+  };
+
+  render() {
+    return (
+      // "It's important to wrap EditControl component into FeatureGroup component from react-leaflet. The elements you draw will be added to this FeatureGroup layer, when you hit edit button only items in this layer will be edited."
+      <FeatureGroup>
+        <EditControl
+          position="topright"
+          onCreated={this._onCreated}
+          draw={{
+            circle: {
+              repeatMode: false, // allows using the tool again after finishing the previous shape. turned off here
+              shapeOptions: {
+                color: "#f9f10c",
+                opacity: 100
+              }
+            },
+            rectangle: {
+              repeatMode: false
+            },
+            polygon: {
+              repeatMode: true,
+              allowIntersection: false, // Restricts shapes to simple polygons
+              drawError: {
+                color: "#e1e100", // Color the shape will turn when intersects
+                message: "<strong>Oh snap!<strong> you can't draw that!" // Message that will show when intersect
+              },
+              shapeOptions: {
+                color: "#ed2572",
+                opacity: 100
+              }
+            },
+            polyline: {
+              repeatMode: true,
+              shapeOptions: {
+                color: "#ed2572",
+                opacity: 100
+              }
+            },
+            marker: {
+              repeatMode: true
+            },
+            circlemarker: false
+          }}
+        />
+      </FeatureGroup>
+    );
+  }
 }
 
-export default DrawTools;
\ No newline at end of file
+export default DrawTools;
-- 
GitLab