Skip to content

Commit

Permalink
Merge pull request #3 from gisaia/rebase/fromMapbox
Browse files Browse the repository at this point in the history
Rebase/from mapbox
  • Loading branch information
sebbousquet authored Oct 15, 2019
2 parents 503beee + 8ff8d07 commit 20a2ae6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog

## 1.1.2

- update mapbox-gl peer dependency

## 1.1.1

- update mapbox-gl peer dependency
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ git push
npm publish
```

Update the version number in [the GL JS example](https://github.com/mapbox/mapbox-gl-js/blob/mb-pages/docs/pages/example/mapbox-gl-draw.html).
Update the version number in [the GL JS example](https://github.com/mapbox/mapbox-gl-js/blob/publisher-production/docs/pages/example/mapbox-gl-draw.html).

### Naming actions

Expand Down
12 changes: 7 additions & 5 deletions docs/MODES.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ _please feel free to add your own modes to this list via a PR_
- [Rotate Mode](https://github.com/mapstertech/mapbox-gl-draw-rotate-mode): Add ability to Rotate GL Draw features
- [Radius Mode](https://gist.github.com/chriswhong/694779bc1f1e5d926e47bab7205fa559): Draws a polygon circle based on a center vertex and radius line
- [Rectangle Mode](https://github.com/edgespatial/mapbox-gl-draw-rectangle-mode)
- [Circle Mode](https://github.com/iamanvesh/mapbox-gl-draw-circle)
- [Assisted Rectangle Mode](https://github.com/geostarters/mapbox-gl-draw-assisted-rectangle-mode)

## Life Cycle Functions

Expand Down Expand Up @@ -204,23 +206,23 @@ Triggered when the mode is being exited, to be used for cleaning up artifacts su

### MODE.onTrash

Triggered when [draw.trash()](https://github.com/mapbox/mapbox-gl-draw/blob/master/API.md#trash-draw) is called.
Triggered when [draw.trash()](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md#trash-draw) is called.

**Parameters**

- `state` {Object} - a mutible state object created by onSetup

### MODE.onCombineFeature

Triggered when [draw.combineFeatures()](https://github.com/mapbox/mapbox-gl-draw/blob/master/API.md#combinefeatures-draw) is called.
Triggered when [draw.combineFeatures()](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md#combinefeatures-draw) is called.

**Parameters**

- `state` {Object} - a mutible state object created by onSetup

### MODE.onUncombineFeature

Triggered when [draw.uncombineFeatures()](https://github.com/mapbox/mapbox-gl-draw/blob/master/API.md#uncombinefeatures-draw) is called.
Triggered when [draw.uncombineFeatures()](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md#uncombinefeatures-draw) is called.

**Parameters**

Expand All @@ -229,7 +231,7 @@ Triggered when [draw.uncombineFeatures()](https://github.com/mapbox/mapbox-gl-dr
### MODE.toDisplayFeatures

Triggered per feature on render to convert raw features into set of features for display on the map
See [styling draw](https://github.com/mapbox/mapbox-gl-draw/blob/master/API.md#styling-draw) for information about what geojson properties Draw uses as part of rendering.
See [styling draw](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md#styling-draw) for information about what geojson properties Draw uses as part of rendering.

**Parameters**

Expand Down Expand Up @@ -335,7 +337,7 @@ Clear all selected coordinates
### this.setActionableState

Indicate if the different actions are currently possible with your mode
See [draw.actionalbe](https://github.com/mapbox/mapbox-gl-draw/blob/master/API.md#drawactionable) for a list of possible actions. All undefined actions are set to **false** by default
See [draw.actionalbe](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md#drawactionable) for a list of possible actions. All undefined actions are set to **false** by default

**Parameters**

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gisaia-team/mapbox-gl-draw",
"version": "1.1.2",
"version": "1.1.3",
"description": "A drawing component for Mapbox GL JS",
"homepage": "https://github.com/mapbox/mapbox-gl-draw",
"author": "mapbox",
Expand Down Expand Up @@ -71,7 +71,7 @@
"unassertify": "^2.0.3"
},
"peerDependencies": {
"mapbox-gl": ">=0.27.0 <=0.51.0"
"mapbox-gl": ">=0.27.0 <2.0.0"
},
"dependencies": {
"@mapbox/geojson-area": "^0.2.1",
Expand Down
10 changes: 7 additions & 3 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = function(ctx) {
const clickedButton = e.target;
if (clickedButton === activeButton) {
deactivateButtons();
options.onDeactivate();
return;
}

Expand Down Expand Up @@ -109,7 +110,8 @@ module.exports = function(ctx) {
container: controlGroup,
className: Constants.classes.CONTROL_BUTTON_LINE,
title: `LineString tool ${ctx.options.keybindings ? '(l)' : ''}`,
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_LINE_STRING)
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_LINE_STRING),
onDeactivate: () => ctx.events.trash()
});
}

Expand All @@ -118,7 +120,8 @@ module.exports = function(ctx) {
container: controlGroup,
className: Constants.classes.CONTROL_BUTTON_POLYGON,
title: `Polygon tool ${ctx.options.keybindings ? '(p)' : ''}`,
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POLYGON)
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POLYGON),
onDeactivate: () => ctx.events.trash()
});
}

Expand All @@ -127,7 +130,8 @@ module.exports = function(ctx) {
container: controlGroup,
className: Constants.classes.CONTROL_BUTTON_POINT,
title: `Marker tool ${ctx.options.keybindings ? '(m)' : ''}`,
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POINT)
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POINT),
onDeactivate: () => ctx.events.trash()
});
}

Expand Down

0 comments on commit 20a2ae6

Please sign in to comment.