-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Paste block in viewport / near cursor #6848
Comments
As a user I copy a block, scroll to the place where I want to block to appear and paste. So scrolling to the default (duplicate) position will break my intent. I think pasting in the middle of my current view is ok as long as it will not connect to an existing stack at that place. |
This seems reasonable to add to core. |
I would like to work on this issue |
1 similar comment
I would like to work on this issue |
@bsampada7 Go for it! @patelb268 Happy to assign you to a different issue since @bsampada7 got here first =) Just comment on a different one and I'll get you assigned! |
I would like to work on this issue |
Hiya @Daphne-wu Someone has already been assigned! If you coment on a different issue I'll get you assigned =) |
The code now relies on getSelected in the paste callback. Which means if you don't have a block selected when you paste, you get an error and pasting fails. This should be changed to not rely on |
Marking this as triage re: #7521 (comment) Looks like we might have had some conflicting changes and lost the fix from OSD. |
Hi @BeksOmega , do I need to work on a fix for this? I'd be happy to work on it. |
Oh nope! You already wrote up a good fix, I think we just need to dig it out of the git history somewhere =) Thank you for your interest though! If you want to work on something else we have a list of other good first issues. |
@BeksOmega @maribethb Could you give an update about this? |
@maribethb Assigning this to you since you mentioned wanting it yesterday. |
🚧⚠️ 🚧 This issue is being saved for Grace Hopper Open Source Day. 🚧⚠️ 🚧 An event we're running to help girls and non-binary technologists make their first contributions to open source! Please see our list of help wanted issues if you'd like to contribute!
Check for duplicates
Description
When you paste a block, you expect the block to appear in the part of the workspace you are looking at. Usually either:
Currently in Blockly, this is ignored, and blocks are always pasted near the original block that was copied.
Reproduction steps
Additional Info
Pasting in the viewport may cause cascading block bumps for the pasted blocks, which would also be a bad user experience. I'm nopt sure if this occures with the current system or not.
Note: block bumping is when we move blocks away from other blocks connections so they don't accidentally appear to be connected.
To Fix
getRelativeToSurfaceXY(): Coordinate
method to the IMovable interface.getRelativeToSurfaceXY
in acopyCoords
variable.A. Run
copyWorkspace.getMetricsManager().getViewMetrics(true)
to get the coordinates of the viewport of the workspace.B. If the
copyCoords
are within the viewport, passcopyCoords
toclipboard.paste
.C. Otherwise, paste at a new
Coordinate
in the middle of the viewport. You can use the view metrics to calculate this.The text was updated successfully, but these errors were encountered: