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

Copy paste with parent items #317

Merged
merged 3 commits into from May 13, 2020
Merged

Conversation

amolenaar
Copy link
Member

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes

What is the current behavior?

Items, part of a super item, such as Components in a Node, are not copied properly.

Issue Number: #286

What is the new behavior?

  • When a nested item is copied, it's pasted in the same parent item
  • When child and parent item are copied together, a new parent item is created and the child will be part of that

Note that items are still pasted relative to the item position (position to the parent). Gaphor still needs some work so pasted items are always pasted inside the canvas' view port.

Does this PR introduce a breaking change?

  • Yes
  • No

@amolenaar amolenaar added this to the 1.3 milestone May 10, 2020
@amolenaar amolenaar requested a review from danyeaw May 10, 2020 20:28
@amolenaar amolenaar force-pushed the copy-paste-with-parent-items branch from 2d77341 to 4cc724b Compare May 10, 2020 20:32
Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

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

This look great! Do you know why the builds are failing?

@amolenaar
Copy link
Member Author

It's failing when I update the relationship for UseCase.subject to bi-directional. Other end is Classifier.useCase.

@amolenaar amolenaar force-pushed the copy-paste-with-parent-items branch from 4cc724b to 07d55b4 Compare May 13, 2020 17:45
@amolenaar amolenaar force-pushed the copy-paste-with-parent-items branch from 07d55b4 to 6500d23 Compare May 13, 2020 17:46
@amolenaar amolenaar merged commit 9911bc2 into master May 13, 2020
@amolenaar amolenaar deleted the copy-paste-with-parent-items branch May 13, 2020 17:59
@amolenaar amolenaar added the feature A new feature label May 14, 2020
@actionless
Copy link
Contributor

thanks a lot! now it seems almost perfect, except for some small sporadic padding changes:

2020-05-14--1589461421_1920x1080_scrot

2020-05-14--1589461425_1920x1080_scrot

@actionless
Copy link
Contributor

(looks like top and left padding are multiplied by 2)

@amolenaar
Copy link
Member Author

amolenaar commented May 16, 2020

Thanks a lot for testing this. I see what’s going on: as part of a paste action, the offset of the elements is changed by 10 pixels. This way it’s clear to a user the new item is pasted. Hoever, it also applies this offset to the nested items. That should not be the case, of course.

The offset should only be applied to elements if the parent element is not part of the past action.

@amolenaar
Copy link
Member Author

Fixed it in 74c82d4.

@actionless
Copy link
Contributor

actionless commented May 17, 2020

i still find it a bit weird what the whole copy-pasted fragment is padded extra 10px, i'd probably would make some sort of dotted line highlight around pasted elements, unless you click once somewhere

but that's not a blocker anymore, thanks a lot for your work!

@amolenaar amolenaar linked an issue May 24, 2020 that may be closed by this pull request
7 tasks
@danyeaw danyeaw modified the milestones: 1.3, 2.0 Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't open diagram with a stalled(?) comment node
3 participants