/** 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); }
/** 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); }
/** 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); }
/** Return the anchor as the previous Notehead. * Even though this is private, we always use getAnchor() instead of * looking at _anchor directly, because this allows us to * delay computing it as long as possible. */ private Anchored getAnchor() { if (_anchor != null) return _anchor; MusicSymbol previousNotehead = previousInstanceOf(typeof(Notehead)); if (previousNotehead == null) // DEBUG: maybe this should be an error _anchor = findDefaultAnchor(); else _anchor = previousNotehead; return _anchor; }
/** 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() { _anchor = null; _screenHotspot = null; }
/** 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() { _multiNodes = null; _anchor = null; }
/** Get the anchor which is the previous Notehead. * Even though this is private, we always use getAnchor() instead of * looking at _anchor directly, because this allows us to * delay computing it as long as possible. */ private Anchored getAnchor() { if (_anchor != null) return _anchor; var previousNotehead = previousInstanceOf(typeof(Notehead)); if (previousNotehead == null) // DEBUG: should check for multi-node end and start of system _anchor = findDefaultAnchor(); else _anchor = previousNotehead; return _anchor; }
public override void SetupOrbit() { orbit = new Anchored(); }
/** Return the anchor as the parent time slice. * Even though this is private, we always use getAnchor() instead of * looking at _anchor directly, because this allows us to * delay computing it as long as possible. */ private Anchored getAnchor() { if (_anchor != null) return _anchor; _anchor = getParentTimeSlice(); return _anchor; }
/** Return the anchor as the previous Notehead or Rest. * Even though this is private, we always use getAnchor() instead of * looking at _anchor directly, because this allows us to * delay computing it as long as possible. */ private Anchored getAnchor() { if (_anchor != null) return _anchor; MusicSymbol previousNotehead = previousInstanceOf(typeof(Notehead)); MusicSymbol previousRest = previousInstanceOf(typeof(Rest)); if (previousNotehead == null && previousRest == null) // DEBUG: maybe this should be an error _anchor = findDefaultAnchor(); else if (previousRest == null) // There is only a notehead _anchor = previousNotehead; else if (previousNotehead == null) // There is only a rest _anchor = previousRest; else { // Use the most recent notehead or rest if (previousNotehead.getIndex() > previousRest.getIndex()) _anchor = previousNotehead; else _anchor = previousRest; } return _anchor; }