-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
119 lines (96 loc) · 3.08 KB
/
example.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
#map_canvas { height: 100% }
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
.controls {
margin-top: 16px;
border: 1px solid transparent;
border-radius: 2px 0 0 2px;
box-sizing: border-box;
-moz-box-sizing: border-box;
height: 32px;
outline: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
#pac-input {
background-color: #fff;
padding: 0 11px 0 13px;
width: 400px;
font-family: Roboto;
font-size: 15px;
font-weight: 300;
text-overflow: ellipsis;
}
#pac-input:focus {
border-color: #4d90fe;
margin-left: -1px;
padding-left: 14px; /* Regular padding-left + 1. */
width: 401px;
}
.pac-container {
font-family: Roboto;
}
#type-selector {
color: #fff;
background-color: #4d90fe;
padding: 5px 11px 0px 11px;
}
#type-selector label {
font-family: Roboto;
font-size: 13px;
font-weight: 300;
}
</style>
</script>
<script type="text/javascript" src="vendor/jquery.js"> </script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>
<script type="text/javascript" src="src/jquery.draw-the-route.js"> </script>
</head>
<body>
<input id="pac-input" class="controls" type="text" placeholder="Search Box">
<div id="map_canvas" style="width:100%; height:80%"></div>
<div id="controls" style="padding: 20px;">
<button id="close-route">Close route</button>
<label for="attach_to_road">Attach to road</label>
<input type="checkbox" id="attach-to-road">
<button id="undo">Undo</button>
<button id="reset" type="button">Reset</button>
<button id="export-data">Export data</button>
<textarea cols='50' rows='3' id="agl-exported-data"></textarea>
<span id='traveledDistance'></span>
</div>
<script type="text/javascript">
$(function () {
'use strict';
var dtr = $('#map_canvas').drawTheRoute();
$('#close-route').on('click', function () {
dtr.closeRoute();
});
$('#attach-to-road').prop('checked', dtr.attachToRoad());
$('#attach-to-road').on('change', function () {
dtr.attachToRoad(this.checked);
});
$('#undo').on('click', function () {
dtr.undo();
});
$("#reset").on("click", function(e) {
var response = confirm('Are you sure?');
if(response) dtr.resetResources();
});
$('#export-data').on('click', function () {
$('#agl-exported-data').text(JSON.stringify(dtr.exportData()));
});
$('#map_canvas').on('click', function () {
$('#traveledDistance').text('Distancia: ' + dtr.traveledDistance() + 'm');
});
});
</script>
</body>
</html>