react-mapbox-gl
Advanced tools
Comparing version 4.6.0 to 4.6.1
@@ -79,2 +79,3 @@ import * as MapboxGl from 'mapbox-gl'; | ||
transformRequest?: RequestTransformFunction; | ||
antialias?: boolean; | ||
} | ||
@@ -89,3 +90,3 @@ declare global { | ||
} | ||
declare const ReactMapboxFactory: ({ accessToken, apiUrl, minZoom, maxZoom, hash, preserveDrawingBuffer, scrollZoom, interactive, dragRotate, pitchWithRotate, attributionControl, customAttribution, logoPosition, renderWorldCopies, trackResize, touchZoomRotate, doubleClickZoom, keyboard, dragPan, boxZoom, refreshExpiredTiles, failIfMajorPerformanceCaveat, bearingSnap, injectCSS, transformRequest }: FactoryParameters) => { | ||
declare const ReactMapboxFactory: ({ accessToken, apiUrl, minZoom, maxZoom, hash, preserveDrawingBuffer, scrollZoom, interactive, dragRotate, pitchWithRotate, attributionControl, customAttribution, logoPosition, renderWorldCopies, trackResize, touchZoomRotate, doubleClickZoom, keyboard, dragPan, boxZoom, refreshExpiredTiles, failIfMajorPerformanceCaveat, bearingSnap, injectCSS, antialias, transformRequest }: FactoryParameters) => { | ||
new (props: Readonly<Props & Events>): { | ||
@@ -92,0 +93,0 @@ state: State; |
@@ -35,8 +35,8 @@ var __extends = (this && this.__extends) || (function () { | ||
var ReactMapboxFactory = function (_a) { | ||
var accessToken = _a.accessToken, apiUrl = _a.apiUrl, _b = _a.minZoom, minZoom = _b === void 0 ? 0 : _b, _c = _a.maxZoom, maxZoom = _c === void 0 ? 20 : _c, _d = _a.hash, hash = _d === void 0 ? false : _d, _e = _a.preserveDrawingBuffer, preserveDrawingBuffer = _e === void 0 ? false : _e, _f = _a.scrollZoom, scrollZoom = _f === void 0 ? true : _f, _g = _a.interactive, interactive = _g === void 0 ? true : _g, _h = _a.dragRotate, dragRotate = _h === void 0 ? true : _h, _j = _a.pitchWithRotate, pitchWithRotate = _j === void 0 ? true : _j, _k = _a.attributionControl, attributionControl = _k === void 0 ? true : _k, customAttribution = _a.customAttribution, _l = _a.logoPosition, logoPosition = _l === void 0 ? 'bottom-left' : _l, _m = _a.renderWorldCopies, renderWorldCopies = _m === void 0 ? true : _m, _o = _a.trackResize, trackResize = _o === void 0 ? true : _o, _p = _a.touchZoomRotate, touchZoomRotate = _p === void 0 ? true : _p, _q = _a.doubleClickZoom, doubleClickZoom = _q === void 0 ? true : _q, _r = _a.keyboard, keyboard = _r === void 0 ? true : _r, _s = _a.dragPan, dragPan = _s === void 0 ? true : _s, _t = _a.boxZoom, boxZoom = _t === void 0 ? true : _t, _u = _a.refreshExpiredTiles, refreshExpiredTiles = _u === void 0 ? true : _u, _v = _a.failIfMajorPerformanceCaveat, failIfMajorPerformanceCaveat = _v === void 0 ? false : _v, _w = _a.bearingSnap, bearingSnap = _w === void 0 ? 7 : _w, _x = _a.injectCSS, injectCSS = _x === void 0 ? true : _x, transformRequest = _a.transformRequest; | ||
var _y; | ||
var accessToken = _a.accessToken, apiUrl = _a.apiUrl, _b = _a.minZoom, minZoom = _b === void 0 ? 0 : _b, _c = _a.maxZoom, maxZoom = _c === void 0 ? 20 : _c, _d = _a.hash, hash = _d === void 0 ? false : _d, _e = _a.preserveDrawingBuffer, preserveDrawingBuffer = _e === void 0 ? false : _e, _f = _a.scrollZoom, scrollZoom = _f === void 0 ? true : _f, _g = _a.interactive, interactive = _g === void 0 ? true : _g, _h = _a.dragRotate, dragRotate = _h === void 0 ? true : _h, _j = _a.pitchWithRotate, pitchWithRotate = _j === void 0 ? true : _j, _k = _a.attributionControl, attributionControl = _k === void 0 ? true : _k, customAttribution = _a.customAttribution, _l = _a.logoPosition, logoPosition = _l === void 0 ? 'bottom-left' : _l, _m = _a.renderWorldCopies, renderWorldCopies = _m === void 0 ? true : _m, _o = _a.trackResize, trackResize = _o === void 0 ? true : _o, _p = _a.touchZoomRotate, touchZoomRotate = _p === void 0 ? true : _p, _q = _a.doubleClickZoom, doubleClickZoom = _q === void 0 ? true : _q, _r = _a.keyboard, keyboard = _r === void 0 ? true : _r, _s = _a.dragPan, dragPan = _s === void 0 ? true : _s, _t = _a.boxZoom, boxZoom = _t === void 0 ? true : _t, _u = _a.refreshExpiredTiles, refreshExpiredTiles = _u === void 0 ? true : _u, _v = _a.failIfMajorPerformanceCaveat, failIfMajorPerformanceCaveat = _v === void 0 ? false : _v, _w = _a.bearingSnap, bearingSnap = _w === void 0 ? 7 : _w, _x = _a.injectCSS, injectCSS = _x === void 0 ? true : _x, _y = _a.antialias, antialias = _y === void 0 ? false : _y, transformRequest = _a.transformRequest; | ||
var _z; | ||
if (injectCSS) { | ||
require('mapbox-gl/dist/mapbox-gl.css'); | ||
} | ||
return _y = (function (_super) { | ||
return _z = (function (_super) { | ||
__extends(ReactMapboxGl, _super); | ||
@@ -99,2 +99,3 @@ function ReactMapboxGl() { | ||
failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat, | ||
antialias: antialias, | ||
transformRequest: transformRequest | ||
@@ -202,3 +203,3 @@ }; | ||
}(React.Component)), | ||
_y.defaultProps = { | ||
_z.defaultProps = { | ||
onStyleLoad: function (map, evt) { return null; }, | ||
@@ -214,5 +215,5 @@ center: defaultCenter, | ||
}, | ||
_y; | ||
_z; | ||
}; | ||
export default ReactMapboxFactory; | ||
//# sourceMappingURL=map.js.map |
@@ -79,2 +79,3 @@ import * as MapboxGl from 'mapbox-gl'; | ||
transformRequest?: RequestTransformFunction; | ||
antialias?: boolean; | ||
} | ||
@@ -89,3 +90,3 @@ declare global { | ||
} | ||
declare const ReactMapboxFactory: ({ accessToken, apiUrl, minZoom, maxZoom, hash, preserveDrawingBuffer, scrollZoom, interactive, dragRotate, pitchWithRotate, attributionControl, customAttribution, logoPosition, renderWorldCopies, trackResize, touchZoomRotate, doubleClickZoom, keyboard, dragPan, boxZoom, refreshExpiredTiles, failIfMajorPerformanceCaveat, bearingSnap, injectCSS, transformRequest }: FactoryParameters) => { | ||
declare const ReactMapboxFactory: ({ accessToken, apiUrl, minZoom, maxZoom, hash, preserveDrawingBuffer, scrollZoom, interactive, dragRotate, pitchWithRotate, attributionControl, customAttribution, logoPosition, renderWorldCopies, trackResize, touchZoomRotate, doubleClickZoom, keyboard, dragPan, boxZoom, refreshExpiredTiles, failIfMajorPerformanceCaveat, bearingSnap, injectCSS, antialias, transformRequest }: FactoryParameters) => { | ||
new (props: Readonly<Props & Events>): { | ||
@@ -92,0 +93,0 @@ state: State; |
@@ -37,8 +37,8 @@ "use strict"; | ||
var ReactMapboxFactory = function (_a) { | ||
var accessToken = _a.accessToken, apiUrl = _a.apiUrl, _b = _a.minZoom, minZoom = _b === void 0 ? 0 : _b, _c = _a.maxZoom, maxZoom = _c === void 0 ? 20 : _c, _d = _a.hash, hash = _d === void 0 ? false : _d, _e = _a.preserveDrawingBuffer, preserveDrawingBuffer = _e === void 0 ? false : _e, _f = _a.scrollZoom, scrollZoom = _f === void 0 ? true : _f, _g = _a.interactive, interactive = _g === void 0 ? true : _g, _h = _a.dragRotate, dragRotate = _h === void 0 ? true : _h, _j = _a.pitchWithRotate, pitchWithRotate = _j === void 0 ? true : _j, _k = _a.attributionControl, attributionControl = _k === void 0 ? true : _k, customAttribution = _a.customAttribution, _l = _a.logoPosition, logoPosition = _l === void 0 ? 'bottom-left' : _l, _m = _a.renderWorldCopies, renderWorldCopies = _m === void 0 ? true : _m, _o = _a.trackResize, trackResize = _o === void 0 ? true : _o, _p = _a.touchZoomRotate, touchZoomRotate = _p === void 0 ? true : _p, _q = _a.doubleClickZoom, doubleClickZoom = _q === void 0 ? true : _q, _r = _a.keyboard, keyboard = _r === void 0 ? true : _r, _s = _a.dragPan, dragPan = _s === void 0 ? true : _s, _t = _a.boxZoom, boxZoom = _t === void 0 ? true : _t, _u = _a.refreshExpiredTiles, refreshExpiredTiles = _u === void 0 ? true : _u, _v = _a.failIfMajorPerformanceCaveat, failIfMajorPerformanceCaveat = _v === void 0 ? false : _v, _w = _a.bearingSnap, bearingSnap = _w === void 0 ? 7 : _w, _x = _a.injectCSS, injectCSS = _x === void 0 ? true : _x, transformRequest = _a.transformRequest; | ||
var _y; | ||
var accessToken = _a.accessToken, apiUrl = _a.apiUrl, _b = _a.minZoom, minZoom = _b === void 0 ? 0 : _b, _c = _a.maxZoom, maxZoom = _c === void 0 ? 20 : _c, _d = _a.hash, hash = _d === void 0 ? false : _d, _e = _a.preserveDrawingBuffer, preserveDrawingBuffer = _e === void 0 ? false : _e, _f = _a.scrollZoom, scrollZoom = _f === void 0 ? true : _f, _g = _a.interactive, interactive = _g === void 0 ? true : _g, _h = _a.dragRotate, dragRotate = _h === void 0 ? true : _h, _j = _a.pitchWithRotate, pitchWithRotate = _j === void 0 ? true : _j, _k = _a.attributionControl, attributionControl = _k === void 0 ? true : _k, customAttribution = _a.customAttribution, _l = _a.logoPosition, logoPosition = _l === void 0 ? 'bottom-left' : _l, _m = _a.renderWorldCopies, renderWorldCopies = _m === void 0 ? true : _m, _o = _a.trackResize, trackResize = _o === void 0 ? true : _o, _p = _a.touchZoomRotate, touchZoomRotate = _p === void 0 ? true : _p, _q = _a.doubleClickZoom, doubleClickZoom = _q === void 0 ? true : _q, _r = _a.keyboard, keyboard = _r === void 0 ? true : _r, _s = _a.dragPan, dragPan = _s === void 0 ? true : _s, _t = _a.boxZoom, boxZoom = _t === void 0 ? true : _t, _u = _a.refreshExpiredTiles, refreshExpiredTiles = _u === void 0 ? true : _u, _v = _a.failIfMajorPerformanceCaveat, failIfMajorPerformanceCaveat = _v === void 0 ? false : _v, _w = _a.bearingSnap, bearingSnap = _w === void 0 ? 7 : _w, _x = _a.injectCSS, injectCSS = _x === void 0 ? true : _x, _y = _a.antialias, antialias = _y === void 0 ? false : _y, transformRequest = _a.transformRequest; | ||
var _z; | ||
if (injectCSS) { | ||
require('mapbox-gl/dist/mapbox-gl.css'); | ||
} | ||
return _y = (function (_super) { | ||
return _z = (function (_super) { | ||
__extends(ReactMapboxGl, _super); | ||
@@ -101,2 +101,3 @@ function ReactMapboxGl() { | ||
failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat, | ||
antialias: antialias, | ||
transformRequest: transformRequest | ||
@@ -204,3 +205,3 @@ }; | ||
}(React.Component)), | ||
_y.defaultProps = { | ||
_z.defaultProps = { | ||
onStyleLoad: function (map, evt) { return null; }, | ||
@@ -216,5 +217,5 @@ center: defaultCenter, | ||
}, | ||
_y; | ||
_z; | ||
}; | ||
exports.default = ReactMapboxFactory; | ||
//# sourceMappingURL=map.js.map |
{ | ||
"name": "react-mapbox-gl", | ||
"version": "4.6.0", | ||
"version": "4.6.1", | ||
"description": "A React binding of mapbox-gl-js", | ||
@@ -83,3 +83,3 @@ "main": "lib/index.js", | ||
"@types/jest": "23.3.5", | ||
"@types/mapbox-gl": "^0.51.6", | ||
"@types/mapbox-gl": "^0.54.3", | ||
"@types/node": "8.0.29", | ||
@@ -86,0 +86,0 @@ "@types/prettier": "1.10.0", |
@@ -8,8 +8,9 @@ ![Logo](/logo.png) | ||
[![npm downloads](https://img.shields.io/npm/dm/react-mapbox-gl.svg)](https://www.npmjs.com/package/react-mapbox-gl) | ||
[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/ellerbrock/typescript-badges/) | ||
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-blue.svg)](https://github.com/microsoft/TypeScript) | ||
<br/> | ||
#### React wrapper for [mapbox-gl-js](https://www.mapbox.com/mapbox-gl-js/api/). | ||
<br/><br/> | ||
![London cycle example gif](docs/london-cycle-example.gif "London cycle example gif") | ||
![London cycle example gif](docs/london-cycle-example.gif 'London cycle example gif') | ||
@@ -19,23 +20,25 @@ ## Components | ||
### Proxy components (proxy between React and Mapbox API) | ||
- ReactMapboxGL | ||
- Layer & Feature | ||
- property `symbol` displays a mapbox symbol. | ||
- property `line` displays a lineString. | ||
- property `fill` displays a polygon. | ||
- property `circle` displays a mapbox circle. | ||
- property `raster` displays a mapbox raster tiles. | ||
- property `fill-extrusion` displays a layer with extruded buildings. | ||
- property `background` displays a mapbox background layer. | ||
- property `heatmap` displays a mapbox heatmap layer. | ||
- Source | ||
- GeoJSONLayer | ||
* ReactMapboxGL | ||
* Layer & Feature | ||
* property `symbol` displays a mapbox symbol. | ||
* property `line` displays a lineString. | ||
* property `fill` displays a polygon. | ||
* property `circle` displays a mapbox circle. | ||
* property `raster` displays a mapbox raster tiles. | ||
* property `fill-extrusion` displays a layer with extruded buildings. | ||
* property `background` displays a mapbox background layer. | ||
* property `heatmap` displays a mapbox heatmap layer. | ||
* Source | ||
* GeoJSONLayer | ||
### DOM components (normal React components) | ||
- ZoomControl | ||
- ScaleControl | ||
- RotationControl | ||
- Marker (Projected component) | ||
- Popup (Projected component) | ||
- Cluster | ||
* ZoomControl | ||
* ScaleControl | ||
* RotationControl | ||
* Marker (Projected component) | ||
* Popup (Projected component) | ||
* Cluster | ||
## Getting Started | ||
@@ -51,6 +54,6 @@ | ||
// ES6 | ||
import ReactMapboxGl, { Layer, Feature } from "react-mapbox-gl"; | ||
import ReactMapboxGl, { Layer, Feature } from 'react-mapbox-gl'; | ||
// ES5 | ||
var ReactMapboxGl = require("react-mapbox-gl"); | ||
var ReactMapboxGl = require('react-mapbox-gl'); | ||
var Layer = ReactMapboxGl.Layer; | ||
@@ -60,3 +63,4 @@ var Feature = ReactMapboxGl.Feature; | ||
const Map = ReactMapboxGl({ | ||
accessToken: "pk.eyJ1IjoiZmFicmljOCIsImEiOiJjaWc5aTV1ZzUwMDJwdzJrb2w0dXRmc2d0In0.p6GGlfyV-WksaDV_KdN27A" | ||
accessToken: | ||
'pk.eyJ1IjoiZmFicmljOCIsImEiOiJjaWc5aTV1ZzUwMDJwdzJrb2w0dXRmc2d0In0.p6GGlfyV-WksaDV_KdN27A' | ||
}); | ||
@@ -68,27 +72,32 @@ | ||
containerStyle={{ | ||
height: "100vh", | ||
width: "100vw" | ||
}}> | ||
<Layer | ||
type="symbol" | ||
id="marker" | ||
layout={{ "icon-image": "marker-15" }}> | ||
<Feature coordinates={[-0.481747846041145, 51.3233379650232]}/> | ||
</Layer> | ||
</Map> | ||
height: '100vh', | ||
width: '100vw' | ||
}} | ||
> | ||
<Layer type="symbol" id="marker" layout={{ 'icon-image': 'marker-15' }}> | ||
<Feature coordinates={[-0.481747846041145, 51.3233379650232]} /> | ||
</Layer> | ||
</Map>; | ||
``` | ||
## Why are `zoom`, `bearing` and `pitch` Arrays ? | ||
If those properties changed at the mapbox-gl-js level and you don't update the value kept in your state, it will be unsynced with the current viewport. At some point you might want to update the viewport value (zoom, pitch or bearing) with the ones in your state but using value equality is not enough. Taking zoom as example, you will still have the unsynced zoom value therefore we can't tell if you want to update the prop or not. In order to explicitly update the current viewport values you can instead break the references of those props and reliably update the current viewport with the one you have in your state to be synced again. | ||
## [Version 3.0 Documentation](docs/API.md) | ||
## [Version 2.0 Documentation](https://github.com/alex3165/react-mapbox-gl/blob/v2-archive/docs/API.md) | ||
## [Current version documentation](docs/API.md) | ||
## [Version 3.0 documentation](https://github.com/alex3165/react-mapbox-gl/blob/v3.9.2/docs/API.md) | ||
## [Version 2.0 documentation](https://github.com/alex3165/react-mapbox-gl/blob/v2-archive/docs/API.md) | ||
## Contributions | ||
Please try to reproduce your problem with the [boilerplate](https://github.com/alex3165/react-mapbox-gl-debug) before posting an issue. | ||
## mapbox-gl-draw compatibility | ||
Try [react-mapbox-gl-draw](https://github.com/amaurymartiny/react-mapbox-gl-draw) | ||
## Looking for an Angular alternative? | ||
Try [ngx-mapbox-gl](https://github.com/Wykks/ngx-mapbox-gl) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
480605
9356
99