Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow text to overflow without breaking / wrapping #177

Open
hassanshaikley opened this issue Nov 3, 2019 · 2 comments
Open

Allow text to overflow without breaking / wrapping #177

hassanshaikley opened this issue Nov 3, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@hassanshaikley
Copy link
Contributor

#62 # What problem does this feature solve?

I want text to be able to overflow outside of the screen; that way I can create scrolling text.

I want text to scroll in like a marquee.

What is your proposed solution?

Allow it to be as wide as need be and just slide it over to the left continuously.

@hassanshaikley hassanshaikley changed the title Disable word wrapping for text Allow text to overflow without breaking / wrapping Nov 3, 2019
@axelson
Copy link
Collaborator

axelson commented Jul 9, 2022

@boydm This might be another good issue to revisit. Here's an example scene that reproduces the text wrapping (which doesn't match the size of the view port):

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

  alias Scenic.Graph

  import Scenic.Primitives
  @text_size 24

  def init(scene, _param, _opts) do
    {width, height} = scene.viewport.size

    graph =
      Graph.build(font: :roboto, font_size: @text_size)
      |> add_specs_to_graph([
        text_spec(
          "Very long text will wrap at some point. Is there a way to disable this? aa ab ac ad ae af ag ah ai aj ak al am an ao ap",
          translate: {20, 40 + @text_size}
        ),
        rect_spec({width, height})
      ])

    scene = push_graph(scene, graph)

    {:ok, scene}
  end


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

And here's a screenshot rendered from the scene above:
Screen Shot 2022-07-09 12-46-33

@JediLuke
Copy link
Contributor

JediLuke commented Aug 10, 2022

The reason this happens is due to a hard-coded wrapping limit inside script.c, which is in the local driver - see here https://github.com/ScenicFramework/scenic_driver_local/blob/main/c_src/script.c#L216

If you clone the repo & set this limit to like 2000 (it's 1000 now) and recompile it, the wrapping limit goes away.

I am not sure what the best overall way to fix this is though, maybe it should be a compile option? Maybe we can pass it down as an argument?

@crertel crertel added the enhancement New feature or request label Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants