- Bump mapbox-gl to 0.37.0
- New:
fitBounds
util function - Fix: Map flickering when drag over popups
- BREAKING:
onChangeViewport
is nowonViewportChange
- New event management system based on hammer.js
- FIX: Touch interaction
- Remove
MapControls
React component - Remove
ControllerClass
prop fromInteractiveMap
- Add
mapControls
prop toInteractiveMap
- Add
visibility
prop toStaticMap
for showing/hiding the map - Rename
_getMap
method togetMap
- Add
queryRenderedFeatures
method that exposes the MapboxGL API with the same name - Remove all interactivity related props from
StaticMap
- Remove intermediate state props from
InteractiveMap
:startPanLngLat
,startZoomLngLat
,startBearing
,startPitch
,startZoom
. InteractiveMap
is now stateful (isDragging
andisHover
)- Rename
onClickFeatures
andonHoverFeatures
toonClick
andonHover
. RemoveignoreEmptyFeatures
prop. The callbacks are invoked with an event object withfeatures
andlngLat
fields. - New
getCursor
prop ofInteractiveMap
: returns cursor style from the current map state - Rename
displayConstraints
tovisibilityConstraints
- Remove
perspectiveEnabled
prop. AddscrollZoom
,dragPan
,dragRotate
,doubleClickZoom
,touchZoomRotate
props.
- NEW: Marker component
- NEW: Popup component
- FIX:
attributeControl
prop - NEW: NavigationControl component
- FIX: Prop comparison bug in static map
- FIX: Children get unmounted/re-mounted when the map is shown/hidden
- FIX: Viewport jump at start of rotation with pitch
- FIX: Viewport jump at start of pan with pitch
- FIX: Zoom around mouse position
-
NEW: Supports "tree-shaking" in Webpack2 and Rollup - adds new package.json
module
field that points to files with preserved ES6 import/exports. -
NEW: Significant reduction in number of npm dependencies.
-
NEW: Setting the new
pressKeyToRotate
prop tofalse
will make rotation rather than pan the default operation, requiring a function key to be pressed for pan. -
BREAKING: The
ChoroplethOverlay
React component is no longer part of the exported library. It has been moved to examples folder, applications that still need it can copy it from there instead of importing it directly. RemovingChoroplethOverlay
eliminated a number of big D3 dependencies from react-map-gl, which seemed like the right tradeoff since most users are using mapbox styles or deck.gl layers for Choropleths.
- Event handling (Pan/Zoom/Tilt) has been significantly refactored, and is
now handled by a separate component (
MapControls
). - A new
StaticMap
component is the actualmapbox-gl
wrapper. It only handles click and hover events. - The separation of event handling from the map component opens up some
interesting use cases, including creating apps that can modify viewports
beyond mapbox' rendering limits and using the
MapControls
with non-mapbox maps.
- A new
InteractiveMap
is provided, that uses theMapControls
component to add pan/zoom/title toStaticMap
.InteractiveMap
closely resembles the originalMapGL
component from version 1 and is the default export ofreact-map-gl
in v2.react-map-gl
should thus be API compatible with v1 in most cases, although there might be subtle differences in how events are handled.
- Changed
postinstall
script again to use postinstall.js to run flow-remove-types. This attempts to resolve cross-platform issues. (#192)
- Fixed calculation of map pitch during interaction
- Changed
postinstall
script
- We updated to
mapbox-gl
0.31.0 which introduced flow types as well as having a hard dependency on Node >= v4. We now assume that you are on Node >= v4 and npm >= v3. - We want >= v2.0.0 of
react-map-gl
to continue trackingmapbox-gl
updates as closely as possible. This means minor / patch updates will be published more frequently. - This also marks the start of more aggressive development on
react-map-gl
and we will start rolling out bigger updates in the coming months.
- Bump
mapbox-gl
to v0.31.0 - Add
maxZoom
prop and defaults to20
- Add
onLoad
event handler - Add
onClick
prop handler (#140)
- Ensure fitBounds doesn't return NaN zoom value (#159)
- Use 'changedTouches' for 'touchend' / 'touchcancel' events (#164)
- Typo fix in draggable-points overlay (#178)
- Remove mapbox-gl's
Point
dependency from map-interactions. (#161)
- Added more info about usage with Webpack in README
- Use any one of the function keys {command, shift, ctrl, alt} to enable the perspective mode.
- Bump Mapbox version to 0.26
-
Provide a way to control per-layer interactivity - onClickFeatures and onHoverFeatures have the option to only query selected layers. Enabled by setting the
interactive
property totrue
in layer styles. (#131) -
Fix bug where onClickFeatures is fired after panning/rotating (#133)
- Hotfix: GeoJSON style support issue with mapbox-gl 0.24.0
- Reduced flicker when updating GeoJSON sources in styles - (Thanks @tsemerad) Covers certain cases, for more info see #124)
MapGL.supported()
- New function which calls mapbox-gl'ssupported()
. Enables applications to detect unsupported browsers and avoid rendering the react-map-gl, for graceful recovery or error handling.- Bumps mapbox-gl dependency to 0.24.0.
- Cursor now changes to pointer over interactive features
- Fix grab cursor in recent Chrome browsers
- Add touch support (Thanks @cammanderson)
- Remove alphaify dependency due to peerDependency issues
- Bumped
alphaify
dependency to avoid pulling in d3 v3 as sub-dependency - Added test case for
fitBounds
- Bump d3 to v4, replaces monolithic d3 dependency with specific d3 submodules.
- Added
clickRadius
prop to allow for customization of hitbox around clicked point
- Add
fitBounds
- Update mapbox-gl from v0.21.0 (from v0.20.0)
- Now supports
bearing
andpitch
properties, per mapbox-gl-js api documentation. These props default to 0 which means that maps will still be rendered in flat/ortographic mode when they are not provided. - Setting the
perspectiveEnabled
prop to true enables a perspective control mode (Command-Drag) allowing the user to change perspective.
Limitations: The existing overlays (HTMLOverlay, CanvasOverlay, SVGOverlay etc) do not currently support perspective mode. For a set of overlays that do support perspective mode, see deck.gl
Note: The map state reported by onViewportChanged may now contain additional state fields (tracking not only pitch and bearing, but also transient information about how the projection is being changed by the user). To simplify and future proof applications, it is recommended to simply save the entire mapState in your app store whenever it changes and then pass it back to the component rather than trying to keep track of individual fields (More info in README.md).
Note 2: A utility for calculating projections and projection matrices based
on props that include pitch and bearing will be provided separately.
In the mean-time, ViewportMercatorProject
still works
for non-perspective maps.
- The code base has been updated to ES6+ and is now transpiled back to ES5 before being published on npm.
- The map overlay components (HTMLOverlay, CanvasOverlay, SVGOverlay etc)
previously had to be imported via their relative source paths (e.g.
import SVGOverlay from 'react-map-gl/src/overlays/svg-overlays';
). These files still exist, but have now be rewritten in ES6+ which will not work for most applications. Instead the various Layers components are now exported as additional named exports from the module, and can be accessed using "desctructuring" imports:
import MapGL, {SVGOverlay} from 'react-map-gl';
or
var MapGL = require(`react-map-gl`);
var SVGOverlay = MapGL.SVGOverlay;
The previously exported fitbounds
function will be made available
as part of the separate package of utilities that handles coordinate
projections in perspective mode.