What's Pointeract?
Pointeract is a tiny JavaScript/TypeScript utility library focusing on one thing - handling user interactions with DOM elements, e.g. multitouch and touchpad.
Powered by SynthKernel architecture, Pointeract have achieved a highly modular, extensible and efficient architecture. Its core bundle size is only 1KB minified + gzipped, functionalities come from also byte-sized modules. It's fully tree-shakable, the fewer modules you use, the smaller your bundle is.
To use it, one only needs to bind a DOM element and load some modules, and it will start monitoring user interactions and dispatch consumable events like pan and zoom.
Advantages
- 🐣 Tiny: With base 1KB minified and gzipped, 1-2KB for normal usage.
- 🦾 Robust: Excels at complex gestures where most interaction libraries fail, Why?
- 🧩 Extensible: Extend Pointeract effortlessly via our module API.
- 🔌 Flexible during Runtime: Options are updated reactively. Stop/start any module during runtime.
- 🛡️ Safe: Not modifying the DOM (except the
PreventDefaultmodule). Meticulous clean up prevents memory leaks.
Currently Supported Features
- Click (Double Click, Triple Click, Quadruple Click, Any Click)
- Drag
- Pan and Zoom via Mouse Wheel (
ctrl/shiftkey binding, touchpad support) - Pan and Zoom via Multitouch (Pan, Pinch)
- One-line Prevent Default
- Smooth Everything (drag / pan / zoom / any interaction involving numbers)
Those interactions are shipped via modules, which can be composed from a single drag-and-drop to a canvas app.
Missing your desired interaction? Write your own module!
How Pointeract Stands Out?
There're already plenty of interaction libraries out there, most famous ones are d3-drag + d3-zoom, Interact.js and Hammer.js, but Pointeract is different.
| Criteria | Pointeract | D3 Drag + D3 Zoom | Hammer.js | Interact.js |
|---|---|---|---|---|
| Written in TypeScript? | ✅ | ❌ | ❌ | ✅ |
| Tree-shakeable? | ✅ | ❌ | ❌ | ❌ |
| Total Bundle Size (Minified + Gzipped) | 👑 3KB | 17KB | 7KB | 28KB |
| Last Updated | 👑 Actively Maintained | 2021 | 2015 | 2023 |
| Versatility | Pointer and Wheel Related + Some Utils | 👑 Pointer and Wheel Related + Ecosystem | Pointer Related | Pointer Related + Comprehensive Utils |
| Support | 👑 Mouse, Mouse Wheel, Touch, and Touchpad | ⚠️ No Touchpad Support | ⚠️ No Touchpad or Mouse Wheel Support | ⚠️ No Touchpad or Mouse Wheel Support |
| Robust (Passes Monkey Test) | ✅ | ✅ | ❌ Element Jerks | ❌ Element Ignores the Second Touch |
| Extensible? | ✅ | ❌ | ❌ | ❌ |
License
Pointeract is licensed under the Apache License 2.0.