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

Click events on Mobile #23

Closed
davidebukali opened this issue Sep 14, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@davidebukali
Copy link

commented Sep 14, 2018

Click events do not work on mobile devices. Perhaps requires a new feature; Is there a guide to contribute code to PIXI-UI

@bQvle

This comment has been minimized.

Copy link
Collaborator

commented Sep 19, 2018

Hi David,

if you are using obj.click = ...; this is just forwarding the function to the inner container.

For click events in PIXI-UI you can try this.

var clickEvent = new PIXI.UI.Interaction.ClickEvent(object, hover?, rightclick?, doubleClick?);
object = the object which needs interaction,
hover = boolean (trigger hover events),
rightclick = boolean (right click event?)
doubleClick = boolean (double click event?)

then you can do
clickEvent.onPress = function (event, isPressed) { ... };
clickEvent.onClick = function (event) { ... };
clickEvent.onHover = function (event, over) { ... }; (only triggered with hover = true on clickEvent)
clickEvent.onMove = function (event) { ... }; (only triggered with hover = true on clickEvent)

PIXI.UI.Interaction also contains DragEvent for dragging and MouseScrollEvent for scrolling :)

and everything should work with touch.

@bQvle bQvle closed this Sep 19, 2018

@bQvle

This comment has been minimized.

Copy link
Collaborator

commented Sep 19, 2018

Forgot your last question :)

If you want to contribute, feel free to branch PIXI-UI and make pull-requests.

@davidebukali

This comment has been minimized.

Copy link
Author

commented Sep 24, 2018

Thank you bQvle, the object you mentioned below worked both for mobile and desktop.

var clickEvent = new PIXI.UI.Interaction.ClickEvent(object, hover?, rightclick?, doubleClick?);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.