Beispiel #1
0
        protected void PositionNubs(Mode currentMode)
        {
            if (this.moveNubs == null)
            {
                this.moveNubs = new MoveNubRenderer[8];

                for (int i = 0; i < this.moveNubs.Length; ++i)
                {
                    this.moveNubs[i] = new MoveNubRenderer(this.RendererList);
                    this.RendererList.Add(this.moveNubs[i], false);
                }

                RectangleF bounds = Selection.GetBoundsF(false);

                this.moveNubs[(int)Edge.TopLeft].Location = new PointF(bounds.Left, bounds.Top);
                this.moveNubs[(int)Edge.TopLeft].Shape    = MoveNubShape.Circle;

                this.moveNubs[(int)Edge.Top].Location = new PointF((bounds.Left + bounds.Right) / 2.0f, bounds.Top);

                this.moveNubs[(int)Edge.TopRight].Location = new PointF(bounds.Right, bounds.Top);
                this.moveNubs[(int)Edge.TopRight].Shape    = MoveNubShape.Circle;

                this.moveNubs[(int)Edge.Left].Location  = new PointF(bounds.Left, (bounds.Top + bounds.Bottom) / 2.0f);
                this.moveNubs[(int)Edge.Right].Location = new PointF(bounds.Right, (bounds.Top + bounds.Bottom) / 2.0f);

                this.moveNubs[(int)Edge.BottomLeft].Location = new PointF(bounds.Left, bounds.Bottom);
                this.moveNubs[(int)Edge.BottomLeft].Shape    = MoveNubShape.Circle;

                this.moveNubs[(int)Edge.Bottom].Location = new PointF((bounds.Left + bounds.Right) / 2.0f, bounds.Bottom);

                this.moveNubs[(int)Edge.BottomRight].Location = new PointF(bounds.Right, bounds.Bottom);
                this.moveNubs[(int)Edge.BottomRight].Shape    = MoveNubShape.Circle;
            }

            if (this.rotateNub == null)
            {
                this.rotateNub    = new RotateNubRenderer(this.RendererList);
                rotateNub.Visible = false;
                this.RendererList.Add(this.rotateNub, false);
            }

            if (Selection.IsEmpty)
            {
                foreach (SurfaceBoxRenderer nub in this.moveNubs)
                {
                    nub.Visible = false;
                }

                this.rotateNub.Visible = false;
            }
            else
            {
                foreach (MoveNubRenderer nub in this.moveNubs)
                {
                    nub.Visible   = !tracking || currentMode == Mode.Scale;
                    nub.Transform = Selection.GetInterimTransformReadOnly();
                }
            }
        }
Beispiel #2
0
        protected void DestroyNubs()
        {
            if (this.moveNubs != null)
            {
                for (int i = 0; i < this.moveNubs.Length; ++i)
                {
                    this.RendererList.Remove(this.moveNubs[i]);
                    this.moveNubs[i].Dispose();
                    this.moveNubs[i] = null;
                }

                this.moveNubs = null;
            }

            if (this.rotateNub != null)
            {
                this.RendererList.Remove(this.rotateNub);
                this.rotateNub.Dispose();
                this.rotateNub = null;
            }
        }
Beispiel #3
0
        protected void PositionNubs(Mode currentMode)
        {
            if (this.moveNubs == null)
            {
                this.moveNubs = new MoveNubRenderer[8];

                for (int i = 0; i < this.moveNubs.Length; ++i)
                {
                    this.moveNubs[i] = new MoveNubRenderer(this.RendererList);
                    this.RendererList.Add(this.moveNubs[i], false);
                }

                RectangleF bounds = Selection.GetBoundsF(false);

                this.moveNubs[(int)Edge.TopLeft].Location = new PointF(bounds.Left, bounds.Top);
                this.moveNubs[(int)Edge.TopLeft].Shape = MoveNubShape.Circle;

                this.moveNubs[(int)Edge.Top].Location = new PointF((bounds.Left + bounds.Right) / 2.0f, bounds.Top);

                this.moveNubs[(int)Edge.TopRight].Location = new PointF(bounds.Right, bounds.Top);
                this.moveNubs[(int)Edge.TopRight].Shape = MoveNubShape.Circle;

                this.moveNubs[(int)Edge.Left].Location = new PointF(bounds.Left, (bounds.Top + bounds.Bottom) / 2.0f);
                this.moveNubs[(int)Edge.Right].Location = new PointF(bounds.Right, (bounds.Top + bounds.Bottom) / 2.0f);

                this.moveNubs[(int)Edge.BottomLeft].Location = new PointF(bounds.Left, bounds.Bottom);
                this.moveNubs[(int)Edge.BottomLeft].Shape = MoveNubShape.Circle;

                this.moveNubs[(int)Edge.Bottom].Location = new PointF((bounds.Left + bounds.Right) / 2.0f, bounds.Bottom);

                this.moveNubs[(int)Edge.BottomRight].Location = new PointF(bounds.Right, bounds.Bottom);
                this.moveNubs[(int)Edge.BottomRight].Shape = MoveNubShape.Circle;
            }

            if (this.rotateNub == null)
            {
                this.rotateNub = new RotateNubRenderer(this.RendererList);
                rotateNub.Visible = false;
                this.RendererList.Add(this.rotateNub, false);
            }

            if (Selection.IsEmpty)
            {
                foreach (SurfaceBoxRenderer nub in this.moveNubs)
                {
                    nub.Visible = false;
                }

                this.rotateNub.Visible = false;
            }
            else
            {
                foreach (MoveNubRenderer nub in this.moveNubs)
                {
                    nub.Visible = !tracking || currentMode == Mode.Scale;
                    nub.Transform = Selection.GetInterimTransformReadOnly();
                }
            }
        }
Beispiel #4
0
        protected void DestroyNubs()
        {
            if (this.moveNubs != null)
            {
                for (int i = 0; i < this.moveNubs.Length; ++i)
                {
                    this.RendererList.Remove(this.moveNubs[i]);
                    this.moveNubs[i].Dispose();
                    this.moveNubs[i] = null;
                }

                this.moveNubs = null;
            }

            if (this.rotateNub != null)
            {
                this.RendererList.Remove(this.rotateNub);
                this.rotateNub.Dispose();
                this.rotateNub = null;
            }
        }