Skip to content

Commit

Permalink
master -> main
Browse files Browse the repository at this point in the history
  • Loading branch information
karimnaaji committed Jun 16, 2020
1 parent 405e3bf commit 3e2f29f
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

## 1.0.0

- Adds [Custom Mode support](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/MODES.md)
- Adds [Custom Mode support](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/MODES.md)
- Drops `static` mode, which can now be found [in its own repo](https://github.com/mapbox/mapbox-gl-draw-static-mode)
- Fixes bug where `MapboxDraw` would prevent `MapboxGeocoder` delete actions (#673)

Expand Down Expand Up @@ -119,7 +119,7 @@

#### ⚠️ Breaking changes ⚠️

- Requires [[email protected]](https://github.com/mapbox/mapbox-gl-js/blob/master/CHANGELOG.md#0270-november-11-2016).
- Requires [[email protected]](https://github.com/mapbox/mapbox-gl-js/blob/main/CHANGELOG.md#0270-november-11-2016).
- Detects style changes and reapplies Draw if it has been removed.
- Fixes UMD support.
- Changes `mapboxgl.Draw` to `mapboxglDraw` when in global scope.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @mapbox/mapbox-gl-draw

[![Greenkeeper badge](https://badges.greenkeeper.io/mapbox/mapbox-gl-draw.svg)](https://greenkeeper.io/) [![Build Status](https://travis-ci.org/mapbox/mapbox-gl-draw.svg?branch=master)](https://travis-ci.org/mapbox/mapbox-gl-draw)
[![Greenkeeper badge](https://badges.greenkeeper.io/mapbox/mapbox-gl-draw.svg)](https://greenkeeper.io/) [![Build Status](https://travis-ci.org/mapbox/mapbox-gl-draw.svg?branch=main)](https://travis-ci.org/mapbox/mapbox-gl-draw)

Adds support for drawing and editing features on [mapbox-gl.js](https://www.mapbox.com/mapbox-gl-js/) maps. [See a live example here](https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/)

Expand Down Expand Up @@ -69,13 +69,13 @@ map.on('load', function() {

https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/

### See [API.md](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md) for complete reference.
### See [API.md](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/API.md) for complete reference.

### Enhancements and New Interactions

For additional functionality [check out our list of custom modes](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/MODES.md#available-custom-modes).
For additional functionality [check out our list of custom modes](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/MODES.md#available-custom-modes).

Mapbox Draw accepts functionality changes after the functionality has been proven out via a [custom mode](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/MODES.md#creating-modes-for-mapbox-draw). This lets users experiment and validate their mode before entering a review process, hopefully promoting innovation. When you write a custom mode, please open a PR adding it to our [list of custom modes](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/MODES.md#available-custom-modes).
Mapbox Draw accepts functionality changes after the functionality has been proven out via a [custom mode](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/MODES.md#creating-modes-for-mapbox-draw). This lets users experiment and validate their mode before entering a review process, hopefully promoting innovation. When you write a custom mode, please open a PR adding it to our [list of custom modes](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/MODES.md#available-custom-modes).

### Developing and testing

Expand Down
8 changes: 4 additions & 4 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ All of the following options are optional.
- `clickBuffer`, number (default: `2`): Number of pixels around any feature or vertex (in every direction) that will respond to a click.
- `touchBuffer`, number (default: `25`): Number of pixels around any feature of vertex (in every direction) that will respond to a touch.
- `controls`, Object: Hide or show individual controls. Each property's name is a control, and value is a boolean indicating whether the control is on or off. Available control names are `point`, `line_string`, `polygon`, `trash`, `combine_features` and `uncombine_features`. By default, all controls are on. To change that default, use `displayControlsDefault`.
- `displayControlsDefault`, boolean (default: `true`): The default value for `controls`. For example, if you would like all controls to be *off* by default, and specify a whitelist with `controls`, use `displayControlsDefault: false`.
- `displayControlsDefault`, boolean (default: `true`): The default value for `controls`. For example, if you would like all controls to be *off* by default, and specify an allowed list with `controls`, use `displayControlsDefault: false`.
- `styles`, Array\<Object\>: An array of map style objects. By default, Draw provides a map style for you. To learn about overriding styles, see the [Styling Draw](#styling-draw) section below.
- `modes`, Object: over ride the default modes with your own. `MapboxDraw.modes` can be used to see the default values. More information on custom modes [can be found here](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/MODES.md).
- `modes`, Object: over ride the default modes with your own. `MapboxDraw.modes` can be used to see the default values. More information on custom modes [can be found here](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/MODES.md).
- `defaultMode`, String (default: `'simple_select'`): the mode (from `modes`) that user will first land in.
- `userProperties`, boolean (default: `false`): properties of a feature will also be available for styling and prefixed with `user_`, e.g., `['==', 'user_custom_label', 'Example']`

## Modes

By default MapboxDraw ships with a few modes. These modes aim to cover the basic needed functionally for MapboxDraw to create the core GeoJSON feature types. Along with these, MapboxDraw also supports [custom modes. Click here for more details](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/MODES.md).
By default MapboxDraw ships with a few modes. These modes aim to cover the basic needed functionally for MapboxDraw to create the core GeoJSON feature types. Along with these, MapboxDraw also supports [custom modes. Click here for more details](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/MODES.md).

The mode name strings are available as an enum at `Draw.modes`.

Expand Down Expand Up @@ -549,7 +549,7 @@ If `opts.userProperties` is set to `true` the properties of a feature will also

### Example Custom Styles

See [EXAMPLES.md](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/EXAMPLES.md) for examples of custom styles.
See [EXAMPLES.md](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/EXAMPLES.md) for examples of custom styles.

## Using Draw with Mapbox GL JS's `queryRenderedFeatures`

Expand Down
2 changes: 1 addition & 1 deletion docs/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Styling

See [API.md#styling-draw](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md#styling-draw) for a complete styling reference.
See [API.md#styling-draw](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/API.md#styling-draw) for a complete styling reference.

### points

Expand Down
22 changes: 11 additions & 11 deletions docs/MODES.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,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/docs/API.md#trash-draw) is called.
Triggered when [draw.trash()](https://github.com/mapbox/mapbox-gl-draw/blob/main/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/docs/API.md#combinefeatures-draw) is called.
Triggered when [draw.combineFeatures()](https://github.com/mapbox/mapbox-gl-draw/blob/main/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/docs/API.md#uncombinefeatures-draw) is called.
Triggered when [draw.uncombineFeatures()](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/API.md#uncombinefeatures-draw) is called.

**Parameters**

Expand All @@ -231,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/docs/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/main/docs/API.md#styling-draw) for information about what geojson properties Draw uses as part of rendering.

**Parameters**

Expand All @@ -250,7 +250,7 @@ Sets Draw's internal selected state
**Parameters**

- `features`
- `null-null` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;DrawFeature>** whats selected as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js)
- `null-null` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;DrawFeature>** whats selected as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)

### this.setSelectedCoordinates

Expand All @@ -262,7 +262,7 @@ Sets Draw's internal selected coordinate state

### this.getSelected

Get all selected features as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js)
Get all selected features as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;DrawFeature>**

Expand All @@ -284,7 +284,7 @@ Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe

### this.getFeature

Get a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js) by its id
Get a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) by its id

**Parameters**

Expand Down Expand Up @@ -319,7 +319,7 @@ Delete a feature from draw

### this.addFeature

Add a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js) to draw.
Add a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) to draw.
See `this.newFeature` for converting geojson into a DrawFeature

**Parameters**
Expand All @@ -337,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/docs/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/main/docs/API.md#drawactionable) for a list of possible actions. All undefined actions are set to **false** by default

**Parameters**

Expand Down Expand Up @@ -381,7 +381,7 @@ Get the features at the location of an event object or in a bbox

### this.newFeature

Create a new [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js) from geojson
Create a new [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) from geojson

**Parameters**

Expand All @@ -391,7 +391,7 @@ Returns **DrawFeature**

### this.isInstanceOf

Check is an object is an instance of a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js)
Check is an object is an instance of a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)

**Parameters**

Expand Down
8 changes: 4 additions & 4 deletions src/modes/mode_interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,29 +113,29 @@ ModeInterface.prototype.onTap = function() {};
ModeInterface.prototype.onStop = function() {};

/**
* 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/main/API.md#trash-draw) is called.
* @name MODE.onTrash
* @param state {Object} - a mutible state object created by onSetup
*/
ModeInterface.prototype.onTrash = function() {};

/**
* 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/main/API.md#combinefeatures-draw) is called.
* @name MODE.onCombineFeature
* @param state {Object} - a mutible state object created by onSetup
*/
ModeInterface.prototype.onCombineFeature = function() {};

/**
* 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/main/API.md#uncombinefeatures-draw) is called.
* @name MODE.onUncombineFeature
* @param state {Object} - a mutible state object created by onSetup
*/
ModeInterface.prototype.onUncombineFeature = function() {};

/**
* 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/main/API.md#styling-draw) for information about what geojson properties Draw uses as part of rendering.
* @name MODE.toDisplayFeatures
* @param state {Object} - a mutible state object created by onSetup
* @param geojson {Object} - a geojson being evaulated. To render, pass to `display`.
Expand Down
14 changes: 7 additions & 7 deletions src/modes/mode_interface_accessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function ModeInterface(ctx) {
/**
* Sets Draw's interal selected state
* @name this.setSelected
* @param {DrawFeature[]} - whats selected as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js)
* @param {DrawFeature[]} - whats selected as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)
*/
ModeInterface.prototype.setSelected = function(features) {
return this._ctx.store.setSelected(features);
Expand All @@ -37,7 +37,7 @@ ModeInterface.prototype.setSelectedCoordinates = function(coords) {
};

/**
* Get all selected features as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js)
* Get all selected features as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)
* @name this.getSelected
* @returns {DrawFeature[]}
*/
Expand Down Expand Up @@ -65,7 +65,7 @@ ModeInterface.prototype.isSelected = function(id) {
};

/**
* Get a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js) by its id
* Get a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) by its id
* @name this.getFeature
* @param {String} id - a feature id
* @returns {DrawFeature}
Expand Down Expand Up @@ -102,7 +102,7 @@ ModeInterface.prototype.deleteFeature = function(id, opts = {}) {
};

/**
* Add a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js) to draw.
* Add a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) to draw.
* See `this.newFeature` for converting geojson into a DrawFeature
* @name this.addFeature
* @param {DrawFeature} feature - the feature to add
Expand All @@ -127,7 +127,7 @@ ModeInterface.prototype.clearSelectedCoordinates = function() {

/**
* Indicate if the different action 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/main/API.md#drawactionable) for a list of possible actions. All undefined actions are set to **false** by default
* @name this.setActionableState
* @param {Object} actions
*/
Expand Down Expand Up @@ -182,7 +182,7 @@ ModeInterface.prototype.featuresAt = function(event, bbox, bufferType = 'click')
};

/**
* Create a new [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js) from geojson
* Create a new [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) from geojson
* @name this.newFeature
* @param {GeoJSONFeature} geojson
* @returns {DrawFeature}
Expand All @@ -196,7 +196,7 @@ ModeInterface.prototype.newFeature = function(geojson) {
};

/**
* Check is an object is an instance of a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/master/src/feature_types/feature.js)
* Check is an object is an instance of a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)
* @name this.isInstanceOf
* @param {String} type - `Point`, `LineString`, `Polygon`, `MultiFeature`
* @param {Object} feature - the object that needs to be checked
Expand Down

0 comments on commit 3e2f29f

Please sign in to comment.