Implemented stacked button groups.
This commit is contained in:
+19
-31
@@ -263,12 +263,20 @@
|
||||
|
||||
<span class="subtitle">Methods</span>
|
||||
|
||||
<li class="parent " data-name="ButtonGroup#_stackHorizontal"><a href="ButtonGroup.html#_stackHorizontal">_stackHorizontal</a></li>
|
||||
|
||||
<li class="parent " data-name="ButtonGroup#_stackVertical"><a href="ButtonGroup.html#_stackVertical">_stackVertical</a></li>
|
||||
|
||||
<li class="parent " data-name="ButtonGroup#capture"><a href="ButtonGroup.html#capture">capture</a></li>
|
||||
|
||||
<li class="parent " data-name="ButtonGroup#hide"><a href="ButtonGroup.html#hide">hide</a></li>
|
||||
|
||||
<li class="parent " data-name="ButtonGroup#layout"><a href="ButtonGroup.html#layout">layout</a></li>
|
||||
|
||||
<li class="parent " data-name="ButtonGroup#show"><a href="ButtonGroup.html#show">show</a></li>
|
||||
|
||||
<li class="parent " data-name="ButtonGroup#stack"><a href="ButtonGroup.html#stack">stack</a></li>
|
||||
|
||||
</ul>
|
||||
<ul class="events itemMembers">
|
||||
|
||||
@@ -1438,7 +1446,7 @@
|
||||
</div>
|
||||
</header>
|
||||
<article>
|
||||
<pre id="source-code" class="prettyprint source linenums"><code>/* globals */
|
||||
<pre id="source-code" class="prettyprint source linenums"><code>/* globals ThrowPropsPlugin, Strong */
|
||||
|
||||
/* Imports */
|
||||
import Events from '../events.js'
|
||||
@@ -1548,9 +1556,7 @@ export default class List extends PIXI.Container {
|
||||
if (this.opts.app) {
|
||||
const app = this.opts.app
|
||||
app.view.addEventListener('mousewheel', event => {
|
||||
const bounds = this.mask
|
||||
? this.mask.getBounds()
|
||||
: this.getBounds()
|
||||
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)) {
|
||||
@@ -1607,14 +1613,10 @@ export default class List extends PIXI.Container {
|
||||
if (this.opts.orientation === 'vertical') {
|
||||
switch (this.opts.align) {
|
||||
case 'center':
|
||||
this.__items.forEach(
|
||||
it => (it.x = margin + this.width / 2 - it.width / 2)
|
||||
)
|
||||
this.__items.forEach(it => (it.x = margin + this.width / 2 - it.width / 2))
|
||||
break
|
||||
case 'right':
|
||||
this.__items.forEach(
|
||||
it => (it.x = margin + this.width - it.width)
|
||||
)
|
||||
this.__items.forEach(it => (it.x = margin + this.width - it.width))
|
||||
break
|
||||
default:
|
||||
this.__items.forEach(it => (it.x = margin))
|
||||
@@ -1640,14 +1642,10 @@ export default class List extends PIXI.Container {
|
||||
this.__items.forEach(it => (it.y = margin))
|
||||
break
|
||||
case 'bottom':
|
||||
this.__items.forEach(
|
||||
it => (it.y = margin + this.height - it.height)
|
||||
)
|
||||
this.__items.forEach(it => (it.y = margin + this.height - it.height))
|
||||
break
|
||||
default:
|
||||
this.__items.forEach(
|
||||
it => (it.y = margin + this.height / 2 - it.height / 2)
|
||||
)
|
||||
this.__items.forEach(it => (it.y = margin + this.height / 2 - it.height / 2))
|
||||
break
|
||||
}
|
||||
|
||||
@@ -1781,8 +1779,7 @@ export default class List extends PIXI.Container {
|
||||
{
|
||||
throwProps,
|
||||
ease: Strong.easeOut,
|
||||
onComplete: () =>
|
||||
ThrowPropsPlugin.untrack(this.container.position)
|
||||
onComplete: () => ThrowPropsPlugin.untrack(this.container.position)
|
||||
},
|
||||
0.8,
|
||||
0.4
|
||||
@@ -1803,20 +1800,14 @@ export default class List extends PIXI.Container {
|
||||
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
|
||||
) {
|
||||
} 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
|
||||
) {
|
||||
} else if (this.container.position.y + this.innerHeight < this.opts.height) {
|
||||
this.container.position.y = this.opts.height - this.innerHeight
|
||||
}
|
||||
}
|
||||
@@ -1828,10 +1819,7 @@ export default class List extends PIXI.Container {
|
||||
* @param {event|PIXI.InteractionEvent} event - The PIXI event to capture.
|
||||
*/
|
||||
capture(event) {
|
||||
const originalEvent =
|
||||
event.data && event.data.originalEvent
|
||||
? event.data.originalEvent
|
||||
: event
|
||||
const originalEvent = event.data && event.data.originalEvent ? event.data.originalEvent : event
|
||||
Events.capturedBy(originalEvent, this)
|
||||
}
|
||||
}
|
||||
@@ -1848,7 +1836,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.6.3</a> on Tue Jul 30 2019 10:48:36 GMT+0200 (Mitteleuropäische Sommerzeit)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Jul 31 2019 15:00:47 GMT+0200 (Mitteleuropäische Sommerzeit)
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user