npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vcmap/gamepad

v1.0.1

Published

gamepad and controller support for map navigation

Downloads

51

Readme

@vcmap/gamepad

Part of the VC Map Project

This is a plugin extending the VC Map Core Navigation API by two new Controller types:

The plugin uses the GamepadAPI to track controllers being connected or disconnected.

Configuration

You can optionally configure gain control (scales & axesThreshold) and map keys to navigation axes (mapping).

To apply controller configuration you have to provide an id, which corresponds to the gamepads id The plugin should log to your browser console, when a controller is connected or disconnected Use those logs or your browser navigator API navigator.getGamepads() to find out the gamepads id

If no configuration is found for your gamepad, the plugin will try to apply a configuration of the same controller type, if any available.

Gain control

| property | type | default | description | | ------------- | --------------- | ------- | ------------------------------------------------------------------------------------------ | | scales | ControllerInput | | A scale applied to the corresponding input axis. Can also be used to change the direction. | | axesThreshold | number | 0.1 | Threshold for inputs to be applied. Smaller inputs are ignored. |

You may want to change the axesThreshold, if you experience unexpected movements without corresponding inputs

Key mapping

To configure a key mapping provide an array with indices of your gamepads axes or buttons. If you want to use buttons, you can provide an object with + for forward direction and - for backward direction. For an axes, just provide the index.

To inverse the direction of an axes you can change the sign of your corresponding scales configuration.

Example configuration

  • template (please replace all values with valid configuration)
{
  "type": "GamepadController or SpaceMouseController",
  "id": "Name of your gamepad as displayed in the browser console",
  "scales": {
    "forward": "change scale or direction",
    "right": "change scale or direction",
    "up": "change scale or direction",
    "tiltDown": "change scale or direction",
    "rollRight": "change scale or direction",
    "turnRight": "change scale or direction"
  },
  "mapping": {
    "forward": "axes or button index",
    "right": "axes or button index",
    "up": "axes or button index",
    "tiltDown": "axes or button index",
    "rollRight": "axes or button index",
    "turnRight": "axes or button index"
  }
}
  • PlayStation Controller example mapping:
{
  "type": "GamepadController",
  "id": "PS(R) Gamepad",
  "scales": [1, -1, 1, -0.5, 1, 1],
  "mapping": [
    0,
    1,
    {
      "+": 4,
      "-": 5
    },
    5,
    {
      "+": 6,
      "-": 7
    },
    2
  ]
}
  • Xbox Controller example mapping:
{
  "type": "GamepadController",
  "id": "Xbox 360 Controller (XInput STANDARD GAMEPAD)",
  "scales": {
    "forward": 1,
    "right": -1,
    "up": -1,
    "tiltDown": 0.5,
    "rollRight": 1,
    "turnRight": 1
  },
  "mapping": {
    "forward": 1,
    "right": 0,
    "up": {
      "+": 0,
      "-": 1
    },
    "tiltDown": 3,
    "rollRight": {
      "+": 2,
      "-": 3
    },
    "turnRight": 2
  }
}