05-21-2024 04:33
05-21-2024 04:33
Hi, do click events work in the simulator when running on Windows 11?
I'm running node v20.13.1, Windows 11 Home vers 23H2, simulator version 0.9.4 with device type Versa 3 and the code as posted below, but clicking the mouse anywhere on the screen doesn't execute anything in the event listener or onclick functions nor generate any console.log messages. I've checked the simulator isn't zoomed in or out and uninstall/reinstall the simulator. Thanks.
index.js
05-21-2024 23:06 - edited 05-21-2024 23:23
05-21-2024 23:06 - edited 05-21-2024 23:23
05-21-2024 23:22
05-21-2024 23:22
@joco2222- or define
index.js
const myScreen = document.getElementById("myScreen");
and change the onclick and addlistener to myScreen instead of mystest
Author | ch, passion for improvement.
05-21-2024 23:28
05-21-2024 23:28
I normally do it the way that Guy_ described.
Is there a chance that there's something conflicting in the definition of "background"? It might be worth a giggle to remove that class reference and see what happens.
05-21-2024 23:36
05-22-2024 18:04
05-22-2024 18:04
Hi, thanks for the replies everyone.
I've tried all the suggestions starting from the 1st reply, but the app still doesn't log any clicks or change the fill colour. The small rectangle was just a confined area to test the clicks, I found on the web when searching for solutions.
I tried removing <svg class="background"> from index.view as per Gondwana's suggestion but it failed to load. I changed the spelling of background and it loads and runs but still no click events are logged. I've also tried earlier versions of the fitbit simulator but they wont wouldn't run.
Is anyone using Windows 11 to develop watch faces? I'm just wondering if it's my installation that's the problem. I'll try running some of the clock faces from the github page and see if the simulator responds to clicks.
05-22-2024 19:19
05-22-2024 19:19
Yes, I used Windows 11.
Instead of removing <svg class="background"> entirely, try changing it to just <svg> ; ie, remove class="background". That probably won't make any difference, but I can't see what else could be interfering with your code.
05-22-2024 19:47
05-22-2024 19:47
I changed it to just <svg> but unfortunately that didn't make any difference.
I installed https://github.com/cgguardian/circles on the simulator and tried clicking on the icons which are supposed to change from icon to numbers but there was no change and after adding a console.log statement that wasnt executed either.
I'm at a bit of a loss, because if I've tried some known working code (circles) and it's not working on the simulator then it looks like the simulator is the problem but I don't know where to go from here. I've reinstalled it a few times so I'm not sure what else I can do.
05-22-2024 19:51
05-22-2024 19:51
This probably isn't relevant, but are you sure you're running node 20? I didn't think CLI would work with anything later than node 16.
05-22-2024 20:02
05-22-2024 20:02
Ctrl+0 (zero) should reset sim zoom, just in case. You could also try removing all sim cache (local files) and reinstalling, just in case it's remembering a setting that it shouldn't.
Here's some more source code that uses touch, but I think the issue is in your installation. Could it be that there's an OS or display utility setting that's applying zoom/magnification? Non-native screen resolution?
05-22-2024 20:13
05-22-2024 20:20
05-22-2024 20:20
node --version gives me v20.13.1 And from the Getting started page I did
nvm install 14 nvm alias default 14
nvm install 14 says Version 14.21.3 is already installed and the alias default 14 says Running version 1.1.12 and then gives the usage help.
Theres a popup about the GeForce ingame experience running whenever I start the simulator. I'll see if I can disable that and also remove all sim cache files too.
05-22-2024 20:43
05-22-2024 20:43
If node --version is still saying 20, it sounds like node 14 might be installed but is not being used. I can't help with that because I only install one version of node at a time. I would have thought that nvm would provide a way of switching the in-use version.
When changing node versions, I think you'll need `npm i` to change the node_modules in the project.
But I suspect the node version is not the cause of the original problem. 😞
05-22-2024 23:30
05-23-2024 08:40
05-23-2024 08:40
I got node to use vers 14 as the default but click events still didn't work, so managed to get everything installed on an old Windows 10 laptop and my click events are now working!😊
Interestingly clicking the imaginary left button works on Win 11, and then clicking the screen wakes up the simulator but I cant drag the mouse to show quick settings or notifications on the Win 11 simulator like it does on the Win 10 machine. So I'll just use the Win 10 machine to develop my watch app.
Thanks Gondwana and Guy_ for all the time and effort you put into trying to find a fix for me. I really appreciate it. 👍