Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Click events on Mobile #23

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

Click events on Mobile #23

davidebukali opened this issue Sep 14, 2018 · 3 comments

Comments

@davidebukali
Copy link

davidebukali 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
Copy link
Collaborator

bQvle 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 as completed Sep 19, 2018
@bQvle
Copy link
Collaborator

bQvle commented Sep 19, 2018

Forgot your last question :)

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

@davidebukali
Copy link
Author

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants