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

Distraction free mode messes up the css style of text-box #158

Open
yookoala opened this issue May 3, 2022 · 0 comments · May be fixed by #159
Open

Distraction free mode messes up the css style of text-box #158

yookoala opened this issue May 3, 2022 · 0 comments · May be fixed by #159

Comments

@yookoala
Copy link
Contributor

yookoala commented May 3, 2022

Text Box is shown as "display: grid" by default:

this.element ().show ('grid');

But after applying distraction free then recover, the display mode would become "display: block" because it is simply calling ".show()".

Monogatari/src/monogatari.js

Lines 2447 to 2469 in 1e26a7b

* @static distractionFree - Enable or disable the distraction free mode
* where the dialog box is hidden so that the player can look at the characters
* and background with no other elements on the way. A 'transparent' class
* is added to the quick menu when this mode is enabled.
*/
static distractionFree () {
if (this.global ('playing')) {
// Check if the distraction free is currently enabled
if (this.global ('distraction_free') === true) {
this.element ().find ('[data-component="quick-menu"] [data-action="distraction-free"] [data-string]').text (this.string ('Hide'));
this.element ().find ('[data-component="quick-menu"] [data-action="distraction-free"] [data-icon]').replaceWith ('<span class="fas fa-eye" data-action="distraction-free"></span>');
this.element ().find ('[data-component="quick-menu"]').removeClass ('transparent');
this.element ().find ('[data-component="text-box"]').show ();
this.global ('distraction_free', false);
} else {
this.element ().find ('[data-component="quick-menu"] [data-action="distraction-free"] [data-string]').text (this.string ('Show'));
this.element ().find ('[data-component="quick-menu"] [data-action="distraction-free"] [data-icon]').replaceWith ('<span class="fas fa-eye-slash" data-action="distraction-free"></span>');
this.element ().find ('[data-component="quick-menu"]').addClass ('transparent');
this.element ().find ('[data-component="text-box"]').hide();
this.global ('distraction_free', true);
}
}
}

Besides, it is really hard to customize the style of text-box if distraction free mode is using inline style. The better approach would be to use class to control the showing or hiding of text-box.

@yookoala yookoala linked a pull request May 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant