Skip to content

Commit

Permalink
Merge a65818c into 393e076
Browse files Browse the repository at this point in the history
  • Loading branch information
Xintong Xia committed Apr 20, 2020
2 parents 393e076 + a65818c commit 78d6018
Show file tree
Hide file tree
Showing 654 changed files with 18,766 additions and 696 deletions.
11 changes: 4 additions & 7 deletions examples/react-map-gl-draw/app.js
@@ -1,27 +1,24 @@
import React, { Component } from 'react';
import { render } from 'react-dom';
import MapGL from 'react-map-gl';
import { Editor, EditingMode } from 'react-map-gl-draw';

import {
Editor,
SelectMode,
EditingMode,
DrawPointMode,
DrawLineStringMode,
DrawRectangleMode,
DrawRectangleOneclickMode,
DrawPolygonMode,
} from 'react-map-gl-draw';
} from '@nebula.gl/edit-modes';

import { MODES } from './constants';
import Toolbar from './toolbar';

const MODE_TO_HANDLER = {
[MODES.READ_ONLY]: null,
[MODES.SELECT]: SelectMode,
[MODES.EDITING]: EditingMode,
[MODES.DRAW_POINT]: DrawPointMode,
[MODES.DRAW_PATH]: DrawLineStringMode,
[MODES.DRAW_RECTANGLE]: DrawRectangleMode,
[MODES.DRAW_RECTANGLE_ONE_CLICK]: DrawRectangleOneclickMode,
[MODES.DRAW_POLYGON]: DrawPolygonMode,
};

Expand Down
2 changes: 0 additions & 2 deletions examples/react-map-gl-draw/constants.js
@@ -1,9 +1,7 @@
export const MODES = {
READ_ONLY: 'READ_ONLY',
SELECT: 'SELECT',
EDITING: 'EDITING',
DRAW_POINT: 'DRAW_POINT',
DRAW_CIRCLE: 'DRAW_CIRCLE',
DRAW_PATH: 'DRAW_PATH',
DRAW_POLYGON: 'DRAW_POLYGON',
DRAW_RECTANGLE: 'DRAW_RECTANGLE',
Expand Down
7 changes: 7 additions & 0 deletions examples/react-map-gl-draw/static/icon-circle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion examples/react-map-gl-draw/static/icon-rectangle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions examples/react-map-gl-draw/toolbar.js
Expand Up @@ -10,11 +10,6 @@ const ICON_MAP = [
{ id: MODES.DRAW_PATH, text: 'Draw Polyline', icon: 'icon-path.svg' },
{ id: MODES.DRAW_POLYGON, text: 'Draw Polygon', icon: 'icon-polygon.svg' },
{ id: MODES.DRAW_RECTANGLE, text: 'Draw Rectangle', icon: 'icon-rectangle.svg' },
{
id: MODES.DRAW_RECTANGLE_ONE_CLICK,
text: 'Draw Rectangle (One Click)',
icon: 'icon-rectangle.svg',
},
];

const Container = styled.div`
Expand Down
20 changes: 13 additions & 7 deletions examples/webpack.config.local.js
Expand Up @@ -11,12 +11,12 @@ const resolve = require('path').resolve;
const webpack = require('webpack');

const LIB_DIR = resolve(__dirname, '..');
const MAIN_SRC_DIR = resolve(LIB_DIR, './modules/main');
const EDIT_MODES_SRC_DIR = resolve(LIB_DIR, './modules/edit-modes');
const LAYERS_SRC_DIR = resolve(LIB_DIR, './modules/layers');
const OVERLAYS_SRC_DIR = resolve(LIB_DIR, './modules/overlays');
const EDITOR_SRC_DIR = resolve(LIB_DIR, './modules/editor');
const REACT_EDITOR_LITE_SRC_DIR = resolve(LIB_DIR, './modules/react-map-gl-draw');
const MAIN_SRC_DIR = resolve(LIB_DIR, './modules/main/src/');
const EDIT_MODES_SRC_DIR = resolve(LIB_DIR, './modules/edit-modes/src/');
const LAYERS_SRC_DIR = resolve(LIB_DIR, './modules/layers/src/');
const OVERLAYS_SRC_DIR = resolve(LIB_DIR, './modules/overlays/src/');
const EDITOR_SRC_DIR = resolve(LIB_DIR, './modules/editor/src/');
const REACT_EDITOR_LITE_SRC_DIR = resolve(LIB_DIR, './modules/react-map-gl-draw/src');

// const babelConfig = require('../babel.config');

Expand All @@ -33,6 +33,7 @@ function makeLocalDevConfig(EXAMPLE_DIR = LIB_DIR) {
devtool: 'source-map',

resolve: {
extensions: ['.js', '.ts', '.tsx'],
alias: {
'nebula.gl/dist': MAIN_SRC_DIR,
'nebula.gl': MAIN_SRC_DIR,
Expand Down Expand Up @@ -70,10 +71,15 @@ function makeLocalDevConfig(EXAMPLE_DIR = LIB_DIR) {
rules: [
{
// Unfortunately, webpack doesn't import library sourcemaps on its own...
test: /\.js$/,
test: /\.js$|\.ts$|\.tsx$/,
use: ['source-map-loader'],
enforce: 'pre',
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
// Optional: Enables reading mapbox token from environment variable
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Expand Up @@ -3,6 +3,6 @@ module.exports = {
verbose: true,
testURL: 'http://localhost/',
collectCoverageFrom: ['modules/*/src/**/*.{ts,tsx}', '!**/node_modules/**'],
testPathIgnorePatterns: ['/node_modules/', '/website/'],
testPathIgnorePatterns: ['/node_modules/', '/lib/', '/website/'],
"preset": "ts-jest"
};
2 changes: 2 additions & 0 deletions lib/examples/advanced/src/app.d.ts
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=app.d.ts.map
1 change: 1 addition & 0 deletions lib/examples/advanced/src/app.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions lib/examples/advanced/src/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/examples/advanced/src/app.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions lib/examples/advanced/src/example.d.ts
@@ -0,0 +1,60 @@
import { Component } from 'react';
import { GeoJsonEditMode } from 'nebula.gl';
export default class Example extends Component<{}, {
viewport: Record<string, any>;
testFeatures: any;
mode: typeof GeoJsonEditMode;
modeConfig: any;
pointsRemovable: boolean;
selectedFeatureIndexes: number[];
editHandleType: string;
selectionTool?: string;
showGeoJson: boolean;
pathMarkerLayer: boolean;
featureMenu?: {
index: number;
x: number;
y: number;
};
}> {
constructor(props: {});
componentDidMount(): void;
componentWillUnmount(): void;
_onChangeViewport: (viewport: Record<string, any>) => void;
_onLayerClick: (info: any) => void;
_resize: () => void;
_loadSample: (type: string) => void;
_copy: () => void;
_paste: () => void;
_download: () => void;
_parseStringJson: (json: string) => void;
_error: (err: any) => void;
_getHtmlColorForFeature(index: number, selected: boolean): string;
_getDeckColorForFeature(index: number, bright: number, alpha: number): number[];
_renderSelectFeatureCheckbox(index: number, featureType: string): JSX.Element;
_renderSelectFeatureCheckboxes(): any[];
_renderBooleanOperationControls(): JSX.Element;
_renderTwoClickPolygonControls(): JSX.Element;
_renderModifyModeControls(): JSX.Element;
_renderSplitModeControls(): JSX.Element;
_renderSnappingControls(): JSX.Element;
_renderMeasureDistanceControls(): JSX.Element;
_renderModeConfigControls(): any[];
_renderToolBox(): JSX.Element;
renderStaticMap(viewport: Record<string, any>): JSX.Element;
_featureMenuClick(action: string): void;
_renderFeatureMenu({ x, y }: {
x: number;
y: number;
}): JSX.Element;
customizeLayers(layers: Record<string, any>[]): void;
onEdit: ({ updatedData, editType, editContext }: {
updatedData: any;
editType: any;
editContext: any;
}) => void;
getFillColor: (feature: any, isSelected: any) => number[];
getLineColor: (feature: any, isSelected: any) => number[];
render(): JSX.Element;
}
//# sourceMappingURL=example.d.ts.map
1 change: 1 addition & 0 deletions lib/examples/advanced/src/example.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 78d6018

Please sign in to comment.