import Scrollbox from './scrollbox.js' /** * Class that represents a PixiJS Scrollview. * * @example * // Create the app * const app = new PIXIApp({ * view: canvas, * width: 600, * height: 400 * }).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: 300}) * 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 * @see https://davidfig.github.io/pixi-scrollbox/jsdoc/Scrollbox.html */ constructor(opts = {}) { super(opts) this.opts = opts } /** * 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() { this.update() return this } }