コード例 #1
0
        public static void ChangeDefaultSides(int delta)
        {
            // called by GUI in response to INC/DEC when no shape is ongoing, but tool is selected
            int newSides = CURRENTSIDES + delta;

            if (newSides < MINIMUMSIDES || newSides > MAXIMUMSIDES)
            {
                return;
            }
            CURRENTSIDES = newSides;
            CurrentSidesChanged?.Invoke();
        }
コード例 #2
0
        private VerbResult ChangeSides(int delta)
        {
            // shared between verb during drawing and key later...
            int newSides = m_Sides + delta;

            if (newSides < MINIMUMSIDES || newSides > MAXIMUMSIDES)
            {
                return(VerbResult.Rejected);
            }
            m_Sides      = newSides;
            CURRENTSIDES = m_Sides;
            CurrentSidesChanged?.Invoke();
            if (m_DefinedVertices > 1 && m_Acceptable)             // if Baseline is fixed
            {
                // otherwise we do not have a complete set of postulated vertices yet
                SetLength(m_Sides);
                m_Bounds = RectangleF.Empty;
                int direction = base.TurnDirection();                 // must be <>0 if m_bolAcceptable
                PlacePoints(direction);
                m_DefinedVertices = m_Sides;
                return(VerbResult.Continuing);
            }
            return(VerbResult.Continuing);
        }