Prettified all files.
This commit is contained in:
@@ -1443,7 +1443,7 @@ import Popup from './popup.js'
|
||||
|
||||
/**
|
||||
* Class that represents a PixiJS PopupMenu.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* // Create the button and the modal when clicked
|
||||
* const button = new Button({
|
||||
@@ -1468,10 +1468,9 @@ import Popup from './popup.js'
|
||||
* @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/popupmenu.html|DocTest}
|
||||
*/
|
||||
export default class PopupMenu extends Popup {
|
||||
|
||||
/**
|
||||
* Creates an instance of a PopupMenu.
|
||||
*
|
||||
*
|
||||
* @constructor
|
||||
* @param {object} [opts] - An options object to specify to style and behaviour of the modal.
|
||||
* @param {object[]} [opts.items=[]] - A list of the menu items. Each item must be of type object.
|
||||
@@ -1483,38 +1482,42 @@ export default class PopupMenu extends Popup {
|
||||
* @param {boolean} [opts.closeOnPopup=true] - The opacity of the background.
|
||||
*/
|
||||
constructor(opts = {}) {
|
||||
|
||||
const theme = Theme.fromString(opts.theme)
|
||||
|
||||
opts = Object.assign({}, {
|
||||
items: [],
|
||||
margin: theme.margin / 2,
|
||||
textStyle: theme.textStyle,
|
||||
closeOnPopup: true
|
||||
}, opts)
|
||||
|
||||
opts = Object.assign(
|
||||
{},
|
||||
{
|
||||
items: [],
|
||||
margin: theme.margin / 2,
|
||||
textStyle: theme.textStyle,
|
||||
closeOnPopup: true
|
||||
},
|
||||
opts
|
||||
)
|
||||
|
||||
super(opts)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates children and instantiates everything.
|
||||
*
|
||||
*
|
||||
* @private
|
||||
* @return {PopupMenu} A reference to the popupmenu for chaining.
|
||||
*/
|
||||
setup() {
|
||||
|
||||
// content
|
||||
//-----------------
|
||||
const content = new PIXI.Container()
|
||||
|
||||
|
||||
let y = 0
|
||||
for (let item of this.opts.items) {
|
||||
|
||||
let object = null
|
||||
|
||||
if (item.label) {
|
||||
object = new PIXI.Text(item.label, item.textStyle || this.opts.textStyle)
|
||||
object = new PIXI.Text(
|
||||
item.label,
|
||||
item.textStyle || this.opts.textStyle
|
||||
)
|
||||
} else {
|
||||
object = item.content
|
||||
}
|
||||
@@ -1523,16 +1526,22 @@ export default class PopupMenu extends Popup {
|
||||
|
||||
if (item.action) {
|
||||
if (item.disabled) {
|
||||
object.alpha = .5
|
||||
object.alpha = 0.5
|
||||
} else {
|
||||
object.interactive = true
|
||||
object.buttonMode = true
|
||||
}
|
||||
object.on('pointerover', e => {
|
||||
TweenLite.to(object, this.theme.fast, {alpha: .83, overwrite: 'none'})
|
||||
TweenLite.to(object, this.theme.fast, {
|
||||
alpha: 0.83,
|
||||
overwrite: 'none'
|
||||
})
|
||||
})
|
||||
object.on('pointerout', e => {
|
||||
TweenLite.to(object, this.theme.fast, {alpha: 1, overwrite: 'none'})
|
||||
TweenLite.to(object, this.theme.fast, {
|
||||
alpha: 1,
|
||||
overwrite: 'none'
|
||||
})
|
||||
})
|
||||
object.on('pointerup', e => {
|
||||
item.action.call(object, e, object)
|
||||
@@ -1565,7 +1574,7 @@ export default class PopupMenu extends Popup {
|
||||
|
||||
<footer class="content-size">
|
||||
<div class="footer">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.2</a> on Wed Jul 10 2019 11:54:25 GMT+0200 (Mitteleuropäische Sommerzeit)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jul 18 2019 12:16:18 GMT+0200 (Mitteleuropäische Sommerzeit)
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user