import Scrollbox from './scrollbox.js'
/**
* Class that represents a PixiJS Scrollview.
*
* @example
* // Create the app
* const app = new PIXIApp({
* view: canvas,
* width: 900,
* height: 250
* }).setup().run()
*
* // Create the Scrollview
* app.loader
* .add('elephant', './assets/elephant-1.jpg')
* .load((loader, resources) => {
* const sprite = new PIXI.Sprite(resources.elephant.texture)
* const scrollview = new Scrollview({boxWidth: 400, boxHeight: 180})
* scrollview.content.addChild(sprite)
* app.scene.addChild(scrollview)
*
* @class
* @extends PIXI.extras.Scrollbox
* @see {@link https://davidfig.github.io/pixi-scrollbox/jsdoc/Scrollbox.html|Scrollbox}
* @see {@link https://davidfig.github.io/pixi-viewport/jsdoc/Viewport.html|Viewport}
*/
export default class Scrollview extends Scrollbox {
/**
* Creates an instance of a Scrollview.
*
* @constructor
*/
constructor(opts = {}) {
super(opts)
this.opts = opts
// setup
//-----------------
this.setup()
// layout
//-----------------
this.layout()
}
/**
* Creates children and instantiates everything.
*
* @private
* @return {Scrollview} A reference to the Scrollview for chaining.
*/
setup() {
return this
}
/**
* Should be called to refresh the layout of the Scrollview. Can be used after resizing.
*
* @return {Scrollview} A reference to the Scrollview for chaining.
*/
layout() {
return this
}
}