Пример #1
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            if (plotter == null)
            {
                return(finalSize);
            }

            var transform = plotter.Viewport.Transform;

            overallViewportBounds = DataRect.Empty;
            foreach (UIElement child in InternalChildren)
            {
                if (child != null)
                {
                    if (child.Visibility != Visibility.Visible)
                    {
                        continue;
                    }

                    Rect bounds = GetElementScreenBounds(transform, child);
                    child.Arrange(bounds);

                    UniteWithBounds(transform, bounds);
                }
            }

            if (!InBatchAdd)
            {
                Viewport2D.SetContentBounds(this, overallViewportBounds);
                ContentBoundsChanged.Raise(this);
            }

            return(finalSize);
        }
Пример #2
0
        public override void EndBatchAdd()
        {
            base.EndBatchAdd();

            if (plotter == null)
            {
                return;
            }

            overallViewportBounds = DataRect.Empty;
            if (Children.Count > 0 && invalidatePositionCalls == 0)
            {
                var transform = plotter.Viewport.Transform.WithScreenOffset(-translateTransform.X, -translateTransform.Y);
                foreach (FrameworkElement child in Children)
                {
                    if (child != null)
                    {
                        if (child.Visibility != Visibility.Visible)
                        {
                            continue;
                        }

                        Rect bounds = GetElementScreenBounds(transform, child);
                        UniteWithBounds(transform, bounds);
                    }
                }
            }

            Viewport2D.SetContentBounds(this, overallViewportBounds);
            ContentBoundsChanged.Raise(this);
        }
        private void UpdateContentBounds(bool recalculate)
        {
            if (recalculate)
            {
                var transform = plotter.Viewport.Transform.WithScreenOffset(-translateTransform.X, -translateTransform.Y);
                overallViewportBounds = DataRect.Empty;
                foreach (FrameworkElement child in Children)
                {
                    if (child != null)
                    {
                        if (child.Visibility != Visibility.Visible)
                        {
                            continue;
                        }

                        Rect bounds = GetElementScreenBounds(transform, child);
                        UniteWithBounds(transform, bounds);
                    }
                }
            }

            if (useContentBounds)
            {
                Viewport2D.SetContentBounds(this, overallViewportBounds);
                ContentBoundsChanged.Raise(this);
            }
        }
Пример #4
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);
            }
        }