OpenSheetMusicDisplay
    Preparing search index...

    Class BoundingBox

    A bounding box delimits an area on the 2D plane.

    Graphical object where the bounding box will be attached

    Parent bounding box of an object in a higher hierarchy position

    Create a child to parent relationship too. Will be true by default

    Index
    • Create a bounding box

      Parameters

      • dataObject: object = undefined

        Graphical object where the bounding box will be attached

      • parent: BoundingBox = undefined

        Parent bounding box of an object in a higher hierarchy position

      • isSymbol: boolean = false

        Defines the bounding box to be symbol thus not calculating its boundaries by itself. NOTE: Borders need to be set!

      Returns BoundingBox

    absolutePosition: PointF2D = ...
    borderBottom: number = 0
    borderLeft: number = 0
    borderMarginBottom: number = 0
    borderMarginLeft: number = 0
    borderMarginRight: number = 0
    borderMarginTop: number = 0
    borderRight: number = 0
    borderTop: number = 0
    boundingMarginRectangle: RectangleF2D = undefined
    boundingRectangle: RectangleF2D = undefined
    childElements: BoundingBox[] = []
    dataObject: object
    isSymbol: boolean = false
    marginSize: SizeF2D = undefined
    parent: BoundingBox
    relativePosition: PointF2D = ...
    relativePositionHasBeenSet: boolean = false
    size: SizeF2D = undefined
    upperLeftCorner: PointF2D = undefined
    upperLeftMarginCorner: PointF2D = undefined
    xBordersHaveBeenSet: boolean = false
    yBordersHaveBeenSet: boolean = false
    • Calculate the the absolute position by adding up all relative positions of all parents (including the own rel. pos.)

      Returns void

    • This method calculates the Absolute Positions recursively from the root element down to the leaf elements

      Parameters

      • x: number
      • y: number

      Returns void

    • This method calculates the BoundingBoxes

      Parameters

      • ignoreClasses: (string | ClassType)[] = []

        The classes (or class names, see isInstanceOfClass()) of the objects whose bounding boxes, and their children's, to leave as they are, e.g. [GraphicalMeasure]

      Returns void

    • Updates the margin size, upper left margin corner and margin rectangle after a margin changed: drops them, and their getters make them from the margins when next called.

      Returns void

    • Updates the size, upper left corner and rectangle after a border changed: drops them, and their getters make them from the borders when next called. Also the margin ones, as the margin getters include the borders.

      Returns void

    • Calculates the top and bottom borders (and margins) of this bounding box from those of its child elements.

      Parameters

      • recursive: boolean = true

        whether to calculate those of the child elements first, recursively (default). false only recalculates this bounding box, when the borders below it are up to date (repeating the calculation for an unchanged child element gives the same borders).

      Returns void

    • Returns the object of the class whose bounding box contains the position, e.g. of a click: of this bounding box or its descendants, the innermost one, e.g. without a class, at a lyric, its label rather than its staff entry, measure or page. The generic type T doesn't select the object (types don't exist at runtime), classOrName does.

      Type Parameters

      • T

      Parameters

      • clickPosition: PointF2D

        The position in units

      • classOrName: string | ClassType = GraphicalObject

        The class of the object, e.g. GraphicalStaffEntry, or its name, which is unreliable in minified builds (see isInstanceOfClass()). By default, any graphical object.

      Returns T

    • Returns the objects of this bounding box and its descendants that lie inside the region (liesInside), or overlap it. The generic type T doesn't select the objects (types don't exist at runtime), classOrName does.

      Type Parameters

      Parameters

      • region: BoundingBox
      • liesInside: boolean = true
      • classOrName: string | ClassType = GraphicalObject

        The class of the objects, e.g. GraphicalMeasure, or its name, which is unreliable in minified builds (see isInstanceOfClass())

      Returns T[]