update docs for locate-related methods
This commit is contained in:
parent
f807088328
commit
3cfe5d7897
196
reference.html
196
reference.html
@ -287,7 +287,7 @@ map.addLayer(cloudmade);</code></pre>
|
||||
<td><code>Boolean</code></td>
|
||||
<td>depends</td>
|
||||
<td>Whether the tile fade animation is enabled. By default it's enabled in all browsers that support CSS3 Transitions except Android.</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>closePopupOnClick</code></td>
|
||||
<td><code>Boolean</code></td>
|
||||
@ -560,18 +560,19 @@ map.addLayer(cloudmade);</code></pre>
|
||||
<td>Checks if the map container size changed and updates the map if so — call it after you've changed the map size dynamically.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>locate( <Object> <code>options?</code> )</code></td>
|
||||
<td><code>locate( <<a href="#map-locate-options">Locate options</a>> <code>options?</code> )</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Tries to locate the user using Geolocation API, firing <code>locationfound</code> event with location data on success or <code>locationerror</code> event on failure. Options are PositionOptions from the <a href="http://dev.w3.org/geo/api/spec-source.html#position-options">W3C Geolocation API</a>.<!-- Usage example:
|
||||
<pre><code class="javascript">map
|
||||
.on('locationfound', function(e) { map.fitBounds(e.bounds); })
|
||||
.on('locationerror', function(e) { alert(e.message); })
|
||||
.locate();</code></pre> --></td>
|
||||
<td>Tries to locate the user using Geolocation API, firing <code>locationfound</code> event with location data on success or <code>locationerror</code> event on failure. See <a href="#map-locate-options">Locate options</a> for more details.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>locateAndSetView( <Number> maxZoom )</code></td>
|
||||
<td><code>locateAndSetView( <Number> maxZoom, <<a href="#map-locate-options">Locate options</a>> <code>options?</code>)</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>The same as <code>locate</code> method, but it automatically sets the map view to the user location with respect to detection accuracy (or to the world view if geolocation failed). You can optionally specify the maximum zoom of the view.</td>
|
||||
<td>Automatically sets the map view to the user location with respect to detection accuracy (or to the world view if geolocation failed). A shortcut for <code>map.locate({setView: true, maxZoom: maxZoom});</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>stopLocate()</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Stops watching location previously initiated by <code>map.locate({watch: true})</code>.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -602,11 +603,11 @@ map.addLayer(cloudmade);</code></pre>
|
||||
<td><code>getMaxZoom()</code></td>
|
||||
<td><code>Number</code></td>
|
||||
<td>Returns the maximum zoom level of the map.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>getBounds()</code></td>
|
||||
<td><code><a href="#latlngbounds">LatLngBounds</a></code></td>
|
||||
<td>Returns the LatLngBounds of the current map view.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>getBounds()</code></td>
|
||||
<td><code><a href="#latlngbounds">LatLngBounds</a></code></td>
|
||||
<td>Returns the LatLngBounds of the current map view.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>getBoundsZoom( <LatLngBounds> <i>bounds</i> )</code></td>
|
||||
@ -746,8 +747,53 @@ map.addLayer(cloudmade);</code></pre>
|
||||
<td>Returns an object with different map panes (to render overlays in).</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<h3 id="map-locate-options">Locate options</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th>Type</th>
|
||||
<th>Default</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>watch</code></td>
|
||||
<td><code>Boolean</code></td>
|
||||
<td><code>false</code></td>
|
||||
<td>If true, starts continous watching of location changes (instead of detecting it once) using W3C <code>watchPosition</code> method. You can later stop watching using <code>map.stopLocate()</code> method.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>setView</code></td>
|
||||
<td><code>Boolean</code></td>
|
||||
<td><code>false</code></td>
|
||||
<td>If true, automatically sets the map view to the user location with respect to detection accuracy.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>maxZoom</code></td>
|
||||
<td><code>Number</code></td>
|
||||
<td><code>Infinity</code></td>
|
||||
<td>The maximum zoom for automatic view setting when using `setView` option.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>timeout</code></td>
|
||||
<td><code>Number</code></td>
|
||||
<td><code>10000</code></td>
|
||||
<td>Number of millisecond to wait for a response from geolocation before firing a <code>locationerror</code> event.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>maximumAge</code></td>
|
||||
<td><code>Number</code></td>
|
||||
<td><code>0</code></td>
|
||||
<td>Maximum age of detected location. If less than this amount of milliseconds passed since last geolocation response, <code>locate</code> will return a cached location.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>enableHighAccuracy</code></td>
|
||||
<td><code>Boolean</code></td>
|
||||
<td><code>false</code></td>
|
||||
<td>Enables high accuracy, see <a href="http://dev.w3.org/geo/api/spec-source.html#high-accuracy">description in the W3C spec</a>.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h2 id="marker">L.Marker</h2>
|
||||
@ -1262,12 +1308,12 @@ var image = new L.ImageOverlay(
|
||||
<td><code>Number</code></td>
|
||||
<td>0.2</td>
|
||||
<td>Fill opacity.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>clickable</code></td>
|
||||
<td><code>Boolean</code></td>
|
||||
<td><code>true</code></td>
|
||||
<td>If false, the vector will not emit mouse events and will act as a part of the underlying map.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>clickable</code></td>
|
||||
<td><code>Boolean</code></td>
|
||||
<td><code>true</code></td>
|
||||
<td>If false, the vector will not emit mouse events and will act as a part of the underlying map.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1332,16 +1378,16 @@ var image = new L.ImageOverlay(
|
||||
<td><code>bindPopup( <String> <i>htmlContent</i>, <<a href="#popup-options">Popup options</a>> <i>options?</i> )</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Binds a popup with a particular HTML content to a click on this path.</td>
|
||||
</tr>
|
||||
<tr id="#path-setstyle">
|
||||
<td><code>setStyle( <<a href="#path-options">Path options</a>> <i>object</i>)</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Changes the appearance of a Path based on the options in the <a href="#path-options">Path options</a> object.</td>
|
||||
</tr>
|
||||
<tr id="#path-getbounds">
|
||||
<td><code>getBounds()</code></td>
|
||||
<td><code><a href="#latlngbounds">LatLngBounds</a></code></td>
|
||||
<td>Returns the LatLngBounds of the path.</td>
|
||||
</tr>
|
||||
<tr id="#path-setstyle">
|
||||
<td><code>setStyle( <<a href="#path-options">Path options</a>> <i>object</i>)</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Changes the appearance of a Path based on the options in the <a href="#path-options">Path options</a> object.</td>
|
||||
</tr>
|
||||
<tr id="#path-getbounds">
|
||||
<td><code>getBounds()</code></td>
|
||||
<td><code><a href="#latlngbounds">LatLngBounds</a></code></td>
|
||||
<td>Returns the LatLngBounds of the path.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1417,21 +1463,21 @@ map.addLayer(polyline);</code></pre>
|
||||
<td><code>setLatLngs( <<a href="#latlng">LatLng</a>[]> <i>latlngs</i> )</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Replaces all the points in the polyline with the given array of geographical points.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>getLatLngs()</code></td>
|
||||
<td><code><a href="#latlng">LatLng</a>[]</code></td>
|
||||
<td>Returns an array of the points in the path.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>getLatLngs()</code></td>
|
||||
<td><code><a href="#latlng">LatLng</a>[]</code></td>
|
||||
<td>Returns an array of the points in the path.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>spliceLatLngs( <Number> <i>index</i>, <Number> <i>pointsToRemove</i>, <<a href="#latlng">LatLng</a>> <i>latlng1?</i>, <<a href="#latlng">LatLng</a>> <i>latlng2?</i>, … )</code></td>
|
||||
<td><code><a href="#latlng">LatLng</a>[]</code></td>
|
||||
<td>Allows adding, removing or replacing points in the polyline. Syntax is the same as in <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice">Array#splice</a>. Returns the array of removed points (if any).</td>
|
||||
</tr>
|
||||
<tr id="#path-getbounds">
|
||||
<td><code>getBounds()</code></td>
|
||||
<td><code><a href="#latlngbounds">LatLngBounds</a></code></td>
|
||||
<td>Returns the LatLngBounds of the polyline.</td>
|
||||
</tr>
|
||||
<tr id="#path-getbounds">
|
||||
<td><code>getBounds()</code></td>
|
||||
<td><code><a href="#latlngbounds">LatLngBounds</a></code></td>
|
||||
<td>Returns the LatLngBounds of the polyline.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -1512,23 +1558,23 @@ map.addLayer(polyline);</code></pre>
|
||||
<td><code>L.Circle( <<a href="#latlng">LatLng</a>> <i>latlng</i>, <Number> <i>radius</i>, <<a href="#path-options">Path options</a>> <i>options?</i> )</code></td>
|
||||
<td>Instantiates a circle object given a geographical point, a radius in meters and optionally an options object.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Methods</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Returns</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>setLatLng( <<a href="#latlng">LatLng</a>> <i>latlng</i> )</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Sets the position of a circle to a new location.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</table>
|
||||
|
||||
<h3>Methods</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Returns</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>setLatLng( <<a href="#latlng">LatLng</a>> <i>latlng</i> )</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Sets the position of a circle to a new location.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<h2 id="circlemarker">L.CircleMarker</h2>
|
||||
@ -1546,21 +1592,21 @@ map.addLayer(polyline);</code></pre>
|
||||
<td><code>L.CircleMarker( <<a href="#latlng">LatLng</a>> <i>latlng</i>, <<a href="#path-options">Path options</a>> <i>options?</i> )</code></td>
|
||||
<td>Instantiates a circle marker given a geographical point and optionally an options object. The default radius is 10 and can be altered by passing a "radius" member in the path options object.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<h3>Methods</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Returns</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>setLatLng( <<a href="#latlng">LatLng</a>> <i>latlng</i> )</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Sets the position of a circle marker to a new location.</td>
|
||||
</tr>
|
||||
<h3>Methods</h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Returns</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>setLatLng( <<a href="#latlng">LatLng</a>> <i>latlng</i> )</code></td>
|
||||
<td><code>this</code></td>
|
||||
<td>Sets the position of a circle marker to a new location.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -1682,7 +1728,7 @@ map.addLayer(group);</code></pre>
|
||||
<td>Fired when the user double-clicks (or double-taps) on the group.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<h2 id="geojson">L.GeoJSON</h2>
|
||||
|
||||
@ -2511,4 +2557,4 @@ var marker = new L.Marker(marker, {icon: icon});</code></pre>
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user