Add a mouse cursor
From SpinetiX Support Wiki
Introduction
Due to the nature of digital signage projects, usually there's no need to display a mouse cursor on the screen. Nevertheless, when having an interactive project for a touchscreen or driven by a mouse connected on the USB port of the HMP, showing a cursor might be necessary.
The tutorial below explains how to add a mouse cursor on your interactive project using just a few lines of code. Or you can just download the sample project.
Tutorial
- Difficulty: Medium (some programming skills are required).
- Total duration: 5-10 minutes.
- Requirements:
Steps
- Create a new project in Elementi X or open an existing one.
- Open its main index.svg file and go to the XML Tree view in Edit panel.
- Include the jSignage UI plugin
- Find the
<script>
element loading the jSignage.js library. - Press Ctrl+C, then Ctrl+V to duplicate it.
- Expand it and edit the value of the xlink:href attribute to point to http://download.spinetix.com/spxjslibs/jSignage.UI.js instead.
- Find the
- Add the following code that invokes the cursor function.
- Find the next
<script>
element that holds the jSignage code and click on the arrow to expand it. - Double-click on the green text to open the "Edit CDATA" dialog.
- Add the highlighted line to the existing script:
$(function(){ var txt = $('#jsonLayers').text(); if ( $.trim(txt)=="") { txt = $('#defaultContent').text(); } $('#layers').add( $.uncan( $.parseJSON( txt ) ) ); jSignage.UI.cursor({type: 'circle', size: 10, color: 'blue'}).addTo('svg'); });
- Click OK button to close the dialog.
- Find the next
- Click the save button to apply the changes.
- Click the finger button to enable the interactivity mode in Elementi.
- Make sure a blue cursor is following the mouse movements.
- Publish the project on the HMP (make sure that the player is configured to accept touchscreen and keyboard events).
Note:
If you are using a text editor, locate the project folder on your disk, open the index.svg file for editing, and manually add the above.