Fixed eslint problems

This commit is contained in:
Uwe Oestermeier 2019-07-02 10:06:23 +02:00
parent 1480ad8145
commit 8a4f64f545
1 changed files with 53 additions and 51 deletions

View File

@ -1,3 +1,4 @@
/* global PIXI TweenLite */
import Theme from './theme.js'
import Tooltip from './tooltip.js'
import Badge from './badge.js'
@ -160,7 +161,7 @@ export default class Button extends PIXI.Container {
}
if (this.opts.style === 'link') {
Object.assign(this.opts, {strokeAlpha: 0, strokeActiveAlpha: 0, fillAlpha: 0, fillActiveAlpha: 0})
Object.assign(this.opts, { strokeAlpha: 0, strokeActiveAlpha: 0, fillAlpha: 0, fillActiveAlpha: 0 })
}
this._active = null
@ -232,7 +233,7 @@ export default class Button extends PIXI.Container {
//-----------------
this.button.on('pointerover', e => {
this.capture(e)
TweenLite.to([this.button, this.content], this.theme.fast, {alpha: .83, overwrite: 'none'})
TweenLite.to([this.button, this.content], this.theme.fast, { alpha: .83, overwrite: 'none' })
})
this.button.on('pointermove', e => {
@ -241,12 +242,13 @@ export default class Button extends PIXI.Container {
this.button.on('pointerout', e => {
this.capture(e)
TweenLite.to([this.button, this.content], this.theme.fast, {alpha: 1, overwrite: 'none'})
TweenLite.to([this.button, this.content], this.theme.fast, { alpha: 1, overwrite: 'none' })
})
// eslint-disable-next-line no-unused-vars
this.button.on('pointerdown', e => {
//this.capture(e)
TweenLite.to([this.button, this.content], this.theme.fast, {alpha: .7, overwrite: 'none'})
TweenLite.to([this.button, this.content], this.theme.fast, { alpha: .7, overwrite: 'none' })
})
this.button.on('pointerup', e => {
@ -259,7 +261,7 @@ export default class Button extends PIXI.Container {
this.opts.action.call(this, e, this)
}
TweenLite.to([this.button, this.content], this.theme.fast, {alpha: .83, overwrite: 'none'})
TweenLite.to([this.button, this.content], this.theme.fast, { alpha: .83, overwrite: 'none' })
if (this.opts.type === 'checkbox') {
this.active = !this.active
@ -282,9 +284,9 @@ export default class Button extends PIXI.Container {
//-----------------
if (this.opts.tooltip) {
if (typeof this.opts.tooltip === 'string') {
this.tooltip = new Tooltip({object: this, content: this.opts.tooltip})
this.tooltip = new Tooltip({ object: this, content: this.opts.tooltip })
} else {
this.opts.tooltip = Object.assign({}, {object: this}, this.opts.tooltip)
this.opts.tooltip = Object.assign({}, { object: this }, this.opts.tooltip)
this.tooltip = new Tooltip(this.opts.tooltip)
}
}
@ -299,7 +301,7 @@ export default class Button extends PIXI.Container {
offsetTop: 0
})
if (typeof this.opts.badge === 'string') {
opts = Object.assign(opts, {content: this.opts.badge})
opts = Object.assign(opts, { content: this.opts.badge })
} else {
opts = Object.assign(opts, this.opts.badge)
}
@ -307,25 +309,25 @@ export default class Button extends PIXI.Container {
const badge = new Badge(opts)
switch (opts.align) {
case 'left':
badge.x = this.x - badge.width / 2 + opts.offsetLeft
break
case 'center':
badge.x = this.x + this.width / 2 - badge.width / 2 + opts.offsetLeft
break
case 'right':
badge.x = this.x + this.width - badge.width / 2 + opts.offsetLeft
case 'left':
badge.x = this.x - badge.width / 2 + opts.offsetLeft
break
case 'center':
badge.x = this.x + this.width / 2 - badge.width / 2 + opts.offsetLeft
break
case 'right':
badge.x = this.x + this.width - badge.width / 2 + opts.offsetLeft
}
switch (opts.verticalAlign) {
case 'top':
badge.y = this.y - badge.height / 2 + opts.offsetTop
break
case 'middle':
badge.y = this.y + this.height / 2 - badge.height / 2 + opts.offsetTop
break
case 'bottom':
badge.y = this.y + this.height - badge.height / 2 + opts.offsetTop
case 'top':
badge.y = this.y - badge.height / 2 + opts.offsetTop
break
case 'middle':
badge.y = this.y + this.height / 2 - badge.height / 2 + opts.offsetTop
break
case 'bottom':
badge.y = this.y + this.height - badge.height / 2 + opts.offsetTop
}
this.addChild(badge)
@ -435,15 +437,15 @@ export default class Button extends PIXI.Container {
for (let child of this.content.children) {
switch (this.opts.verticalAlign) {
case 'top':
child.y = 0
break
case 'middle':
child.y = this.content.height / 2 - child.height / 2
break
case 'bottom':
child.y = this.content.height - child.height
break
case 'top':
child.y = 0
break
case 'middle':
child.y = this.content.height / 2 - child.height / 2
break
case 'bottom':
child.y = this.content.height - child.height
break
}
}
@ -460,27 +462,27 @@ export default class Button extends PIXI.Container {
layoutContent() {
switch (this.opts.align) {
case 'left':
this.content.x = this.opts.padding
break
case 'center':
this.content.x = ((this._width - this.content.width) / 2)
break
case 'right':
this.content.x = this._width - this.opts.padding - this.content.width
break
case 'left':
this.content.x = this.opts.padding
break
case 'center':
this.content.x = ((this._width - this.content.width) / 2)
break
case 'right':
this.content.x = this._width - this.opts.padding - this.content.width
break
}
switch (this.opts.verticalAlign) {
case 'top':
this.content.y = this.opts.padding
break
case 'middle':
this.content.y = (this._height - this.content.height) / 2
break
case 'bottom':
this.content.y = this._height - this.opts.padding - this.content.height
break
case 'top':
this.content.y = this.opts.padding
break
case 'middle':
this.content.y = (this._height - this.content.height) / 2
break
case 'bottom':
this.content.y = this._height - this.opts.padding - this.content.height
break
}
return this