public static async Task <Rect> DrawGliss(IRootElementRenderer rootRenderer, Beat beat, IEnumerable <int> stringIndices, GlissDirection direction) { var beatRenderer = rootRenderer.GetRenderer <Beat, BeatRenderer>(beat); var renderingContext = beatRenderer.RenderingContext; var bounds = new BoundingBoxUnion(); foreach (var stringIndex in stringIndices) { var noteBounds = renderingContext.GetNoteBoundingBox(beat.OwnerColumn.ColumnIndex, stringIndex); Debug.Assert(noteBounds != null); double x; switch (direction) { case GlissDirection.FromHigher: case GlissDirection.FromLower: x = noteBounds.Value.Left - renderingContext.Style.NoteMargin; break; case GlissDirection.ToHigher: case GlissDirection.ToLower: x = noteBounds.Value.Right + renderingContext.Style.NoteMargin; break; default: throw new InvalidOperationException(); } bounds.AddBounds(await renderingContext.DrawGliss(x, stringIndex, direction, beat.VoicePart)); } Debug.Assert(bounds.HasAnyBounds); return(bounds.Bounds); }
// x is absolute position public Task <Rect> DrawGliss(double x, int stringIndex, GlissDirection direction, VoicePart voicePart) { return(this.PrimitiveRenderer.DrawGliss(x, this.Owner.GetStringPosition(stringIndex), direction)); }
public Task <Rect> DrawGliss(double x, double y, GlissDirection direction) => this.InvokeAsyncRenderMethodReturnBoundingBox("drawGliss", x, y, direction);