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

fix: prevent helpfulWheel from appearing on block right-click #4219

Merged
merged 3 commits into from
Jan 4, 2025

Conversation

BeNikk
Copy link
Contributor

@BeNikk BeNikk commented Jan 1, 2025

#4217

Changes made

  • Modified doContextMenus event handler to check if right-click intersects with block coordinates
  • Added check to prevent helpfulWheel from appearing when blocks are clicked
  • Improves menu behavior by ensuring only appropriate context menus appear

Before fix:
Screencast from 02-01-25 12:03:14 AM IST.webm

After fix:
Screencast from 02-01-25 12:40:36 AM IST.webm

@BeNikk
Copy link
Contributor Author

BeNikk commented Jan 1, 2025

@walterbender I tried this fix by capturing the location for blocks and based on that, I am allowing opening of the menus, what do you think about this

@walterbender
Copy link
Member

This approach makes sense to me. We need to establish the context.
But please clean up the formatting (use of spaces around punctuation to match the rest of the code.

@walterbender
Copy link
Member

The alternative would be to put the event handler into each block.

@walterbender
Copy link
Member

I am pretty sure we have a function (probably in blocks.js) that finds the block at an X,Y location. We could reuse that. If not, we should create it in blocks.js and make it a more general utility.

@BeNikk
Copy link
Contributor Author

BeNikk commented Jan 2, 2025

Sure,I will look into the blocks.js file and if the function is not there, ill just add it

@BeNikk
Copy link
Contributor Author

BeNikk commented Jan 2, 2025

@walterbender I could not detect any function specifically for detecting block clicks, so I created one in blocks.js, is it good to go?

@BeNikk
Copy link
Contributor Author

BeNikk commented Jan 2, 2025

The block click detection function in blocks.js (isCordinateBlock) can be used in #4213 and other places where this might be helpful

js/activity.js Outdated Show resolved Hide resolved
@walterbender
Copy link
Member

One small bit of cleanup and I think we are ready to merge. Thx

@BeNikk
Copy link
Contributor Author

BeNikk commented Jan 4, 2025

Thanks for pointing that out, I have corrected it now and I will be more careful in future.

@walterbender walterbender merged commit 340a1d0 into sugarlabs:master Jan 4, 2025
4 checks passed
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.

2 participants