示例#1
0
        public void FlipPegsVertically()
        {
            CreateUndoPoint();

            LevelEntryCollection objects = new LevelEntryCollection(GetSelectedObjects());

            if (objects.Count < 2)
            {
                return;
            }

            objects.Sort(new Comparison <LevelEntry>(CompareObjectsByY));

            float startY = objects[0].Y;
            float height = objects[objects.Count - 1].Y - objects[0].Y;

            foreach (LevelEntry o in objects)
            {
                o.Y = (startY + height) - (o.Y - startY);

                if (o is Brick)
                {
                    Brick brick = (Brick)o;
                    brick.Rotation = MathExt.FixAngle(brick.Rotation);
                    brick.Rotation = 360.0f - brick.Rotation;
                }
            }

            UpdateRedraw();
        }
示例#2
0
        public void FlipObjectsHorizontally()
        {
            CreateUndoPoint();

            LevelEntryCollection objects = new LevelEntryCollection(GetSelectedObjects());

            if (objects.Count < 2)
            {
                return;
            }

            objects.Sort(new Comparison <LevelEntry>(CompareObjectsByX));

            float startX = objects[0].X;
            float width  = objects[objects.Count - 1].X - objects[0].X;

            foreach (LevelEntry o in objects)
            {
                o.X = (startX + width) - (o.X - startX);

                if (o is Brick)
                {
                    Brick brick = (Brick)o;
                    brick.Rotation = MathExt.FixAngle(brick.Rotation);

                    if (brick.Rotation < 180.0f)
                    {
                        brick.Rotation = 180.0f - brick.Rotation;
                    }
                    else
                    {
                        brick.Rotation = 540.0f - brick.Rotation;
                    }
                }
            }

            UpdateRedraw();
        }
示例#3
0
        public void SpaceObjectYsEqually()
        {
            LevelEntryCollection objects = GetSelectedObjects();

            if (objects.Count < 3)
            {
                return;
            }

            CreateUndoPoint();

            //Sort list by Y
            objects.Sort(new Comparison <LevelEntry>(CompareObjectsByY));

            //Common spacing
            float ySpacing = objects[1].Y - objects[0].Y;

            for (int i = 2; i < objects.Count; i++)
            {
                objects[i].Y = objects[i - 1].Y + ySpacing;
            }

            UpdateRedraw();
        }
示例#4
0
		public void FlipPegsVertically()
		{
			CreateUndoPoint();

			LevelEntryCollection objects = new LevelEntryCollection(GetSelectedObjects());
			if (objects.Count < 2)
				return;

			objects.Sort(new Comparison<LevelEntry>(CompareObjectsByY));

			float startY = objects[0].Y;
			float height = objects[objects.Count - 1].Y - objects[0].Y;

			foreach (LevelEntry o in objects) {
				o.Y = (startY + height) - (o.Y - startY);

				if (o is Brick) {
					Brick brick = (Brick)o;
					brick.Rotation = MathExt.FixAngle(brick.Rotation);
					brick.Rotation = 360.0f - brick.Rotation;
				}
			}

			UpdateRedraw();
		}
示例#5
0
		public void FlipObjectsHorizontally()
		{
			CreateUndoPoint();

			LevelEntryCollection objects = new LevelEntryCollection(GetSelectedObjects());
			if (objects.Count < 2)
				return;

			objects.Sort(new Comparison<LevelEntry>(CompareObjectsByX));

			float startX = objects[0].X;
			float width = objects[objects.Count - 1].X - objects[0].X;

			foreach (LevelEntry o in objects) {
				o.X = (startX + width) - (o.X - startX);

				if (o is Brick) {
					Brick brick = (Brick)o;
					brick.Rotation = MathExt.FixAngle(brick.Rotation);

					if (brick.Rotation < 180.0f)
						brick.Rotation = 180.0f - brick.Rotation;
					else
						brick.Rotation = 540.0f - brick.Rotation;
				}
			}

			UpdateRedraw();
		}