-
Notifications
You must be signed in to change notification settings - Fork 71
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
toggling grabbable #157
Comments
Yes you can add and remove grabbable on live entities. It could be related to this statement which doesn't provide a valid property value for grabbable:
Use an empty string ( |
Hi @wmurphyrd , working on the same project as above! I've made the above switch, but still no dice on being able to switch grabbable back on once it's been turned off. I see in inspector the component is added/removed with the toggle, but still no dice. |
Hey @gabrieljbaker. Of course it wasn't that easy. Can you confirm your collision detection component is tracking the entities with grabbable added dynamically? If you're using attribute selectors and the raycaster or w/e is not auto updating, that would cause the issue. |
Hi, @wmurphyrd. Love I have however noticed a difference in behavior between In The ideal situation would allow for it to bound to state like Any thoughts on how this can be remedied? Thanks and keep up the great work! |
Hi!,
I am creating a toggle component so that a user can switch entities from being grabbable or not. I have it on hover-start and on keyup for "g"...I basically just use removeAttribute or setAttribute for the DOM and I have a db that keeps track of all of the positions, rotations, etc (including whether its grabbable) and update the db on keyup as well...all of that is working fine, but say i change something from not having a grabbable attribute to having it with the keyup, it does not become grababble until I refresh the page and the object is loaded from the database.
Can such an attribute be changed after it has been rendered? Is there a better way to be doing the DOM manipulation for this than I am doing? Below is a snippet from the component. Thanks and I am a huge fan...keep it up. Note that the grabtext is an a-text that I am overlaying on top of the object while hovered to tell the user whether the object is currently grabbable or not.
if(event.which == 71) { if(el.hasAttribute("grabbable")){ var grabtext = document.querySelector('#grabtext'); grabtext.setAttribute('value', 'not grabbable'); el.removeAttribute('grabbable'); // send grabbable false to db } else { el.setAttribute('grabbable', 'true'); var grabtext = document.querySelector('#grabtext'); grabtext.setAttribute('value', 'grabbable'); } } })
The text was updated successfully, but these errors were encountered: