Skip to content

v2.1.0-rc.5

Pre-release
Pre-release

Choose a tag to compare

@jtangelder jtangelder released this 04 Dec 10:49
Features
  • Add Hammer.QuickScale one-handed double-tap-and-drag zoom recognizer (disabled by default in Hammer.defaults.preset, linked ahead of pan and press via requireFailure) and export Hammer.STATE_PENDING (64), locking ev.center to the priming tap anchor and scaling exponentially (2 ** (dy / sensitivity))
Recognizers
  • Enforce minimum pointer counts (_minPointers: 2 on Pinch and Rotate, 1 otherwise) when pointers: 0, and stay in STATE_BEGAN | STATE_CHANGED on partial multi-finger liftoff while at least _minPointers remain active
  • Keep Press active without redundant press re-emits on pointer movement and handle partial liftoff cleanly when pointers: 0
  • Handle trailing finger movement/liftoff and pointers: 0 liftoff consistently in Tap
  • Evaluate same-manager requireFailure chains in cached topological order (getEvalOrder()) so blockers always run before dependents regardless of registration order
  • Set input.direction = input.offsetDirection on Swipe emit and keep AttrRecognizer / Manager state-machine blocking driven solely by isBlocked() (removing redundant session._curRecognizer)
Input
  • Lazily attach window and visibilitychange listeners on MouseInput and PointerEventInput only while pointers are active (keeping SingleTouchInput window listener eager for window targets)
  • Cancel active gestures on dragstart (unless defaultPrevented), visibilitychange (hidden), and document-targeted lostpointercapture (detached captured nodes)
  • Preserve the last tracked (clientX, clientY) on iOS Safari pointercancel frames when Safari zeros coordinates to (0, 0)
  • Emit INPUT_CANCEL in TouchMouseInput when touch takes over an active mouse session or an abandoned touch session expires past DEDUP_TIMEOUT
  • Support Shadow DOM retargeting and slotted children via shared isInShadowTarget() (composedPath() + getRootNode()) in both computeInputData() and TouchInput
  • Drop synthetic-only/unreachable guards (duplicate Touch.identifier maps already prevented by W3C TouchList, backward wall-clock clamps while keeping dt < 0 skip for staggered hardware timestamps)
  • Use Date.now() directly instead of a module-cached reference so fake timers work against the built hammer.js / hammer.min.js bundles too
Manager & Touch-action
  • Preserve original inline CSS !important priorities when applying and restoring cssProps and touch-action (using [value, priority] backup tuples via getCssProp() / setCssProp())
  • Flush iOS WebKit's touch event region with a single requestAnimationFrame when dynamically toggling native touch-action
  • Narrow pinch-zoom composition order cleanly in cleanTouchActions() (preserving native pinch-zoom with JS polyfill fallback when unsupported)
Bundle Size & Internal Simplification
  • Prefix internal/private properties with _ and enable UglifyJS mangle.properties (regex: /^_/, reserving _super and _timer) plus compress.passes: 2
  • Extract velocity tracking into src/velocity.js, move internal-only prototype helpers to module-private functions, unify TouchAction.set(), and deduplicate async timer completion (scheduleRecognize())
  • Switch subclass constructors from Base.apply(this, arguments) to named-parameter Base.call(this, ...)
  • Minified bundle: hammer.min.js trimmed from 37.44 kB (38,335 B, immediately after porting QuickScale + 3.0.0 fixes) down to 30.31 kB (31,040 B min, 11.13 kB gzip, 10.04 kB brotli); build script now reports brotli size alongside minified and gzipped sizes
Tooling, Types & Testing
  • Replace Grunt, QUnit, and jQuery test harness with Node build scripts (scripts/build.mjs + magic-string) and Vitest 5 + Playwright (Chromium, Firefox, WebKit)
  • Port cross-browser real-pointer E2E suite, fast-check synthetic/legacy/CDP fuzz suites (fixing t=0..1ms timestamp clamping in runSyntheticTrace()), and live iOS Safari Appium/XCUITest simulator suite (11/11 passing incl. QuickScale)
  • Modernize CI, nightly fuzz/iOS, and OIDC Trusted Publishing release workflows
  • Add full JSDoc coverage across src/ with shared compact @typedefs in src/types.js and TypeScript 7 (tsc --noEmit / checkJs) verification in lint and test

Full Changelog: v2.1.0-rc.4...v2.1.0-rc.5