/// <inheritdoc /> public override void OnDragPerform(DragPerformEvent e) { var dropElements = DragSource.GetSelection(); var contentViewContainer = (e.target as GraphView)?.ContentViewContainer ?? e.target as VisualElement; var variablesToCreate = dropElements .OfType <IVariableDeclarationModel>() .Select((e1, i) => ( e1, GUID.Generate().ToSerializableGUID(), contentViewContainer.WorldToLocal(e.mousePosition) + i * DragDropSpacer * Vector2.down)) .ToList(); var droppedNodes = dropElements.OfType <INodeModel>(); if (droppedNodes.Any(e2 => !(e2 is IVariableNodeModel)) && variablesToCreate.Any()) { // no way to handle this ATM throw new ArgumentException("Unhandled case, dropping blackboard/variables fields and nodes at the same time"); } if (variablesToCreate.Any()) { Stencil.OnDragAndDropVariableDeclarations(Dispatcher, variablesToCreate); } }