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

missing UI functionality: Option-click drag doesn't duplicate Parts #115

Open
ooper-zz opened this issue May 28, 2022 · 3 comments
Open

Comments

@ooper-zz
Copy link
Contributor

Look at how to HC works in duplicating objects with its attributes, not the content --at least not in HC

@ooper-zz
Copy link
Contributor Author

ooper-zz commented Jun 1, 2022

Hey @defano, hope all is well!

I did a study/prototype on how we might go about leveraging what's already there to make the above functionality work. I got most of it by overloading CardPartTransferHandler.importData(TransferHandler.TransferSupport info) method to take an instance of a Transferable object (transfer data being the ToolEditablePart). This is because the create method in CardPartTransferHandler is protected through a private class. I get it, the design is very deliberate about the clipboard and not suggesting my approach to change it, only to make a case for some refactoring work for duplication.

At any rate, I still don't have a good way of passing the initial dragging event from the copiedPart to the importedPart.

Please advise if you have any thoughts on both these issues. Would be highly appreciated.

image

image

@defano
Copy link
Owner

defano commented Jun 1, 2022

Hmm, I don't have a good answer off the top of my head; would need to hack around a bit.

I would guess that you could invoke the mousePressed() method directly on the new part, and pass it the MouseEvent you received on the original part. There's probably some other state hacking you'd need to do, like set the newly duplicated part as having been selected... but I'd start there.

You might find that both parts start dragging then... you might have to make a copy of the original MouseEvent before invoking mousePressed() on the new part, then call .consume() on the original event to get the original part from dragging along with the duplicated one.

@ooper-zz
Copy link
Contributor Author

ooper-zz commented Jun 1, 2022 via email

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

No branches or pull requests

2 participants