shbatm / MMM-OnScreenMenu

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

auto close the list after x second #7

Closed mcnahum closed 5 years ago

mcnahum commented 6 years ago

Hello, I cannot find if there is a function to autoclose the menu...

I'm using the Rasperry 7 touchscreen and it not react very good with the cross to close the menu... will be good to close alone after x second..

shbatm commented 6 years ago

Please try the new option on the WIP branch.

Switch branches:

cd ~/MagicMirror/modules/MMM-OnScreenMenu
git checkout wip
git pull

Update your MagicMirror Config for MMM-OnScreenMenu -- Add to the modules' main config section (outside of the menu items): autoCloseTimeout: 1000, where 1000 will auto close the menu after 1s (1000ms). Set to 0 to disable (default).

I have not tested yet, so please let me know if it works.

mcnahum commented 6 years ago

when I switch to wip it's said I'm already up-to-date:

pi@raspberrypi:~ $ cd ~/MagicMirror/modules/MMM-OnScreenMenu
pi@raspberrypi:~/MagicMirror/modules/MMM-OnScreenMenu $ git checkout wip
Branch wip set up to track remote branch wip from origin.
Switched to a new branch 'wip'
pi@raspberrypi:~/MagicMirror/modules/MMM-OnScreenMenu $ git pull
Already up-to-date.
shbatm commented 6 years ago

Try git fetch -all before git pull.

mcnahum commented 6 years ago

same there:

pi@raspberrypi:~/MagicMirror/modules/MMM-OnScreenMenu $ git fetch --all
Fetching origin
pi@raspberrypi:~/MagicMirror/modules/MMM-OnScreenMenu $ git pull
Already up-to-date.
pi@raspberrypi:~/MagicMirror/modules/MMM-OnScreenMenu $ 
shbatm commented 6 years ago

You may have already updated it then. You can confirm with this: git log --pretty=format:'%h' -n 1 which should spit out the last update: c8be6ad

You can also open MMM-OnScreenMenu.js and make sure Line 22 says: autoCloseTimeout: 0, and Lines 174-176 say the following:

            if (this.config.autoCloseTimeout) {
                setTimeout(() => { this.toggleMenu(true); }, this.config.autoCloseTimeout);
            }

If it didn't update, I'm not sure what's going on with your setup, but you can make the 4 changes above and test manually.

mcnahum commented 6 years ago

good news: yes it's already updated. bad news: the menu stay open ...

config look ok: { module: 'MMM-OnScreenMenu', position: 'bottom_left', config: { touchMode: true, enableKeyboard: false, autoCloseTimeout: 1000, menuItems: { toggleFullscreen: { title: "Toggle Screen", icon: "desktop" }, notify1: { title: "Display Forcast", icon: "eye", notification: "CURRENT_PROFILE", payload: "Weather_Forcast" }, }, }, classes: 'default everyone' },

shbatm commented 6 years ago

I just re-tested with a touch screen on my laptop and I think I see the problem. The Open/Close button will open the menu when you hover over it--when you click on the close button, the cursor is still hovering over the menu. The easiest solution is to touch anywhere but the menu (e.g. just to the right of the close button) and it should close.

mcnahum commented 6 years ago

of course ... :-> I was just trying to click on the cross and not trying to click somewhere else ... Thanks a lot for your help.