Added graphics alpha workaround.

This commit is contained in:
Sebastian Kupke 2020-01-30 15:41:31 +01:00
parent 1967b791e0
commit 6cdf5310ba
3 changed files with 20 additions and 13 deletions

14
dist/iwmlib.pixi.js vendored
View File

@ -2334,6 +2334,8 @@
const theme = Theme.fromString(opts.theme); const theme = Theme.fromString(opts.theme);
this.theme = theme; this.theme = theme;
this.HIDDEN_ALPHA = 0.000000001; // WORKAROUND: See https://github.com/pixijs/pixi.js/wiki/v5-Migration-Guide#graphics-interaction
this.opts = Object.assign( this.opts = Object.assign(
{}, {},
{ {
@ -2393,10 +2395,10 @@
if (this.opts.style === 'link') { if (this.opts.style === 'link') {
Object.assign(this.opts, { Object.assign(this.opts, {
strokeAlpha: 0, strokeAlpha: this.HIDDEN_ALPHA,
strokeActiveAlpha: 0, strokeActiveAlpha: this.HIDDEN_ALPHA,
fillAlpha: 0, fillAlpha: this.HIDDEN_ALPHA,
fillActiveAlpha: 0 fillActiveAlpha: this.HIDDEN_ALPHA
}); });
} }
@ -2861,8 +2863,8 @@
hide() { hide() {
this.opts.strokeAlpha = 0.0; this.opts.strokeAlpha = 0.0;
this.opts.strokeActiveAlpha = 0.0; this.opts.strokeActiveAlpha = 0.0;
this.opts.fillAlpha = 0.0000000001; // WORKAROUND: See https://github.com/pixijs/pixi.js/wiki/v5-Migration-Guide#graphics-interaction this.opts.fillAlpha = this.HIDDEN_ALPHA;
this.opts.fillActiveAlpha = 0.0000000001; this.opts.fillActiveAlpha = this.HIDDEN_ALPHA;
this.layout(); this.layout();

View File

@ -248,7 +248,10 @@ const button20 = new Button({
y: 310, y: 310,
label: 'Link Button', label: 'Link Button',
type: 'checkbox', type: 'checkbox',
style: 'link' style: 'link',
action: event => {
console.log('Link button clicked')
}
}) })
const button21 = new Button({ const button21 = new Button({

View File

@ -113,6 +113,8 @@ export default class Button extends PIXI.Container {
const theme = Theme.fromString(opts.theme) const theme = Theme.fromString(opts.theme)
this.theme = theme this.theme = theme
this.HIDDEN_ALPHA = 0.000000001 // WORKAROUND: See https://github.com/pixijs/pixi.js/wiki/v5-Migration-Guide#graphics-interaction
this.opts = Object.assign( this.opts = Object.assign(
{}, {},
{ {
@ -172,10 +174,10 @@ export default class Button extends PIXI.Container {
if (this.opts.style === 'link') { if (this.opts.style === 'link') {
Object.assign(this.opts, { Object.assign(this.opts, {
strokeAlpha: 0, strokeAlpha: this.HIDDEN_ALPHA,
strokeActiveAlpha: 0, strokeActiveAlpha: this.HIDDEN_ALPHA,
fillAlpha: 0, fillAlpha: this.HIDDEN_ALPHA,
fillActiveAlpha: 0 fillActiveAlpha: this.HIDDEN_ALPHA
}) })
} }
@ -640,8 +642,8 @@ export default class Button extends PIXI.Container {
hide() { hide() {
this.opts.strokeAlpha = 0.0 this.opts.strokeAlpha = 0.0
this.opts.strokeActiveAlpha = 0.0 this.opts.strokeActiveAlpha = 0.0
this.opts.fillAlpha = 0.0000000001 // WORKAROUND: See https://github.com/pixijs/pixi.js/wiki/v5-Migration-Guide#graphics-interaction this.opts.fillAlpha = this.HIDDEN_ALPHA
this.opts.fillActiveAlpha = 0.0000000001 this.opts.fillActiveAlpha = this.HIDDEN_ALPHA
this.layout() this.layout()