From f84d554a69547d4d7dc741df54a199014664aa40 Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Fri, 29 Mar 2019 11:44:34 +0100 Subject: [PATCH] Updated docs. --- doc/out/AbstractPopup.html | 2 +- doc/out/Badge.html | 2 +- doc/out/BlurFilter.html | 2 +- doc/out/Button.html | 2 +- doc/out/ButtonGroup.html | 2 +- doc/out/DeepZoomImage.html | 2 +- doc/out/DeepZoomInfo.html | 2 +- doc/out/Flippable.html | 2 +- doc/out/FontInfo.html | 2 +- doc/out/Hypenate.html | 2 +- doc/out/InteractivePopup.html | 2 +- ...beledGraphics.exports.LabeledGraphics.html | 2 +- doc/out/LabeledGraphics.html | 2 +- doc/out/List.html | 45 ++++++++++-- doc/out/Message.html | 2 +- doc/out/Modal.html | 2 +- doc/out/PIXIApp.html | 2 +- doc/out/Popup.html | 2 +- doc/out/PopupMenu.html | 2 +- doc/out/Progress.html | 2 +- doc/out/Slider.html | 2 +- doc/out/Switch.html | 2 +- doc/out/TextLabel.TextLabel.html | 2 +- doc/out/Theme.html | 2 +- doc/out/ThemeDark.html | 2 +- doc/out/ThemeLight.html | 2 +- doc/out/ThemeRed.html | 2 +- doc/out/TileQuadNode.html | 2 +- doc/out/Tooltip.html | 2 +- doc/out/UITest.html | 2 +- doc/out/Volatile.html | 2 +- doc/out/global.html | 2 +- doc/out/index.html | 2 +- doc/out/pixi_abstractpopup.js.html | 2 +- doc/out/pixi_app.js.html | 2 +- doc/out/pixi_badge.js.html | 2 +- doc/out/pixi_blurfilter.js.html | 2 +- doc/out/pixi_button.js.html | 2 +- doc/out/pixi_buttongroup.js.html | 2 +- doc/out/pixi_deepzoom_image.js.html | 2 +- doc/out/pixi_flippable.js.html | 2 +- doc/out/pixi_labeledgraphics.js.html | 2 +- doc/out/pixi_list.js.html | 68 ++++++++++++++++--- doc/out/pixi_message.js.html | 2 +- doc/out/pixi_modal.js.html | 2 +- doc/out/pixi_popup.js.html | 2 +- doc/out/pixi_popupmenu.js.html | 2 +- doc/out/pixi_progress.js.html | 2 +- doc/out/pixi_slider.js.html | 2 +- doc/out/pixi_switch.js.html | 2 +- doc/out/pixi_theme.js.html | 2 +- doc/out/pixi_tooltip.js.html | 2 +- doc/out/pixi_volatile.js.html | 2 +- doc/out/uitest.js.html | 2 +- package.json | 2 +- 55 files changed, 152 insertions(+), 67 deletions(-) diff --git a/doc/out/AbstractPopup.html b/doc/out/AbstractPopup.html index 99a7c7b..50946f4 100644 --- a/doc/out/AbstractPopup.html +++ b/doc/out/AbstractPopup.html @@ -2658,7 +2658,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/Badge.html b/doc/out/Badge.html index 65fa067..d449e1d 100644 --- a/doc/out/Badge.html +++ b/doc/out/Badge.html @@ -2106,7 +2106,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/BlurFilter.html b/doc/out/BlurFilter.html index 31ab95c..f65287a 100644 --- a/doc/out/BlurFilter.html +++ b/doc/out/BlurFilter.html @@ -1538,7 +1538,7 @@ app.scene.filters = [blurFilter] diff --git a/doc/out/Button.html b/doc/out/Button.html index 11bd946..fe6d098 100644 --- a/doc/out/Button.html +++ b/doc/out/Button.html @@ -3556,7 +3556,7 @@ the tint property of the icon sprite.

diff --git a/doc/out/ButtonGroup.html b/doc/out/ButtonGroup.html index d7de39a..ebea199 100644 --- a/doc/out/ButtonGroup.html +++ b/doc/out/ButtonGroup.html @@ -2952,7 +2952,7 @@ app.scene.addChild(buttonGroup) diff --git a/doc/out/DeepZoomImage.html b/doc/out/DeepZoomImage.html index 979a6c3..fc870f3 100644 --- a/doc/out/DeepZoomImage.html +++ b/doc/out/DeepZoomImage.html @@ -4829,7 +4829,7 @@ load tiles accordingly.

