shbatm / MMM-OnScreenMenu

MagicMirror² utility module that provides a simple on screen menu for control
MIT License
62 stars 22 forks source link

moduleToggle #1

Closed jkbailmeout closed 7 years ago

jkbailmeout commented 7 years ago

Working with the module toggle function and it's currently not able to change the module's visibility. I can create a menu item to show and hide and it will change the visibility as expected, but trying to create a button using moduleToggle does not produce any results. Any ideas?

shbatm commented 7 years ago

Looks like I dropped a "not" from the function.

Edit ~/MagicMirror/modules/MMM-OnScreenMenu/MMM-OnScreenMenu.js Line #190 and add a ! before k.hidden.

Full if statement starting at Line #189 should look like:

                if (action.indexOf("Hide") > -1 ||
                    (action.indexOf("Toggle") > -1 && !k.hidden)) {
                    console.log(`Hiding ${this.config.menuItems[action].name}`);
                    k.hide(0, { lockString: "osm" });

Pushed an update to fix this.