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

Group layers with Ctrl+G into independent groups if they're spread across artboards #1992

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

Conversation

moOsama76
Copy link
Contributor

@moOsama76 moOsama76 commented Sep 19, 2024

Resolves the TODO comment here, here's a snippet:

DocumentMessage::GroupSelectedLayers => {
	responses.add(DocumentMessage::AddTransaction);

	let Some(parent) = self.network_interface.deepest_common_ancestor(&self.selection_network_path, false) else {
		// Cancel grouping layers across different artboards
		// TODO: Group each set of layers for each artboard separately
		return;
	};

A document can have multiple artboards, each containing its own layers. If layers are selected across multiple artboards, Ctrl+G currently yanks them out of their other artboards and puts them all in a group within a single artboard. This change makes the grouping happen on a per-artboard basis, so there ends up being multiple groups (one per artboard that had a selected layer).

@moOsama76 moOsama76 closed this Sep 19, 2024
@moOsama76 moOsama76 reopened this Sep 19, 2024
@adamgerhant
Copy link
Collaborator

I think this would have several issues. If the artboard was not selected, then it would not be added to the hashmap and nothing would happen. The best way to approach this would be to collect all the layer paths, and check if there is an artboard in the path. If so, then the ROOT_PARENT gets popped from the path. If the path is just one item at this point, it can be filtered out (since it is an artboard). Once these paths are collected, a hash map can be used to group the paths based on the last element. Then each group of paths can be grouped. The parent is the deepest common ancestor, and the rest of the logic can be applied from there.

@moOsama76
Copy link
Contributor Author

Okay I'll rework it

@Keavon Keavon changed the title Group every selected set of layers for it's Artboard independently Group every selected set of layers for its Artboard independently Sep 28, 2024
@Keavon Keavon changed the title Group every selected set of layers for its Artboard independently Group every selected set of layers for its artboard independently Sep 28, 2024
@moOsama76
Copy link
Contributor Author

@adamgerhant can you review?

@adamgerhant
Copy link
Collaborator

I pushed my changes/fixes about 2 weeks ago, and it was ready to merge after that.

@Keavon
Copy link
Member

Keavon commented Oct 11, 2024

@adamgerhant in that situation, could you please remember to leave an approval on the PR? Thanks :)

@adamgerhant
Copy link
Collaborator

I'm confused by what exactly happened with the commit history. It seems my commit got edited and then forced pushed? I reviewed/tested it though and its ready to merge

@Keavon Keavon marked this pull request as draft October 29, 2024 21:59
@moOsama76
Copy link
Contributor Author

I checked this and I think it's okay

@Keavon
Copy link
Member

Keavon commented Dec 23, 2024

Sorry, what issue or #code-todo-list task is this solving? The PR description is blank and the title doesn't give me enough details to understand what this is meant to fix.

@moOsama76
Copy link
Contributor Author

Sorry, what issue or #code-todo-list task is this solving? The PR description is blank and the title doesn't give me enough details to understand what this is meant to fix.

https://github.com/GraphiteEditor/Graphite/blob/77936c44b053a7a4cf5af677e024bb443738cdde/editor/src/messages/portfolio/document/document_message_handler.rs#L494C1-L494C68

@Keavon
Copy link
Member

Keavon commented Dec 24, 2024

Ah, cool, thanks. Yeah, that looks useful. I put that in the PR description. This will need to have its conflicts resolved against master but then I can code review it with that context in mind.

@Keavon Keavon changed the title Group every selected set of layers for its artboard independently Group layers with Ctrl+G into independent groups if they're spread across artboards Dec 24, 2024
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.

3 participants