protected void MoveFramedTextBottomToDefaultPosition(Metrics framedTextMetrics) { double staffTop = this.Voice.Staff.Metrics.StafflinesTop; double defaultBottom = staffTop - (Gap * 3); if (framedTextMetrics != null) { framedTextMetrics.Move(0, defaultBottom - framedTextMetrics.Bottom); } }
internal virtual void Move(double dy) { if (_textAndBracketMetrics != null) { _textAndBracketMetrics.Move(0, dy); // moves both text and brackets } else { Metrics.Move(0, dy); // only moves the text } }
private void MoveFramedTextAboveBeamBlock(Metrics framedTextMetrics, BeamBlock beamBlock) { double padding = Gap * 1.5; double verticalOverlap = beamBlock.OverlapHeight(framedTextMetrics, padding); if (verticalOverlap > 0) { verticalOverlap = (verticalOverlap > padding) ? verticalOverlap : padding; framedTextMetrics.Move(0, -verticalOverlap); } }
private void MoveFramedTextAboveNoteheadExtenders(Metrics framedTextMetrics, List <NoteheadExtenderMetrics> noteheadExtendersMetrics) { double padding = Gap * 1.5; int indexOfTopExtender = 0; for (int i = 1; i < noteheadExtendersMetrics.Count; ++i) { indexOfTopExtender = (noteheadExtendersMetrics[indexOfTopExtender].Top < noteheadExtendersMetrics[i].Top) ? indexOfTopExtender : i; } NoteheadExtenderMetrics topExtender = noteheadExtendersMetrics[indexOfTopExtender]; double verticalOverlap = topExtender.OverlapHeight(framedTextMetrics, padding); if (verticalOverlap > 0) { verticalOverlap = (verticalOverlap > padding) ? verticalOverlap : padding; framedTextMetrics.Move(0, -(verticalOverlap)); } }
/// <summary> /// The flagBlock is moved to the correct x-position wrt noteheads. /// The distance between the inner notehead's alignmentY and the closest edge of the flagsBlock is set to a little less than two spaces. /// If there is only one flag, the distance is increased to a little less than three spaces (1 octave). /// If the stem is up and the bottom of the flagBlock is too low, the flagBlock is moved up. /// If the stem is down and the top of the flagBlock is too high, the flagBlock is moved down. /// </summary> private void SetFlagsPositionReNoteheads(List<HeadMetrics> topDownHeadsMetrics, Metrics flagsBlockMetrics, VerticalDir stemDirection, float stemThickness) { Debug.Assert(flagsBlockMetrics != null); HeadMetrics outerNoteheadMetrics = FindOuterNotehead(topDownHeadsMetrics, stemDirection); HeadMetrics innerNoteheadMetrics = FindInnerNotehead(topDownHeadsMetrics, stemDirection); float innerNoteheadAlignmentY = (innerNoteheadMetrics.Bottom + innerNoteheadMetrics.Top) / 2F; float minDist = _gap * 1.8F; // constant found by experiment float deltaX = 0; float deltaY = 0; if(stemDirection == VerticalDir.up) { deltaY = minDist - (innerNoteheadAlignmentY - flagsBlockMetrics.Bottom); if(flagsBlockMetrics.ID_Type == "Right1Flag") deltaY += _gap; deltaY *= -1; if(flagsBlockMetrics.ID_Type == "Right1Flag") { if((flagsBlockMetrics.Bottom + deltaY) > (_gap * 2.5F)) { deltaY = (_gap * 2.5F) - flagsBlockMetrics.Bottom; } } else // other right flag types if((flagsBlockMetrics.Bottom + deltaY) > (_gap * 3.5F)) { deltaY = (_gap * 3.5F) - flagsBlockMetrics.Bottom; } deltaX = outerNoteheadMetrics.RightStemX - (stemThickness / 2F); } else // stem is down { deltaY = minDist - (flagsBlockMetrics.Top - innerNoteheadAlignmentY); if(flagsBlockMetrics.ID_Type == "Left1Flag") deltaY += _gap; if(flagsBlockMetrics.ID_Type == "Left1Flag") { if((flagsBlockMetrics.Top + deltaY) < (_gap * 1.5F)) { deltaY = (_gap * 1.5F) - flagsBlockMetrics.Top; } } else // other left flag types if((flagsBlockMetrics.Top + deltaY) < (_gap * 0.5F)) { deltaY = (_gap * 0.5F) - flagsBlockMetrics.Top; } deltaX = outerNoteheadMetrics.LeftStemX + (stemThickness / 2F); } flagsBlockMetrics.Move(deltaX, deltaY); // the flagsBlockMetrics is added to either this.MetricsList or this.PostJustificationMetrics in a later function. }
private void MoveBelowBottomBoundary(Metrics metrics, ref float bottomBoundary, float padding) { Debug.Assert(padding >= 0.0F); float newTop = bottomBoundary + padding; metrics.Move(0F, newTop - metrics.Top); bottomBoundary = metrics.Bottom; SetExternalBoundary(); }
private void MoveAboveTopBoundary(Metrics metrics, ref float topBoundary, float padding) { Debug.Assert(padding >= 0.0F); float newBottom = topBoundary - padding; metrics.Move(0F, newBottom - metrics.Bottom); topBoundary = metrics.Top; SetExternalBoundary(); }