Exemplo n.º 1
0
        private void SendToLocation(DockItem dockItem, double location)
        {
            double activeTarget;

            if (Math.Abs(_getLocation(dockItem) - location) < 1.0
                ||
                _activeAnimationTargetLocations.TryGetValue(dockItem, out activeTarget) &&
                Math.Abs(activeTarget - location) < 1.0)
            {
                return;
            }

            _activeAnimationTargetLocations[dockItem] = location;

            var animation = Animate.Property(dockItem, _canvasPerspexProperty, dockItem.GetValue(_canvasPerspexProperty),
                                             location, LinearEasing.For <double>(), TimeSpan.FromMilliseconds(200));

            animation.Subscribe(_ => { }, () =>
            {
                _setLocation(dockItem, location);
                _activeAnimationTargetLocations.Remove(dockItem);
            });
        }
Exemplo n.º 2
0
 public DockDragStartedEventArgs(RoutedEvent routedEvent, IInteractive source, DockItem dockItem,
                                 VectorEventArgs dragStartedEventArgs)
     : base(routedEvent, source, dockItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
Exemplo n.º 3
0
 public DockDragStartedEventArgs(RoutedEvent routedEvent, DockItem dockItem, VectorEventArgs dragStartedEventArgs)
     : base(routedEvent, dockItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
Exemplo n.º 4
0
 public void OrganizeOnDragCompleted(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem)
 {
 }
Exemplo n.º 5
0
        public void OrganizeOnMouseDownWithin(DockItemsControl requestor, Size measureBounds, List <DockItem> siblingItems, DockItem dockItem)
        {
            var zIndex = int.MaxValue;

            foreach (var source in siblingItems.OrderByDescending(x => x.GetValue(Visual.ZIndexProperty)))
            {
                source.SetValue(Visual.ZIndexProperty, --zIndex);
            }
            dockItem.SetValue(Visual.ZIndexProperty, int.MaxValue);
        }
Exemplo n.º 6
0
 private Action <RoutedEventArgs> OnMouseDownWithin(DockItem dockItem)
 {
     return(args => dockItem.RaiseEvent(new DockItemEventArgs(MouseDownWithinEvent, dockItem)));
 }
 public DockItemEventArgs(RoutedEvent routedEvent, IInteractive source, DockItem dockItem)
     : base(routedEvent, source)
 {
     _dockItem = dockItem;
 }
 public DockItemEventArgs(RoutedEvent routedEvent, DockItem dockItem)
     : base(routedEvent)
 {
     _dockItem = dockItem;
 }
Exemplo n.º 9
0
 private void SetLocation(DockItem dockItem, double location)
 {
     _setLocation(dockItem, location);
 }
Exemplo n.º 10
0
        public void OrganizeOnDragCompleted(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException(nameof(siblingItems));
            }
            var currentLocations = siblingItems
                                   .Select(GetLocationInfo)
                                   .Union(new[] { GetLocationInfo(dockItem) })
                                   .OrderBy(loc => loc.Item == dockItem ? loc.Start : _siblingItemLocationOnDragStart[loc.Item].Start);

            var currentCoord = 0.0;
            var z            = int.MaxValue;
            var logicalIndex = 0;

            foreach (var location in currentLocations)
            {
                SetLocation(location.Item, currentCoord);
                currentCoord += _getDesiredSize(location.Item) + _itemOffset;
                location.Item.SetValue(Visual.ZIndexProperty, --z);
                location.Item.LogicalIndex = logicalIndex++;
            }
            dockItem.SetValue(Visual.ZIndexProperty, int.MaxValue);
        }
Exemplo n.º 11
0
        public void OrganizeOnDragStarted(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException(nameof(siblingItems));
            }
            if (dockItem == null)
            {
                throw new ArgumentNullException(nameof(dockItem));
            }

            _siblingItemLocationOnDragStart = siblingItems.Select(GetLocationInfo).ToDictionary(loc => loc.Item);
        }
Exemplo n.º 12
0
 public void OrganizeOnMouseDownWithin(DockItemsControl requestor, Size measureBounds, List <DockItem> siblingItems, DockItem dockItem)
 {
 }
Exemplo n.º 13
0
 private bool IsMyItem(DockItem item)
 {
     return(_dockItemsControl != null && _dockItemsControl.DockItems().Contains(item));
 }
        public DockDragCompletedEventArgs(RoutedEvent routedEvent, IInteractive source, DockItem dockItem,
                                          VectorEventArgs dragCompletedEventArgs)
            : base(routedEvent, source)
        {
            if (dockItem == null)
            {
                throw new ArgumentNullException(nameof(dockItem));
            }
            if (dragCompletedEventArgs == null)
            {
                throw new ArgumentNullException(nameof(dragCompletedEventArgs));
            }

            _dockItem = dockItem;
            _dragCompletedEventArgs = dragCompletedEventArgs;
        }