Fixed eslint problems
This commit is contained in:
parent
1480ad8145
commit
8a4f64f545
@ -1,3 +1,4 @@
|
|||||||
|
/* global PIXI TweenLite */
|
||||||
import Theme from './theme.js'
|
import Theme from './theme.js'
|
||||||
import Tooltip from './tooltip.js'
|
import Tooltip from './tooltip.js'
|
||||||
import Badge from './badge.js'
|
import Badge from './badge.js'
|
||||||
@ -160,7 +161,7 @@ export default class Button extends PIXI.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.opts.style === 'link') {
|
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
|
this._active = null
|
||||||
@ -232,7 +233,7 @@ export default class Button extends PIXI.Container {
|
|||||||
//-----------------
|
//-----------------
|
||||||
this.button.on('pointerover', e => {
|
this.button.on('pointerover', e => {
|
||||||
this.capture(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 => {
|
this.button.on('pointermove', e => {
|
||||||
@ -241,12 +242,13 @@ export default class Button extends PIXI.Container {
|
|||||||
|
|
||||||
this.button.on('pointerout', e => {
|
this.button.on('pointerout', e => {
|
||||||
this.capture(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.button.on('pointerdown', e => {
|
||||||
//this.capture(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 => {
|
this.button.on('pointerup', e => {
|
||||||
@ -259,7 +261,7 @@ export default class Button extends PIXI.Container {
|
|||||||
this.opts.action.call(this, e, this)
|
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') {
|
if (this.opts.type === 'checkbox') {
|
||||||
this.active = !this.active
|
this.active = !this.active
|
||||||
@ -282,9 +284,9 @@ export default class Button extends PIXI.Container {
|
|||||||
//-----------------
|
//-----------------
|
||||||
if (this.opts.tooltip) {
|
if (this.opts.tooltip) {
|
||||||
if (typeof this.opts.tooltip === 'string') {
|
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 {
|
} 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)
|
this.tooltip = new Tooltip(this.opts.tooltip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +301,7 @@ export default class Button extends PIXI.Container {
|
|||||||
offsetTop: 0
|
offsetTop: 0
|
||||||
})
|
})
|
||||||
if (typeof this.opts.badge === 'string') {
|
if (typeof this.opts.badge === 'string') {
|
||||||
opts = Object.assign(opts, {content: this.opts.badge})
|
opts = Object.assign(opts, { content: this.opts.badge })
|
||||||
} else {
|
} else {
|
||||||
opts = Object.assign(opts, this.opts.badge)
|
opts = Object.assign(opts, this.opts.badge)
|
||||||
}
|
}
|
||||||
@ -307,25 +309,25 @@ export default class Button extends PIXI.Container {
|
|||||||
const badge = new Badge(opts)
|
const badge = new Badge(opts)
|
||||||
|
|
||||||
switch (opts.align) {
|
switch (opts.align) {
|
||||||
case 'left':
|
case 'left':
|
||||||
badge.x = this.x - badge.width / 2 + opts.offsetLeft
|
badge.x = this.x - badge.width / 2 + opts.offsetLeft
|
||||||
break
|
break
|
||||||
case 'center':
|
case 'center':
|
||||||
badge.x = this.x + this.width / 2 - badge.width / 2 + opts.offsetLeft
|
badge.x = this.x + this.width / 2 - badge.width / 2 + opts.offsetLeft
|
||||||
break
|
break
|
||||||
case 'right':
|
case 'right':
|
||||||
badge.x = this.x + this.width - badge.width / 2 + opts.offsetLeft
|
badge.x = this.x + this.width - badge.width / 2 + opts.offsetLeft
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (opts.verticalAlign) {
|
switch (opts.verticalAlign) {
|
||||||
case 'top':
|
case 'top':
|
||||||
badge.y = this.y - badge.height / 2 + opts.offsetTop
|
badge.y = this.y - badge.height / 2 + opts.offsetTop
|
||||||
break
|
break
|
||||||
case 'middle':
|
case 'middle':
|
||||||
badge.y = this.y + this.height / 2 - badge.height / 2 + opts.offsetTop
|
badge.y = this.y + this.height / 2 - badge.height / 2 + opts.offsetTop
|
||||||
break
|
break
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
badge.y = this.y + this.height - badge.height / 2 + opts.offsetTop
|
badge.y = this.y + this.height - badge.height / 2 + opts.offsetTop
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addChild(badge)
|
this.addChild(badge)
|
||||||
@ -435,15 +437,15 @@ export default class Button extends PIXI.Container {
|
|||||||
|
|
||||||
for (let child of this.content.children) {
|
for (let child of this.content.children) {
|
||||||
switch (this.opts.verticalAlign) {
|
switch (this.opts.verticalAlign) {
|
||||||
case 'top':
|
case 'top':
|
||||||
child.y = 0
|
child.y = 0
|
||||||
break
|
break
|
||||||
case 'middle':
|
case 'middle':
|
||||||
child.y = this.content.height / 2 - child.height / 2
|
child.y = this.content.height / 2 - child.height / 2
|
||||||
break
|
break
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
child.y = this.content.height - child.height
|
child.y = this.content.height - child.height
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,27 +462,27 @@ export default class Button extends PIXI.Container {
|
|||||||
layoutContent() {
|
layoutContent() {
|
||||||
|
|
||||||
switch (this.opts.align) {
|
switch (this.opts.align) {
|
||||||
case 'left':
|
case 'left':
|
||||||
this.content.x = this.opts.padding
|
this.content.x = this.opts.padding
|
||||||
break
|
break
|
||||||
case 'center':
|
case 'center':
|
||||||
this.content.x = ((this._width - this.content.width) / 2)
|
this.content.x = ((this._width - this.content.width) / 2)
|
||||||
break
|
break
|
||||||
case 'right':
|
case 'right':
|
||||||
this.content.x = this._width - this.opts.padding - this.content.width
|
this.content.x = this._width - this.opts.padding - this.content.width
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.opts.verticalAlign) {
|
switch (this.opts.verticalAlign) {
|
||||||
case 'top':
|
case 'top':
|
||||||
this.content.y = this.opts.padding
|
this.content.y = this.opts.padding
|
||||||
break
|
break
|
||||||
case 'middle':
|
case 'middle':
|
||||||
this.content.y = (this._height - this.content.height) / 2
|
this.content.y = (this._height - this.content.height) / 2
|
||||||
break
|
break
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
this.content.y = this._height - this.opts.padding - this.content.height
|
this.content.y = this._height - this.opts.padding - this.content.height
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
Loading…
Reference in New Issue
Block a user