Sha256: 0b20e8f8de3bc4317593862b83d20047477a3e186fbb9d2073b4466d1fc62cc1

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

<!DOCTYPE html>
<html>
<head>
	<title>Leaflet.draw vector editing handlers</title>

	<link rel="stylesheet" href="libs/leaflet.css" />

	<script src="libs/leaflet-src.js"></script>

	<script src="../src/Leaflet.draw.js"></script>

	<script src="../src/edit/handler/Edit.Poly.js"></script>
	<script src="../src/edit/handler/Edit.SimpleShape.js"></script>
	<script src="../src/edit/handler/Edit.Circle.js"></script>
	<script src="../src/edit/handler/Edit.Rectangle.js"></script>
</head>
<body>
	<div id="map" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>

	<script>
		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
			cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
			map = new L.Map('map', {layers: [cloudmade], center: new L.LatLng(51.505, -0.04), zoom: 13});

		var polygon = new L.Polygon([
			[51.51, -0.1],
			[51.5, -0.06],
			[51.52, -0.03]
		]);

		polygon.editing.enable();

		map.addLayer(polygon);

		var polyline = new L.Polyline([
			[51.50, -0.04],
			[51.49, -0.02],
			[51.51, 0],
			[51.52, -0.02]
		]);

		polyline.editing.enable();

		map.addLayer(polyline);

		var circle = L.circle([51.53, -0.06], 600);

		circle.editing.enable();

		map.addLayer(circle);

		var rectangle = L.rectangle([[51.49, -0.1], [51.48, -0.06]]);

		rectangle.editing.enable();

		map.addLayer(rectangle);

		polygon.on('edit', function() {
			console.log('Polygon was edited!');
		});
		polyline.on('edit', function() {
			console.log('Polyline was edited!');
		});
	</script>
</body>
</html>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
leaflet-js-0.8.dev2 lib/leaflet.draw/examples/edithandlers.html