-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1261 from osmlab/prerelease
v3.6.3
- Loading branch information
Showing
78 changed files
with
2,023 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import L from 'leaflet' | ||
import './leaflet-areaselect' | ||
import { injectIntl } from 'react-intl' | ||
import { MapControl, withLeaflet } from 'react-leaflet' | ||
|
||
/** | ||
* Leaflet AreaSelect that allows selection of a bounding box. | ||
* | ||
* Note: An object passed to the constructor will be available as `this.options` | ||
* | ||
* Code provided by: https://github.com/heyman/leaflet-areaselect/ | ||
*/ | ||
const AreaSelectLeaflet = L.Control.extend({ | ||
onAdd: function(map) { | ||
const areaSelect = L.areaSelect({width:200, height:300}); | ||
areaSelect.addTo(map) | ||
|
||
// Send a callback when the bounds change | ||
areaSelect.on("change", () => { | ||
this.options.onBoundsChanged(areaSelect.getBounds()) | ||
}) | ||
|
||
return L.DomUtil.create('div') | ||
}}) | ||
|
||
|
||
/** | ||
* AreaSelect is a react-leaflet component intended to be | ||
* used as a child of a react-leaflet Map instance, such as EnhancedMap. When | ||
* clicked, the control activates | ||
*/ | ||
export class AreaSelect extends MapControl { | ||
// props will be available as `options` field in the leaflet control | ||
createLeafletElement(props) { | ||
return new AreaSelectLeaflet(props) | ||
} | ||
} | ||
|
||
export default withLeaflet(injectIntl(AreaSelect)) |
Oops, something went wrong.