getOpFromAction method

dynamic getOpFromAction(
  1. dynamic mouse,
  2. dynamic key
)

Return the operation associated to a mouse/keyboard combination @param {} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches @param {} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed @returns The operation if it has been found, null otherwise

Implementation

getOpFromAction(mouse, key) {
  var action;

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

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

  return null;
}