public virtual int calculateBeamY(int stemSize, int xCorrection, int xPosition, double scale, global::haxe.lang.Function yPosition) { unchecked { global::alphatab.rendering.utils.BeamDirection direction = this.getDirection(); if ((this.beats.length == 1)) { if ((this.getDirection() == global::alphatab.rendering.utils.BeamDirection.Up)) { return(((int)(yPosition.__hx_invoke1_f(default(double), this.maxNote))) - stemSize); } else { return(((int)(yPosition.__hx_invoke1_f(default(double), this.minNote))) + stemSize); } } int maxDistance = ((int)((10 * scale))); if ((((direction == global::alphatab.rendering.utils.BeamDirection.Down) && (this.minNote != this.firstMinNote)) && (this.minNote != this.lastMinNote))) { return(((int)(yPosition.__hx_invoke1_f(default(double), this.minNote))) + stemSize); } else { if ((((direction == global::alphatab.rendering.utils.BeamDirection.Up) && (this.maxNote != this.firstMaxNote)) && (this.maxNote != this.lastMaxNote))) { return(((int)(yPosition.__hx_invoke1_f(default(double), this.maxNote))) - stemSize); } } int startX = (this.getBeatLineX(this.firstMinNote.beat) + xCorrection); int startY = default(int); if ((direction == global::alphatab.rendering.utils.BeamDirection.Up)) { startY = (((int)(yPosition.__hx_invoke1_f(default(double), this.firstMaxNote))) - stemSize); } else { startY = (((int)(yPosition.__hx_invoke1_f(default(double), this.firstMinNote))) + stemSize); } int endX = (this.getBeatLineX(this.lastMaxNote.beat) + xCorrection); int endY = default(int); if ((direction == global::alphatab.rendering.utils.BeamDirection.Up)) { endY = (((int)(yPosition.__hx_invoke1_f(default(double), this.lastMaxNote))) - stemSize); } else { endY = (((int)(yPosition.__hx_invoke1_f(default(double), this.lastMinNote))) + stemSize); } if ((((direction == global::alphatab.rendering.utils.BeamDirection.Down) && (startY > endY)) && ((startY - endY) > maxDistance))) { endY = (startY - maxDistance); } if ((((direction == global::alphatab.rendering.utils.BeamDirection.Down) && (endY > startY)) && ((endY - startY) > maxDistance))) { startY = (endY - maxDistance); } if ((((direction == global::alphatab.rendering.utils.BeamDirection.Up) && (startY < endY)) && ((endY - startY) > maxDistance))) { endY = (startY + maxDistance); } if ((((direction == global::alphatab.rendering.utils.BeamDirection.Up) && (endY < startY)) && ((startY - endY) > maxDistance))) { startY = (endY + maxDistance); } return((int)((((((double)(((endY - startY)))) / ((endX - startX))) * ((xPosition - startX))) + startY))); } }