From 1c8b7bdb2682479b2a7a4dc73ce6530e29c8f543 Mon Sep 17 00:00:00 2001
From: Jussi Surma-Aho <L4929@student.jamk.fi>
Date: Tue, 11 Jun 2019 13:54:32 +0300
Subject: [PATCH] Button actually looks legit!

---
 src/App.css                  |   6 ++++++
 src/components/DrawTools.js  |  14 +++++++-------
 src/icons/button-textbox.png | Bin 0 -> 793 bytes
 src/icons/nil.png            | Bin 0 -> 564 bytes
 4 files changed, 13 insertions(+), 7 deletions(-)
 create mode 100644 src/icons/button-textbox.png
 create mode 100644 src/icons/nil.png

diff --git a/src/App.css b/src/App.css
index b0f08dd..db7594a 100644
--- a/src/App.css
+++ b/src/App.css
@@ -138,3 +138,9 @@ div.login button:hover {
   background-color: darkblue;
   cursor: pointer;
 }
+
+/* Editing text button in the toolbar */
+.leaflet-draw-toolbar .leaflet-draw-draw-textbox {
+  background-image: url('icons/button-textbox.png');
+  background-size: 30px 30px;
+}
\ No newline at end of file
diff --git a/src/components/DrawTools.js b/src/components/DrawTools.js
index d0617ff..dfb0158 100644
--- a/src/components/DrawTools.js
+++ b/src/components/DrawTools.js
@@ -1,6 +1,7 @@
 import React, {Component} from 'react';
 import { EditControl } from 'react-leaflet-draw'
 import L from 'leaflet'
+import 'leaflet-draw'
 import { FeatureGroup } from 'react-leaflet'
 
 // empty icon for the text field
@@ -19,9 +20,9 @@ L.Draw.MarkerTextBox = L.Draw.Marker.extend({
 	initialize: function (map, options) {
 		// important to have a unique type, so that it won't get mixed up with other elements
 		this.type = 'textbox';
-		this.featureTypeCode = 'textbox';
+    this.featureTypeCode = 'textbox';
 		L.Draw.Feature.prototype.initialize.call(this, map, options);
-	}
+  }
 });
 
 //Redefinitions d'éléments de DrawToolbar 
@@ -58,7 +59,7 @@ L.DrawToolbar.include ({
 			handler: new L.Draw.Marker(map, this.options.marker),
 			title: L.drawLocal.draw.toolbar.buttons.marker
 		},{
-			enabled: this.options.marker,
+      enabled: this.options.marker,
 			handler: new L.Draw.MarkerTextBox(map, this.options.marker),
 			title: 'Write text'
 		}];
@@ -72,11 +73,10 @@ class DrawTools extends Component {
 			e.layer.remove();
 			return;
     }
-    if (e.layerType === 'marker') {
-      e.layer.bindTooltip('say hello to mr. akers');
+    if (e.layerType === 'textbox') {
+      e.layer.bindTooltip('say hello to mr. akers', {permanent: true});
     }
-		let type = e.layerType; // from the example; isn't used right now, but may be relevant in the future
-		let layer = e.layer;		
+		let layer = e.layer;
 		let geoJSON = layer.toGeoJSON();
 		console.log(JSON.stringify(geoJSON, null, 4)); // makes the output readable in the console
 	}
