willAccept static method

bool willAccept(
  1. IDragDrop droppable,
  2. IDragDrop draggable
)

Implementation

static bool willAccept(IDragDrop droppable, IDragDrop draggable) {
  bool ok = true;

  var expression = droppable.canDropObservable?.signature;

  // accept is not defined
  if (isNullOrEmpty(expression)) return ok;

  // bindings
  var bindings = droppable.canDropObservable?.bindings;

  // variables
  var variables = EventHandler.getVariables(
      bindings, droppable as Model, draggable as Model,
      localAliasNames: ['this', 'drop'], remoteAliasNames: ['drag']);

  // execute will accept
  ok = toBool(Observable.doEvaluation(expression, variables: variables)) ??
      true;

  // return result
  return ok;
}