fernandojsg / aframe-input-mapping-component

https://fernandojsg.github.io/aframe-input-mapping-component
MIT License
24 stars 7 forks source link

Create a `common` mapping and remove `default` #11

Closed fernandojsg closed 6 years ago

fernandojsg commented 6 years ago

The same way we have common for mappings that apply to all the controllers. We could have a common mapping that applies to any other mapping. Basically it was what I was doing right now: https://github.com/fernandojsg/aframe-input-mapping-component/blob/d6cd8b2dae32bbe17c56232fd679634b115aa520/index.js#L121 but I was not clear enough that I even filed an issue (https://github.com/fernandojsg/aframe-input-mapping-component/issues/10) because of that :D

So removing the default state will make the system to activate the first mapping on the list by default.

So we could have the following and still be able to teleport on every task without need to duplicate that code.

mappings: {
  common: {
    common: {
      trackpad: 'teleport'
    },
    'windows-motion-controls': {
      gpadup: 'teleport'
    }
  },
  task1: {
    ...
  },
  task2: {
    ...
  }
}

/cc @dmarcos @netpro2k

netpro2k commented 6 years ago

A default state and a common set of bindings that exist across all states are pretty different ideas, so I agree if default was actually behaving as common it should be renamed.

That said I do think its a good idea to have an explicit default state as relying on ordering of object keys as the order is not technically guaranteed and you may also want no bindings set by default.

For the common case, I wonder if the answer is just allowing multiple input states to be active? Not sure yet if that's useful or just confusing..

fernandojsg commented 6 years ago

@netpro2k yep, as discussed in other issues, default state is something needed and addressed here https://github.com/fernandojsg/aframe-input-mapping-component/pull/20

Regarding the common we have two kind of commons here: