Skip to content

Commit 635c28b

Browse files
author
Savina Shen (Manpower Services Taiwan Co Ltd)
committed
add scale control options to map nav control sample
1 parent 0c2152f commit 635c28b

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎Samples/Controls/Map Navigation Control Options/Map Navigation Control Options.html‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@
9292
layout: pickerLayout
9393
}));
9494

95+
//Create a scale control and add it to the map.
96+
controls.push(new atlas.control.ScaleControl({
97+
maxWidth: parseFloat(getSelectValue('scaleMaxWidth')),
98+
unit: getSelectValue('scaleUnit'),
99+
style: controlStyle
100+
}));
101+
95102
//Add controls to the map.
96103
map.controls.add(controls, {
97104
position: positionOption
@@ -224,6 +231,28 @@
224231
</select>
225232
</td>
226233
</tr>
234+
235+
<tr title="The maximum length of the scale control in pixels.">
236+
<td>Scale Max Width:</td>
237+
<td>
238+
<select id="scaleMaxWidth" onchange="addControls()" title="Scale Max Width">
239+
<option>50</option>
240+
<option selected="selected">100</option>
241+
<option>200</option>
242+
<option>400</option>
243+
</select>
244+
</td>
245+
</tr>
246+
<tr title="The unit of the distance shown on scale control.">
247+
<td>Scale Unit:</td>
248+
<td>
249+
<select id="scaleUnit" onchange="addControls()" title="Scale Unit">
250+
<option>imperial</option>
251+
<option selected="selected">metric</option>
252+
<option>nautical</option>
253+
</select>
254+
</td>
255+
</tr>
227256
</table>
228257
</div>
229258

0 commit comments

Comments
 (0)