mattcolman / phaser-list-view

List view class for Phaser. Great for high scoreboards.
http://mattcolman.com/labs/phaser-list-view/index.html
MIT License
114 stars 22 forks source link

Add Scrollbar #28

Closed Archon- closed 5 years ago

Archon- commented 5 years ago

Hi all,

nice project @mattcolman . I'd like to use this list view component with scroll (horizontal/vertical). Of course this would be optional and could be render at any place, up to developer.

Example of usage:

import { ListView, ScrollBar } from 'phaser-list-view';

const listView = new ListView(this.game, parent, bounds, options);
const scrollBar = new ScrollBar(listView, {
  height: 100px,
  width: 8px,
  type: 'horizontal'
});

I'm happy to work on some proposal PR. Please let me know what do you think.

mattcolman commented 5 years ago

Hi @Archon- glad you're liking this project. I think you could use any scroll bar for this. Maybe there's an existing scroll bar on npm, or you could build your own, but it doesn't need to live inside this project. For example the code might look like this:

const scrollBar = new ScrollBar(options)
scrollBar.onMove(({x, y}) => {
  listView.moveToPosition(x)
})

Hope that helps! Cheers,

Archon- commented 5 years ago

Sure, sounds good to me. :)