Closed QuipHop closed 7 years ago
UPDATE: Click will fire if make click on the parent where item is overflowed
Ok, i've found solution According to Your example from http://mattcolman.com/labs/phaser-list-view/index.html I've moved out text to the img child and give it's input.priorityID to 9999;
For those looking at this now, the solution for ListView
is passing in the optionSearchForClicks
set to true
. This means that the ListView checks for onInputDown
and onInputUp
events if you only click (don't drag) on the list view. Took me a while to figure this out, so just posting for future reference in case anyone else is looking for such an answer. Example code:
const options = {
direction: "y",
overflow: 200,
padding: 100,
searchForClicks: true,
};
const listView = new ListView(this.game, parent, bounds, options);
listView.addMultiple(...items);
@drewsilcock I want to make use of onclick for the list items but this is not helping me.
Thanks @drewsilcock for pointing out that searchForClicks
is hidden.
Just added docs for this https://github.com/mattcolman/phaser-list-view/commit/f12e72bc40db35fd58b4475c0c8c9e49095fff1b
Hi @mattcolman is searchForClicks working for 1.0.1
probably not. We're at version 1.3.0. Can you upgrade and try?
I was unable to make the listview work with the latest version hence had to fall back to the initial version which I got working, but now I need onClick listener for the list items.
I think best option is to get 1.3.0 working. Maybe post some code and we can work out why it's not working for you.
Do you have any working example for the latest version 1.3.0 ?
I can find one. Are you using npm or script tag?
Npm
@ankurToko thanks for reporting the problem. Imports were not working in 1.3.0 when I started supporting script tag. Fixed now in 1.3.1. Also added an example repo here https://github.com/mattcolman/phaser-list-view-example
Thanks @mattcolman , after the fix it works fine. Cheers!
Hi I'm trying to add click event on the item inside list and this event won't fire my code :