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

    Constructors

    • 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

    Properties

    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
    boundingRectangle: RectangleF2D
    childElements: BoundingBox[] = []
    dataObject: Object
    isSymbol: boolean = false
    marginSize: SizeF2D = ...
    parent: BoundingBox
    relativePosition: PointF2D = ...
    relativePositionHasBeenSet: boolean = false
    size: SizeF2D = ...
    upperLeftCorner: PointF2D = ...
    upperLeftMarginCorner: PointF2D = ...
    xBordersHaveBeenSet: boolean = false
    yBordersHaveBeenSet: boolean = false

    Accessors

    Methods

    • 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

    • 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 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[]