-
Notifications
You must be signed in to change notification settings - Fork 24
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 bounding box tool #5767
Add bounding box tool #5767
Conversation
- reduce global position calculation complexity - no dashed lines as highlighed bbox anymore
frontend/javascripts/oxalis/model/accessors/view_mode_accessor.js
Outdated
Show resolved
Hide resolved
TODOs:
Maybe in this PR / maybe in a follow-up pr:
Testing TODOs:
|
- add move plane when alt is pressed - add c as shortcut to create a new bbox - remove left click to create new bbox - set center of bbox created with context menu at clicked position - remove `user` from default naming schema of bboxes
frontend/javascripts/oxalis/controller/combinations/skeleton_handlers.js
Show resolved
Hide resolved
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.
Great stuff :) Here's my first round of feedback. Didn't review all files yet, but will do the rest tomorrow!
frontend/javascripts/oxalis/controller/combinations/tool_controls.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/tool_controls.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/model/accessors/view_mode_accessor.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/model/accessors/view_mode_accessor.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/model/actions/annotation_actions.js
Outdated
Show resolved
Hide resolved
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.
Wow, really impressive how you poured the complexity into code and even added usability perks, such as resizing via corners and undo/redo 👍 I left a couple of comments on which we should do at least one iteration pass, I think. Also, I'm looking forward to testing, but the CI fails. Let me know in case you need some help with that 🤙
frontend/javascripts/oxalis/model/reducers/annotation_reducer.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/model/reducers/annotation_reducer.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/model/reducers/annotation_reducer.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Outdated
Show resolved
Hide resolved
// between the mouse and bounding box be the same in each dimension. | ||
const cornerToCompareWith = compareToMin ? min : max; | ||
if (pos[edgeDim] < min[edgeDim]) { | ||
// Case 1: Distance to the min corner is needed in edgeDim. |
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 don't understand why this is computing the distance to the corner (even though the method is named getDistanceToBoundingBoxEdge
). Wouldn't this mean that if I try to resize the top border of a bbox like this:
mouse grabs here
x
--------------------------------------------------------------------------------------------------
| |
| |
a very long distance to a corner would be returned (because the bbox is very wide) so that I cannot really grab the handle, even though I'm only one pixel away from the border?
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.
The first case computes the distance to the left top corner in your example.
But this way of calculating the distance is only chosen when mouse.x is smaller than the min.x of the bounding box.
See pos[edgeDim] < min[edgeDim]
in the if at line 63.
Here is a matching when which case kicks in and the vector / distance that is calculated;
min.x max.x
↓ ↓
↓ ↓
case 1 ↓ case 3 case 3 ↓ case 2
'. | | .'
'↘ ↓ ↓ ↙'
-------------------------------------------------
| |
| |
Is a little bit better understandable?
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.
Ahhhh, now I got it :) So, in my example, edgeDim
would need to be 0
because it's referring to the case where the horizontal edge is checked. And consequentially, it would compare the x values (and not the y values which I somehow assumed would also be a valid case).
Could you please adapt the above comment to explain how to interpret edgeDim
? I.e., 1
means it's a vertical edge. Now, I also understand the "This example is for the xy viewport for y as the main direction / edgeDim." comment which I apparently didn't really grok before.
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.
Ahhhh, now I got it :) So, in my example, edgeDim would need to be 0 because it's referring to the case where the horizontal edge is checked. And consequentially, it would compare the x values (and not the y values which I somehow assumed would also be a valid case).
Exactly 🐈
Could you please adapt the above comment to explain how to interpret edgeDim? I.e., 1 means it's a vertical edge.
Not exactly, edgeDim
gives the dimension index that the edge extents to: 0 <=> edge direction is x (like above), 1 <=> edge direction is y (like above but downwards), 2 <=> edge direction is z.
I changed the comment highlighted above in the code. Could you please check whether this is now understandable? If not, could you please try to help me explain this logic? I think the explanation is not straightforward.
- and make ui more expressive via tooltips
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.
awesome :) I'll test tomorrow!
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/controller/combinations/bounding_box_handlers.js
Outdated
Show resolved
Hide resolved
TODOS:
|
Testing went great mostly! I only noticed:
And also a thing which is not blocking, though:
|
Yeah, I also had the issue while testing. Only updating on enter or blur fixes the issue. 👍
That was easy to fix. I accidentally remove the line that closed the context menu. But the bounding box color selection item is problematic, as color inputs only have an on change and on blur. The problem with the blur is, that is triggered once a color is selected for the first time and not when the color input of the browser is closed. Therefore closing the context menu on blur leads to wrong behavior. And also important:During testing I noticed a regression of a bug that the cursor might be fixed at looking like something is resizable when changing form the bbox tool to another tool. Therefore the deselection mechanism added by this pr wasn't working properly, but it had before. As this was a "regression" bug in this pr, I added two tests to avoid a regression later on. Note that I had to update the testing lib "sinon" to get a function needed for the tests. |
…nossos into add-bounding-box-tool
Another way of solving this could be to remember the "previous tool" in the saga (also see the
I like this solution better, because it doesn't require adding more information into the existing action. Do you think, this can be changed?
Cool! This means that the context-menu always closes automatically except when changing the color, right? |
Great 🐝 🐝 🐝 |
Yeah, your suggestion is much better than my current solution. I just coded in your solution and it works purrfect 🐱
Indeed 👍 @philippotto Could you please do a final testing? I think this pr should be finally ready to go |
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.
Awesome work 🥇 Feel free to merge :)
URL of deployed dev instance (used for testing):
Steps to test:
Issues:
Note: