How to use the react-map-gl-draw.EditorModes.DRAW_RECTANGLE function in react-map-gl-draw

To help you get started, we’ve selected a few react-map-gl-draw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / / examples / react-map-gl-draw / toolbar.js View on Github external
/* global setTimeout */
import React, { PureComponent } from 'react';
import styled from 'styled-components';
import { EditorModes } from 'react-map-gl-draw';

const MODES = [
  { id: EditorModes.SELECT, text: 'Edit Feature', icon: 'icon-select.svg' },
  { id: EditorModes.DRAW_POINT, text: 'Draw Point', icon: 'icon-point.svg' },
  { id: EditorModes.DRAW_PATH, text: 'Draw Polyline', icon: 'icon-path.svg' },
  { id: EditorModes.DRAW_POLYGON, text: 'Draw Polygon', icon: 'icon-polygon.svg' },
  { id: EditorModes.DRAW_RECTANGLE, text: 'Draw Rectangle', icon: 'icon-rectangle.svg' }

const Container = styled.div`
  position: absolute;
  width: 48px;
  left: 24px;
  top: 24px;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.15);
  outline: none;
  display: flex;
  justify-content: center;
  flex-direction: column;

const Row = styled.div`