From ca6aff029588596f8bf0fd1c68647c795780dd4a Mon Sep 17 00:00:00 2001 From: Per Liedman Date: Fri, 27 Oct 2017 08:27:41 +0200 Subject: [PATCH] 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 --- src/geo/LatLng.js | 4 ++++ src/geo/LatLngBounds.js | 4 ++++ src/geo/crs/CRS.js | 4 ++++ src/geo/projection/index.js | 4 ++++ src/geometry/Bounds.js | 4 ++++ src/geometry/Point.js | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/src/geo/LatLng.js b/src/geo/LatLng.js index 11c87993..f384674c 100644 --- a/src/geo/LatLng.js +++ b/src/geo/LatLng.js @@ -21,6 +21,10 @@ import {toLatLngBounds} from './LatLngBounds'; * map.panTo({lat: 50, lng: 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) { diff --git a/src/geo/LatLngBounds.js b/src/geo/LatLngBounds.js index c9783b28..8fc03c3a 100644 --- a/src/geo/LatLngBounds.js +++ b/src/geo/LatLngBounds.js @@ -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. + * + * 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[]) diff --git a/src/geo/crs/CRS.js b/src/geo/crs/CRS.js index 7dfcdd0e..553775fd 100644 --- a/src/geo/crs/CRS.js +++ b/src/geo/crs/CRS.js @@ -15,6 +15,10 @@ import * as Util from '../../core/Util'; * Leaflet defines the most usual CRSs by default. If you want to use a * CRS not defined by default, take a look at the * [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 = { diff --git a/src/geo/projection/index.js b/src/geo/projection/index.js index b51d36d4..781d1cf2 100644 --- a/src/geo/projection/index.js +++ b/src/geo/projection/index.js @@ -15,6 +15,10 @@ * The inverse of `project`. Projects a 2D point into a geographical location. * 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'; diff --git a/src/geometry/Bounds.js b/src/geometry/Bounds.js index 62fcbdc5..2b3286b8 100644 --- a/src/geometry/Bounds.js +++ b/src/geometry/Bounds.js @@ -19,6 +19,10 @@ import {Point, toPoint} from './Point'; * ```js * 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) { diff --git a/src/geometry/Point.js b/src/geometry/Point.js index 6fa73972..ac21c649 100644 --- a/src/geometry/Point.js +++ b/src/geometry/Point.js @@ -18,6 +18,10 @@ import {isArray, formatNum} from '../core/Util'; * map.panBy([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) {