private void DrawAnimate(DrawingContext ctx, Matrix matrix, IEnumerable <IAdornerAnimation> activeAdornerAnimations)
        {
            IAdornerAnimation adornerAnimation = activeAdornerAnimations != null?Enumerable.FirstOrDefault <IAdornerAnimation>(activeAdornerAnimations, (Func <IAdornerAnimation, bool>)(item => item.Name == "PreviewBox")) : (IAdornerAnimation)null;

            if (!this.ShouldDraw || this.Element.Visual == null)
            {
                return;
            }
            Rect elementBounds = this.ElementBounds;
            Pen  pen           = this.BorderPen;

            if (pen.IsFrozen && adornerAnimation != null)
            {
                pen = adornerAnimation.ClientData as Pen;
                if (pen == null)
                {
                    pen = this.BorderPen.Clone();
                    adornerAnimation.ClientData = (object)pen;
                }
            }
            if (adornerAnimation != null)
            {
                pen.Brush.Opacity = adornerAnimation.LerpValue;
            }
            this.DrawBounds(ctx, elementBounds, (Brush)null, pen);
            if (!this.AdornerSet.ToolContext.Tool.ShowDimensions || !this.Element.ViewModel.ElementSelectionSet.Selection.Contains(this.Element) || this.ElementSet.IsPrimaryTransformNonAffine)
            {
                return;
            }
            Matrix computedTransformToRoot = this.DesignerContext.ActiveView.GetComputedTransformToRoot(this.Element);

            SizeAdorner.DrawDimension(ctx, ElementLayoutAdornerType.Right, matrix, computedTransformToRoot, pen, elementBounds, 1.0);
            SizeAdorner.DrawDimension(ctx, ElementLayoutAdornerType.Bottom, matrix, computedTransformToRoot, pen, elementBounds, 1.0);
        }
Beispiel #2
0
        private void OnAnimationNotify(IAdornerAnimation sender, AdornerAnimationNotification eventArg)
        {
            if (!this.ShouldNotify())
            {
                return;
            }
            AdornerAnimation adornerAnimation = (AdornerAnimation)sender;

            if (eventArg == AdornerAnimationNotification.AnimationComplete)
            {
                adornerAnimation.Stop();
                adornerAnimation.AnimationEventHandlers -= new Action <IAdornerAnimation, AdornerAnimationNotification>(this.OnAnimationNotify);
                this.activeAnimations.Remove(adornerAnimation);
                adornerAnimation.Dispose();
            }
            else
            {
                if (eventArg != AdornerAnimationNotification.AnimationTick)
                {
                    return;
                }
                this.InvalidateRender();
                this.Update();
            }
        }