Skip to content

Commit

Permalink
fix: add support for DrawPolygonByDragging mode (uber#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
faroceann authored Jan 22, 2021
1 parent 8c86eca commit cbb7284
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/react-map-gl-draw/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export {
DrawLineStringMode,
DrawPolygonMode,
DrawRectangleMode,
DrawPolygonByDraggingMode,
} from '@nebula.gl/edit-modes';
7 changes: 6 additions & 1 deletion modules/react-map-gl-draw/src/mode-handler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,16 @@ export default class ModeHandler extends React.PureComponent<EditorProps, Editor
pointerDownPicks,
pointerDownScreenCoords,
pointerDownMapCoords,
cancelPan: event.sourceEvent.stopImmediatePropagation,
};

if (this.state.didDrag) {
const modeProps = this.getModeProps();
this._modeHandler.handlePointerMove(pointerMoveEvent, modeProps);
if (this._modeHandler.handleDragging) {
this._modeHandler.handleDragging(pointerMoveEvent, modeProps);
} else {
this._modeHandler.handlePointerMove(pointerMoveEvent, modeProps);
}
}

this.setState({
Expand Down

0 comments on commit cbb7284

Please sign in to comment.