diff --git a/pages/ex-four.html b/pages/ex-four.html index 0d159df..ac3c5cb 100644 --- a/pages/ex-four.html +++ b/pages/ex-four.html @@ -4,7 +4,11 @@ Exemple Four - + -
-
MORE
- +
@@ -72,20 +76,20 @@ '© OpenStreetMap', }).addTo(map); - var polygonPoints = [] + var polygonPoints = []; var polygon; var marker; - - map.on('click', (e) => { + + map.on("click", (e) => { // kiểm tra nếu độ dài mảng polygonPoints thì vẽ polygon if (polygonPoints.length == 4) { - polygon = L.polygon(polygonPoints, {color: 'red'}).addTo(map); - polygonPoints = [] + polygon = L.polygon(polygonPoints, { color: "red" }).addTo(map); + polygonPoints = []; } else { - polygonPoints.push(e.latlng) - marker = L.marker(e.latlng).addTo(map) + polygonPoints.push(e.latlng); + marker = L.marker(e.latlng).addTo(map); } - }) + }); diff --git a/pages/ex-one.html b/pages/ex-one.html index 43ccfd2..adf01a1 100644 --- a/pages/ex-one.html +++ b/pages/ex-one.html @@ -4,7 +4,11 @@ Exemple One - + -
-
MORE
-