Skip to content

Commit

Permalink
Export library methods for external custom modes
Browse files Browse the repository at this point in the history
These are all the library methods that all the modes use. Exporting them
makes it possible for others to write custom modes which provides the
same functionality.

Fixes mapbox#786
  • Loading branch information
trygveaa committed Mar 20, 2020
1 parent 405e3bf commit 7274ac0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import runSetup from './src/setup';
import setupOptions from './src/options';
import setupAPI from './src/api';
import * as Constants from './src/constants';
import * as CommonSelectors from './src/lib/common_selectors';
import constrainFeatureMovement from './src/lib/constrain_feature_movement';
import createSupplementaryPoints from './src/lib/create_supplementary_points';
import createVertex from './src/lib/create_vertex';
import doubleClickZoom from './src/lib/double_click_zoom';
import featuresAt from './src/lib/features_at';
import isEventAtCoordinates from './src/lib/is_event_at_coordinates';
import mouseEventPoint from './src/lib/mouse_event_point';
import moveFeatures from './src/lib/move_features';
import StringSet from './src/lib/string_set';

const setupDraw = function(options, api) {
options = setupOptions(options);
Expand Down Expand Up @@ -30,4 +40,18 @@ function MapboxDraw(options) {
import modes from './src/modes/index';
MapboxDraw.modes = modes;

export {
Constants,
CommonSelectors,
constrainFeatureMovement,
createSupplementaryPoints,
createVertex,
doubleClickZoom,
featuresAt,
isEventAtCoordinates,
mouseEventPoint,
moveFeatures,
StringSet
};

export default MapboxDraw;
1 change: 1 addition & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default {
name: 'MapboxDraw',
file: outputFile,
format: 'umd',
exports: 'named',
sourcemap: true,
indent: false
},
Expand Down

0 comments on commit 7274ac0

Please sign in to comment.