Example #1
0
        /** Get the hotspot for this object in screen coordinates.
         */
        public override FinalPoint getScreenHotspot()
        {
            if (_screenHotspot != null)
            {
                return(_screenHotspot);
            }

            int             deltaY      = 0;
            Anchored        anchor      = getAnchor();
            AugmentationDot previousDot = getPreviousDot();

            if (anchor is Notehead)
            {
                // Debug: should ensure that anchor is always a Notehead
                if (previousDot == null && ((Notehead)anchor).getStaffStep() % 2 == 0)
                {
                    // Notehead is on a line and this is the first dot, so shift up the dot
                    deltaY = -3;
                }
            }

            if (previousDot == null)
            {
                // This is the first dot
                _screenHotspot = new FinalPoint(anchor.getScreenHotspot(), 5, deltaY);
            }
            else
            {
                // Shift to the right from the previous dot
                _screenHotspot = new FinalPoint(previousDot.getScreenHotspot(), 3, deltaY);
            }

            return(_screenHotspot);
        }
Example #2
0
 /** This is automatically called after the object is modified to force
  *  this to recompute all its values when the "get"
  *    method is called for the value.
  */
 public override void invalidate()
 {
     _previousDot = null;
       _anchor = null;
       _screenHotspot = null;
 }
Example #3
0
        /** Return the previous dot for this Notehead, or null if this is the first one.
         * Don't set the anchor to the previous dot, because the anchor should
         * always be the Notehead.
         */
        private AugmentationDot getPreviousDot()
        {
            if (_gotPreviousDot)
            return _previousDot;

              // Search for the previous AugmentationDot before a Notehead
              _previousDot = null;
              for (int i = getIndex() - 1; i >= 0; --i) {
            MusicSymbol symbol = getParentTimeSlice().getMusicSymbol(i);
            if (symbol is Notehead)
              break;
            if (symbol is AugmentationDot) {
              _previousDot = (AugmentationDot)symbol;
              break;
            }
              }

              _gotPreviousDot = true;
              return _previousDot;
        }