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

Text field typing lag #24

Open
ckhrysze opened this issue May 12, 2019 · 4 comments
Open

Text field typing lag #24

ckhrysze opened this issue May 12, 2019 · 4 comments

Comments

@ckhrysze
Copy link

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.

@Eiji7
Copy link

Eiji7 commented May 13, 2019

I have added your code to example project generated using: mix scenic.new.example example and I did not noticed any special lag between input and draw. Since it's hard to reproduce it we need to find a different way to fix your problem. Did you tried same code on any other PC?

@ckhrysze
Copy link
Author

I tried, but attempting the basic scenic.new project on my Macbook led to the other issue I just filed. The only only computer I have access to is windows...I started down the path of using Ubuntu bash shell on windows; I will continue that when I get a chance.

@boydm
Copy link
Collaborator

boydm commented May 13, 2019

Hey guys. Just want you to know that I see this, but am traveling right now and won't get a chance to really look at it for a bit...

@Eiji7
Copy link

Eiji7 commented May 13, 2019

@ckhrysze

The only only computer I have access to is windows

This should not be a problem. Just use any live CD/USB Linux distribution … In second USB drive you can save some test projects.

I tried, but attempting the basic scenic.new project on my Macbook led to the other issue I just filed.

Unfortunately I can't help here as I don't have any PC from Apple. Unlike official Linux live CD/USB releases I don't believe that Hackintosh tests would be proper at all.

I started down the path of using Ubuntu bash shell on windows

Oh, WSL is a big mystery for me - I never tried it. It's like wine project - it would probably never be a complete solution. Also I don't think that "laggy" Windows would run Linux software faster than Linux. I would have no other choice then I prefer to run virtual machine instead.

By "laggy" I mean that all versions I tried (from XP, Vista, 7, 8, 8.1, 10) every time I tried to click on "My computer" right after inserting any CD/DVD disc I got explorer window freeze. If they can't fix so simple thing in so many years then it's just not OS I could even consider for daily use. Such important part of software in 21th century without any multithreading is not even a bad joke for me. For sure if I need to replace such important OS parts with 3rd-party apps then I prefer to simply install any Linux distribution with package manager.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants