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

Preserve layer stacking order on copy and paste #668

Merged
merged 1 commit into from
Jun 8, 2022
Merged

Preserve layer stacking order on copy and paste #668

merged 1 commit into from
Jun 8, 2022

Conversation

nupsi
Copy link
Contributor

@nupsi nupsi commented Jun 8, 2022

After looking into the issue, it only seems to happen when copying and pasting serialized data using PortfolioMessage::PasteSerializedData. To fix the issue, the copy buffer entry vector in portfolio_message_handler.rs#L417 should be iterated in a reverse order.

Something similar can be seen when using PortfolioMessage::PasteIntoFolder in portfolio_message_handler.rs#L397-L405, where the iteration direction is changed based on the insert_index. In PortfolioMessage::PasteSerializedData the insert_index is known ahead of time which allows us to simply reverse the direciton.

This fix should result in PortfolioMessage::PasteIntoFolder and PortfolioMessage::PasteSerializedData producing matching results.

Closes #610

Fix Issue#610  by reversing the direction of the copy buffer entry vector. This will preserve the layer ordering and match the behaviour of PasteIntoFolder.
Copy link
Member

@Keavon Keavon left a comment

Choose a reason for hiding this comment

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

Excellent! The best changes are those that are the simplest to fix and maintain. Thanks for digging into this issue and finding where to fix it.

@Keavon Keavon changed the title Preserve order on copy and paste Preserve layer stacking order on copy and paste Jun 8, 2022
@Keavon Keavon merged commit 5a9518f into GraphiteEditor:master Jun 8, 2022
Keavon pushed a commit that referenced this pull request Jun 16, 2022
Fix Issue#610

Fix Issue#610  by reversing the direction of the copy buffer entry vector. This will preserve the layer ordering and match the behaviour of PasteIntoFolder.
Keavon pushed a commit that referenced this pull request Jul 30, 2023
Fix Issue#610

Fix Issue#610  by reversing the direction of the copy buffer entry vector. This will preserve the layer ordering and match the behaviour of PasteIntoFolder.
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.

Preserve order on copy and paste
2 participants