OpenSheetMusicDisplay
    Preparing search index...

    Class GraphicalMeasureAbstract

    Represents a measure in the music sheet (one measure in one staff line)

    Hierarchy (View Summary)

    Index
    beginInstructionsWidth: number

    The x-width of possibly existing: repetition start line, clef, key, rhythm.

    boundingBox: BoundingBox
    endInstructionsWidth: number

    The x-width of possibly existing: repetition end line, clef.

    ExtraGraphicalMeasurePreviousMeasure: GraphicalMeasure
    firstInstructionStaffEntry: GraphicalStaffEntry
    hasError: boolean
    hasOnlyRests: boolean = false

    Whether or not this measure is nothing but rest(s). Also see SourceMeasure.allRests, which is not the same, because a source measure can have multiple staffs/graphicalMeasures.

    InitiallyActiveClef: ClefInstruction

    The clef of the first note of the measure (the clef the measure starts with).

    IsExtraGraphicalMeasure: boolean

    Used to show key, rhythm changes at the end of the system, has MeasureNumber < 0, because never set.

    isTabMeasure: boolean = false
    lastInstructionStaffEntry: GraphicalStaffEntry
    minimumStaffEntriesWidth: number

    The minimum possible x-width of all staff entries without overlapping.

    multiRestElement: any

    Only exists on multiple rest measure (VexFlowMultiRestMeasure). See isMultiRestMeasure() function.

    parentSourceMeasure: SourceMeasure
    ShowKeySignature: boolean = true
    ShowTimeSignature: boolean = true
    staffEntries: GraphicalStaffEntry[]
    staffEntriesScaleFactor: number

    Will be set by music system builder while building systems.

    svgGElement: SVGGElement = undefined

    The SVG group the measure was drawn into, see getSVGGElement(). Set by the backend's measure (VexFlowMeasure.draw()).

    • Gets the SVG group (g.vf-measure) this measure was drawn into, with the SVG backend: its staff lines (g.vf-stave), barlines, clef, key and time signature, notes, and the ties that end in it. Each group has an id of its own in the sheet's drawing, e.g. "osmd-m11-1" for the group of MeasureList[11][1], the 12th measure of the second staff (see getSVGGElementId()). Several OSMD instances on a web page give their measures the same ids, so find a group by its id in the instance's container, or with this method.

      Returns SVGGElement

      The group, or undefined with the canvas backend and for a measure that isn't drawn.

      // the staff lines of the second staff's first measure in red
      osmd.GraphicSheet.MeasureList[0][1].getSVGGElement()?.querySelector(".vf-stave")?.setAttribute("stroke", "#FF0000");
    • Gets the id of the SVG group this measure is drawn into (see getSVGGElement()), unique in the sheet's drawing: "osmd-m", the measure's index in Sheet.SourceMeasures, "-" and its staff's index in Sheet.Staves, both counted from 0, which are the measure's indices in GraphicSheet.MeasureList: "osmd-m11-1" is MeasureList[11][1], the 12th measure of the second staff. A multiple rest measure has the index of its first measure. An extra instruction measure (the key or time signature of the next system at the end of a system) has the index of the measure it follows and an "x": "osmd-m1x-0" follows "osmd-m1-0". The index, not the measure number, which can repeat (e.g. 0 for a pickup and for an implicit measure after it).

      Returns string

    • Check if the all the [[GraphicalMeasure]]'s [[StaffEntry]]s (their minimum Length) have the same duration with the [[SourceMeasure]].

      Returns boolean

    • This method is called after the StaffEntriesScaleFactor has been set. Here the final x-positions of the staff entries have to be set. (multiply the minimal positions with the scaling factor, considering the BeginInstructionsWidth).

      Returns void

    • Reset all the geometric values and parameters of this measure and put it in an initialized state. This is needed to evaluate a measure a second time by system builder.

      Returns void

    • Set the x-position relative to the staffline (y-Position is always 0 relative to the staffline).

      Parameters

      • xPos: number

      Returns void