How to use the react-map-gl.experimental.MapControls function in react-map-gl

To help you get started, we’ve selected a few react-map-gl 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 bsdavidson / trimetric / web / src / components / map.jsx View on Github external
mask: true
  },
  stop: {
    x: 240,
    y: 0,
    width: 80,
    height: 80,
    mask: true
  }
};

function clamp(f) {
  return f < 0 ? 0 : f > 1 ? 1 : f;
}

export class CustomMapControls extends experimental.MapControls {
  constructor(props) {
    super(props);
    this.props = props;
    this.events = ["click", "mousedown"];
  }

  handleEvent(event) {
    if (event.type === "mousedown") {
      this.props.onMouseDown();
    }
    return super.handleEvent(event);
  }
}

class MapBox extends Component {
  constructor(props) {