Skip to content

Disallow invalid layer reorder placements as siblings of artboards#3289

Draft
Sahil-Gupta584 wants to merge 11 commits intoGraphiteEditor:masterfrom
Sahil-Gupta584:enhance-artboard-layer-drop
Draft

Disallow invalid layer reorder placements as siblings of artboards#3289
Sahil-Gupta584 wants to merge 11 commits intoGraphiteEditor:masterfrom
Sahil-Gupta584:enhance-artboard-layer-drop

Conversation

@Sahil-Gupta584
Copy link
Contributor

Closes #3256

Demo:

Graphite.-.Personal.2.-.Microsoft_.Edge.2025-10-15.20-04-11.mp4

@Keavon
Copy link
Member

Keavon commented Oct 15, 2025

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.

@Sahil-Gupta584
Copy link
Contributor Author

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 ?

@Keavon
Copy link
Member

Keavon commented Oct 17, 2025

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

@Sahil-Gupta584
Copy link
Contributor Author

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 ?

@Keavon
Copy link
Member

Keavon commented Oct 17, 2025

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).

@Sahil-Gupta584
Copy link
Contributor Author

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?

@Keavon
Copy link
Member

Keavon commented Oct 18, 2025

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 Keavon changed the title artboard layer drop at bottom Disallow invalid layer reorder placements as siblings of artboards Oct 19, 2025
@Sahil-Gupta584
Copy link
Contributor Author

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

@Keavon
Copy link
Member

Keavon commented Oct 21, 2025

Correct.

@Sahil-Gupta584 Sahil-Gupta584 force-pushed the enhance-artboard-layer-drop branch 2 times, most recently from 89aaa5e to 1ab4d41 Compare October 25, 2025 17:13
@Sahil-Gupta584 Sahil-Gupta584 force-pushed the enhance-artboard-layer-drop branch 2 times, most recently from 510f06e to 2a61db5 Compare October 25, 2025 17:18
@Sahil-Gupta584
Copy link
Contributor Author

Demo:

Graphite.and.7.more.pages.-.Personal.2.-.Microsoft_.Edge.2025-10-25.22-37-17.mp4

@Sahil-Gupta584
Copy link
Contributor Author

Hey @Keavon you can have a look

@Keavon
Copy link
Member

Keavon commented Oct 27, 2025

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.

@Sahil-Gupta584
Copy link
Contributor Author

Hey @Keavon, Hows its now?

Graphite.-.Personal.2.-.Microsoft_.Edge.2025-10-31.22-31-12.mp4

@Keavon
Copy link
Member

Keavon commented Oct 31, 2025

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).

@Sahil-Gupta584
Copy link
Contributor Author

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

@Keavon
Copy link
Member

Keavon commented Oct 31, 2025

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

@Sahil-Gupta584
Copy link
Contributor Author

@Keavon Is this one perfect?

Graphite.and.3.more.pages.-.Personal.2.-.Microsoft_.Edge.2025-11-01.21-46-28.mp4

@Sahil-Gupta584
Copy link
Contributor Author

@Keavon @timon-schelling, just pinning.

const lastLayerDepth = layers[layers.length - 1]?.entry?.depth;
const draggingLayerDepth = layers[dataIndex]?.entry?.depth;

if (clientY > treeChildren[layers.length - 1].getBoundingClientRect().bottom - 10) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this exact 10 px threshold value is used ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, move it to the top in a constant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its for better ui feel when user drags layer on edges. other wise use sometimes still sees white line for invalid drops.

@Keavon
Copy link
Member

Keavon commented Feb 16, 2026

This generally isn't working in a lot of ways:

capture_20_.mp4

@Keavon Keavon marked this pull request as draft February 16, 2026 21:18
@Sahil-Gupta584
Copy link
Contributor Author

weird let me check again

@Sahil-Gupta584
Copy link
Contributor Author

@Keavon Can you test again, tried directly using insertDepth

@Keavon
Copy link
Member

Keavon commented Feb 17, 2026

If you pass CI and mark it as ready for review, I'll take a look then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lazy drag layer(s) to the bottom of the stack if there is only 1 Artboard

3 participants