Skip to content
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

Tracking Issue: Quick measurement overlays while holding the Alt key #1896

Open
3 of 4 tasks
Keavon opened this issue Aug 5, 2024 · 20 comments · Fixed by #1894 or #2147
Open
3 of 4 tasks

Tracking Issue: Quick measurement overlays while holding the Alt key #1896

Keavon opened this issue Aug 5, 2024 · 20 comments · Fixed by #1894 or #2147
Assignees
Labels
Good First Issue Good for newcomers

Comments

@Keavon
Copy link
Member

Keavon commented Aug 5, 2024


When holding the Alt key with a layer (or multiple) selected, while hovering over another layer (or group), an overlay should appear visualizing the AABB of both the selected and hovered layers, with lines and distance numbers (in document coordinates) between them as shown below.

When the document is viewed with a tilt in the viewport PTZ navigation, the lines become angled but the text labels stay upright for readability.

Here are, I believe, all the scenarios. The three diagrams with text do care about which is the selected layer and which is the hovered layer; all the others are drawn the same in either order, so it doesn't matter which is the selected or hovered one. The two colored boxes represent AABBs, not actual shapes in the artwork— those should be drawn with a blue outline around both their AABBs.

Scenarios
Terminology definitions:

- "Boxes overlap along 0/1/2 axes" means extruding the box's edge infinitely left/right, or up/down, would hit the other box
- "0/1/2 of their centerlines cross the other boxes" means extending both box's center points infinitely left/right, or up/down, would hit the other box
- "Along axis A/B" means either the X and Y, or the Y and X, axes
- "box A/B" means either one particular box and its opposite, or the reverse

Boxes overlap along 0 axes:

image
Boxes overlap along 1 axis and 0 of their centerlines cross the other boxes:

image
Boxes overlap along 1 axis and 2 of their centerlines cross the other boxes:

image
Boxes overlap along 1 axis and 1 of their centerlines cross the other boxes:

image
Boxes overlap along 2 axes and:
- Along axis A, box A has 1 edge line cross box B while box B has 1 edge line cross box A
- Along axis B, box A has 1 edge line cross box B while box B has 1 edge line cross box A

capture
Boxes overlap along 2 axes and:
- Along axis A, box A has 1 edge line cross box B while box B has 1 edge line cross box A
- Along axis B, box A has 2 edge lines cross box B while box B has 0 edge lines cross box A

capture
Boxes overlap along 2 axes and:
- Along axis A, box A has 2 edge lines cross box B while box B has 0 edge lines cross box A
- Along axis B, box A has 0 edge lines cross box B while box B has 2 edge lines cross box A

capture
Boxes overlap along 2 axes and:
- Along axis A, box A has 2 edge lines cross box B while box B has 0 edge lines cross box A
- Along axis B, box A has 1 edge line cross box B while box B has 1 edge line cross box A

capture
Boxes overlap along 2 axes and:
- Along axis A, box A has 2 edge lines cross box B while box B has 0 edge lines cross box A
- Along axis B, box A has 2 edge lines cross box B while box B has 0 edge lines cross box A

capture

Diagram source file: Quick Measurement Overlays Design.graphite.txt

@singhutsav5502
Copy link
Contributor

Hi, @Keavon .

@singhutsav5502
Copy link
Contributor

Hi, @Keavon opened a PR #2155 for sub-task 3.

@Keavon Keavon changed the title Quick measurement overlays while holding the Alt key Tracking Issue: Quick measurement overlays while holding the Alt key Dec 23, 2024
@Keavon Keavon moved this from In-Progress Tasks to In-Progress Projects in Task Board Dec 23, 2024
@Keavon Keavon removed the Rust label Dec 30, 2024
@singhutsav5502
Copy link
Contributor

Hi, @Keavon do you happen to know of any tool(s) that show similar functionality/features especially for rotated objects. I think it would be best to have some examples on expected functionality for rotated shapes before i work any further on this issue especially since the existing axis crossing and center line crossing logic may not work as expected when relative rotation is involved.

@Keavon
Copy link
Member Author

Keavon commented Jan 7, 2025

Please ping me again if I forget to respond with an answer in the next day or two. It'll take me a little while to prepare a spec for you, but you are definitely right to ask because it's nontrivial what should happen here.

@singhutsav5502
Copy link
Contributor

Please ping me again if I forget to respond with an answer in the next day or two. It'll take me a little while to prepare a spec for you, but you are definitely right to ask because it's nontrivial what should happen here.

okay!

@0HyperCube 0HyperCube removed their assignment Jan 10, 2025
@singhutsav5502
Copy link
Contributor

