Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] HTML Debug Layer #4526

Closed
msqaddura opened this issue Dec 10, 2017 · 6 comments
Closed

[Feature] HTML Debug Layer #4526

msqaddura opened this issue Dec 10, 2017 · 6 comments
Labels
🙏 Feature Request Community request for new features, APIs, packages. 💾 v4.x (Legacy) Legacy version 4 support

Comments

@msqaddura
Copy link

msqaddura commented Dec 10, 2017

Hello,
I am working on a project where I ended up needing some kind of a debug layer to display some information on top of my DisplayObjects. console.log and break points do help in this case, but it is time consuming and as well have to keep trace on everything (filtering the logs, and using conditional breakpoints). Hence it made a lot of sense to create HTML div on top of my DisplayObjects with the information displayed inside. Of course it can be done using PIXI.Text but that would require to create a new Text object and make sure it has highest z order.

The simplest and straightforward solution was to use Accessibility as follows (steps 2 & 3 just in case someone wanted to try quickly) :

  1. change the CSS to display the text of the title as shown below
button{
      background: rgba(40, 185, 230, 0.671)!important;
}

button::after{
      content: attr(title); /*take the content from the title*/
      color:white;
 }
  1. I did what is needed for accessibility in my code
this.interactive = true; // otherwise accessibility manager would skip this
this.accessible = true;
this.accessibleTitle=`I:${this.i}  J:${this.j}`;
  1. hit the Tab button anytime to enable accessibility

Achieved result is shown below:
image

This is a badass trick and it really helped me where needed. However, from an ethical and legal perspective, accessibility doesnt seem fair to be used as a debugging tool. Hence, I would say it might make sense to have a HTML debug layer for that purpose. + developers can always change CSS as per need.

@themoonrat themoonrat added 🙏 Feature Request Community request for new features, APIs, packages. 💾 v4.x (Legacy) Legacy version 4 support Plugin: AccesibilityManager labels Jul 2, 2018
@themoonrat
Copy link
Member

I don't see the problem in using AccessibilityManager in creative ways. If it supplies what you need, then great!

@msqaddura
Copy link
Author

Thanks for your reply,
Do you think it is worth making it a seperate feature? at least so we dont need to add interactive=true or shall it remain as is? from a rather subjective point of view, i would say it might be helpful for developers. or otherwise to spread it out we can add it to the gotchas page https://github.com/pixijs/pixi.js/wiki/v4-Gotchas
In order to propagate to other developers

@themoonrat
Copy link
Member

Lemme know the exact wording for what you think we should add to the wiki and I'll add it. It'd be nice to come from you because you came here looking for an answer... so if the wording in the gotchas would have appealed to you and got you thinking, then that's what we want for other devs also coming to pixi thinking the same thing :)

The reason I'm ok with using AccessibilityManager as you are is because, in general, the less code to maintain, the better; so if you can have 1 thing that does what you want but it's named slightly wrong, i'd rather that then 2 things with twice the code that pretty much do the same thing

@msqaddura
Copy link
Author

I understand the AccessibiltyManager part, and I do agree and happy with that.
As per the gotchas, I am sure developers would want at some point to use my approach, and apparently the only way to do so is to reference this thread in the gotchas. we did same thing with this :
https://github.com/pixijs/pixi.js/wiki/v4-Gotchas#theres-no-anchor-on-non-sprite-objects
that references :
#3272 (comment)

Of course i can write this trick with accessibilitymanager on some forum/blog/post but the point is to help others not to get credit

@themoonrat
Copy link
Member

Added! Thanks again :)

@lock
Copy link

lock bot commented Jul 4, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Jul 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🙏 Feature Request Community request for new features, APIs, packages. 💾 v4.x (Legacy) Legacy version 4 support
Projects
None yet
Development

No branches or pull requests

2 participants