v5.0.0
    Preparing search index...

    Class TickContext

    TickContext formats abstract tickable objects, such as notes, chords, tabs, etc.

    It has a public attribute of tContexts which is a parent array of the TickContexts in which this TickContext belongs.

    Index

    Constructors

    Properties

    currentTick: Fraction
    formatterMetrics: { freedom: { left: number; right: number } }
    glyphPx: number
    leftDisplacedHeadPx: number
    maxTickable?: Tickable
    maxTicks: Fraction
    minTickable?: Tickable
    minTicks?: Fraction
    modLeftPx: number
    modRightPx: number
    notePx: number
    padding: number
    postFormatted: boolean = false
    preFormatted: boolean = false
    rightDisplacedHeadPx: number
    tContexts: TickContext[]
    tickables: Tickable[]
    tickablesByVoice: Record<string, Tickable>
    tickID: number
    totalLeftPx: number
    totalRightPx: number
    width: number
    x: number
    xBase: number
    xOffset: number

    Methods

    • Like getDeviationCost, but averages the cost of space deviations so that TickContexts with more Tickables are not weighted more heavily.

      Returns number

    • Return the total cost of space deviations from formatter metrics for each tickable in the context. Used by formatters.

      Since FormatterMetrics.space.deviation is the amount each tickable is smaller (negative) or wider (positive) than the mean amount of space allocated to that duration, a negative return value means the tickables at this position are on average getting less space than they should, while a positive number means they are getting more space than they should.

      Returns number

    • Returns { freedom: { left: number; right: number } }

    • Move this tick context by shift pixels rightward, and adjust the freedom on adjacent tickcontexts.

      Parameters

      • shift: number

        pixels to shift rightward.

      • Optionalprev: TickContext

        the previous TickContext, whose right freedom will be increased by shift.

      • Optionalnext: TickContext

        the next TickContext, whose left freedom will be decreased by shift.

      Returns void