getOpStateFromAction method

int? getOpStateFromAction(
  1. int mouse,
  2. String? key
)
  • Get the operation associated to mouse and key combination and returns the corresponding FSA state
  • mouse Mouse button
  • key Keyboard modifier
  • returns The FSA state obtained from the operation associated to mouse/keyboard combination

Implementation

int? getOpStateFromAction(int mouse, String? key) {
    Map<String,dynamic> action;

    for (int i = 0; i < mouseActions.length; i++) {
      action = mouseActions[i];
      if (action['mouse'] == mouse && action['key'] == key) {
        return action['state'];
      }
    }

    if (key != null) {
      for (int i = 0; i < mouseActions.length; i++) {
        action = mouseActions[i];
        if (action['mouse'] == mouse && action['key'] == null) {
          return action['state'];
        }
      }
    }

    return null;
  }