fernandojsg / aframe-input-mapping-component

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

Added states and mappings sections #5

Closed fernandojsg closed 6 years ago

fernandojsg commented 6 years ago

Added the most conservatives changes from https://github.com/fernandojsg/aframe-input-mapping-component/issues/3

the structure now is:

{
    actions: {
      changeTask: { label: 'Change task' },
      testlog: { label: 'Test Log' },
      testlog_task1: { label: 'Test Log Task 1' }
    },
    mappings: {
      default: {
        common: {
          triggerdown: 'testlog'
        },
        'vive-controls': {
          gripdown: 'changeTask'
        },
        'oculus-touch-controls': {
          abuttondown: 'changeTask'
        },
        'windows-motion-controls': {
          gripdown: 'changeTask'
        },
        keyboard: {
          't_up': 'testlog',
          'c_up': 'changeTask'
        }
      },
      task1: {
        'vive-controls': {
          triggerdown: 'testlog_task1',
          gripdown: 'changeTask'
        },
        'oculus-touch-controls': {
          triggerdown: 'testlog_task1',
          abuttondown: 'changeTask'
        },
        'windows-motion-controls': {
          triggerdown: 'testlog_task1',
          gripdown: 'changeTask'
        },
        keyboard: {
          'y_up': 'testlog_task1',
          'c_up': 'changeTask'
        }
      }
    }
  };

I don't have an strong opinion about the naming on states or mapping

/cc @netpro2k @dmarcos

netpro2k commented 6 years ago

I prefer "state" but don't feel super strongly about it. Whichever it is, it should be consistent with AFRAME.currentMapping and for both it might be nice to use the word "input":

mapping -> AFRAME.currentInputMapping state -> AFRAME.currentInputState

fernandojsg commented 6 years ago

@netpro2k yep, I forgot to change that :+1: @dmarcos tie-breaker! what you think? :)

dmarcos commented 6 years ago

I think the term state is broad and might be confusing. A-Frame does not prescribe a way to define application states. Different mappings might nor not might map to whatever idea of state each application decides to implement. I would prefer not to hold on the word state and carry on with mappings that is a more specific word. Those are my two cents.

netpro2k commented 6 years ago

Fine by me. id still go with naming the currently active one AFRAME.currentInputMapping or AFRAME.activeInputMapping though. I think AFRAME.currentMapping is a bit too generic. Mapping of what?

fernandojsg commented 6 years ago

Thanks for the feedback. Updated using currenInputMapping