|
52 | 52 | //Add events to the control. |
53 | 53 | map.events.add('geolocationerror', geolocationControl, displayEventInfo); |
54 | 54 | map.events.add('geolocationsuccess', geolocationControl, displayEventInfo); |
| 55 | + map.events.add('compassheadingchanged', geolocationControl, (e) => { |
| 56 | + displayEventInfo(`Compass heading: ${e}`); |
| 57 | + }); |
55 | 58 |
|
56 | 59 | //Add control and a style control to the map. |
57 | 60 | map.controls.add([new atlas.control.StyleControl(), geolocationControl], { |
|
77 | 80 | timeout: parseFloat(document.getElementById('timeout').value) |
78 | 81 | }, |
79 | 82 | calculateMissingValues: document.getElementById('calculateMissingValues').checked, |
80 | | - maxZoom: parseFloat(document.getElementById('maxZoom').value) |
| 83 | + maxZoom: parseFloat(document.getElementById('maxZoom').value), |
| 84 | + |
| 85 | + enableCompass: document.getElementById('enableCompass').checked, |
| 86 | + compassEventThrottleDelay: parseFloat(document.getElementById('compassEventThrottleDelay').value), |
| 87 | + syncMapCompassHeading: document.getElementById('syncMapCompassHeading').checked |
81 | 88 | }); |
82 | 89 | } |
83 | 90 |
|
|
117 | 124 | } |
118 | 125 |
|
119 | 126 | #eventInfo { |
120 | | - width: 300px; |
121 | | - height: 420px; |
| 127 | + width: 290px; |
| 128 | + height: 370px; |
122 | 129 | overflow-y: auto; |
123 | 130 | } |
124 | 131 |
|
|
152 | 159 | padding: 6px 12px; |
153 | 160 | border: 1px solid #ccc; |
154 | 161 | border-top: none; |
| 162 | + overflow-y: auto; |
| 163 | + max-height: 400px; |
155 | 164 | } |
156 | 165 | </style> |
157 | 166 | </head> |
|
187 | 196 | <tr title="Shows the users current location on the map and updates it as they move."> |
188 | 197 | <td>Track user location:</td> |
189 | 198 | <td><input id="trackUserLocation" type="checkbox" onclick="update()" title="Track user location" /></td> |
| 199 | + </tr> |
| 200 | + <tr> |
| 201 | + <td>Enable Compass</td> |
| 202 | + <td><input id="enableCompass" type="checkbox" checked="true" onclick="update()" /></td> |
| 203 | + </tr> |
| 204 | + <tr> |
| 205 | + <td>Sync Map Compass Heading</td> |
| 206 | + <td><input id="syncMapCompassHeading" type="checkbox" onclick="update()" /></td> |
| 207 | + </tr> |
| 208 | + <tr> |
| 209 | + <td>Compass Event Throttle Delay</td> |
| 210 | + <td> |
| 211 | + <form oninput="ceth.value=compassEventThrottleDelay.value"> |
| 212 | + <input type="range" id="compassEventThrottleDelay" value="100" min="0" max="5000" step="100" onchange="update()" /> |
| 213 | + <output name="ceth" for="compassEventThrottleDelay">100</output> |
| 214 | + </form> |
| 215 | + </td> |
190 | 216 | </tr> |
191 | 217 | <tr title="Specifies that if the speed or heading values are missing in the geolocation position, it will calculate these values based on the last known position."> |
192 | 218 | <td>Calculate missing values:</td> |
|
0 commit comments