Hi, @Keavon just a quick ping for the specs.

@Keavon
Copy link
Member Author

Keavon commented Jan 15, 2025

Still haven't gotten to it yet, sorry. Ping me in a few more days if I still haven't.

@Keavon Keavon removed the Feature label Jan 19, 2025
@Keavon
Copy link
Member Author

Keavon commented Jan 23, 2025

@singhutsav5502 Ok, I have an answer for you, thanks for your patience.

The quick measurement overlay should occur in the rotational space of the selected layer.

Then, if the hovered layer has a different rotation compared to the selected layer, it should draw blue overlays of an axis-aligned bounding box (where the axis-alignment is in the space of the selected layer) around the hovered layer. That way, the quick measurement can measure a straight line from the selected layer to this bounding box of the hovered layer, with both sharing the same rotation in relation to each other.

References to the "selected layer" in the previous paragraph technically mean "the transform cage's bounding box". Because if you have multiple layers selected and they don't share the same rotation, the transform cage will use the rotation of the top layer for the transform cage. It is the transform cage which counts as the "selected layer" in the context of the previous paragraph.

@singhutsav5502
Copy link
Contributor

@singhutsav5502 Ok, I have an answer for you, thanks for your patience.

Then, if the hovered layer has a different rotation compared to the selected layer, it should draw blue overlays of an axis-aligned bounding box (where the axis-alignment is in the space of the selected layer) around the hovered layer. That way, the quick measurement can measure a straight line from the selected layer to this bounding box of the hovered layer, with both sharing the same rotation in relation to each other.

I see, so the AABB drawn around the Hovered layer runs parallel to the "selected layer" transform cage? and there's a straight line connecting the "selected layer" transform cage to the drawn AABB ?

@Keavon
Copy link
Member Author

Keavon commented Jan 25, 2025

Yes, exactly.

Also please be aware of the situation where the layer is skewed. Currently this happens, which isn't desired, and it completely breaks apart in most other positions (I had to find a nice position for the screenshot):

capture

@singhutsav5502
Copy link
Contributor

Yes, exactly.

Also please be aware of the situation where the layer is skewed. Currently this happens, which isn't desired, and it completely breaks apart in most other positions (I had to find a nice position for the screenshot):

capture

Okay, is there a particular function that defines how the AABB is affected by the skew transform?

@Keavon
Copy link
Member Author

Keavon commented Jan 25, 2025

On both ends of the quick measure, we want the AABB in the rotational space of the transform cage. As the name AABB implies, "box" shouldn't be a parallelogram. So you will want the AABB around the parallelogram on the selected (transform cage) and hovered ends of the measurement, where both of those boxes have parallel edges with each other.

@Keavon
Copy link
Member Author

Keavon commented Jan 25, 2025

By the way, there's no need to quote my message every time you reply, that just makes this comment section longer than it needs to be. You can either @mention the person or check from the "Participants" list at the top right sidebar of the issue to see who will receive notifications, so in this case there's three of us receiving notifications to all comments. Quoting doesn't even send notifications. It's meant for quoting a specific snippet to type a response to, not just repeating the whole message. Just wanted to let you know.

@singhutsav5502
Copy link
Contributor

Image

using the path tool to skew the selected layer seems to retain the original functionality, how do i go about skewing the "layer" ?

@Keavon
Copy link
Member Author

Keavon commented Feb 1, 2025

If you just moved the points with the Path tool, that isn't skewing. Use the Select tool to rotate it, scale it along one axis with S and X, then un-rotate it.

@singhutsav5502
Copy link
Contributor

Hi, in case of the below case of a skewed rectangle, which one of the following 2 would serve as the expected functionality?
The first one seems to be following the minimum x value of the skewed rectangle, which technically based on the definition of AABB should be correct.

Image

Image

@singhutsav5502
Copy link
Contributor

Also maybe i am misunderstanding something here, do the axis aligned Rect return the AABB values when queried for selected_bounds.min() / max() or do they return values for the actual shape itself. ( i have been assuming that they return AABB values so far ).

Image

@Keavon
Copy link
Member Author

Keavon commented Feb 4, 2025

The first image is correct. I don't understand your second comment's question so I can't answer it.

@Keavon
Copy link
Member Author

Keavon commented Feb 11, 2025

@singhutsav5502 just checking in :)

@singhutsav5502
Copy link
Contributor

Hi, still working on the issue. Will try to figure out what's causing the issue with skewed objects first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for newcomers
Projects
Status: Ongoing Projects
3 participants