MudRipple: Show ripple effect based on click position (#157)#7637
Merged
henon merged 1 commit intoMudBlazor:devfrom Oct 11, 2023
Merged
MudRipple: Show ripple effect based on click position (#157)#7637henon merged 1 commit intoMudBlazor:devfrom
henon merged 1 commit intoMudBlazor:devfrom
Conversation
This solution uses JavaScript to calculate an offset based on the click position. The offset is then applied to the ripple pseudo-element using css variables.
Contributor
|
Ohhh, finally, I love it! Thanks a lot! |
Contributor
|
Btw, is this still on mouse up, which has always been wrong in my eyes? |
Contributor
Author
|
Yes, it's still triggered after the click. That's a limitation of the way the Disclaimer: I don't fully understand how this works. I think the |
|
It looks so much better now, thanks! |
ilovepilav
pushed a commit
to ilovepilav/MudBlazor
that referenced
this pull request
Nov 25, 2023
…MudBlazor#7637) This solution uses JavaScript to calculate an offset based on the click position. The offset is then applied to the ripple pseudo-element using css variables.
Contributor
|
I can't believe after all these years we finally have a ripple on mouse pos, I know I am late, but thank you very much! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This solution uses JavaScript to calculate an offset based on the click position. The offset is then applied to the ripple pseudo-element using css variables.
I've tried to make the ripple look the same as before. Because I had to double the size of the pseudo-element
transform: scale(10,10)->transform: scale(20,20)a minor visual difference may be noticeable. This could possibly be mitigated by calculating a scaling factor based on the distance between the click position and the center of the clicked element:I'm not sure if the added complexity is worth it but I'd be happy to implement that as well if wanted.
Note: This does not have the same issue as the reverted
ripple.jsimplementation, the ripple "stays with the button when it moves", see: #157 (comment)resolves #157
How Has This Been Tested?
visually
Types of changes
Before
before.mp4
After
after.mp4
Checklist:
dev).