protected void OnChildContentBoundsChanged(object sender, RoutedEventArgs e)
        {
            DependencyObject dependencySender = sender as DependencyObject;
            var contentBounds = Viewport2D.GetContentBounds(dependencySender);

            Debug.WriteLine("ContentBounds = " + contentBounds);

            RaiseChangedEvent();
        }
Ejemplo n.º 2
0
        protected void OnChildContentBoundsChanged(object sender, RoutedEventArgs e)
        {
            var child = (DependencyObject)sender;

            ContentBounds = child.GetValueSync <DataRect>(Viewport2D.ContentBoundsProperty);

            DependencyObject dependencySender = sender as DependencyObject;
            var contentBounds = Viewport2D.GetContentBounds(dependencySender);

            Debug.WriteLine("ContentBounds = " + contentBounds);

            RaiseChangedAsync();
        }
Ejemplo n.º 3
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            var dc = drawingContext;

            if (plotter == null)
            {
                return;
            }
            var transform     = plotter.Transform;
            var contentBounds = Viewport2D.GetContentBounds(this);
            var screenBounds  = contentBounds.ViewportToScreen(transform);

            dc.DrawImage(whiteNoizeBmp, screenBounds);
        }
        public override bool Contains(TileIndex id)
        {
            if (child == null)
            {
                return(false);
            }

            var childBounds = Viewport2D.GetContentBounds(child);
            var tileBounds  = GetTileBounds(id);

            bool contains = childBounds.IntersectsWith(tileBounds);

            return(contains);
        }
        private void viewportItemsPanel_ContentBoundsChanged(object sender, EventArgs e)
        {
            var contentBounds = Viewport2D.GetContentBounds(currentItemsPanel);

            var plottedItems = CurrentItemsPanel.Children.OfType <UIElement>()
                               .Where(x => x.Visibility == Visibility.Visible)
                               .Where(item => !double.IsNaN(ViewportPanel.GetX(item)) || !double.IsNaN(ViewportPanel.GetY(item)));

            if (plottedItems.Any())
            {
                Viewport2D.SetContentBounds(this, contentBounds);
            }
            else
            {
                Viewport2D.SetContentBounds(this, DataRect.Empty);
            }
        }
Ejemplo n.º 6
0
        protected override void InvalidatePosition(FrameworkElement child)
        {
            invalidatePositionCalls++;

            if (viewport == null)
            {
                return;
            }
            if (child.Visibility != Visibility.Visible)
            {
                return;
            }

            var transform = viewport.Transform;

            Size elementSize = GetElementSize(child, AvailableSize, transform);

            child.Measure(elementSize);

            Rect bounds = GetElementScreenBounds(transform, child);

            child.Arrange(bounds);

            var viewportBounds = Viewport2D.GetContentBounds(this);

            if (!viewportBounds.IsEmpty)
            {
                overallViewportBounds = viewportBounds;
            }

            UniteWithBounds(transform, bounds);

            if (!InBatchAdd)
            {
                Viewport2D.SetContentBounds(this, overallViewportBounds);
                ContentBoundsChanged.Raise(this);
            }
        }
Ejemplo n.º 7
0
        private void viewportItemsPanel_ContentBoundsChanged(object sender, EventArgs e)
        {
            var contentBounds = Viewport2D.GetContentBounds(currentItemsPanel);

            Viewport2D.SetContentBounds(this, contentBounds);
        }
Ejemplo n.º 8
0
        private void UpdateContentBounds(DependencyObject source)
        {
            var contentBounds = Viewport2D.GetContentBounds(source);

            Viewport2D.SetContentBounds(this, contentBounds);
        }