Esempio n. 1
0
 private void OnDragPerformEvent(DragPerformEvent evt)
 {
     if (onDragPerform != null)
     {
         onDragPerform(evt);
         evt.StopImmediatePropagation();
     }
 }
Esempio n. 2
0
        protected override void OnDragPerformEvent(DragPerformEvent evt)
        {
            if (!(DragAndDrop.GetGenericData("DragSelection") is GraphElement selectedElement) || !AcceptDrop(selectedElement))
            {
                m_ParentElement.SetDragIndicatorVisible(false);
                evt.StopImmediatePropagation();
                return;
            }

            if (selectedElement is CriteriaModelRow criteriaModelRow)
            {
                criteriaModelRow.DuplicateRow(criteriaModelRow, this, insertAtEnd: true);
                evt.StopImmediatePropagation();
                return;
            }

            base.OnDragPerformEvent(evt);
        }
        void OnDragPerformEvent(DragPerformEvent evt)
        {
            var updateList = false;

            var newIndex = GetInsertIndexFromMousePosition(evt.mousePosition);

            foreach (var obj in (List <ISelectable>)DragAndDrop.GetGenericData("DragSelection"))
            {
                if (!(obj is UniExposedParameterFieldView view))
                {
                    continue;
                }

                if (!updateList)
                {
                    graphView.RegisterCompleteObjectUndo("Moved parameters");
                }

                var parameters = graphAsset.uniExposedParameters;
                var oldIndex   = parameters.FindIndex(e => e == view.parameter);
                var parameter  = parameters[oldIndex];
                parameters.RemoveAt(oldIndex);

                // Patch new index after the remove operation:
                if (newIndex > oldIndex)
                {
                    newIndex--;
                }

                parameter.Apply(graphAsset);

                updateList = true;
            }

            if (!updateList)
            {
                return;
            }

            evt.StopImmediatePropagation();
            UpdateParameterList();
        }
Esempio n. 4
0
        void OnDragPerformEvent(DragPerformEvent evt)
        {
            bool updateList = false;

            int newIndex = GetInsertIndexFromMousePosition(evt.mousePosition);

            foreach (var obj in DragAndDrop.GetGenericData("DragSelection") as List <ISelectable> )
            {
                if (obj is ExposedParameterFieldView view)
                {
                    if (!updateList)
                    {
                        graphView.RegisterCompleteObjectUndo("Moved parameters");
                    }

                    int oldIndex  = graphView.graph.exposedParameters.FindIndex(e => e == view.parameter);
                    var parameter = graphView.graph.exposedParameters[oldIndex];
                    graphView.graph.exposedParameters.RemoveAt(oldIndex);

                    // Patch new index after the remove operation:
                    if (newIndex > oldIndex)
                    {
                        newIndex--;
                    }

                    graphView.graph.exposedParameters.Insert(newIndex, parameter);

                    updateList = true;
                }
            }

            if (updateList)
            {
                graphView.graph.NotifyExposedParameterListChanged();
                evt.StopImmediatePropagation();
                UpdateParameterList();
            }
        }