ScenicFramework / scenic

Core Scenic library
Apache License 2.0
1.99k stars 137 forks source link

cursor_exit is continually sent when cursor is outside rect #236

Closed jolonf closed 3 years ago

jolonf commented 3 years ago

With a simple scene of a single small rectangle dimensions {0, 0, 100, 100} when the cursor is outside the rectangle the :cursor_exit event is continually sent when the cursor moves. Should this only be sent once when the cursor leaves the rect?

I just started with a mix scene.new project and changed the graph build to:

    graph =
      Graph.build(font: :roboto, font_size: @text_size)
      |> add_specs_to_graph([
        rect_spec({100, 100}, fill: {50, 50, 50})
      ])

The following output occurs:

09:14:01.840 [info]  Received event: {:cursor_exit, 1}

09:14:01.873 [info]  Received event: {:cursor_exit, 1}

09:14:01.908 [info]  Received event: {:cursor_exit, 1}

09:14:01.940 [info]  Received event: {:cursor_exit, 1}

09:14:01.974 [info]  Received event: {:cursor_exit, 1}

Versions and Environment

Elixir: 1.12.3 Erlang: 24 Scenic: 0.10.5

OS: macOS 12.0 Beta

Steps to reproduce

Create a scenic.new project and a graph with a single small rect.

Expected Behavior

:cursor_exit only sent once when cursor leaves rect.

Actual Behavior

:cursor_exit is sent continuously when the cursor moves until the cursor re-enters the rect.

The id for the :cursor_exit event is always 1 indicating it is for the same rect.

boydm commented 3 years ago

This should be fixed in v0.11, which is still in the v0.11 branch. Merging to main soon. You would need to pair it with the v0.11 branch of eithet glfw driver or the new local driver (both glfw and rpi drivers will be deprecated once the local driver gets more stable).

If you want to give it a try, make sure to read the notes on porting. There are breaking changes.

boydm commented 3 years ago

Please confirm this is fixed in v0.11 (beta is published to hex) and close if you agree.

jolonf commented 3 years ago

Does v0.11 have a cursor_exit event for primitives? I can see an exit event for the viewport. Or was cursor_exit in v0.10 meant only for the viewport?

boydm commented 3 years ago

Was and is only meant for the viewport.

jolonf commented 3 years ago

Okay, closing as fixed in v0.11.