Пример #1
0
        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.GetRect().center);
                }
            }
        }
        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);
        }
Пример #3
0
 public override void GetInsertInfo(Vector2 worldPosition, out InsertInfo insertInfo)
 {
     insertInfo = new InsertInfo {
         target = stack, index = parent.IndexOf(this), localPosition = this.ChangeCoordinatesTo(stack, this.GetRect().center)
     };
 }
Пример #4
0
 public abstract void GetInsertInfo(Vector2 worldPosition, out InsertInfo insert);