Features
- Add
Hammer.QuickScaleone-handed double-tap-and-drag zoom recognizer (disabled by default inHammer.defaults.preset, linked ahead ofpanandpressviarequireFailure) and exportHammer.STATE_PENDING(64), lockingev.centerto the priming tap anchor and scaling exponentially (2 ** (dy / sensitivity))
Recognizers
- Enforce minimum pointer counts (
_minPointers: 2onPinchandRotate,1otherwise) whenpointers: 0, and stay inSTATE_BEGAN | STATE_CHANGEDon partial multi-finger liftoff while at least_minPointersremain active - Keep
Pressactive without redundantpressre-emits on pointer movement and handle partial liftoff cleanly whenpointers: 0 - Handle trailing finger movement/liftoff and
pointers: 0liftoff consistently inTap - Evaluate same-manager
requireFailurechains in cached topological order (getEvalOrder()) so blockers always run before dependents regardless of registration order - Set
input.direction = input.offsetDirectiononSwipeemit and keepAttrRecognizer/Managerstate-machine blocking driven solely byisBlocked()(removing redundantsession._curRecognizer)
Input
- Lazily attach window and
visibilitychangelisteners onMouseInputandPointerEventInputonly while pointers are active (keepingSingleTouchInputwindow listener eager forwindowtargets) - Cancel active gestures on
dragstart(unlessdefaultPrevented),visibilitychange(hidden), and document-targetedlostpointercapture(detached captured nodes) - Preserve the last tracked
(clientX, clientY)on iOS Safaripointercancelframes when Safari zeros coordinates to(0, 0) - Emit
INPUT_CANCELinTouchMouseInputwhen touch takes over an active mouse session or an abandoned touch session expires pastDEDUP_TIMEOUT - Support Shadow DOM retargeting and slotted children via shared
isInShadowTarget()(composedPath()+getRootNode()) in bothcomputeInputData()andTouchInput - Drop synthetic-only/unreachable guards (duplicate
Touch.identifiermaps already prevented by W3CTouchList, backward wall-clock clamps while keepingdt < 0skip for staggered hardware timestamps) - Use
Date.now()directly instead of a module-cached reference so fake timers work against the builthammer.js/hammer.min.jsbundles too
Manager & Touch-action
- Preserve original inline CSS
!importantpriorities when applying and restoringcssPropsandtouch-action(using[value, priority]backup tuples viagetCssProp()/setCssProp()) - Flush iOS WebKit's touch event region with a single
requestAnimationFramewhen dynamically toggling nativetouch-action - Narrow
pinch-zoomcomposition order cleanly incleanTouchActions()(preserving nativepinch-zoomwith JS polyfill fallback when unsupported)
Bundle Size & Internal Simplification
- Prefix internal/private properties with
_and enable UglifyJSmangle.properties(regex: /^_/, reserving_superand_timer) pluscompress.passes: 2 - Extract velocity tracking into
src/velocity.js, move internal-only prototype helpers to module-private functions, unifyTouchAction.set(), and deduplicate async timer completion (scheduleRecognize()) - Switch subclass constructors from
Base.apply(this, arguments)to named-parameterBase.call(this, ...) - Minified bundle:
hammer.min.jstrimmed from37.44 kB(38,335 B, immediately after portingQuickScale+3.0.0fixes) down to30.31 kB(31,040 Bmin,11.13 kBgzip,10.04 kBbrotli); 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-checksynthetic/legacy/CDP fuzz suites (fixingt=0..1mstimestamp clamping inrunSyntheticTrace()), and live iOS Safari Appium/XCUITest simulator suite (11/11passing incl.QuickScale) - Modernize CI, nightly fuzz/iOS, and OIDC Trusted Publishing release workflows
- Add full JSDoc coverage across
src/with shared compact@typedefs insrc/types.jsand TypeScript 7 (tsc --noEmit/checkJs) verification inlintandtest
Full Changelog: v2.1.0-rc.4...v2.1.0-rc.5