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

Fix Document > Clear Artboards so it doesn't also clear everything else #2177

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

moOsama76
Copy link
Contributor

@moOsama76 moOsama76 commented Jan 4, 2025

Continuation of first attempt with unmerged PR #2015

@Keavon
Copy link
Member

Keavon commented Jan 6, 2025

!build

Copy link

github-actions bot commented Jan 6, 2025

📦 Build Complete for fb422f7
https://28720137.graphite.pages.dev

@Keavon
Copy link
Member

Keavon commented Jan 6, 2025

Problem: this introduces an intermediate history step which you'll see if you open the graph and undo three times to get back when it should have taken just one step.

Other minor problem: it seems that the Artboard layer gets replaced by a Merge layer but it ends up in a different position in the graph. Ideally this wouldn't cause the layers to shift. In a case with multiple artboards each containing layers, I'm finding this even results in things overlapping in the graph after running this which isn't a suitable outcome.

Thanks, and welcome back!

@Keavon Keavon changed the title Clear Artboards Fix Document > Clear Artboards so it doesn't also clear everything else Jan 6, 2025
- Fix node positions
- Optimize nodes' deletion
@Keavon
Copy link
Member

Keavon commented Jan 10, 2025

!build

Copy link

📦 Build Complete for f6587ca
https://a35a885b.graphite.pages.dev

@Keavon
Copy link
Member

Keavon commented Jan 10, 2025

Can you please make it add a Transform node, feeding into the replacement Merge node, if the artboard has a nonzero Location? Currently, all former artboards teleport to having a top-left location at the canvas origin since the artboard offset is lost.

@Keavon Keavon marked this pull request as draft January 10, 2025 11:46
@moOsama76 moOsama76 marked this pull request as ready for review January 15, 2025 15:36
@Keavon Keavon force-pushed the master branch 2 times, most recently from 7465fad to ab724d8 Compare January 18, 2025 00:03
@Keavon
Copy link
Member

Keavon commented Jan 19, 2025

Marking this as a draft in the meantime. And copying what I sent you in Discord for convenient reference:

Hi, I got a chance to review your PR again (sorry I've been so so so busy lately). It looks like the way you apply transformation of the artboard to the constituent layers is by deeply traversing the layer hierarchy and applying it to the roots. But this seems to cause bugs (for example, try setting the artboard for Isometric Fountain to a non-default X, Y position then clearing artboards and watch how the plants and pond ripples move). It's also not necessarily desirable how it ends up adding Transform nodes to all the individual layers rather than setting it on just one upstream Transform node that already exists. Can you make it set the Transform node on the least-nested layer of each artboard-that-becomes-a-layer rather than deeply setting it on all deepest-nested layers?

Thanks and great work so far, this is close!

@Keavon Keavon marked this pull request as draft January 19, 2025 07:13
@moOsama76
Copy link
Contributor Author

Marking this as a draft in the meantime. And copying what I sent you in Discord for convenient reference:

Hi, I got a chance to review your PR again (sorry I've been so so so busy lately). It looks like the way you apply transformation of the artboard to the constituent layers is by deeply traversing the layer hierarchy and applying it to the roots. But this seems to cause bugs (for example, try setting the artboard for Isometric Fountain to a non-default X, Y position then clearing artboards and watch how the plants and pond ripples move). It's also not necessarily desirable how it ends up adding Transform nodes to all the individual layers rather than setting it on just one upstream Transform node that already exists. Can you make it set the Transform node on the least-nested layer of each artboard-that-becomes-a-layer rather than deeply setting it on all deepest-nested layers?

Thanks and great work so far, this is close!

It's okay I am not like waiting for it to be merged, I appreciate you reviews :)

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.

2 participants