Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Disallow invalid layer reorder placements as siblings of artboards

Open Sahil-Gupta584 opened this issue 2 months ago • 17 comments

Closes #3256

Demo:

https://github.com/user-attachments/assets/d3f77519-a683-4acd-8541-596ce88ca268

Sahil-Gupta584 avatar Oct 15 '25 14:10 Sahil-Gupta584

Upon watching your video demo, I realized that the ideal behavior will be rejecting the placement opportunity in places that are siblings of artboards (generalized to be describable as "invalid placements"). This would need to be given to the frontend by the backend, or maybe better, answered by the backend in response to a query by the frontend. This way, we never show the white insertion line of a width that would indicate an invalid placement, which is a flaw of this "just correct it if it's invalid" approach that I realized now.

Keavon avatar Oct 15 '25 15:10 Keavon

Upon watching your video demo, I realized that the ideal behavior will be rejecting the placement opportunity in places that are siblings of artboards (generalized to be describable as "invalid placements"). This would need to be given to the frontend by the backend, or maybe better, answered by the backend in response to a query by the frontend. This way, we never show the white insertion line of a width that would indicate an invalid placement, which is a flaw of this "just correct it if it's invalid" approach that I realized now.

makes sense. And then what about the feat pr is raised for, it will be valid or invalid drop behaviour ?

Sahil-Gupta584 avatar Oct 17 '25 13:10 Sahil-Gupta584

I'd suggest iterating on this PR with the suggested change of approach. No need to open a separate PR.

Keavon avatar Oct 17 '25 13:10 Keavon

I'd suggest irritating on this PR with the suggested change of approach. No need to open a separate PR.

Can you tell me more clearly what i need to implement? got little confused.

and what about the feat for which pr is raised ?

Sahil-Gupta584 avatar Oct 17 '25 16:10 Sahil-Gupta584

This PR. I'm suggesting you keep working on changes to it to implement my described updated approach (from my first comment in this discussion).

Keavon avatar Oct 17 '25 19:10 Keavon

This PR. I'm suggesting you keep working on changes to it to implement my described updated approach (from my first comment in this discussion).

Yes but what about dropping on bottom, should I consider it as valid or invalid now?

Sahil-Gupta584 avatar Oct 18 '25 18:10 Sahil-Gupta584

I'm not understanding the question. All invalid drop locations shouldn't be valid white horizontal line placements, thus pre-filtering instead of post-rejecting.

Keavon avatar Oct 18 '25 21:10 Keavon

I'm not understanding the question. All invalid drop locations shouldn't be valid white horizontal line placements, thus pre-filtering instead of post-rejecting.

Ok so you mean dropping a layer as artboard sibling should be invalid? and currently if we try to do that we do see white line indicating its valid drop even though its invalid

Sahil-Gupta584 avatar Oct 20 '25 06:10 Sahil-Gupta584

Correct.

Keavon avatar Oct 21 '25 09:10 Keavon

Demo:

https://github.com/user-attachments/assets/33304b85-6ea4-495a-8d5b-87b1d777a194

Sahil-Gupta584 avatar Oct 25 '25 17:10 Sahil-Gupta584

Hey @Keavon you can have a look

Sahil-Gupta584 avatar Oct 25 '25 19:10 Sahil-Gupta584

Your video seems to show the line jumping around and appearing in places rather erratically. Please pay attention to small details like that and ensure it's behaving how it should. Happy to take another look at a video with your next shot (and thanks for making it easy with the video recording for me). Thanks.

Keavon avatar Oct 27 '25 02:10 Keavon

Hey @Keavon, Hows its now?

https://github.com/user-attachments/assets/b12a9e3a-e83e-49cf-9372-16e0948019ef

Sahil-Gupta584 avatar Oct 31 '25 17:10 Sahil-Gupta584

That looks good! However at the bottom, it needs to check if a valid placement can exist and choose that one (the outermost if there are multiple).

Keavon avatar Oct 31 '25 17:10 Keavon

That looks good! However at the bottom, it needs to check if a valid placement can exist and choose that one (the outermost if there are multiple).

actually i dont find any reason to disallow layers/artbords placement at bottom most. do you think there will be any case in which we have to disallow placing layer/artb at bottom most? if not then then let me remove this implementation so users can place any layers at bottom most

Sahil-Gupta584 avatar Oct 31 '25 17:10 Sahil-Gupta584

No, only artboards are valid at the bottom of the artboard layer stack.

Keavon avatar Oct 31 '25 17:10 Keavon

@Keavon Is this one perfect?

https://github.com/user-attachments/assets/58a02ec7-118c-4685-8956-466ed38635cc

Sahil-Gupta584 avatar Nov 01 '25 16:11 Sahil-Gupta584