private void HighlightCenter(PointCollection col, IEnumerable <TabWellItem> sourceTabs, TabWellItem item) { var relativeOrigin = (UIElement)DockHost?.ContentHost ?? Window.GetWindow(TargetHost); var hostOffset = TargetHost.TranslatePoint(new Point(), relativeOrigin); if (TargetHost is DocumentContainer) { col.Add(hostOffset); col.Add(new Point(hostOffset.X + TargetArea.Width, hostOffset.Y)); col.Add(new Point(hostOffset.X + TargetArea.Width, hostOffset.Y + TargetArea.Height)); col.Add(new Point(hostOffset.X, hostOffset.Y + TargetArea.Height)); } else { var well = TargetHost as TabWellBase; var first = well.FirstContainer; if (item == null) { item = first; } var firstOffset = first?.TranslatePoint(new Point(), relativeOrigin) ?? hostOffset; var itemOffset = item?.TranslatePoint(new Point(), relativeOrigin) ?? hostOffset; var itemHeight = sourceTabs.Max(t => t.ActualHeight); var itemWidth = sourceTabs.Sum(t => t.ActualWidth); if (TargetHost is DocumentWell) { col.Add(new Point(hostOffset.X, firstOffset.Y + itemHeight)); //well top-left col.Add(new Point(itemOffset.X, itemOffset.Y + itemHeight)); //item bottom-left col.Add(new Point(itemOffset.X, itemOffset.Y)); //item top-left col.Add(new Point(itemOffset.X + itemWidth, itemOffset.Y)); //item top-right col.Add(new Point(itemOffset.X + itemWidth, itemOffset.Y + itemHeight)); //item bottom-right col.Add(new Point(hostOffset.X + TargetHost.ActualWidth, itemOffset.Y + itemHeight)); //well top-right col.Add(new Point(hostOffset.X + TargetHost.ActualWidth, hostOffset.Y + TargetHost.ActualHeight)); //well bottom-right col.Add(new Point(hostOffset.X, hostOffset.Y + TargetHost.ActualHeight)); //well bottom-left } else { col.Add(new Point(hostOffset.X, hostOffset.Y)); //well top-left col.Add(new Point(hostOffset.X + TargetHost.ActualWidth, hostOffset.Y)); //well top-right col.Add(new Point(hostOffset.X + TargetHost.ActualWidth, itemOffset.Y)); //well bottom-right if (well.Items.Count > 1) //tab panel visible { col.Add(new Point(itemOffset.X + itemWidth, itemOffset.Y)); //item top-right col.Add(new Point(itemOffset.X + itemWidth, itemOffset.Y + itemHeight)); //item bottom-right col.Add(new Point(itemOffset.X, itemOffset.Y + itemHeight)); //item bottom-left col.Add(new Point(itemOffset.X, itemOffset.Y)); //item top-left } col.Add(new Point(hostOffset.X, itemOffset.Y)); //well bottom-left } } }
internal FloatEventArgs(TabWellBase tabWell, TabWellItem tab, MouseEventArgs e) { Source = Window.GetWindow(tabWell); DataContext = tab?.GetContainerContext() ?? tabWell.GetContainerContext(); MouseOffset = e.GetPosition(tabWell); if (tab != null) { TabOffset = tab.TranslatePoint(new Point(0, 0), tabWell).X; } var loc = tabWell.PointToScreenScaled(new Point(0, 0)); VisualBounds = new Rect(loc.X, loc.Y, tabWell.ActualWidth, tabWell.ActualHeight); }