Skip to content

Commit

Permalink
Blocks generated from the palette now does not generate behid the pal…
Browse files Browse the repository at this point in the history
…ette

The new blocks now generated by using the palette now does not generate behind the palette. Gets generated at an other location on the canvas after clicked

"Fixes sugarlabs#3175"
  • Loading branch information
YashTote committed Feb 14, 2023
1 parent 7ce7203 commit b0a84dc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions js/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3098,6 +3098,13 @@ class Blocks {
myBlock.container.snapToPixelEnabled = true;
myBlock.container.x = 0;
myBlock.container.y = 0;

// All the new generated block graphics have this default position when clicked.
requestAnimationFrame(function() {
myBlock.container.x = 550;
myBlock.container.y = 250;
},0);


/** and we need to load the images into the container. */
myBlock.imageLoad();
Expand Down

2 comments on commit b0a84dc

@pikurasa
Copy link

Choose a reason for hiding this comment

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

I tested it, and it puts all the newly generated blocks in the middle of the screen. I don't think that's not entirely useful, do you, @YashTote ?

I thought it might just place them beside the palette (to its right), but the same height that they are now. WDYT?

@YashTote
Copy link
Owner Author

Choose a reason for hiding this comment

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

I can do that too, I just need to change the Y- co-ordinate. But there is an issue with the flow blocks. As @walterbender pointed it out in https://github.com/sugarlabs/musicblocks/pull/3179, there is an issue with flow blocks. I have been working on resolving it but unable to find relevant code in the codebase to modify. If you have any suggestions to where I can find the code to solve this overlapping issue, please let me know.

Please sign in to comment.