diff --git a/doc/out/DeepZoomInfo.html b/doc/out/DeepZoomInfo.html index a7ba186..3205b35 100644 --- a/doc/out/DeepZoomInfo.html +++ b/doc/out/DeepZoomInfo.html @@ -2342,7 +2342,7 @@ height and width of the overall image, overlap, and image type.

diff --git a/doc/out/Flippable.html b/doc/out/Flippable.html index 9e8f72e..a392310 100644 --- a/doc/out/Flippable.html +++ b/doc/out/Flippable.html @@ -2252,7 +2252,7 @@ front.on('click', event => flippable.toggle()) diff --git a/doc/out/FontInfo.html b/doc/out/FontInfo.html index 8049414..f466a4a 100644 --- a/doc/out/FontInfo.html +++ b/doc/out/FontInfo.html @@ -1299,7 +1299,7 @@ diff --git a/doc/out/Hypenate.html b/doc/out/Hypenate.html index 9ce1d00..f96fc0d 100644 --- a/doc/out/Hypenate.html +++ b/doc/out/Hypenate.html @@ -1501,7 +1501,7 @@ diff --git a/doc/out/InteractivePopup.html b/doc/out/InteractivePopup.html index 02ca997..2ffdd74 100644 --- a/doc/out/InteractivePopup.html +++ b/doc/out/InteractivePopup.html @@ -2068,7 +2068,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/LabeledGraphics.exports.LabeledGraphics.html b/doc/out/LabeledGraphics.exports.LabeledGraphics.html index b289513..b12fc74 100644 --- a/doc/out/LabeledGraphics.exports.LabeledGraphics.html +++ b/doc/out/LabeledGraphics.exports.LabeledGraphics.html @@ -1301,7 +1301,7 @@ diff --git a/doc/out/LabeledGraphics.html b/doc/out/LabeledGraphics.html index 8a8eeda..67d9279 100644 --- a/doc/out/LabeledGraphics.html +++ b/doc/out/LabeledGraphics.html @@ -2366,7 +2366,7 @@ than wanted

diff --git a/doc/out/List.html b/doc/out/List.html index 54c7f98..038ec59 100644 --- a/doc/out/List.html +++ b/doc/out/List.html @@ -1578,6 +1578,41 @@ + + + + app + + + + + +PIXI.Application + + + + + + + + + + + + + + + optional + + + + + +

The PixiJS Application. Must be set if you want to use the mousewheel to + scroll your list.

+ + + @@ -1788,7 +1823,7 @@ app.scene.addChild(list)
- list.js:330 + list.js:379
@@ -1912,7 +1947,7 @@ app.scene.addChild(list)
- list.js:128 + list.js:147
@@ -2017,7 +2052,7 @@ app.scene.addChild(list)
- list.js:235 + list.js:254
@@ -2138,7 +2173,7 @@ app.scene.addChild(list)
- list.js:114 + list.js:133
@@ -2290,7 +2325,7 @@ app.scene.addChild(list) diff --git a/doc/out/Message.html b/doc/out/Message.html index f55322a..b008377 100644 --- a/doc/out/Message.html +++ b/doc/out/Message.html @@ -1894,7 +1894,7 @@ app.scene.addChild(button) diff --git a/doc/out/Modal.html b/doc/out/Modal.html index 5f120ce..970f55e 100644 --- a/doc/out/Modal.html +++ b/doc/out/Modal.html @@ -2064,7 +2064,7 @@ a string or a PIXI.Text object.

diff --git a/doc/out/PIXIApp.html b/doc/out/PIXIApp.html index 12a5b0e..5ba5c94 100644 --- a/doc/out/PIXIApp.html +++ b/doc/out/PIXIApp.html @@ -5483,7 +5483,7 @@ Overwrite this method if you need additonal views and components.

