text/label

<script src="./point_src/text/label"></script>

A Label provides an interface to a persistent, styled text element. Under the hood it maintains a position:

    let label = new Label(ctx, {
        fontSize: 50
        , textAlign: "center"
        , fontName: '"lexend deca"'
    })

    // label.fillStyle = 'orange'
    label.position = new Point(300, 200)
    this.label = label;

    this.label.text = "updated text"
    this.label.writeText(ctx)
Meta Data
filepath_exists True
path text/label
filepath text/label.js
clean_files ()

  • ClassDeclaration
    class comments:

    A Label class accepts generic text properties.

    • Accept basic styles
    • position and rotation
    • property

      fontSize

      = 14
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      fontWeight

      = 'normal'
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      fontName

      = 'Courier New'
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      textAlign

      = "left"
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      textBaseline

      = "top"
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      position

      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      fillStyle

      = 'orange'
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      _letterSpacing

      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • constructor

      constructor

      (
      ctx , text = undefined
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      updateData

      (
      d
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • get

      width

      (
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      draw

      (
      ctx , conf
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Anything that can be written to the canvas directly, has a draw method.

    • method

      gather

      (
      ctx , conf = {}
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      || '"Courier New"'

    • method

      apply

      (
      ctx , d
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      ctx.letterSpacing = .335em;

    • method

      write

      (
      ctx , d
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      ctx.translate(300, 300)

    • method

      generateGrad

      (
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      writeText

      (
      ctx , fillStyle
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      ctx.letterSpacing = .335em;

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ClassDeclaration
    class comments:

    With modulo for slower updates.

    • property

      _tick

      = 0
      from FastLabel
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      fixed

      = 0
      from FastLabel
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      _liveText

      = '??'
      from FastLabel
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • constructor

      constructor

      (
      ctx , text = undefined
      )
      from FastLabel
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      update

      (
      )
      from FastLabel
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      this.text = currentFPS

    • method

      getCurrentText

      (
      )
      from FastLabel
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • set

      text

      (
      v
      )
      from FastLabel
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • get

      text

      (
      )
      from FastLabel
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      gather

      (
      ctx , conf = {}
      )
      from FastLabel
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • property

      fontSize

      = 14
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      fontWeight

      = 'normal'
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      fontName

      = 'Courier New'
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      textAlign

      = "left"
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      textBaseline

      = "top"
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      position

      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      fillStyle

      = 'orange'
      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • property

      _letterSpacing

      from Label
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos', 'class_name'])
    • constructor

      constructor

      (
      ctx , text = undefined
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      updateData

      (
      d
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • get

      width

      (
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      draw

      (
      ctx , conf
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Anything that can be written to the canvas directly, has a draw method.

    • method

      gather

      (
      ctx , conf = {}
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      || '"Courier New"'

    • method

      apply

      (
      ctx , d
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      ctx.letterSpacing = .335em;

    • method

      write

      (
      ctx , d
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      ctx.translate(300, 300)

    • method

      generateGrad

      (
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      writeText

      (
      ctx , fillStyle
      )
      from Label
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      ctx.letterSpacing = .335em;

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])