Updated docs.

This commit is contained in:
2019-03-29 11:44:34 +01:00
parent 1292fd23f0
commit f84d554a69
55 changed files with 152 additions and 67 deletions
+59 -9
View File
@@ -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)
}
}
</code></pre>
@@ -1528,7 +1578,7 @@ export default class List extends PIXI.Container {
<footer class="content-size">
<div class="footer">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Mar 29 2019 08:49:40 GMT+0100 (Mitteleuropäische Normalzeit)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Mar 29 2019 11:44:08 GMT+0100 (Mitteleuropäische Normalzeit)
</div>
</footer>
</div>