diff --git a/doc/out/Popup.html b/doc/out/Popup.html index 3f3b6fc..a410ae4 100644 --- a/doc/out/Popup.html +++ b/doc/out/Popup.html @@ -2056,7 +2056,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/PopupMenu.html b/doc/out/PopupMenu.html index ba57f5b..c3eb4c5 100644 --- a/doc/out/PopupMenu.html +++ b/doc/out/PopupMenu.html @@ -2104,7 +2104,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/Progress.html b/doc/out/Progress.html index c3acab4..1754411 100644 --- a/doc/out/Progress.html +++ b/doc/out/Progress.html @@ -2615,7 +2615,7 @@ app.scene.addChild(progress) diff --git a/doc/out/Slider.html b/doc/out/Slider.html index 2335bf2..f0a6045 100644 --- a/doc/out/Slider.html +++ b/doc/out/Slider.html @@ -2706,7 +2706,7 @@ app.scene.addChild(slider) diff --git a/doc/out/Switch.html b/doc/out/Switch.html index 7fabbd7..345450e 100644 --- a/doc/out/Switch.html +++ b/doc/out/Switch.html @@ -3136,7 +3136,7 @@ app.scene.addChild(switch1) diff --git a/doc/out/TextLabel.TextLabel.html b/doc/out/TextLabel.TextLabel.html index 49ecd87..f505657 100644 --- a/doc/out/TextLabel.TextLabel.html +++ b/doc/out/TextLabel.TextLabel.html @@ -1430,7 +1430,7 @@ diff --git a/doc/out/Theme.html b/doc/out/Theme.html index 870a7e4..2b21508 100644 --- a/doc/out/Theme.html +++ b/doc/out/Theme.html @@ -2905,7 +2905,7 @@ const app = new PIXIApp({ diff --git a/doc/out/ThemeDark.html b/doc/out/ThemeDark.html index 767e615..1760963 100644 --- a/doc/out/ThemeDark.html +++ b/doc/out/ThemeDark.html @@ -1326,7 +1326,7 @@ const app = new PIXIApp({ diff --git a/doc/out/ThemeLight.html b/doc/out/ThemeLight.html index 8360079..0151794 100644 --- a/doc/out/ThemeLight.html +++ b/doc/out/ThemeLight.html @@ -1331,7 +1331,7 @@ const app = new PIXIApp({ diff --git a/doc/out/ThemeRed.html b/doc/out/ThemeRed.html index e44ad96..e9be5dd 100644 --- a/doc/out/ThemeRed.html +++ b/doc/out/ThemeRed.html @@ -1331,7 +1331,7 @@ const app = new PIXIApp({ diff --git a/doc/out/TileQuadNode.html b/doc/out/TileQuadNode.html index 6cc997a..44d27ee 100644 --- a/doc/out/TileQuadNode.html +++ b/doc/out/TileQuadNode.html @@ -1790,7 +1790,7 @@ and west flags to address nw, ne, sw, and se.

diff --git a/doc/out/Tooltip.html b/doc/out/Tooltip.html index d9be409..b214bca 100644 --- a/doc/out/Tooltip.html +++ b/doc/out/Tooltip.html @@ -2242,7 +2242,7 @@ a string, a number or a PIXI.Text object.

diff --git a/doc/out/UITest.html b/doc/out/UITest.html index 339fac1..b9aeed4 100644 --- a/doc/out/UITest.html +++ b/doc/out/UITest.html @@ -3923,7 +3923,7 @@ test.start() diff --git a/doc/out/Volatile.html b/doc/out/Volatile.html index 469edf0..56409e4 100644 --- a/doc/out/Volatile.html +++ b/doc/out/Volatile.html @@ -1839,7 +1839,7 @@ app.scene.addChild(button) diff --git a/doc/out/global.html b/doc/out/global.html index c9e27eb..2e1030b 100644 --- a/doc/out/global.html +++ b/doc/out/global.html @@ -3060,7 +3060,7 @@ diff --git a/doc/out/index.html b/doc/out/index.html index 506907d..c65a9b7 100644 --- a/doc/out/index.html +++ b/doc/out/index.html @@ -1221,7 +1221,7 @@ diff --git a/doc/out/pixi_abstractpopup.js.html b/doc/out/pixi_abstractpopup.js.html index 2c63eed..12974e6 100644 --- a/doc/out/pixi_abstractpopup.js.html +++ b/doc/out/pixi_abstractpopup.js.html @@ -1554,7 +1554,7 @@ export default class AbstractPopup extends PIXI.Graphics { diff --git a/doc/out/pixi_app.js.html b/doc/out/pixi_app.js.html index 9952a60..bc07352 100644 --- a/doc/out/pixi_app.js.html +++ b/doc/out/pixi_app.js.html @@ -1920,7 +1920,7 @@ class FpsDisplay extends PIXI.Graphics { diff --git a/doc/out/pixi_badge.js.html b/doc/out/pixi_badge.js.html index 032b697..ee7860a 100644 --- a/doc/out/pixi_badge.js.html +++ b/doc/out/pixi_badge.js.html @@ -1306,7 +1306,7 @@ export default class Badge extends AbstractPopup { diff --git a/doc/out/pixi_blurfilter.js.html b/doc/out/pixi_blurfilter.js.html index 0731094..4e70b5d 100644 --- a/doc/out/pixi_blurfilter.js.html +++ b/doc/out/pixi_blurfilter.js.html @@ -1460,7 +1460,7 @@ class TiltShiftYFilter extends TiltShiftAxisFilter { diff --git a/doc/out/pixi_button.js.html b/doc/out/pixi_button.js.html index 2d3ac27..be8f9b4 100644 --- a/doc/out/pixi_button.js.html +++ b/doc/out/pixi_button.js.html @@ -1864,7 +1864,7 @@ export default class Button extends PIXI.Container { diff --git a/doc/out/pixi_buttongroup.js.html b/doc/out/pixi_buttongroup.js.html index 0c2b78f..8ff8a42 100644 --- a/doc/out/pixi_buttongroup.js.html +++ b/doc/out/pixi_buttongroup.js.html @@ -1543,7 +1543,7 @@ export default class ButtonGroup extends PIXI.Graphics { diff --git a/doc/out/pixi_deepzoom_image.js.html b/doc/out/pixi_deepzoom_image.js.html index 5dc95ba..fc72f2b 100644 --- a/doc/out/pixi_deepzoom_image.js.html +++ b/doc/out/pixi_deepzoom_image.js.html @@ -2315,7 +2315,7 @@ export class DeepZoomImage extends PIXI.Container { diff --git a/doc/out/pixi_flippable.js.html b/doc/out/pixi_flippable.js.html index 83fb413..5155d6c 100644 --- a/doc/out/pixi_flippable.js.html +++ b/doc/out/pixi_flippable.js.html @@ -1638,7 +1638,7 @@ export default class Flippable extends PIXI.projection.Camera3d { diff --git a/doc/out/pixi_labeledgraphics.js.html b/doc/out/pixi_labeledgraphics.js.html index 8da3d72..ab71369 100644 --- a/doc/out/pixi_labeledgraphics.js.html +++ b/doc/out/pixi_labeledgraphics.js.html @@ -1611,7 +1611,7 @@ export class BitmapLabeledGraphics extends LabeledGraphics { diff --git a/doc/out/pixi_list.js.html b/doc/out/pixi_list.js.html index 042ec12..f5f55e1 100644 --- a/doc/out/pixi_list.js.html +++ b/doc/out/pixi_list.js.html @@ -1225,6 +1225,8 @@ export default class List extends PIXI.Container { * left, center and right. * @param {string} [opts.verticalAlign=middle] - The vertical position of the items. Possible values are * top, middle and bottom. + * @param {PIXI.Application} [opts.app] - The PixiJS Application. Must be set if you want to use the mousewheel to + * scroll your list. */ constructor(items = [], opts = {}) { @@ -1237,7 +1239,8 @@ export default class List extends PIXI.Container { align: 'left', verticalAlign: 'middle', width: null, - height: null + height: null, + app: null }, opts) this.__items = items @@ -1283,6 +1286,22 @@ export default class List extends PIXI.Container { this.on('pointercancel', this.onEnd.bind(this)) this.on('pointerout', this.onEnd.bind(this)) this.on('pointerupoutside', this.onEnd.bind(this)) + this.on('scroll', this.onScroll.bind(this)) + + // mousewheel + //-------------------- + if (this.opts.app) { + const app = this.opts.app + app.view.addEventListener('mousewheel', event => { + event.preventDefault() + const bounds = this.mask ? this.mask.getBounds() : this.getBounds() + const x = event.clientX - app.view.getBoundingClientRect().left + const y = event.clientY - app.view.getBoundingClientRect().top + if (bounds.contains(x, y)) { + this.emit('scroll', event) + } + }) + } this.layout() @@ -1444,7 +1463,9 @@ export default class List extends PIXI.Container { } TweenLite.killTweensOf(this.container.position, {x: true, y: true}) - ThrowPropsPlugin.track(this.container.position, 'x,y') + if (typeof ThrowPropsPlugin != "undefined") { + ThrowPropsPlugin.track(this.container.position, 'x,y') + } } /** @@ -1498,11 +1519,39 @@ export default class List extends PIXI.Container { } } - ThrowPropsPlugin.to(this.container.position, { - throwProps, - ease: Strong.easeOut, - onComplete: () => ThrowPropsPlugin.untrack(this.container.position) - }, .8, .4) + if (typeof ThrowPropsPlugin != "undefined") { + ThrowPropsPlugin.to(this.container.position, { + throwProps, + ease: Strong.easeOut, + onComplete: () => ThrowPropsPlugin.untrack(this.container.position) + }, .8, .4) + } + } + } + + /** + * + * @private + * @param {*} event + */ + onScroll(event) { + + this.capture(event) + + if (this.opts.orientation === 'horizontal') { + this.container.position.x -= event.deltaX + if (this.container.position.x > 0) { + this.container.position.x = 0 + } else if (this.container.position.x + this.innerWidth < this.opts.width) { + this.container.position.x = this.opts.width - this.innerWidth + } + } else { + this.container.position.y -= event.deltaY + if (this.container.position.y > 0) { + this.container.position.y = 0 + } else if (this.container.position.y + this.innerHeight < this.opts.height) { + this.container.position.y = this.opts.height - this.innerHeight + } } } @@ -1512,7 +1561,8 @@ export default class List extends PIXI.Container { * @param {event|PIXI.InteractionEvent} event - The PIXI event to capture. */ capture(event) { - Events.capturedBy(event.data.originalEvent, this) + const originalEvent = event.data && event.data.originalEvent ? event.data.originalEvent : event + Events.capturedBy(originalEvent, this) } } @@ -1528,7 +1578,7 @@ export default class List extends PIXI.Container { diff --git a/doc/out/pixi_message.js.html b/doc/out/pixi_message.js.html index 0ec1a19..e611e03 100644 --- a/doc/out/pixi_message.js.html +++ b/doc/out/pixi_message.js.html @@ -1323,7 +1323,7 @@ export default class Message extends InteractivePopup { diff --git a/doc/out/pixi_modal.js.html b/doc/out/pixi_modal.js.html index 6f6c5f8..3f53a99 100644 --- a/doc/out/pixi_modal.js.html +++ b/doc/out/pixi_modal.js.html @@ -1398,7 +1398,7 @@ export default class Modal extends PIXI.Container { diff --git a/doc/out/pixi_popup.js.html b/doc/out/pixi_popup.js.html index b97070b..57414d8 100644 --- a/doc/out/pixi_popup.js.html +++ b/doc/out/pixi_popup.js.html @@ -1410,7 +1410,7 @@ export default class Popup extends InteractivePopup { diff --git a/doc/out/pixi_popupmenu.js.html b/doc/out/pixi_popupmenu.js.html index 457c76d..e87491c 100644 --- a/doc/out/pixi_popupmenu.js.html +++ b/doc/out/pixi_popupmenu.js.html @@ -1311,7 +1311,7 @@ export default class PopupMenu extends Popup { diff --git a/doc/out/pixi_progress.js.html b/doc/out/pixi_progress.js.html index 750d379..2475416 100644 --- a/doc/out/pixi_progress.js.html +++ b/doc/out/pixi_progress.js.html @@ -1500,7 +1500,7 @@ export default class Progress extends PIXI.Container { diff --git a/doc/out/pixi_slider.js.html b/doc/out/pixi_slider.js.html index 74ad355..976423f 100644 --- a/doc/out/pixi_slider.js.html +++ b/doc/out/pixi_slider.js.html @@ -1668,7 +1668,7 @@ export default class Slider extends PIXI.Container { diff --git a/doc/out/pixi_switch.js.html b/doc/out/pixi_switch.js.html index f614fdd..d42e3cc 100644 --- a/doc/out/pixi_switch.js.html +++ b/doc/out/pixi_switch.js.html @@ -1705,7 +1705,7 @@ export default class Switch extends PIXI.Container { diff --git a/doc/out/pixi_theme.js.html b/doc/out/pixi_theme.js.html index 9aaa837..ba854ad 100644 --- a/doc/out/pixi_theme.js.html +++ b/doc/out/pixi_theme.js.html @@ -1433,7 +1433,7 @@ export class ThemeRed extends Theme { diff --git a/doc/out/pixi_tooltip.js.html b/doc/out/pixi_tooltip.js.html index 26fb96d..4acc0d1 100644 --- a/doc/out/pixi_tooltip.js.html +++ b/doc/out/pixi_tooltip.js.html @@ -1352,7 +1352,7 @@ export default class Tooltip extends AbstractPopup { diff --git a/doc/out/pixi_volatile.js.html b/doc/out/pixi_volatile.js.html index c869b72..b935361 100644 --- a/doc/out/pixi_volatile.js.html +++ b/doc/out/pixi_volatile.js.html @@ -1358,7 +1358,7 @@ export default class Volatile { diff --git a/doc/out/uitest.js.html b/doc/out/uitest.js.html index 1368514..80f0ad5 100644 --- a/doc/out/uitest.js.html +++ b/doc/out/uitest.js.html @@ -2162,7 +2162,7 @@ class Event { diff --git a/package.json b/package.json index 931b08e..83dd37d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iwmlib", - "version": "1.0.0", + "version": "1.1.0", "description": "An Open Source library for multi-touch, WebGL powered applications.", "main": "index.js", "directories": {