New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: react-map-gl-draw #229
Conversation
Pull Request Test Coverage Report for Build 1161
💛 - Coveralls |
- `EditorModes.DRAW_POINT` - Lets you draw a Point feature. | ||
- `EditorModes.DRAW_RECTANGLE` - Lets you draw a Rectangle feature. | ||
|
||
- `getFeatureStyle` (Function, Optional) : Object - A function to style features, function parameters are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't getFeatureStyle
should be for path
element, and getVertexStyle
should be for circle
and rect
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the APIs. getVertexStyle
is kind of exposing the implementation details. So decided to use getEditHandleStyle
, which will be applied to the feature being edited.
- `EditorModes.DRAW_POINT` - Lets you draw a Point feature. | ||
- `EditorModes.DRAW_RECTANGLE` - Lets you draw a Rectangle feature. | ||
|
||
- `getFeatureStyle` (Function, Optional) : Object - A function to style features, function parameters are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we decided what style properties we will support here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react-map-gl-draw
is using svg
circle
, rect
and path
to draw features, so any styles which could be applied to these svg
elements will be supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh - I had it in my head that this was drawing to the gl context. Does this then create an <svg>
element and overlay it on top of the canvas where Deck and/or Mapbox are drawing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. All the drawing will be rendered in a svg overlay on top of react-map-gl base map
- `EditorModes.DRAW_RECTANGLE` - Lets you draw a Rectangle feature. | ||
|
||
- `getFeatureStyle` (Function, Optional) : Object - A function to style features, function parameters are | ||
- `feature`: feature to style |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are features represented by geojson? Or SVG elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
features
are following GeoJson
format, each data point has longitude
, and latitude
value.
features
are rendered using svg
elements. react-map-gl-draw
will use the viewport
provided by MapcontextProvider
to project the lng, lat
to screen coordinates and render in svg.
- `mode` (String, Optional) - `react-map-gl` is stateless, user has complete control of the `mode`. | ||
- `EditorModes.READ_ONLY` - Not interactive. This is the default mode. | ||
- `EditorModes.SELECT_FEATURE` - Lets you select, delete, and drag features. | ||
- `EditorModes.EDIT_VERTEX` - Lets you select, delete, and drag vertices; and drag features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer selectable
and editable
be independent flags from the modes. This would support the scenario where the app allows the user to draw new features and edit existing features at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would it take to get these EditorModes
to just be nebula.gl EditMode
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refactor is the first step, which helps me to understand what kinds of behaviors are expected under different modes. Then the next step is to extract handlers for different modes by extending edit-modes module.
Update doc based on suggestions Fix example code and address comments fix inconsistent naming Update with more explanations and resolve comments udpate API resolve comments
767e7ce
to
e1f4161
Compare
Port RFC from
react-map-gl
and update the API.Below is a demo using
react-map-gl-draw
.