Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Source/AlphaTab/Rendering/Glyphs/TieGlyph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ public override void Paint(float cx, float cy, ICanvas canvas)

var shouldDraw = false;

var direction = GetBeamDirection(StartBeat, startNoteRenderer);
// if we are on the tie start, we check if we
// if we are on the tie start, we check if we
// either can draw till the end note, or we just can draw till the bar end
if (!ForEnd)
var direction = startNoteRenderer == null
? GetBeamDirection(EndBeat, endNoteRenderer)
: GetBeamDirection(StartBeat, startNoteRenderer);
if (!ForEnd && startNoteRenderer != null)
{
// line break or bar break
if (startNoteRenderer != endNoteRenderer)
Expand All @@ -65,7 +67,7 @@ public override void Paint(float cx, float cy, ICanvas canvas)
endX = cx + startNoteRenderer.X + startNoteRenderer.Width;
endY = startY;
}
// bar break: to tie destination
// bar break: to tie destination
// differs only by addition of EndNote X coordinate
else
{
Expand All @@ -85,7 +87,7 @@ public override void Paint(float cx, float cy, ICanvas canvas)
}
// if we draw for the tie end, we only draw a tie if we had a line break between start and end
// in this case there will be a tie from bar start to the note
else if (startNoteRenderer.Staff != endNoteRenderer.Staff)
else if (startNoteRenderer == null || startNoteRenderer.Staff != endNoteRenderer.Staff)
{
startX = cx + endNoteRenderer.X;
endX = cx + endNoteRenderer.X + GetEndX(endNoteRenderer);
Expand All @@ -96,6 +98,7 @@ public override void Paint(float cx, float cy, ICanvas canvas)
shouldDraw = true;
}


if (shouldDraw)
{
PaintTie(canvas,
Expand Down Expand Up @@ -169,7 +172,7 @@ public static void PaintTie(
y2 = t;
}
//
// calculate control points
// calculate control points
//

offset *= scale;
Expand Down