Example #1
0
        internal void OnDrop(DiagramCanvasBase dropTarget, DragEventArgs e)
        {
            DropException = null;

            onDrop(dropTarget, e);

            /*         try
             *       {
             *           onDrop(dropTarget, e);
             *       }
             *       catch (Exception ex)
             *       {
             *           DropException = ex;
             *       }*/
        }
        internal void Arrange(IEnumerable <DiagramItem> arrangedItems)
        {
            //TODO use zGroups on container
            var sortedItems = arrangedItems.OrderBy((item) => DiagramCanvasBase.GetZIndex(item));

            _navigator = new SceneNavigator();

            foreach (var item in sortedItems)
            {
                var collidingItems = _navigator.GetItemsInCollision(item).ToArray();

                foreach (var colidingItem in collidingItems)
                {
                    //move colliding items
                    moveCollidingItem(item, colidingItem);
                }
                _navigator.AddItem(item);
            }
        }
Example #3
0
        private void onDrop(DiagramCanvasBase dropTarget, DragEventArgs e)
        {
            DragAdorner = e.Data.GetData("DragAdorner") as DragAdorner;
            if (DragAdorner == null)
            {
                return;
            }
            E          = e;
            DropTarget = dropTarget;

            E.Handled = true;

            CurrentView = Diagram.InitialView;
            onDrop();

            if (DropTarget.OwnerItem == DragItem)
            {
                //cant drop self to sub slot
                move();
                onDropEnd();
                return;
            }

            if (DragItem.ContainingDiagramCanvas == DropTarget)
            {
                //move within dropTarget canvas
                move();
                onDropEnd();
                return;
            }

            if (excludeFromParent())
            {
                acceptItem();
            }

            onDropEnd();
        }