Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Changes from 23 commits
09506bd
6680637
35ee289
b87ebe7
49f9d00
2830eb7
1c11645
fa0c76a
e3e8b94
299ece4
51f2d31
b30d229
8523355
b0dfada
93ecb91
690fe84
c25fe65
5b4ba2a
9e1a0cf
57cfc8b
a0ea72d
9aefac9
1ca5f27
7c3ce6d
a4598ed
d2e49a6
5514ba1
da41fe6
2a5ebdf
9e31ef2
82c2ce9
b4bcfb3
9fb29e0
bd08c5f
6c95d89
86dfab0
02496cd
f317fd6
61fff90
1f0e75b
d4372a8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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: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;
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 be0
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.
Exactly 🐈
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.