Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Text field typing lag #24

@ckhrysze

Description

@ckhrysze

There is a noticeable amount of delay between typing and text appearing in the text field. The code is still pretty simple:

defmodule Mudex.Scene.Home do
  use Scenic.Scene
  require Logger

  alias Scenic.Graph
  alias Scenic.ViewPort

  import Scenic.Primitives
  import Scenic.Components

  @text_size 18
  @graph Graph.build(font_size: @text_size)

  # ============================================================================
  # setup

  # --------------------------------------------------------
  def init(_, opts) do
    # get the width and height of the viewport. This is to demonstrate creating
    # a transparent full-screen rectangle to catch user input
    {:ok, %ViewPort.Status{size: {width, height}}} = ViewPort.info(opts[:viewport])

    graph =
      @graph
      |> text("Hello Scenic!", fill: :white, translate: {5, 15})
      |> text_field("",
        id: :input,
        width: width - 10,
        translate: {5, height - 40}
      )

    {:ok, graph, push: graph}
  end

  def handle_input(event, _context, state) do
    Logger.info("Received event: #{inspect(event)}")
    {:noreply, state}
  end
end

I'm running this on an HP Pavilion laptop running Ubuntu 18.04. I'm happy to provide any additional information. I also took a quick video trying to demonstrate what I'm seeing, if there is a reasonable place to put that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions