openrndr / orx

A growing library of assorted data structures, algorithms and utilities for OPENRNDR
https://openrndr.org
BSD 2-Clause "Simplified" License
121 stars 37 forks source link

[orx-gui] Collapsed GUI intercepts and handles some mouse and keyboard events #297

Open Yvee1 opened 1 year ago

Yvee1 commented 1 year ago

Operating System

Windows

OPENRNDR version

latest from Github at the time of writing

ORX version

latest from Github at the time of writing

Java version (if applicable)

No response

Describe the bug

A GUI that is collapsed still intercepts and handles some mouse and keyboard events. In particular, I noticed this for the following events:

Steps to reproduce the bug

  1. Run the following program.
    fun main() = application {
    program {
        val s = object {
            @ActionParameter("Button")
            fun f() { println("Clicked") }
        }
        val gui = GUI()
        gui.add(s)
        extend(gui)
        mouse.scrolled.listen { println(it.propagationCancelled) }
        keyboard.keyDown.listen { println(it.propagationCancelled) }
    }
    }
  2. Collapse the GUI and scroll with the scrollwheel in the area of the GUI.
  3. Open the GUI and notice that it has scrolled. The console is filled with "true" indicating that the scroll event was handled.
  4. Click on "Button" under "No name".
  5. Close the GUI, and press the spacebar. Note that "Clicked" and "true" is printed in the console.