public override void GetInsertInfo(Vector2 worldPosition, out InsertInfo insertInfo)
        {
            insertInfo = new InsertInfo {
                target = stack, index = 0, localPosition = Vector2.zero
            };

            foreach (VisualElement child in stack.Children())
            {
                Vector2 localPos = child.WorldToLocal(worldPosition);

                if (child.ContainsPoint(localPos))
                {
                    insertInfo.index         = stack.IndexOf(child);
                    insertInfo.localPosition = child.ChangeCoordinatesTo(stack, child.rect.center);
                }
            }
        }
Beispiel #2
0
        EventPropagation OnInsertNodeKeyDown(KeyDownEvent evt)
        {
            InsertInfo insertInfo    = InsertInfo.nil;
            Vector2    worldPosition = evt.originalMousePosition;

            if (currentInsertLocation != null)
            {
                currentInsertLocation.GetInsertInfo(evt.originalMousePosition, out insertInfo);

                if (insertInfo.target != null)
                {
                    worldPosition = insertInfo.target.LocalToWorld(insertInfo.localPosition);
                }
            }

            RequestNodeCreation(insertInfo.target, insertInfo.index, worldPosition);

            return(EventPropagation.Stop);
        }
 public override void GetInsertInfo(Vector2 worldPosition, out InsertInfo insertInfo)
 {
     insertInfo = new InsertInfo {
         target = stack, index = parent.IndexOf(this), localPosition = this.ChangeCoordinatesTo(stack, rect.center)
     };
 }
 public abstract void GetInsertInfo(Vector2 worldPosition, out InsertInfo insert);