diff --git a/DOCS-TODO b/DOCS-TODO index fb0ea1df..3dce470d 100644 --- a/DOCS-TODO +++ b/DOCS-TODO @@ -1,66 +1,28 @@ - -Layers addTo(map) - Map panning inertia options remove locateAndSetView new locate options - getContainer - containerPointToLatLng - latLngToContainerPoint addHandler - autopanstart event - Icon Icon.Default -DivIcon -Control - position option - - setPosition - getPosition - -Control.Attribution prefix in options - -Scale control - -LatLngBounds pad +NEW DivIcon on/off(eventMap) on/off(space-separated types) off(type) to remove all listeners TileLayer - removed urlParams - - detectRetina option + detectRetina option redraw setUrl bringToFront bringToBack -TileLayer.WMS - setParams - -Marker - opacity option - - setOpacity - update - -ImageOverlay - opacity option - - setOpacity - -Popup - maxHeight - Path bringToFront bringToBack @@ -69,41 +31,30 @@ Path redraw - events - contextmenu +FeatureGroup - ? + setStyle -Circle - getBounds - getLatLng - getRadius - -MouseEvent - originalEvent - containerPoint - -Global switches +NEW Global switches L_NO_TOUCH L_PREFER_CANVAS L_DISABLE_3D - - -Transformation +NEW Transformation Transformation(a, b, c, d) transform(point, scale) untransform(point, scale) -LineUtil +NEW LineUtil simplify(points, tolerance) pointToSegmentDistance(p, p1, p2) closestPointOnSegment(p, p1, p2) clipSegment(a, b, bounds) -PolyUtil +NEW PolyUtil clipPolygon(points, bounds) -DomEvent +NEW DomEvent addListener(obj, type, fn, context) on removeListener(obj, type, fn) @@ -115,7 +66,7 @@ DomEvent getMousePosition(e, container) getWheelDelta(e) -Transition +NEW Transition Transition(el, options) run(props) @@ -131,9 +82,9 @@ Transition step end -Draggable +NEW Draggable Draggable(element, dragStartTarget) - + enable() disable() @@ -143,7 +94,7 @@ Draggable drag dragend -ILayer +NEW ILayer onAdd(map) onRemove(map) @@ -151,29 +102,15 @@ ILayer options.minZoom and options.maxZoom -IFeature - ? - getBounds() or getLatLng() - setStyle - bindPopup - events - -Control - Control(options) - - getPosition() - setPosition() - addTo(map) - removeFrom(map) - -IControl +NEW IControl onAdd(map) onRemove(map) -IProjection +NEW IProjection project(latlng) unproject(point) -ICRS +NEW ICRS latLngToPoint(latlng, zoom) pointToLatLng(point, zoom) project(latlng) diff --git a/docs/css/screen.css b/docs/css/screen.css index 0efca4c6..77dd55fd 100644 --- a/docs/css/screen.css +++ b/docs/css/screen.css @@ -122,24 +122,32 @@ pre code a:hover { text-decoration: underline; } +p code, td:last-child code { + color: #666; +} + table { border-collapse: collapse; box-shadow: 0 3px 15px #f0f0f0; } th { - background-color: #f3f3f3; - background-image: -webkit-gradient(linear, left top, left bottom, from(#f3f3f3), to(#e7e7e7)); /* Saf4+, Chrome */ - background-image: -webkit-linear-gradient(top, #f3f3f3, #e7e7e7); /* Chrome 10+, Saf5.1+, iOS 5+ */ - background-image: -moz-linear-gradient(top, #f3f3f3, #e7e7e7); /* FF3.6+ */ - background-image: -o-linear-gradient(top, #f3f3f3, #e7e7e7); /* Opera 11.10+ */ - background-image: linear-gradient(to bottom, #f3f3f3, #e7e7e7); + background-color: #eeeeee; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#d7d7d7)); /* Saf4+, Chrome */ + background-image: -webkit-linear-gradient(top, #eeeeee, #d7d7d7); /* Chrome 10+, Saf5.1+, iOS 5+ */ + background-image: -moz-linear-gradient(top, #eeeeee, #d7d7d7); /* FF3.6+ */ + background-image: -o-linear-gradient(top, #eeeeee, #d7d7d7); /* Opera 11.10+ */ + background-image: linear-gradient(to bottom, #eeeeee, #d7d7d7); + + text-shadow: 1px 1px 0 white; + + padding: 5px 10px; } th, td { - padding: 8px 10px; vertical-align: top; /*line-height: 1.4;*/ } td { + padding: 8px 10px; /*border-right: 1px solid #eee;*/ } diff --git a/docs/highlight/styles/github.css b/docs/highlight/styles/github.css index 69622eed..ba1fabd9 100644 --- a/docs/highlight/styles/github.css +++ b/docs/highlight/styles/github.css @@ -36,7 +36,8 @@ pre .javascript .title { } code .number, -pre .hexcolor { +pre .hexcolor, +code .literal { color: #00A707 } @@ -66,9 +67,6 @@ pre .tex .command { color: #458; font-weight: bold } -code .literal { - color: #333; -} pre .tag, pre .tag .title, diff --git a/reference.html b/reference.html index 5e33d17c..973b1b42 100644 --- a/reference.html +++ b/reference.html @@ -67,13 +67,15 @@ bodyclass: api-page
  • Point
  • Bounds
  • Icon
  • +
  • DivIcon
  • Controls

    @@ -112,8 +114,9 @@ bodyclass: api-page

    Misc

    @@ -275,7 +278,7 @@ var map = L.map('map', { closePopupOnClick Boolean true - Set it to false if you don't want popups to close when user clicks the map. + Set it to false if you don't want popups to close when user clicks the map. worldCopyJump @@ -329,7 +332,7 @@ var map = L.map('map', { contextmenu MouseEvent - Fired when the user pushes the right mouse button on the map. + Fired when the user pushes the right mouse button on the map, prevents default browser context menu from showing if there are listeners on this event. preclick @@ -386,6 +389,11 @@ var map = L.map('map', { Event Fired when the map zoom changes. + + autopanstart + Event + Fired when the map starts autopanning when opening a popup. + layeradd LayerEvent @@ -429,72 +437,72 @@ var map = L.map('map', { setView( <LatLng> center, <Number> zoom, <Boolean> forceReset? ) - this - Sets the view of the map (geographical center and zoom). If forceReset is set to true, the map is reloaded even if it's eligible for pan or zoom animation (false by default). + this + Sets the view of the map (geographical center and zoom). If forceReset is set to true, the map is reloaded even if it's eligible for pan or zoom animation (false by default). setZoom( <Number> zoom ) - this + this Sets the zoom of the map. zoomIn() - this + this Increases the zoom of the map by 1. zoomOut() - this + this Decreases the zoom of the map by 1. fitBounds( <LatLngBounds> bounds ) - this + this Sets a map view that contains the given geographical bounds with the maximum zoom level possible. fitWorld() - this + this Sets a map view that mostly contains the whole world with the maximum zoom level possible. panTo( <LatLng> latlng ) - this + this Pans the map to a given center. Makes an animated pan if new center is not more than one screen away from the current one. panInsideBounds( <LatLngBounds> bounds ) - this + this Pans the map to the closest view that would lie inside the given bounds (if it's not already). panBy( <Point> point ) - this + this Pans the map by a given number of pixels (animated). invalidateSize() - this + this Checks if the map container size changed and updates the map if so — call it after you've changed the map size dynamically. setMaxBounds( <LatLngBounds> bounds ) - this + this Restricts the map view to the given bounds (see map maxBounds option). locate( <Locate options> options? ) - this + this Tries to locate the user using Geolocation API, firing locationfound event with location data on success or locationerror event on failure. See Locate options for more details. locateAndSetView( <Number> maxZoom?, <Locate options> options? ) - this + this 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 map.locate({setView: true, maxZoom: maxZoom});. stopLocate() - this + this Stops watching location previously initiated by map.locate({watch: true}). @@ -535,7 +543,7 @@ var map = L.map('map', { getBoundsZoom( <LatLngBounds> bounds, <Boolean> inside? ) Number - Returns the maximum zoom level on which the given bounds fit to the map view in its entirety. If inside (optional) is set to true, the method instead returns the minimum zoom level on which the map view fits into the given bounds in its entirety. + Returns the maximum zoom level on which the given bounds fit to the map view in its entirety. If inside (optional) is set to true, the method instead returns the minimum zoom level on which the map view fits into the given bounds in its entirety. getSize() @@ -564,38 +572,38 @@ var map = L.map('map', { addLayer( <ILayer> layer, <Boolean> insertAtTheBottom? ) - this - Adds the given layer to the map. If optional insertAtTheBottom is set to true, the layer is inserted under all others (useful when switching base tile layers). + this + Adds the given layer to the map. If optional insertAtTheBottom is set to true, the layer is inserted under all others (useful when switching base tile layers). removeLayer( <ILayer> layer ) - this + this Removes the given layer from the map. hasLayer( <ILayer> layer ) Boolean - Returns true if the given layer is currently added to the map. + Returns true if the given layer is currently added to the map. openPopup( <Popup> popup ) - this + this Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability). closePopup() - this + this Closes the popup opened with openPopup. addControl( <IControl> control ) - this + this Adds the given control to the map. removeControl( <IControl> control ) - this + this Removes the given control from the map. @@ -629,6 +637,16 @@ var map = L.map('map', { Point Converts the point relative to the map layer to a point relative to the map container. + + latLngToContainerPoint( <LatLng> latlng ) + Point + Returns the map container point that corresponds to the given geographical coordinates. + + + containerPointToLatLng( <Point> point ) + LatLng + Returns the geographical coordinates of a given map container point. + project( <LatLng> latlng, <Number> zoom? ) Point @@ -689,13 +707,13 @@ var map = L.map('map', { watch Boolean false - If true, starts continous watching of location changes (instead of detecting it once) using W3C watchPosition method. You can later stop watching using map.stopLocate() method. + If true, starts continous watching of location changes (instead of detecting it once) using W3C watchPosition method. You can later stop watching using map.stopLocate() method. setView Boolean false - If true, automatically sets the map view to the user location with respect to detection accuracy. + If true, automatically sets the map view to the user location with respect to detection accuracy. maxZoom @@ -892,7 +910,7 @@ var map = L.map('map', { clickable Boolean true - If false, the marker will not emit mouse events and will act as a part of the underlying map. + If false, the marker will not emit mouse events and will act as a part of the underlying map. draggable @@ -912,6 +930,12 @@ var map = L.map('map', { 0 By default, marker images zIndex is set automatically based on its latitude. You this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively). + + opacity + Number + 1.0 + The opacity of the marker. +

    Events

    @@ -974,6 +998,11 @@ var map = L.map('map', { Returns Description + + addTo( <Map> map ) + this + Adds the marker to the map. + getLatLng() LatLng @@ -981,37 +1010,47 @@ var map = L.map('map', { setLatLng( <LatLng> latlng ) - this + this Changes the marker position to the given point. setIcon( <Icon> icon ) - this + this Changes the marker icon. setZIndexOffset( <Number> offset ) - this + this Changes the zIndex offset of the marker. - + + setOpacity( <Number> opacity ) + this + Changes the opacity of the marker. + + + update() + this + Updates the marker position, useful if coordinates of its latLng object were changed directly. + + bindPopup( <String> htmlContent, <Popup options> options? ) - this + this Binds a popup with a particular HTML content to a click on this marker. You can also open the bound popup with the Marker openPopup method. - + unbindPopup() - this + this Unbinds the popup previously bound to the marker with bindPopup. - + openPopup() - this + this Opens the popup previously bound by the bindPopup method. - + closePopup() - this + this Closes the bound popup of the marker if it's opened. @@ -1090,11 +1129,17 @@ var map = L.map('map', { 50 Min width of the popup. + + maxHeight + Number + null + If set, creates a scrollable container of the given height inside a popup if its content exceeds it. + autoPan Boolean true - Set it to false if you don't want the map to do panning animation to fit the opened popup. + Set it to false if you don't want the map to do panning animation to fit the opened popup. closeButton @@ -1119,6 +1164,11 @@ var map = L.map('map', {

    Methods

    + + + + + @@ -1126,12 +1176,12 @@ var map = L.map('map', { - + - +
    addTo( <Map> map )thisAdds the popup to the map.
    Method Returns
    setLatLng( <LatLng> latlng )thisthis Sets the geographical point where the popup will open.
    setContent( <String> htmlContent )thisthis Sets the HTML content of the popup.
    @@ -1228,19 +1278,19 @@ var map = L.map('map', { tms Boolean false - If true, inverses Y axis numbering for tiles (turn this on for TMS services). + If true, inverses Y axis numbering for tiles (turn this on for TMS services). continuousWorld Boolean false - If set to true, the tile coordinates won't be wrapped by world width (-180 to 180 longitude) or clamped to lie within world height (-90 to 90). Use this if you use Leaflet for maps that don't reflect the real world (e.g. game, indoor or photo maps). + If set to true, the tile coordinates won't be wrapped by world width (-180 to 180 longitude) or clamped to lie within world height (-90 to 90). Use this if you use Leaflet for maps that don't reflect the real world (e.g. game, indoor or photo maps). noWrap Boolean false - If set to true, the tiles just won't load outside the world width (-180 to 180 longitude) instead of repeating. + If set to true, the tiles just won't load outside the world width (-180 to 180 longitude) instead of repeating. zoomOffset @@ -1252,7 +1302,7 @@ var map = L.map('map', { zoomReverse Boolean false - If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom) + If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom) opacity @@ -1264,19 +1314,19 @@ var map = L.map('map', { unloadInvisibleTiles Boolean depends - If true, all the tiles that are not visible after panning are removed (for better performance). true by default on mobile WebKit, otherwise false. + If true, all the tiles that are not visible after panning are removed (for better performance). true by default on mobile WebKit, otherwise false. updateWhenIdle Boolean depends - If false, new tiles are loaded during panning, otherwise only after it (for better performance). true by default on mobile WebKit, otherwise false. + If false, new tiles are loaded during panning, otherwise only after it (for better performance). true by default on mobile WebKit, otherwise false. reuseTiles Boolean false - If true, all the tiles that are not visible after panning are placed in a reuse queue from which they will be fetched when new tiles become visible (as opposed to dynamically creating new ones). This will in theory keep memory usage low and eliminate the need for reserving new memory whenever a new tile is needed. + If true, all the tiles that are not visible after panning are placed in a reuse queue from which they will be fetched when new tiles become visible (as opposed to dynamically creating new ones). This will in theory keep memory usage low and eliminate the need for reserving new memory whenever a new tile is needed. @@ -1288,9 +1338,14 @@ var map = L.map('map', { Returns Description + + addTo( <Map> map ) + this + Adds the layer to the map. + setOpacity( <Number> opacity ) - this + this Changes the opacity of the tile layer. @@ -1304,7 +1359,7 @@ var map = L.map('map', {

    L.TileLayer.WMS

    -

    Used to display WMS services as tile layers on the map. Extends TileLayer, implements ILayer interface.

    +

    Used to display WMS services as tile layers on the map. Extends TileLayer.

    Usage example

    @@ -1366,7 +1421,7 @@ var map = L.map('map', { transparent Boolean false - If true, the WMS service will return images with transparency. + If true, the WMS service will return images with transparency. version @@ -1376,11 +1431,25 @@ var map = L.map('map', { +

    Methods

    + + + + + + + + + + + + +
    MethodReturnsDescription
    setParams( <WMS parameters> params, <Boolean> noRedraw? )thisMerges an object with the new parameters and re-requests tiles on the current screen (unless noRedraw was set to true).

    L.TileLayer.Canvas

    -

    Used to create Canvas-based tile layers where tiles get drawn on the browser side. Extends TileLayer, implements ILayer interface.

    +

    Used to create Canvas-based tile layers where tiles get drawn on the browser side. Extends TileLayer.

    Usage example

    @@ -1419,7 +1488,7 @@ canvasTiles.drawTile = function(canvas, tilePoint, zoom) { drawTile( <HTMLCanvasElement> canvas, <Point> tilePoint, <Number> zoom ) - this + this You need to define this method after creating the instance to draw tiles; canvas is the actual canvas tile on which you can draw, tilePoint represents the tile numbers, and zoom is the current zoom. @@ -1450,7 +1519,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map); Description - L.ImageOverlay( <String> imageUrl, <LatLngBounds> bounds ) + L.ImageOverlay( <String> imageUrl, <LatLngBounds> bounds, <ImageOverlay options> options? ) new L.ImageOverlay()
    L.imageOverlay() @@ -1459,7 +1528,40 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map); +

    Options

    + + + + + + + + + + + + + +
    OptionTypeDefaultDescription
    opacityNumber1.0The opacity of the image overlay.
    +

    Methods

    + + + + + + + + + + + + + + + + +
    MethodReturnsDescription
    addTo( <Map> map )thisAdds the overlay to the map.
    setOpacity( <Number> opacity )thisSets the opacity of the overlay.

    L.Path

    @@ -1477,7 +1579,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map); stroke Boolean true - Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles. + Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles. color @@ -1501,7 +1603,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map); fill Boolean depends - Whether to fill the path with color. Set it to false to disable filling on polygons or circles. + Whether to fill the path with color. Set it to false to disable filling on polygons or circles. fillColor @@ -1519,7 +1621,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map); clickable Boolean true - If false, the vector will not emit mouse events and will act as a part of the underlying map. + If false, the vector will not emit mouse events and will act as a part of the underlying map. @@ -1558,6 +1660,11 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map); MouseEvent Fired when the mouse leaves the object. + + contextmenu + MouseEvent + Fired when the user pushes the right mouse button on the object, prevents default browser context menu from showing if there are listeners on this event. +

    Static properties

    @@ -1584,7 +1691,7 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map); CANVAS Boolean depends - True if Canvas is used for vector rendering (Android 2). You can also force this by setting global variable L_PREFER_CANVAS to true before the Leaflet include on your page — sometimes it can increase performance dramatically when rendering thousands of circle markers, but currently suffers from a bug that causes removing such layers to be extremely slow. + True if Canvas is used for vector rendering (Android 2). You can also force this by setting global variable L_PREFER_CANVAS to true before the Leaflet include on your page — sometimes it can increase performance dramatically when rendering thousands of circle markers, but currently suffers from a bug that causes removing such layers to be extremely slow. CLIP_PADDING @@ -1601,14 +1708,24 @@ L.imageOverlay(imageUrl, imageBounds).addTo(map); Returns Description + + addTo( <Map> map ) + this + Adds the layer to the map. + bindPopup( <String> htmlContent, <Popup options> options? ) - this + this Binds a popup with a particular HTML content to a click on this path. + + openPopup( <LatLng> latlng? ) + this + Opens the popup previously bound by the bindPopup method in the given point, or in one of the path's points if not specified. + setStyle( <Path options> object ) - this + this Changes the appearance of a Path based on the options in the Path options object. @@ -1685,12 +1802,12 @@ map.fitBounds(polyline.getBounds()); addLatLng( <LatLng> latlng ) - this + this Adds a given point to the polyline. setLatLngs( <LatLng[]> latlngs ) - this + this Replaces all the points in the polyline with the given array of geographical points. @@ -1703,7 +1820,7 @@ map.fitBounds(polyline.getBounds()); LatLng[] Allows adding, removing or replacing points in the polyline. Syntax is the same as in Array#splice. Returns the array of removed points (if any). - + getBounds() LatLngBounds Returns the LatLngBounds of the polyline. @@ -1830,7 +1947,7 @@ map.fitBounds(bounds); setBounds( <LatLngBounds> bounds ) - this + this Redraws the rectangle with the passed bounds. @@ -1880,12 +1997,12 @@ map.fitBounds(bounds); setLatLng( <LatLng> latlng ) - this + this Sets the position of a circle to a new location. setRadius( <Number> radius ) - this + this Sets the radius of a circle. Units are in meters. @@ -1924,12 +2041,12 @@ map.fitBounds(bounds); setLatLng( <LatLng> latlng ) - this + this Sets the position of a circle marker to a new location. setRadius( <Number> radius ) - this + this Sets the radius of a circle marker. Units are in pixels. @@ -1970,19 +2087,24 @@ map.fitBounds(bounds); Returns Description + + addTo( <Map> map ) + this + Adds the group of layers to the map. + addLayer( <ILayer> layer ) - this + this Adds a given layer to the group. removeLayer( <ILayer> layer ) - this + this Removes a given layer from the group. clearLayers() - this + this Removes all the layers from the group. @@ -2028,13 +2150,13 @@ map.fitBounds(bounds); bindPopup( <String> htmlContent, <Popup options> options? ) - this - Binds a popup with a particular HTML content to a click on any layer from the group. + this + Binds a popup with a particular HTML content to a click on any layer from the group that has a bindPopup method. getBounds() LatLngBounds - Returns the LatLngBounds of the Feature Group. + Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children). @@ -2159,12 +2281,12 @@ map.fitBounds(bounds); coordsToLatlng( <Array> coords, <Boolean> reverse? ) LatLng - Creates a LatLng object from an array of 2 numbers (latitude, longitude) used in GeoJSON for points. If reverse is set to true, the numbers will be interpreted as (longitude, latitude). + Creates a LatLng object from an array of 2 numbers (latitude, longitude) used in GeoJSON for points. If reverse is set to true, the numbers will be interpreted as (longitude, latitude). coordsToLatlngs( <Array> coords, <Number> levelsDeep?, <Boolean> reverse? ) Array - Creates a multidimensional array of LatLng objects from a GeoJSON coordinates array. levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default). If reverse is set to true, the numbers will be interpreted as (longitude, latitude). + Creates a multidimensional array of LatLng objects from a GeoJSON coordinates array. levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default). If reverse is set to true, the numbers will be interpreted as (longitude, latitude). @@ -2236,7 +2358,7 @@ map.panTo(new L.LatLng(50, 30)); equals( <LatLng> otherLatlng ) Boolean - Returns true if the given LatLng point is at the same position (within a small margin of error). + Returns true if the given LatLng point is at the same position (within a small margin of error). toString() @@ -2328,7 +2450,7 @@ map.panTo(new L.LatLng(50, 30)); extend( <LatLng|LatLngBounds> latlng ) - this + this Extends the bounds to contain the given point or bounds. @@ -2359,28 +2481,33 @@ map.panTo(new L.LatLng(50, 30)); contains( <LatLngBounds> otherBounds ) Boolean - Returns true if the rectangle contains the given one. + Returns true if the rectangle contains the given one. contains( <LatLng> latlng ) Boolean - Returns true if the rectangle contains the given point. + Returns true if the rectangle contains the given point. intersects( <LatLngBounds> otherBounds ) Boolean - Returns true if the rectangle intersects the given bounds. + Returns true if the rectangle intersects the given bounds. equals( <LatLngBounds> otherBounds ) Boolean - Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. + Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. toBBoxString() String Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data. + + pad( <Number> bufferRatio ) + LatLngBounds + Returns bigger bounds created by extending the current bounds by a given percentage in each direction. + @@ -2412,7 +2539,7 @@ map.panBy(new L.Point(200, 300)); L.point()
    L.point([]) - Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values. + Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values. @@ -2462,7 +2589,7 @@ map.panBy(new L.Point(200, 300)); divideBy( <Number> number, <Boolean> round? ) Point - Returns the result of division of the current point by the given number. If optional round is set to true, returns a rounded result. + Returns the result of division of the current point by the given number. If optional round is set to true, returns a rounded result. distanceTo( <Point> otherPoint ) @@ -2567,17 +2694,17 @@ map.panBy(new L.Point(200, 300)); contains( <Bounds> otherBounds ) Boolean - Returns true if the rectangle contains the given one. + Returns true if the rectangle contains the given one. contains( <Point> point ) Boolean - Returns true if the rectangle contains the given point. + Returns true if the rectangle contains the given point. intersects( <Bounds> otherBounds ) Boolean - Returns true if the rectangle intersects the given bounds. + Returns true if the rectangle intersects the given bounds. @@ -2643,7 +2770,7 @@ L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); shadowUrl String - The URL to the icon shadow image. If shadowUrl is null then no shadow image will be created. + The URL to the icon shadow image. If shadowUrl is null then no shadow image will be created. shadowSize @@ -2664,40 +2791,186 @@ L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); -

    L.Control.Zoom

    +

    L.Control

    -

    A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its zoomControl option to false. Implements IControl interface.

    +

    The base class for all Leaflet controls. Implements IControl interface. You can add controls to the map like this:

    + +
    control.addTo(map);
    +// the same as
    +map.addControl(control);

    Constructor

    - + + - + + + + +
    ConstructorConstructorUsage Description
    L.Control.Zoom()L.Control( <Control options> options? ) + new L.Control()
    + L.control() +
    Creates a control with the given options.
    + +

    Options

    + + + + + + + + + + + + + +
    OptionTypeDefaultDescription
    positionString'topright'The initial position of the control (one of the map corners). See control positions.
    + +

    Methods

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodReturnsDescription
    setPosition( <String> position )thisSets the position of the control. See control positions.
    getPosition()StringReturns the current position of the control.
    addTo( <Map> map )thisAdds the control to the map.
    removeFrom( <Map> map )thisRemoves the control from the map.
    + +

    Control Positions

    + +

    Control positions (map corner to put a control to) are set using strings. Margins between controls and the map border are set with CSS, so that you can easily override them.

    + + + + + + + + + + + + + + + + + + + + + + +
    PositionDescription
    'topleft'Top left of the map.
    'topright'Top right of the map.
    'bottomleft'Bottom left of the map.
    'bottomright'Bottom right of the map.
    + + +

    L.Control.Zoom

    + +

    A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its zoomControl option to false. Extends Control.

    + +

    Constructor

    + + + + + + + + +
    ConstructorUsageDescription
    L.Control.Zoom( <Control.Zoom options> options? ) + new L.Control.Zoom()
    + L.control.zoom() +
    Creates a zoom control.
    +

    Options

    + + + + + + + + + + + + + +
    OptionTypeDefaultDescription
    positionString'topleft'The position of the control (one of the map corners). See control positions.
    +

    L.Control.Attribution

    -

    The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its attributionControl option to false, and it fetches attribution texts from layers with getAttribution method automatically. Implements IControl interface.

    +

    The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its attributionControl option to false, and it fetches attribution texts from layers with getAttribution method automatically. Extends Control.

    Constructor

    + - + +
    ConstructorUsage Description
    L.Control.Attribution()L.Control.Attribution( <Control.Attribution options> options? ) + new L.Control.Attribution()
    + L.control.attribution() +
    Creates an attribution control.
    +

    Options

    + + + + + + + + + + + + + + + + + + + +
    OptionTypeDefaultDescription
    positionString'bottomright'The position of the control (one of the map corners). See control positions.
    prefixString'Powered by Leaflet'The HTML text shown before the attributions. Pass false to disable.
    +

    Methods

    @@ -2707,17 +2980,17 @@ L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); - - + + - - + + - +
    setPrefix( <String> prefix )-Sets the string before the attributions ("Powered by Leaflet" by default).thisSets the text before the attributions.
    addAttribution( <String> text )-Adds an attribution text (e.g. "Vector data &copy; CloudMade").thisAdds an attribution text (e.g. 'Vector data &copy; CloudMade').
    removeAttribution( <String> text )-this Removes an attribution text.
    @@ -2725,7 +2998,7 @@ L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);

    L.Control.Layers

    -

    The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the detailed example). It should be created and added explicitly to the map using Map#addControl method. Implements IControl interface.

    +

    The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the detailed example). Extends Control.

    var baseLayers = {
     	"CloudMade": cloudmade,
    @@ -2737,18 +3010,21 @@ var overlays = {
     	"Roads": roadsLayer
     };
     
    -layersControl = new L.Control.Layers(baseLayers, overlays);
    -
    -map.addControl(layersControl);
    +L.control.layers(baseLayers, overlays).addTo(map);

    Constructor

    + +
    ConstructorUsage Description
    L.Control.Layers( <Layer Config> baseLayers?, <Layer Config> overlays?, <Control.Layers options> options? ) + new L.Control.Layers()
    + L.control.layers() +
    Creates an attribution control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes.
    @@ -2762,17 +3038,17 @@ map.addControl(layersControl); addBaseLayer( <ILayer> layer, <String> name ) - this + this Adds a base layer (radio button entry) with the given name to the control. addOverlay( <ILayer> layer, <String> name ) - this + this Adds an overlay (checkbox entry) with the given name to the control. removeLayer( <ILayer> layer ) - this + this Remove the given layer from the control. @@ -2786,11 +3062,17 @@ map.addControl(layersControl); Default Description + + position + String + 'topright' + The position of the control (one of the map corners). See control positions. + collapsed Boolean true - If true, the control will be collapsed into an icon and expanded on mouse hover or touch. + If true, the control will be collapsed into an icon and expanded on mouse hover or touch. @@ -2806,6 +3088,72 @@ map.addControl(layersControl); +

    L.Control.Scale

    + +

    A simple scale control that shows the scale of the current center of screen in metric (m/km) and imerial (mi/ft) systems. Implements IControl interface.

    + +
    L.control.scale().addTo(map);
    + +

    Constructor

    + + + + + + + + + + + +
    ConstructorUsageDescription
    L.Control.Scale( <Control.Scale options> options? ) + new L.Control.Attribution()
    + L.control.attribution() +
    Creates an scale control with the given options.
    + +

    Options

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    OptionTypeDefaultDescription
    positionString'bottomleft'The position of the control (one of the map corners). See control positions.
    maxWidthNumber100Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
    metricBooleantrueWhether to show the metric scale line (m/km).
    imerialBooleantrueWhether to show the imerial scale line (mi/ft).
    updateWhenIdleBooleanfalseIf true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).
    + + +

    Events methods

    A set of methods shared between event-powered classes (like Map). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map 'fire' event).

    @@ -2832,37 +3180,37 @@ map.off('click', onClick); addEventListener( <String> type, <Function> fn, <Object> context? ) - this - Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). + this + Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). removeEventListener( <String> type, <Function> fn, <Object> context? ) - this + this Removes a previously added listener function. on( … ) - this + this Alias to addEventListener. off( … ) - this + this Alias to removeEventListener. hasEventListeners( <String> type ) Boolean - Returns true if a particular event type has some listeners attached to it. + Returns true if a particular event type has some listeners attached to it. fireEvent( <String> type, <Object> data? ) - this + this Fires an event of the specified type. You can optionally provide an data object — the first argument of the listener function will contain its properties. fire( … ) - this + this Alias to fireEvent. @@ -2916,6 +3264,16 @@ map.off('click', onClick); Point Pixel coordinates of the point where the mouse event occured relative to the map layer. + + containerPoint + Point + Pixel coordinates of the point where the mouse event occured relative to the map сontainer. + + + originalEvent + DOMMouseEvent + The original DOM mouse event fired by the browser. +

    LocationEvent

    @@ -3172,57 +3530,57 @@ alert('Upgrade your browser, dude!'); ie Boolean - true for all Internet Explorer versions. + true for all Internet Explorer versions. ie6 Boolean - true for Internet Explorer 6. + true for Internet Explorer 6. webkit Boolean - true for webkit-based browsers like Chrome and Safari (including mobile versions). + true for webkit-based browsers like Chrome and Safari (including mobile versions). webkit3d Boolean - true for webkit-based browsers that support CSS 3D transformations. + true for webkit-based browsers that support CSS 3D transformations. gecko Boolean - true for Gecko-based browsers like Firefox and Mozilla. + true for Gecko-based browsers like Firefox and Mozilla. opera Boolean - true for Opera. + true for Opera. android Boolean - true for Android mobile browser. + true for Android mobile browser. mobile Boolean - true for modern mobile browsers (including iOS Safari and different Android browsers). + true for modern mobile browsers (including iOS Safari and different Android browsers). mobileWebkit Boolean - true for mobile webkit-based browsers. + true for mobile webkit-based browsers. mobileOpera Boolean - true for mobile Opera. + true for mobile Opera. touch Boolean - true for all browsers on touch devices. + true for all browsers on touch devices. @@ -3247,7 +3605,7 @@ alert('Upgrade your browser, dude!'); bind( <Function> fn, <Object> obj ) Function - Returns a function which executes function fn with the given scope obj (so that this keyword refers to obj inside the function code). + Returns a function which executes function fn with the given scope obj (so that this keyword refers to obj inside the function code). stamp( <Object> obj ) @@ -3276,7 +3634,7 @@ alert('Upgrade your browser, dude!'); falseFn() Function - Returns a function which always returns false. + Returns a function which always returns false. formatNum( <Number> num, <Number> digits ) @@ -3367,7 +3725,7 @@ alert('Upgrade your browser, dude!'); hasClass( <HTMLElement> el, <String> name ) Boolean - Returns true if the element class attribute contains name. + Returns true if the element class attribute contains name. addClass( <HTMLElement> el, <String> name ) @@ -3387,7 +3745,7 @@ alert('Upgrade your browser, dude!'); testProp( <String[]> props ) String or false - Goes through the array of style names and returns the first name that is a valid style name for an element. If no such name is found, it returns false. Useful for vendor-prefixed styles like transform. + Goes through the array of style names and returns the first name that is a valid style name for an element. If no such name is found, it returns false. Useful for vendor-prefixed styles like transform. getTranslateString( <Point> point ) @@ -3402,7 +3760,7 @@ alert('Upgrade your browser, dude!'); setPosition( <HTMLElement> el, <Point> point, <Boolean> disable3D? ) - - Sets the position of an element to coordinates specified by point, using CSS translate or top/left positioning depending on the browser (used by Leaflet internally to position its layers). Forces top/left positioning if disable3D is true. + Sets the position of an element to coordinates specified by point, using CSS translate or top/left positioning depending on the browser (used by Leaflet internally to position its layers). Forces top/left positioning if disable3D is true. getPosition( <HTMLElement> el ) @@ -3454,7 +3812,7 @@ alert('Upgrade your browser, dude!'); enabled() Boolean - Returns true if the handler is enabled. + Returns true if the handler is enabled.