Prettified all files.

This commit is contained in:
2019-07-18 12:26:39 +02:00
parent 7744b92771
commit 2d400a18ec
125 changed files with 11184 additions and 8154 deletions
+29 -27
View File
@@ -1,9 +1,9 @@
import Theme from './theme.js'
import {InteractivePopup} from './popup.js'
import { InteractivePopup } from './popup.js'
/**
* Class that represents a Message. A message pops up and disappears after a specific amount of time.
*
*
* @example
* // Create the PixiJS App
* const app = new PIXIApp({
@@ -11,7 +11,7 @@ import {InteractivePopup} from './popup.js'
* width: 900,
* height: 250
* }).setup().run()
*
*
* // Create a button
* let button = new Button({
* label: 'Click me',
@@ -24,7 +24,7 @@ import {InteractivePopup} from './popup.js'
* app.scene.addChild(message)
* }
* })
*
*
* // Add the button to the scene
* app.scene.addChild(button)
*
@@ -33,10 +33,9 @@ import {InteractivePopup} from './popup.js'
* @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/message.html|DocTest}
*/
export default class Message extends InteractivePopup {
/**
* Creates an instance of a Message.
*
*
* @constructor
* @param {object} [opts] - An options object to specify to style and behaviour of the message.
* @param {PIXIApp} [opts.app=window.app] - The PIXIApp where this message belongs to.
@@ -53,32 +52,34 @@ export default class Message extends InteractivePopup {
* @param {number} [opts.closeDuration=Theme.fast] - The duration in seconds of the closing of the message box.
*/
constructor(opts = {}) {
const theme = Theme.fromString(opts.theme)
opts = Object.assign({}, {
app: window.app,
closeButton: false,
minWidth: 280,
minHeight: 100,
margin: theme.margin,
align: 'right', // left, center, right
verticalAlign: 'top', // top, middle, bottom
duration: 5,
autoClose: true,
closeDuration: theme.fast
}, opts)
opts = Object.assign(
{},
{
app: window.app,
closeButton: false,
minWidth: 280,
minHeight: 100,
margin: theme.margin,
align: 'right', // left, center, right
verticalAlign: 'top', // top, middle, bottom
duration: 5,
autoClose: true,
closeDuration: theme.fast
},
opts
)
super(opts)
}
/**
* Relayouts the position of the message box.
*
*
* @return {Message} Returns the message box for chaining.
*/
layout() {
super.layout()
// horizontal
@@ -87,10 +88,11 @@ export default class Message extends InteractivePopup {
this.x = this.opts.margin
break
case 'center':
this.x = (this.opts.app.size.width / 2) - (this.width / 2)
this.x = this.opts.app.size.width / 2 - this.width / 2
break
case 'right':
this.x = this.opts.app.size.width - this.opts.margin - this.width
this.x =
this.opts.app.size.width - this.opts.margin - this.width
break
}
@@ -100,21 +102,21 @@ export default class Message extends InteractivePopup {
this.y = this.opts.margin
break
case 'middle':
this.y = (this.opts.app.size.height / 2) - (this.height / 2)
this.y = this.opts.app.size.height / 2 - this.height / 2
break
case 'bottom':
this.y = this.opts.app.size.height - this.opts.margin - this.height
this.y =
this.opts.app.size.height - this.opts.margin - this.height
break
}
}
/**
* Shows the message box.
*
*
* @private
*/
show() {
super.show()
if (this.opts.autoClose) {