render method

  1. @override
void render (
  1. RenderState renderState
)
override

Renders this display object with the given renderState. The display object is rendered without its filters.

Implementation

@override
void render(RenderState renderState) {
  _refreshTextLineMetrics();

  if (renderState.renderContext is RenderContextWebGL || _cacheAsBitmap) {
    _refreshCache(renderState.globalMatrix);
    renderState.renderTextureQuad(_renderTextureQuad);
  } else if (renderState.renderContext is RenderContextCanvas) {
    var renderContextCanvas =
        renderState.renderContext as RenderContextCanvas;
    renderContextCanvas.setTransform(renderState.globalMatrix);
    renderContextCanvas.setAlpha(renderState.globalAlpha);
    _renderText(renderContextCanvas.rawContext);
  }

  // draw cursor for INPUT text fields

  _caretTime += renderState.deltaTime;

  if (_type == TextFieldType.INPUT) {
    var stage = this.stage;
    if (stage != null &&
        stage.focus == this &&
        _caretTime.remainder(0.8) < 0.4) {
      var x1 = _caretX;
      var y1 = _caretY;
      var x3 = _caretX + _caretWidth;
      var y3 = _caretY + _caretHeight;
      var color = _defaultTextFormat.color;
      renderState.renderTriangle(x1, y1, x3, y1, x3, y3, color);
      renderState.renderTriangle(x1, y1, x3, y3, x1, y3, color);
    }
  }
}