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 mouse events to mapped by custom code #1

Open
ianharrigan opened this issue Jul 24, 2016 · 0 comments
Open

Allow mouse events to mapped by custom code #1

ianharrigan opened this issue Jul 24, 2016 · 0 comments

Comments

@ianharrigan
Copy link
Member

ianharrigan commented Jul 24, 2016

It would be nice to allow haxeui-kha (and possibly all other backends) to inject code to handle event mapping. This would be advantageous as it allows, for example, for a HaxeUI application to be put into a 3D scene and co-ord translation logic to be applied for mouse events (instead of the default processing)

Expected Behavior

The ability to side step haxeui-kha event mapping

Current Behavior

At the moment, when haxeui-core adds an event, a mapEvent function is called in the backend, this functions holds onto the event listener and the event in question in a map, it then links up an actual event using Khas Mouse.get().notify

Possible Solution

What may be a better system is to have a class defined in module.xml, this would default to something sensible, this could then be called instead meaning that 3rd part code could be injected into the system. This class could also have an easy way to then dispatch these events via the ComponentBase

eg:

switch (type) {
    case MouseEvent.MOUSE_OVER:
        if (_eventMap.exists(MouseEvent.MOUSE_OVER) == false) {
            _mapper.map(MouseEvent.MOUSE_OVER, listener);
            _eventMap.set(MouseEvent.MOUSE_OVER, listener);
        }
}

it would be nice to get some input from @luboslenco if this makes sense and is the right way to be doing things.

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

No branches or pull requests

1 participant