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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dj256/tuiomanager

v2.2.18

Published

This fork includes some breaking changes to the [original TUIOManager](https://github.com/AtelierIHMTable/TUIOManager). TUIO events are now dispatched directly into the DOM, making the use of widgets obsolete whilst also simplifying the API.

Downloads

40

Readme

TUIOManager

This fork includes some breaking changes to the original TUIOManager. TUIO events are now dispatched directly into the DOM, making the use of widgets obsolete whilst also simplifying the API.

Installation

NPM

npm install @dj256/tuiomanager

CDN

<script src="https://cdn.jsdelivr.net/npm/@dj256/tuiomanager"></script>

Initialization

In order to have TUIO events dispatched into the DOM, you need to initialize the TUIOManager:

NPM

import { TUIOManager } from '@dj256/tuiomanager';
TUIOManager.start();

CDN

<script>
  TUIOManager.start();
</script>

Configuration

You can configure the TUIOManager by passing an object to the start method:

TUIOManager.start({ ...options });

The following options are available:

  • anchor: HTMLElement - The element that will be used as the origin for the TUIO coordinates. This is very important as TUIO events are dispatched by matching the coordinates of the event with the elements on the page. If your surface covers the whole page, you can leave this field empty. TUIOManager will the use the window's dimensions as a reference.
  • showInteractions: boolean - Whether to show the interactions on the page. Defaults to false.
  • showTagIds: boolean - Whether to show the tag IDs on the page. Defaults to false.
  • socketIOUrl: string - The URL of the socket.io server. Defaults to http://localhost:9000.

Usage

Once the TUIOManager is initialized, you can listen to TUIO events on any DOM element:

const element = document.getElementById('myElement');
element.addEventListener('tuiotouchdown', (event) => {
  console.log(event.detail);
});

TUIOManager uses custom events, so you will need to access the event details through event.detail.

Events

All events are dispatched both on the elements that are at the event coordinates (uses document.elementsFromPoint) and on the document object. It is recommended to listen to tuiotouchmove, tuiotouchup, tuiotagmove and tuiotagup events directly from the document object. Thus, if you are implementing a dragging system, you will still receive the events even if the touch event or tag moves outside boundaries of the element being dragged.

tuiotouchdown

Description

Dispatched when a new touch is detected.

Event details

  • x: The x coordinate of the touch event
  • y: The y coordinate of the touch event
  • id: The touch event ID

tuiotouchmove

Description

Dispatched when the position of a touch changes.

Event details

  • x: The x coordinate of the touch event
  • y: The y coordinate of the touch event
  • id: The touch event ID

tuiotouchup

Description

Dispatched when a touch is deleted.

Event details

  • x: The x coordinate of the touch event
  • y: The y coordinate of the touch event
  • id: The touch event ID

tuiotagdown

Description

Dispatched when a tag is placed on the surface.

Event details

  • x: The x coordinate of the tag event
  • y: The y coordinate of the tag event
  • angle: The angle of the tag
  • id: The ID of the tag

tuiotagmove

Description

Dispatched when the position of a tag changes. This event is also dispatched when the angle of the tag changes.

Event details

  • x: The x coordinate of the tag event
  • y: The y coordinate of the tag event
  • angle: The angle of the tag
  • id: The ID of the tag

tuiotagup

Description

Dispatched when a tag is removed from the surface.

Event details

  • x: The x coordinate of the tag event
  • y: The y coordinate of the tag event
  • angle: The angle of the tag
  • id: The ID of the tag

Multi-touch and multi-tag considerations

When designing applications that allow multiple simultaneous touches or tags, you can make use of the id field of the events to keep track of the different touches or tags. Each new touch has a unique ID, and a tag will always have the same ID. This means that you can use the same event listener for all touches or tags, and use the id field to distinguish between them.

Examples

You can find some examples in the examples folder. To test them, you can simply open the index.html file in your browser. If you want to play around with the examples' code and see live edits, you can use lite-server like so:

# Install lite-server if you haven't already
npm install -g lite-server
cd examples/simple-drag
lite-server