-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvents.html
83 lines (80 loc) · 2.37 KB
/
Events.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Create circles</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.27/esri/css/esri.css">
<style>
html, body, #map {
height: 100%; width: 100%; margin: 0; padding: 0;
}
#controls {
background: #fff;
box-shadow: 0 6px 6px -6px #999;
color: #444;
font-family: sans-serif;
height: auto;
left: 1em;
padding: 1em;
position: absolute;
top: 1em;
width: auto;
z-index: 40;
}
#controls div {
padding: 0 0 1em 0;
}
</style>
<script src="https://js.arcgis.com/3.27/"></script>
<script>
var map;
require([
"esri/map", "esri/geometry/Circle", "esri/symbols/SimpleFillSymbol",
"esri/graphic", "esri/layers/GraphicsLayer",
"dojo/dom", "dojo/dom-attr", "dojo/on", "dojo/domReady!"
], function(
Map, Circle, SimpleFillSymbol,
Graphic, GraphicsLayer,
dom, domAttr, on
) {
var checkbox = dom.byId("geodesic");
var callback = function(){
console.log("click");
}
on(checkbox, "click", callback);
map = new Map("map", {
basemap: "streets",
center: [-120.741, 56.39],
slider: false,
zoom: 6
});
map.on("pan-end, zoom-end", function(evt) {
console.log("Map Pan or Zoom", evt);
});
var symbol = new SimpleFillSymbol().setColor(null).outline.setColor("blue");
var gl = new GraphicsLayer({ id: "circles" });
var geodesic = dom.byId("geodesic");
map.addLayer(gl);
map.on("click", function(e) {
var radius = map.extent.getWidth() / 10;
var circle = new Circle({
center: e.mapPoint,
geodesic: domAttr.get(geodesic, "checked"),
radius: radius
});
var graphic = new Graphic(circle, symbol);
gl.add(graphic);
});
});
</script>
</head>
<body>
<div id="map"></div>
<div id="controls">
<div>Click the map.</div>
<input type="checkbox" id="geodesic">
<label for="geodesic">Geodesic?</label>
</div>
</body>
</html>