# \[ANNOUNCE\] node-red-contrib-ui-joystick : beta

**URL:** <https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479>\
**Category:** Share Your Nodes\
**Created:** [3 January 2021 21:30 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479 "2021-01-03T21:30:49Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 January 2021 17:03 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/41 "2021-01-25T17:03:48Z")

</div>

I suspect all the real goodness would need to be handled by the underlying library [GitHub - yoannmoinet/nipplejs: A virtual joystick for touch capable interfaces.](https://github.com/yoannmoinet/nipplejs)  
so maybe need to raise an issue there first 🙂

---

<div class="post-metadata">

**Author:** ![dudleyjosh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dudleyjosh/32/105799_2.png) [@dudleyjosh](https://discourse.nodered.org/u/dudleyjosh)\
**Post date:** [25 January 2021 17:34 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/42 "2021-01-25T17:34:54Z")

</div>

I'll take a look over there... thanks.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [25 January 2021 22:06 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/43 "2021-01-25T22:06:34Z")

</div>

> [@dudleyjosh](#):
>
> something like the image below perhaps?

Hi @dudleyjosh,  
That indeeds look better. Thanks for taking the time to make such a nice demo image!

But indeed - like @dceejay already suggested - the only way to get it done, is to ask the nipplejs author to implement it. If you can convince them to do it, I can support it afterwards in my node (if anything needs to be changed...). Don't forget to share your nice image with them, and please add a link to your nipplejs issue here (so we can follow your request).

Good luck with it!  
Bart

---

<div class="post-metadata">

**Author:** ![dudleyjosh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dudleyjosh/32/105799_2.png) [@dudleyjosh](https://discourse.nodered.org/u/dudleyjosh)\
**Post date:** [25 January 2021 22:34 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/44 "2021-01-25T22:34:40Z")

</div>

@BartButenaers I submitted a feature request on their GitHub 🙂

In the meantime, I hacked together (I'm not a CSS or coding guru in general) a dashboard template node to modify the joysticks when the page loads.

I had to add a timeout to my script to allow enough time for Angular to do whatever it does on page load... I couldn't find the proper way to fire my template script based on an Angular event or something along those lines?

`[{"id":"24979d80.621452","type":"ui_template","z":"f7a3bdce.57314","group":"da148e61.f015f","name":"","order":9,"width":0,"height":0,"format":"<script id=\"formatJoystick\" type=\"text/javascript\">\n\n $(function() {\n \n setTimeout(() => {\n \n var backTilt = $(\".back\")[0];\n backTilt.style.width = \"80px\";\n backTilt.style.left = \"10px\";\n \n var tiltSpan = \n `<span class=\"fa fa-arrows-v\" style=\"\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 2rem;\n color: black;\">\n </span>`;\n \n $(\".front\").eq(0).append(tiltSpan);\n \n var backPan = $(\".back\")[1];\n backPan.style.height = \"80px\";\n backPan.style.top = \"10px\";\n \n var panSpan = \n `<span class=\"fa fa-arrows-h\" style=\"\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 2rem;\n color: black;\">\n </span>`;\n \n $(\".front\").eq(1).append(panSpan);\n \n }, 1000);\n \n });\n\n</script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","x":350,"y":460,"wires":[[]]},{"id":"da148e61.f015f","type":"ui_group","name":"Demo","tab":"da5706ae.6caf58","order":3,"disp":true,"width":"12","collapse":false},{"id":"da5706ae.6caf58","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]`

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 January 2021 22:50 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/45 "2021-01-25T22:50:10Z")

</div>

> [@dudleyjosh](#):
>
> I had to add a timeout to my script to allow enough time for Angular to do whatever it does on page load.

It _ **should** _ be enough to wrap code in `scope` (its in the ui\_template built in help) - not certain though

```JavaScript
(function(scope) {
  //do stuff
})(scope);

```

Worth a try?

---

<div class="post-metadata">

**Author:** ![dudleyjosh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dudleyjosh/32/105799_2.png) [@dudleyjosh](https://discourse.nodered.org/u/dudleyjosh)\
**Post date:** [26 January 2021 14:22 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/46 "2021-01-26T14:22:29Z")

</div>

@Steve-Mcl I actually tried that and a variety of variants from that... but no luck ☹

---

<div class="post-metadata">

**Author:** ![ecyewp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ecyewp/32/53997_2.png) [@ecyewp](https://discourse.nodered.org/u/ecyewp)\
**Post date:** [11 January 2022 15:45 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/47 "2022-01-11T15:45:27Z")

</div>

Hi, i just downloaded and install the ui-joystick node. The properties tab of the node is missing the send output message options (see screenshot). I am new to node-red and may have missed some steps. Could you kindly please help enlighten?

npm version is 6.14.5  
node.js version is 14.17.6

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f2da959d0fe96a00c1deac922aed9df3a936f39f.png)

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [11 January 2022 16:47 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/48 "2022-01-11T16:47:28Z")

</div>

> [@ecyewp](#):
>
> The properties tab of the node is missing the send output message options

Hi @ecyewp,  
Could you explain a bit more what you are missing? It is quite some time ago that I developed that node, so not entirely sure what you mean ...

---

<div class="post-metadata">

**Author:** ![ecyewp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ecyewp/32/53997_2.png) [@ecyewp](https://discourse.nodered.org/u/ecyewp)\
**Post date:** [11 January 2022 19:08 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/49 "2022-01-11T19:08:42Z")

</div>

Hi, @BartButenaers

Compare to left image from your posts previously vs the right image of edit joystick node properties section i had, i am missing the section from "send output msg at 45deg direction change" onwards.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/7/d7d9f675abd14636dfd46acf8e80ad1ff691783f.png)

Is there something i am missing in the node installation?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [11 January 2022 21:38 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/50 "2022-01-11T21:38:38Z")

</div>

@ecyewp,

During the above discussion, some of the properties have been moved to other positions on the config screen:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1eb12d5e7f15fa60aa168c7ab91af0457adf793.png)

And 3 checkboxes have been replaced by a dropdown, as you can see in the above discussion:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/946f929a1bb5db514df6ec0057947a85ed7a26ce.png)

So it is al there, but you are looking at screenshots of my first beta version...

---

<div class="post-metadata">

**Author:** ![Marcos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcos/32/18284_2.png) [@Marcos](https://discourse.nodered.org/u/Marcos)\
**Post date:** [28 June 2022 16:59 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/51 "2022-06-28T16:59:13Z")

</div>

Hi dears and thanks for the great job.  
I'm trying to test this node but actually, I can't understand why the joystick doesn't appear on UI.  
I currently use node-red on raspberry pi and I've been testing the node on different raspberry (3B+ and 4B) with separate node-red installation. In both cases, there are no problems with the installation and I can add the node to fluxes. Once deplyed, everything seems to be ok but on UI I can see only empty space where it is supposed to be found the joystick.  
Any indications?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [28 June 2022 18:05 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/52 "2022-06-28T18:05:44Z")

</div>

Hi @Marcos,  
Do you see any errors in your browser console log? Otherwise I don't have any idea why that happens.  
Bart

---

<div class="post-metadata">

**Author:** ![Marcos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcos/32/18284_2.png) [@Marcos](https://discourse.nodered.org/u/Marcos)\
**Post date:** [28 June 2022 19:48 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/53 "2022-06-28T19:48:40Z")

</div>

Thanks, @BartButenaers,  
in the console log, I found this

![Capture2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7f2a010d71f9e8c722417d69753ecac8cd9f2fdb.jpeg)

So I tried to run in the node-red folder

```auto
npm install nipplejs --save

```

and after a no error install, the behaviour is the same.  
I also tried to restart and change the browser.  
I understand there is something related to nipplejs but I'm not so trained to fix this kind of stuff.  
Do you have any suggestions?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [28 June 2022 21:14 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/54 "2022-06-28T21:14:48Z")

</div>

I think your browser cannot connect the joystick node's endpoint, which it needs to load the [nippleJs](https://www.npmjs.com/package/nipplejs) library. So as a result the library will not be able to display a joystick.

Can you have a look at the "Network" tabsheet of your browser developer tools, to see why the call to the endpoint (to fetch nipplejs from your Node-RED server) fails. I am curious to see the url that is being called. Had similar issues in the past with my other nodes: often this was caused by people adjusting properties in the settings.js file, which caused the basepath of the url to be changed.

---

<div class="post-metadata">

**Author:** ![Marcos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcos/32/18284_2.png) [@Marcos](https://discourse.nodered.org/u/Marcos)\
**Post date:** [29 June 2022 05:49 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/55 "2022-06-29T05:49:22Z")

</div>

Hi @BartButenaers,  
here is what I can read

 ![Capture3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/7/a756ccf7c88c25e4811052741cf213d03ff5b75a.jpeg)

that shows in the Headers tab this

 ![Capture4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/9/19270170155a4055ad6318e84ecba7e493a7cc7a.jpeg)

I'm using chrome.  
Actually, I use a custom settings.js file also for paths because I want UI on base path IP:1880 and the web editor on IP:1880/admin.  
Could be this the reason? How to fix it?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [30 June 2022 05:53 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/56 "2022-06-30T05:53:52Z")

</div>

This is my path when the library is loaded (without any adjustments in the settings.js file):

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9b430a3e990342ff4428ceef791c4775c2b9a813.png)

So I have an extra 'ui' in between the path.

Can you please share the part of your settings.js file and explain how it works, because I have not enough time to start digging myself.

There must be somewhere a bug in my code [here](https://github.com/bartbutenaers/node-red-contrib-ui-joystick/blob/main/joystick.js#L305) where I calculate the path to the endpoint (that serves the nipple library to your dashboard). I use that code snippet in all my ui nodes. In the beginning I had a lot of troubles with that code, for cases like yours. But long time ago that somebody reported that it doesn't work well...

The only difference I see with the UI SVG node is [here](https://github.com/bartbutenaers/node-red-contrib-ui-svg/blob/master/svg_graphics.js#L2036), because there is no `/*` at the end. Not sure if that can cause it.

Summarized: the uipath is calculated based on your settings.js file, and on that url your nipplejs library can be downloaded. But that path doesn't match with the one your dashboard uses in your screenshot.

Now off to work...

---

<div class="post-metadata">

**Author:** ![Marcos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcos/32/18284_2.png) [@Marcos](https://discourse.nodered.org/u/Marcos)\
**Post date:** [30 June 2022 07:50 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/57 "2022-06-30T07:50:14Z")

</div>

Hi, @BartButenaers and thanks.  
my custom settings.js usually have these lines:

```auto
    // By default, the Node-RED UI is available at http://localhost:1880/
    // The following property can be used to specify a different root path.
    // If set to false, this is disabled.
    httpAdminRoot: '/admin',
   
    // If you installed the optional node-red-dashboard you can set it's path
    // relative to httpRoot
    ui: { path: "" },

```

This is why I want to have UI reachable directly on path IP:1880 while I want the developer's interface on the subpath /admin.

Looking at your image it seems that everything is fine based on the relevant different settings.js files.  
In both cases (mine and yours) path is correct. Anyway, the results are different.  
Giving a look at your code I realized that probably using "/" in my settings.js could solve the problem.  
Then using the following line

```auto
ui: { path: "/" },

```

the joystick is now visible.  
So, while in the past with or without "/" was different for node-red I realized that now it seems to be equivalent. I'll deep this.  
Actually, I don't know if this is the case to consider an exception in your code.  
Thanks a lot for helping me out.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [30 June 2022 22:24 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/58 "2022-06-30T22:24:37Z")

</div>

@Marcos,  
Thanks for the analysis! Much appreciated...

You made my head explode by your feedback 🤯  
Let's travel back in history, in chronological order:

1. This [issue](https://github.com/bartbutenaers/node-red-contrib-ui-svg/issues/86#issuecomment-753406485) for the ui-svg node was exactly the same as yours.
2. So on 09-01-2021 I created this [fix](https://github.com/bartbutenaers/node-red-contrib-ui-svg/commit/50eef5364e7044359a4fe31b7afa8216489a83e4#diff-f828ec9941b4d1e9c8ea3a15956fcd723fff5028be5762fa90e0558582613995) for the svg-node.
3. And seems that the same day I did the same fix on all my other ui nodes, so I also [fixed](https://github.com/bartbutenaers/node-red-contrib-ui-joystick/commit/8695e74807501bb447eb44ab53f4f476e5d43c45) the ui-joystick node on Github.
4. But version 1.0.0 of the ui-joystick node was published two days earlier on npm.
5. So you can see the fix on Github, but it has never been published on npm!

That is why I went nuts, because the code of the ui-joystick node on Github looked correct to me...

Will publish the fix tomorrow evening on npm. My (free) time is up for today

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [1 July 2022 05:20 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/59 "2022-07-01T05:20:02Z")

</div>

Was awake early, so here is the fix in version _ **1.0.1** _:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/257623704c54e803cd730b368245ea6006a2f6c8.png)

---

<div class="post-metadata">

**Author:** ![Marcos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcos/32/18284_2.png) [@Marcos](https://discourse.nodered.org/u/Marcos)\
**Post date:** [1 July 2022 05:28 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479/60 "2022-07-01T05:28:57Z")

</div>

Hi @BartButenaers  
I've just updated the node. I confirm everything works.  
I'll use the joystick in the next days.  
Thanks a lot for your work.

[Previous page](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479.md?page=2)

[Next page](https://discourse.nodered.org/t/announce-node-red-contrib-ui-joystick-beta/38479.md?page=4)
