Ejemplo n.º 1
0
        public void Deflate_AllMethods()
        {
            Rect2 rect = new Rect2(10, 20, 50, 30);

            Rect2 inflated = new Rect2(35, 35, 0, 0);

            Assert.Equal(inflated, rect.Deflate(25, 15));
            Assert.Equal(inflated, rect.Deflate(new Vector2(25, 15)));
            Assert.Equal(inflated, Rect2.Deflate(rect, 25, 15));
            Assert.Equal(inflated, Rect2.Deflate(rect, new Vector2(25, 15)));
        }
Ejemplo n.º 2
0
        public override void Render(Win2DRenderable renderable, CanvasDrawingSession session, Win2DColor color, bool renderSelection)
        {
            var borderBrush = renderable.Resources.ThemeDarkBrush(color);

            var backgroundBrush =
                renderable.Node.IsSelected ?
                renderable.Resources.ThemeLightBrush(color) :
                renderable.Resources.ThemeNormalBrush(color);

            var bounds = renderable.RenderBounds.ToRect();

            if (borderRadius > 0)
            {
                session.FillRoundedRectangle(bounds, borderRadius, borderRadius, backgroundBrush);

                session.DrawRoundedRectangle(bounds, borderRadius, borderRadius, borderBrush);
            }
            else
            {
                session.FillRectangle(bounds, backgroundBrush);

                session.DrawRectangle(bounds, borderBrush);
            }

            RenderIcon(renderable, session);
            RenderText(renderable, session);

            RenderCheckBox(renderable, session);

            if (!renderSelection)
            {
                return;
            }

            if (renderable.Node.IsSelected)
            {
                var rect = Rect2.Deflate(renderable.RenderBounds, SelectionMargin).ToRect();

                if (borderRadius > 0)
                {
                    session.DrawRoundedRectangle(rect, borderRadius * 1.4f, borderRadius * 1.4f, borderBrush, 2f, SelectionStrokeStyle);
                }
                else
                {
                    session.DrawRectangle(rect, borderBrush, 2f, SelectionStrokeStyle);
                }
            }

            RenderExpandButton(renderable, session);
            RenderNotesButton(renderable, session);
        }