From 919c8733a0b4ef3d662bea600d700e7cbf2a312f Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Tue, 14 May 2019 14:13:37 +0200 Subject: [PATCH] Fixed display bug. --- dist/iwmlib.pixi.js | 88 +++++++++++++++--------------------------- lib/pixi/scrollbox.js | 34 +++++++++------- lib/pixi/scrollview.js | 2 + 3 files changed, 52 insertions(+), 72 deletions(-) diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index b2652a3..68016e0 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -12441,24 +12441,28 @@ { super(); this.options = Object.assign({}, { - "boxWidth": 100, - "boxHeight": 100, - "scrollbarSize": 10, - "scrollbarBackground": 14540253, - "scrollbarBackgroundAlpha": 1, - "scrollbarForeground": 8947848, - "scrollbarForegroundAlpha": 1, - "dragScroll": true, - "stopPropagation": true, - "scrollbarOffsetHorizontal": 0, - "scrollbarOffsetVertical": 0, - "underflow": "top-left", - "fadeScrollbar": false, - "fadeWait": 3000, - "fadeEase": "easeInOutSine" + boxWidth: 100, + boxHeight: 100, + scrollbarSize: 10, + scrollbarBackground: 14540253, + scrollbarBackgroundAlpha: 1, + scrollbarForeground: 8947848, + scrollbarForegroundAlpha: 1, + dragScroll: true, + stopPropagation: true, + scrollbarOffsetHorizontal: 0, + scrollbarOffsetVertical: 0, + underflow: 'top-left', + fadeScrollbar: false, + fadeWait: 3000, + fadeEase: 'easeInOutSine' }, options); this.ease = new PIXI.extras.Ease.list(); + this.on('added', event => { + this.update(); + }); + /** * content in placed in here * you can use any function from pixi-viewport on content to manually move the content (see https://davidfig.github.io/pixi-viewport/jsdoc/) @@ -12996,39 +13000,7 @@ } /** - * Callback for the switch action. - * - * @callback actionCallback - * @param {object} event - The event object. - * @param {Switch} switch - A reference to the switch (also this refers to the switch). - */ - - /** - * Callback for the switch action. - * - * @callback actionActiveCallback - * @param {object} event - The event object. - * @param {Switch} switch - A reference to the switch (also this refers to the switch). - */ - - /** - * Callback for the switch beforeAction. - * - * @callback beforeActionCallback - * @param {object} event - The event object. - * @param {Switch} switch - A reference to the switch (also this refers to the switch). - */ - - /** - * Callback for the switch afterAction. - * - * @callback afterActionCallback - * @param {object} event - The event object. - * @param {Switch} switch - A reference to the switch (also this refers to the switch). - */ - - /** - * Class that represents a PixiJS Switch. + * Class that represents a PixiJS Scrollview. * * @example * // Create the app @@ -13038,14 +13010,14 @@ * height: 250 * }).setup().run() * - * // Create the switch - * const switch1 = new Switch({ - * x: 10, - * y: 20 - * }) - * - * // Add the switch to a DisplayObject - * app.scene.addChild(switch1) + * // 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 @@ -13055,7 +13027,7 @@ class Scrollview extends Scrollbox { /** - * Creates an instance of a Switch. + * Creates an instance of a Scrollview. * * @constructor */ @@ -13092,6 +13064,8 @@ */ layout() { + this.update(); + return this } } diff --git a/lib/pixi/scrollbox.js b/lib/pixi/scrollbox.js index 83bcd9b..3b95687 100644 --- a/lib/pixi/scrollbox.js +++ b/lib/pixi/scrollbox.js @@ -30,24 +30,28 @@ export default class Scrollbox extends PIXI.Container { { super() this.options = Object.assign({}, { - "boxWidth": 100, - "boxHeight": 100, - "scrollbarSize": 10, - "scrollbarBackground": 14540253, - "scrollbarBackgroundAlpha": 1, - "scrollbarForeground": 8947848, - "scrollbarForegroundAlpha": 1, - "dragScroll": true, - "stopPropagation": true, - "scrollbarOffsetHorizontal": 0, - "scrollbarOffsetVertical": 0, - "underflow": "top-left", - "fadeScrollbar": false, - "fadeWait": 3000, - "fadeEase": "easeInOutSine" + boxWidth: 100, + boxHeight: 100, + scrollbarSize: 10, + scrollbarBackground: 14540253, + scrollbarBackgroundAlpha: 1, + scrollbarForeground: 8947848, + scrollbarForegroundAlpha: 1, + dragScroll: true, + stopPropagation: true, + scrollbarOffsetHorizontal: 0, + scrollbarOffsetVertical: 0, + underflow: 'top-left', + fadeScrollbar: false, + fadeWait: 3000, + fadeEase: 'easeInOutSine' }, options) this.ease = new PIXI.extras.Ease.list() + this.on('added', event => { + this.update() + }) + /** * content in placed in here * you can use any function from pixi-viewport on content to manually move the content (see https://davidfig.github.io/pixi-viewport/jsdoc/) diff --git a/lib/pixi/scrollview.js b/lib/pixi/scrollview.js index 422458c..ca12ec0 100644 --- a/lib/pixi/scrollview.js +++ b/lib/pixi/scrollview.js @@ -65,6 +65,8 @@ export default class Scrollview extends Scrollbox { */ layout() { + this.update() + return this } }