-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add support to draw rectangle shape to filter documents #348
Conversation
e1823aa
to
162096f
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #348 +/- ##
==========================================
- Coverage 85.71% 84.04% -1.68%
==========================================
Files 18 19 +1
Lines 448 470 +22
Branches 66 71 +5
==========================================
+ Hits 384 395 +11
- Misses 43 53 +10
- Partials 21 22 +1 see 5 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
162096f
to
f929262
Compare
Signed-off-by: Vijayan Balasubramanian <[email protected]>
f929262
to
e704224
Compare
@@ -53,6 +62,8 @@ export const DrawFilterShape = ({ | |||
useEffect(() => { | |||
if (filterProperties.mode === FILTER_DRAW_MODE.POLYGON) { | |||
mapboxDrawRef.current.changeMode(MAPBOX_GL_DRAW_MODES.DRAW_POLYGON); | |||
} else if (filterProperties.mode === FILTER_DRAW_MODE.RECTANGLE) { | |||
mapboxDrawRef.current.changeMode(MAPBOX_GL_DRAW_MODES.DRAW_RECTANGLE); | |||
} else { | |||
// default mode | |||
mapboxDrawRef.current.changeMode(MAPBOX_GL_DRAW_MODES.SIMPLE_SELECT); |
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.
How about use switch here?
function setDrawMode(mode) {
switch (mode) {
case FILTER_DRAW_MODE.POLYGON:
return MAPBOX_GL_DRAW_MODES.DRAW_POLYGON;
case FILTER_DRAW_MODE.RECTANGLE:
return MAPBOX_GL_DRAW_MODES.DRAW_RECTANGLE;
default:
return MAPBOX_GL_DRAW_MODES.SIMPLE_SELECT;
}
}
useEffect(() => {
mapboxDrawRef.current.changeMode(setDrawMode(filterProperties.mode));
}, [filterProperties.mode]);
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.
Ack
From the demo video, there are two draw controller icons, is it expected? |
I am waiting for new 'rectangle icon " from UX. Will replace it in new PR. |
Signed-off-by: Vijayan Balasubramanian <[email protected]>
f5b5c2b
* Add rectangle ui tool bar Signed-off-by: Vijayan Balasubramanian <[email protected]> (cherry picked from commit a42c915)
* Add rectangle ui tool bar Signed-off-by: Vijayan Balasubramanian <[email protected]>
Description
Add rectangle draw mode similar to Polygon.
Issues Resolved
#213
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.
Screen.Recording.2023-03-14.at.10.24.55.PM.mov