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

activatable reaction component #148

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

InfiniteLee
Copy link
Contributor

@InfiniteLee InfiniteLee commented Jul 19, 2018

I have run npm run test:machinima, and this patch passes all machinima tests: no

This is very WIP right now

provides bindings for secondary activations while an object is being grabbed. configurable to allow specifying a specific button event, to allow you to have multiple activatable components on an object (this may not be the best way to do this)

provides bindings for secondary activations while an object is being grabbed. configurable to allow specifying a specific button event, to allow you to have multiple activatable components on an object (this may not be the best way to do this)
@InfiniteLee InfiniteLee mentioned this pull request Jul 19, 2018
Copy link
Member

@wmurphyrd wmurphyrd left a comment

Choose a reason for hiding this comment

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

Thanks for getting this going! Looking forward to building it out together and getting it setup with a testing suite.

index.js Outdated
deactivated = this.state.get(this.DEACTIVATE_EVENT)
}
if (deactivated) {
this.state.set(this.DEACTIVATE_EVENT, deactivated)
Copy link
Member

Choose a reason for hiding this comment

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

Do you have a need for storing the last activated entity on the state? So far, the gestures only track the current interaction.

index.js Outdated
activated = this.state.get(this.ACTIVATE_EVENT)
}
if (activated) {
this.state.set(this.ACTIVATE_EVENT, activated)
Copy link
Member

Choose a reason for hiding this comment

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

I think this is unreachable - I don't see another place where the activated state is set, so the condition would always be false

Copy link
Contributor Author

@InfiniteLee InfiniteLee Jul 23, 2018

Choose a reason for hiding this comment

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

Grabbing an object with two hands? nevermind

index.js Outdated
const carried = this.state.get(this.GRAB_EVENT)
let activated = this.state.get(this.ACTIVATE_EVENT)
if (carried) {
if (!activated && !this.emitCancelable(carried, this.ACTIVATE_EVENT, {hand: this.el, buttonEvent: evt})) {
Copy link
Member

Choose a reason for hiding this comment

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

This would mean only an entity which is already the grabbed entity can be activated. In this respect, it wouldn't be much different from the drag gesture. What would you say to making this a more general gesture, just the act of pressing a button while targeting an entity? I'm thinking this way the activatable component would replace the clickable component and do a better job of what it has been trying to do without interfering with grabbing. When you do want an activation that is dependent on also being grabbed, that logic could be handled within the reaction component instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was definitely intended to be similar to draggable, but more generic and customizable (since you can specify exactly what state to set on the objects so you can have multiple). Also, given clickable exists, I didn't see the need to allow activatable to work on ungrabbed objects. I am not opposed to rolling all three of these together since they are pretty similar.

@InfiniteLee
Copy link
Contributor Author

It occurs to me the latest version I've pushed of this is still not quite what I would like, as I would like to customize state set on the super-hands as well (not just the state set on the objects). The problem is I don't know the best way to have that value defined on the reaction component, but read by the super-hand.

@InfiniteLee InfiniteLee mentioned this pull request Aug 23, 2018
3 tasks
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