-
Notifications
You must be signed in to change notification settings - Fork 12
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
Hover on button #9
base: main
Are you sure you want to change the base?
Conversation
Huh it actually doesn't work in VR. >< |
Actually there is no mouseleave / mouseenter events handling in HTMLMesh, that can explain it. |
…ist.remove otherwise it rerenders even if no class was added/removed
…ctually reverses the hover, using 100ms fixes the issue
… code the hover color for now
88999c6
to
455d890
Compare
I made progress, some things I figured out. |
Thanks for taking a look |
I understood something.
and |
I also had some js that focused the first button in the div, changing the button background color. That didn't help to have a non focused background color for the button in the rendered canvas lol. |
Instead of hard coding my own style for hover, latest commit implements a way to store button hover style as data attributes so it works in VR. |
This is a bit hackish but it works. :D |
neat! |
Instead of the |
I want to mention an alternative to the above. I looked at the web2vr code, this creates primitive meshes, it doesn't render on a canvas, but there is some code related to hover. It checks all css selectors in all stylesheets for |
Did you know about aframe-htmlembed-component? I just rediscovered it after several years. I completely forgot this one existed and it was not listed in the component registry. |
@vincentfretin thanks for sharing https://github.com/supereggbert/aframe-htmlembed-component did you check how long last a render? It looks great! |
No I didn't do any perf test with htmlembed. html2canvas is Promise based, so not really for a VR usage to draw on each frame when interacting with a slider for example. Main usage is to create a screenshot of the page. |
aframe-htmlembed-component is also Promise base, but seems to be fast enough in their demo |
Fair, my assumption about Promise may be wrong. Again, I didn't do any tests. |
This references #3
Don't merge it just yet. I opened the PR as draft for discussion and if anyone want to test it.
I'm still experimenting, I added the behavior only on button, but it should be added to input of type submit and button as well. Do we need it on other elements?
If we move too quickly out of the button, the active or hover classes aren't deleted. I need to investigate that, we should have the mouseleave event from the whole div normally so this is strange...
I'm testing on this button styled with tailwindcss:
and