Added graphics alpha workaround.

This commit is contained in:
2020-01-30 15:41:31 +01:00
parent 1967b791e0
commit 6cdf5310ba
3 changed files with 20 additions and 13 deletions
+8 -6
View File
@@ -2334,6 +2334,8 @@
const theme = Theme.fromString(opts.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(
{},
{
@@ -2393,10 +2395,10 @@
if (this.opts.style === 'link') {
Object.assign(this.opts, {
strokeAlpha: 0,
strokeActiveAlpha: 0,
fillAlpha: 0,
fillActiveAlpha: 0
strokeAlpha: this.HIDDEN_ALPHA,
strokeActiveAlpha: this.HIDDEN_ALPHA,
fillAlpha: this.HIDDEN_ALPHA,
fillActiveAlpha: this.HIDDEN_ALPHA
});
}
@@ -2861,8 +2863,8 @@
hide() {
this.opts.strokeAlpha = 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.fillActiveAlpha = 0.0000000001;
this.opts.fillAlpha = this.HIDDEN_ALPHA;
this.opts.fillActiveAlpha = this.HIDDEN_ALPHA;
this.layout();
+4 -1
View File
@@ -248,7 +248,10 @@ const button20 = new Button({
y: 310,
label: 'Link Button',
type: 'checkbox',
style: 'link'
style: 'link',
action: event => {
console.log('Link button clicked')
}
})
const button21 = new Button({
+8 -6
View File
@@ -113,6 +113,8 @@ export default class Button extends PIXI.Container {
const theme = Theme.fromString(opts.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(
{},
{
@@ -172,10 +174,10 @@ export default class Button extends PIXI.Container {
if (this.opts.style === 'link') {
Object.assign(this.opts, {
strokeAlpha: 0,
strokeActiveAlpha: 0,
fillAlpha: 0,
fillActiveAlpha: 0
strokeAlpha: this.HIDDEN_ALPHA,
strokeActiveAlpha: this.HIDDEN_ALPHA,
fillAlpha: this.HIDDEN_ALPHA,
fillActiveAlpha: this.HIDDEN_ALPHA
})
}
@@ -640,8 +642,8 @@ export default class Button extends PIXI.Container {
hide() {
this.opts.strokeAlpha = 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.fillActiveAlpha = 0.0000000001
this.opts.fillAlpha = this.HIDDEN_ALPHA
this.opts.fillActiveAlpha = this.HIDDEN_ALPHA
this.layout()