Beispiel #1
0
        private void OverrideLine(bool isFalseLine, MyBlock block)
        {
            bool isOverride = false;

            if (isFalseLine)
            {
                for (int i = 0; i < Count; i++)
                {
                    if (this[i].BeginId == block.ID && !this[i].IsTrue) //już istnieje taka linia
                    {
                        UndoRedo.Push(new List <UndoRedoItem>()
                        {
                            new UndoRedoItem(MyAction.OverrideLine, null, ToListHistory(i))
                        });
                        RemoveAt(i);
                    }
                }
            }
            else
            {
                for (int i = 0; i < Count; i++)
                {
                    if (this[i].BeginId == block.ID && this[i].IsTrue) //już istnieje taka linia
                    {
                        UndoRedo.Push(new List <UndoRedoItem>()
                        {
                            new UndoRedoItem(MyAction.OverrideLine, null, ToListHistory(i))
                        });
                        RemoveAt(i);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Metoda aktualizuj¹ca(wyliczaj¹ca) po³o¿enie gumek po klikniêciu na blok oraz po zmianie jego rozmiaru. Dodatkowo wywo³uje metodê odpowiedzialn¹ za widocznoœæ gumek.
        /// </summary>
        public void ShowRubbers(MyBlock canvasObject, Point autoScrollPosition)
        {
            AutoScrollPosition = autoScrollPosition;
            if (canvasObject.IsSelected)
            {
                var centerX = canvasObject.Rect.Location.X + autoScrollPosition.X + canvasObject.Rect.Size.Width / 2 -
                              Helper.RubberSize.Width / 2;
                var centerY = canvasObject.Rect.Location.Y + autoScrollPosition.Y + canvasObject.Rect.Size.Height / 2 -
                              Helper.RubberSize.Height / 2;

                var left  = canvasObject.Rect.Location.X - Helper.RubberSize.Width + autoScrollPosition.X;
                var right = canvasObject.Rect.Location.X + canvasObject.Rect.Size.Width + autoScrollPosition.X;
                var up    = canvasObject.Rect.Location.Y - Helper.RubberSize.Height + autoScrollPosition.Y;
                var down  = canvasObject.Rect.Location.Y + canvasObject.Rect.Size.Height + autoScrollPosition.Y;

                var topLeft      = new Point(left, up);
                var topCenter    = new Point(centerX, up);
                var topRight     = new Point(right, up);
                var centerLeft   = new Point(left, centerY);
                var centerRight  = new Point(right, centerY);
                var bottomLeft   = new Point(left, down);
                var bottomCenter = new Point(centerX, down);
                var bottomRight  = new Point(right, down);

                this[0].Location = topLeft;
                this[1].Location = topCenter;
                this[2].Location = topRight;
                this[3].Location = centerRight;
                this[4].Location = bottomRight;
                this[5].Location = bottomCenter;
                this[6].Location = bottomLeft;
                this[7].Location = centerLeft;
                SetRubberVisible(canvasObject.IsSelected);
            }
            else
            {
                SetRubberVisible(false);
            }
        }