JS9JS9 Docs GitHub

Mouse and Touch Actions

JS9 supports the following configurable mouse and touch actions:
  • mouse movement with no buttons pressed
  • mouse movement with one button pressed
  • mouse movement with two buttons pressed
  • touch with one finger
  • touch with two fingers
  • touch with three fingers
The initial actions are defined by the JS9.globalOpts.mouseActions and JS9.globalOpts.touchActions arrays. In addition, the JS9.globalOpts.mousetouchZoom property specifies whether a mouse wheel or touch/pinch will zoom the image. The default actions are:
  • mouseActions: ["display value/position", "change contrast/bias", "pan the image"]
  • touchActions: ["display value/position", "change contrast/bias", "pan the image"]
  • mousetouchZoom: false
where the array elements map to an increasing numbers of buttons/fingers. You can change the default actions of the elements in either array in your js9Prefs.json file. For example, to make pan and zoom the default one-touch and pinch actions respectively:
  • touchActions: ["pan the image", "display value/position", "change contrast/bias"]
  • mousetouchZoom: true
As usual, the defaults in js9Prefs.json are used by all JS9 displays in a web page.

Users can change the action assignments using the MouseTouch plugin, which displays the current mapping between mouse/touch gesture and its action. Simply drag and drop an action to a different gesture in order to change the mapping. You also can toggle the scroll/pinch to zoom capability by clicking its button.