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

            Anchored anchor = getAnchor();

            if (!(anchor is Notehead))
            {
                // We never found a previous Notehead in the TimesSlice, which shouldn't
                //   happen.  Just use whatever anchor was found
                _screenHotspot = anchor.getScreenHotspot();
                return(_screenHotspot);
            }

            Notehead notehead = (Notehead)anchor;
            // Debug: very preliminary.  This does not account for the
            //  possibility of bumping into offset 2nds from the Stem, etc.
            int offsetX = notehead.getLeftEdge() - (graphicShape().getRightEdge() + 3);

            // offsetX should be negative
            _screenHotspot = new FinalPoint(notehead.getScreenHotspot(), offsetX, 0);
            return(_screenHotspot);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        /** Get the hotspot for this object in screen coordinates.
         *  Note that the hotspot for a Lyric is the center of the text.
         */
        public override FinalPoint getScreenHotspot()
        {
            if (_screenHotspot != null)
            {
                return(_screenHotspot);
            }

            // Debug: Maybe we need to find the lowest notehead, not just the anchor.
            Anchored anchor = getAnchor();
            int      staffStep;

            if (anchor is Notehead)
            {
                staffStep = ((Notehead)anchor).getStaffStep();
            }
            else
            {
                // Not a Notehead, but staffStep will be adjusted below.
                staffStep = 0;
            }

            // Adjust so we put the text below the note
            staffStep -= 6;

            if (staffStep > -8)
            {
                // Note is high enough that we need to keep the text below the staff
                staffStep = -8;
            }

            _screenHotspot = new FinalPoint
                                 (anchor.getScreenHotspot().x,
                                 getParentTimeSlice().getScreenHotspot().y +
                                 Notehead.staffStepOffsetY(staffStep));

            return(_screenHotspot);
        }