diff --git a/src/icons/button-textbox.png b/src/icons/button-textbox.png
new file mode 100644
index 0000000000000000000000000000000000000000..e36a2872bdf8f68df996d35159335a77211ead7a
GIT binary patch
literal 793
zcmV+!1LpjRP)<h;3K|Lk000e1NJLTq0015U0015c1^@s6J20-I0004nX+uL$Nkc;*
zaB^>EX>4Tx04R}tkv&MmKpe$iQ?+U<4t5Z62w0sgh>AFB6^c+H)C#RSm|XfHG-*gu
zTpR`0f`cE6RR<SmT^(EnLGS~_#nnmCMN0f%QfLwD!Ery{-Fw`<1B7akX;#}9py{@m
zjK{=uW<?CVq60y6VF*E)S;nj+CD3ww-NVP%yC~0UeeTcEqh>7z_(b9vW|%hdI`Pz|
zZE)Tv4zq%+5}y-~nsh<pN3JU#zj4mHEbz>*nM%$Phl#~}6Dv*33Z_OpNgPo%o$`gW
z$13M7&RVg|>i6U?3}yA@C9cyPL>voPgai=^%Gf{=HlnoZq*zGOeyoLm!1YVyQpmLd
zMvi%uph0&1;D7MDTPrs)?j?m{K>Lg1d<+ADU7%KRobO}Dsht4+XW&Y2_)Aq_`jhlZ
zLyH^%z1zUWbwgA3fXf}A|H+U|*_He>g<KAJKcjET0DZSW_o~-heIKU}K#ICb+yDoM
zz(}65*IK;0v$?l_&(!<-0UMlhgd3@Y6#xJL24YJ`L;xuOfdI;`)T|Q#000SaNLh0L
z04^f{04^f|c%?sf00007bV*G`2jd0{2_zSJukOPD000?uMObu0Z*6U5Zgc=ca%Ew3
zWn>_CX>@2HM@dakSAh-}0002+Nkl<ZNXPAzv1-FG5Qaa=9=xO(I%MgZvDAJB55|k1
zH;4`%x_2uUbj<@4iZQ14WvCKD$RZVW(gzyu;Pi8MzXXXyA`yrRDQcSLRYYnR9*i-q
z?;ScsSVT%-abXp5hqrLswokw#FaSqjSJ(9}y700rrR&-%r3QdJ&#V6!bqS!9vaaj%
z=)K58g#im}ZgTO3wbmaZvUS~8QJ+)Sb(?9LzV6h?JkJk(-+xEh@i>kzPILx7-T47j
zQ54V7%#~%?d6#d-n7uJ(FCy;%>$+Cags<FdFT476x3|G`h_OV(Ugd_r{9uVhBH_&m
X%M47dBA_@d00000NkvXXu0mjf%;j0~

literal 0
HcmV?d00001

diff --git a/src/icons/nil.png b/src/icons/nil.png
new file mode 100644
index 0000000000000000000000000000000000000000..ae058ee7bffad41634a20cd463fc94219f0de69b
GIT binary patch
literal 564
zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1|;Q0k8}drt(nfw0iMpz3I#>^X_+~x3=A3*
zYbV-z9Cna78XukQs?Ap>P<SGsbfbdSqZOeVPOSmjTV5p;y%aae^azTPVZGkeEZ-f<
zE}kAM8^h}Of%(YMtDYBKz5c`pWe7e#SZIImZuOnL%zwTb1)uFJbhxUcJhg*+=9^Ul
zRj%q)0xmp@g^a&i2KpQ-uDN^o`1Rcq=RetffBqu0NR7FM>7&kN-tLO#imJ<(EZ+;e
zM+63SobNo&vrFNl^7Yi|_btR_zI{H^G12d=uzN?Vll1A_GhJ<7Hm)+EA-$jeN=_F&
z7d_`{(Nxp-C*vi~Won;}S#H_FBDRr5kSQf3&`DD4YiN^OSEtC^<F<dA`{Grm`>Yd^
zuoMeu<U0AW`TxQ9d1wDTX_+n3$9z!y_CE<Wr`-;V({A5CzU{6BBh&c<Q?Gpre|6xD
z`pd1;#B7;<ZENg)Jx%RB<8<o-2PW%DPEuyg`1QH+!QY;Jn%rORGu_S3%RgH?$BrTM
zl~yIQj0}@9>#4Z!73Ja8`Tyr-e*4Z`U{$p2O-s#JV7#y;dAqv+X(0INyt^JqaTa()
z7BevDDT6R$#Zvn+pdfpRr>`sfV>WJ9J*7J@t@(gLk|nMYCC>S|xv6<249-QVi6yBi
z3gww484B*6z5(HleBwYw+@3CuAsp9}6Bw8n7+4t?AE~j<1`0EHy85}Sb4q9e0CaKP
AV*mgE

literal 0
HcmV?d00001

-- 
GitLab