-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fixes rectangle deletion on Android. Also changes the way delete works. #345
Conversation
+ No more transparent button with an x on it that has to move around if a rectangle's edge is near the image's edge. + Now, in delete mode, all rectangles go from green to red. Click anywhere on a rectangle to delete it.
I really like this solution! Thinking about a11y / colorblindness though, just switching between red and green may not be super obvious for everyone. How do you feel about adding a diagonal line pattern inside the boxes as well, something like: https://projects.invisionapp.com/d/main#/console/13393648/434396833/preview |
@beckyrother Oooh, you're right! I forgot to check that. I appear to not have access to that link (no idea why). Could you please post a screenshot of it here? |
@beckyrother here's one thing I can definitely do: Let me see what I can find about filling shapes with a pattern! |
@beckyrother WAIIIIIT I got patterns going. I need to figure out the math for this specific pattern but I got it! |
For reviewers' reference: I timeboxed the pattern effort, hit the timebox, and fell back on the semi-opaque fill solution. |
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 LGTM!
I noted an unrelated issue (also on master
) I'll open a GitHub issue for we discussed on Slack.
+ It was displaying a 200 x 200 square on all devices, which was inconsistent with most image dimensions. + Now it displays the exact image dimensions on iOS. + On Android, we chose default dimensions that work for most images. + TODO: revisit when Image.getSize in react-native is fixed for Android.
if (Platform.OS === 'android') { | ||
width = 200 | ||
height = 280 | ||
this.props.classifierActions.setSubjectSizeInWorkflow(subject.id, {width, height}) |
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.
'height' is not defined no-undef
'width' is not defined no-undef
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.
- for iOS iPhone11 I got an error on drawing workflow load -
naturalHeight
undefined perMarkableImage.js
. Adding the following default props toMarkableImage.js
appears to fix:
MarkableImage.defaultProps = {
subjectDimensions: {
naturalWidth: 200,
naturalHeight: 240
},
}
- on Android Pixel 3 there was still a little cutoff, but changing the height to
260
(inDrawingClassifier.js
andMarkableImage.js
) seems to help - EDIT - just read commit messages, not sure about height,240
is definitely better, not sure if downsides to increasing to260
or280
, so I'm going to mark this as ok, but def something to revisit (as already noted)
…d naturalHeight aren't passed
…mmon Android devices
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.
Looks/works great on iPhone11, Pixel 2, and Pixel 3!
Fixes #341.
What this change should allow you to do:
So, originally, the way that drawing flows worked was that they had insert mode and delete mode. In insert mode, you could draw and move rectangles. In delete mode, a transparent, round button with a green border and a green x appeared in the upper right hand corner.
Well, if a rectangle was up against the right side or top of the image, you couldn't reach the delete button.
So an open source contributor submitted a change that would move the button to any of the four corners, depending on where the rectangle was.
This solved the problem of making delete touch targets available for all rectangles. But it introduced a new problem: the button was now harder to find. Because it is transparent with a green x, it blends into images that have green in them, or that have a lot of detail in them. Plus, now you could not narrow down where it would be based on the rectangle position, because it could be in any of the four corners.
There was another problem: Android and iOS calculate positions slightly differently, and the change was calibrated for iOS screen dimension units. So on Android it didn't work, since Android thought the button was in a different place than it was.
We could have just added position conversions for all four corners for Android, doubling our number of special cases from 4 to 8. Such code would be a pain to maintain, and the feature already wasn't user-friendly.
So I changed it.
Now, there is no more "remove" button on the rectangles. In insert mode, it's a green rectangle that you can draw and resize, like before.
In delete mode, all the rectangles turn red, and clicking on one removes it.
This way, since at least one corner of the rectangle is always accessible, it is always possible to delete.
Invision Mock-ups:
Review Checklist
rm -rf node_modules/ && npm install
and app works as expected?My goals for this PR: