PiDraw API
    Preparing search index...

    Class Label

    The text of a figure, drawn in the group of the figure (<text>, or a foreignObject for an HTML label), at a place that the figure chooses (move) and aligned as asked (position).

    The element is made once: a new text is written in it (setLabel), so that it keeps being hidden if it is, and nothing is measured again when neither the text nor the place has changed.

    Index
    autoRotate: boolean = false

    Whether the label is turned along its figure (a line): the figure sets the angle each time it puts the label.

    • get alignementGiven(): boolean

      Whether an alignment was asked for (a call of position with one), as opposed to the default one. A figure that chooses a better alignment from where its label lies (an arc) leaves the one that was asked for.

      Returns boolean

    • get displayName(): string

      The text of the label: for an HTML label, what the texConverter made of it.

      Returns string

    • Put the anchor of the label at a place, in pixels, and draw the label there as it is aligned. Nothing is measured again when the anchor, the text and the alignment are the ones it was drawn with.

      Parameters

      • x: number
      • y: number

      Returns this

    • Align the label to its anchor and draw it. What is not given stays what the label has.

      Parameters

      • Optionalalignement: LABEL_POSITION

        on which side of the anchor the label lies, for example tl: the label is above the anchor and to its left.

      • Optionaloffset: XY

        added to the place, in pixels, the y axis pointing up. A value that is not a number is 0.

      • Optionalrotate: number

        the angle around the anchor, in degrees clockwise on the screen.

      • Optionalpush: number | null

        how far the label is pushed from its anchor, in pixels, in the direction where it lies; null asks none, and the label is then pushed by its clearance.

      Returns this

    • Turn the label by an angle in degrees around its anchor. 0 puts it back straight.

      Parameters

      • angle: number

      Returns this

    • Make the label lie on the side of its anchor that a direction points to, instead of the one of its alignement. The label is drawn again if that changes something.

      Parameters

      • direction: XY | null

        on the screen (the y axis points down), not necessarily of length 1; null (or a null vector) gives the alignement back.

      Returns this

    • Keep the label this far from its anchor, in pixels, when it was asked no push of its own: a drag handle is over the figure, and its label would be under it. The label is drawn again if that changes something.

      Parameters

      • pixels: number

      Returns this

    • Write a new text in the label. Nothing happens if it is the text that is already there; the element is the same, so it is still hidden if it was.

      Parameters

      • Optionaltext: string

        the new text; by default the text stays.

      Returns this