Add notes to classes which don't inherit Class (#5878)

* Add note about LatLng not inheriting Class

Fixes #3301.

* Add note about LatLngBounds, Bounds, Point, CRSs and projections not inheriting Class
This commit is contained in:
Per Liedman 2017-10-27 08:27:41 +02:00 committed by Andrew
parent 0f5507d2a7
commit ca6aff0295
6 changed files with 24 additions and 0 deletions

View File

@ -21,6 +21,10 @@ import {toLatLngBounds} from './LatLngBounds';
* map.panTo({lat: 50, lng: 30}); * map.panTo({lat: 50, lng: 30});
* map.panTo(L.latLng(50, 30)); * map.panTo(L.latLng(50, 30));
* ``` * ```
*
* Note that `LatLng` does not inherit from Leafet's `Class` object,
* which means new classes can't inherit from it, and new methods
* can't be added to it with the `include` function.
*/ */
export function LatLng(lat, lng, alt) { export function LatLng(lat, lng, alt) {

View File

@ -24,6 +24,10 @@ import {LatLng, toLatLng} from './LatLng';
* ``` * ```
* *
* Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range. * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range.
*
* Note that `LatLngBounds` does not inherit from Leafet's `Class` object,
* which means new classes can't inherit from it, and new methods
* can't be added to it with the `include` function.
*/ */
export function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[]) export function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[])

View File

@ -15,6 +15,10 @@ import * as Util from '../../core/Util';
* Leaflet defines the most usual CRSs by default. If you want to use a * Leaflet defines the most usual CRSs by default. If you want to use a
* CRS not defined by default, take a look at the * CRS not defined by default, take a look at the
* [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin. * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin.
*
* Note that the CRS instances do not inherit from Leafet's `Class` object,
* and can't be instantiated. Also, new classes can't inherit from them,
* and methods can't be added to them with the `include` function.
*/ */
export var CRS = { export var CRS = {

View File

@ -15,6 +15,10 @@
* The inverse of `project`. Projects a 2D point into a geographical location. * The inverse of `project`. Projects a 2D point into a geographical location.
* Only accepts actual `L.Point` instances, not arrays. * Only accepts actual `L.Point` instances, not arrays.
* Note that the projection instances do not inherit from Leafet's `Class` object,
* and can't be instantiated. Also, new classes can't inherit from them,
* and methods can't be added to them with the `include` function.
*/ */
export {LonLat} from './Projection.LonLat'; export {LonLat} from './Projection.LonLat';

View File

@ -19,6 +19,10 @@ import {Point, toPoint} from './Point';
* ```js * ```js
* otherBounds.intersects([[10, 10], [40, 60]]); * otherBounds.intersects([[10, 10], [40, 60]]);
* ``` * ```
*
* Note that `Bounds` does not inherit from Leafet's `Class` object,
* which means new classes can't inherit from it, and new methods
* can't be added to it with the `include` function.
*/ */
export function Bounds(a, b) { export function Bounds(a, b) {

View File

@ -18,6 +18,10 @@ import {isArray, formatNum} from '../core/Util';
* map.panBy([200, 300]); * map.panBy([200, 300]);
* map.panBy(L.point(200, 300)); * map.panBy(L.point(200, 300));
* ``` * ```
*
* Note that `Point` does not inherit from Leafet's `Class` object,
* which means new classes can't inherit from it, and new methods
* can't be added to it with the `include` function.
*/ */
export function Point(x, y, round) { export function Point(x, y, round) {