Esempio n. 1
0
        public void ResizeTo(float w, float h)
        {
#if DEBUG
            Time.AssertTimeThread();
#endif

            this.Width  = w;
            this.Height = h;
            SizeOrPositionChanged.Fire();
        }
Esempio n. 2
0
        public void MoveTo(float x, float y, int?z = null)
        {
#if DEBUG
            Time.AssertTimeThread();
#endif

            this.Left = x;
            this.Top  = y;
            if (z.HasValue)
            {
                this.ZIndex = z.Value;
            }

            SizeOrPositionChanged.Fire();
        }
Esempio n. 3
0
        public SpacialElement(float w = 1, float h = 1, float x = 0, float y = 0, int z = 0)
        {
            Width              = w;
            Height             = h;
            Left               = x;
            Top                = y;
            ZIndex             = z;
            this.InternalState = new SpacialElementInternalState();
            Edges              = new Edge[4];
            Edges[0]           = new Edge();
            Edges[1]           = new Edge();
            Edges[2]           = new Edge();
            Edges[3]           = new Edge();

            Geometry.UpdateEdges(this, Edges);
            SizeOrPositionChanged.SubscribeForLifetime(() => Geometry.UpdateEdges(this, Edges), this.Lifetime);
        }
Esempio n. 4
0
        public void MoveTo(float x, float y, int?z = null)
        {
            Time.AssertTimeThread();

            if (float.IsNaN(x))
            {
                x = 0;
            }

            if (float.IsNaN(y))
            {
                y = 0;
            }

            this.Left = x;
            this.Top  = y;
            if (z.HasValue)
            {
                this.ZIndex = z.Value;
            }

            SizeOrPositionChanged.Fire();
        }
Esempio n. 5
0
        public void MoveTo(float x, float y, int?z = null)
        {
            Time.AssertTimeThread();

            x = x < 0 ? 0 : x;
            y = y < 0 ? 0 : y;

            if (x + Width > SpaceTime.CurrentSpaceTime.Width)
            {
                x = SpaceTime.CurrentSpaceTime.Width - Width;
            }

            if (y + Height > SpaceTime.CurrentSpaceTime.Height)
            {
                y = SpaceTime.CurrentSpaceTime.Height - Height;
            }

            if (float.IsNaN(x))
            {
                x = 0;
            }

            if (float.IsNaN(y))
            {
                y = 0;
            }

            this.Left = x;
            this.Top  = y;
            if (z.HasValue)
            {
                this.ZIndex = z.Value;
            }

            SizeOrPositionChanged.Fire();
        }