Skip to content

Instantly share code, notes, and snippets.

@dp21g
dp21g / pinch.js
Created May 1, 2019
Track pinch gestures in browser using only touch events (attempt to not use HammerJS)
View pinch.js
// 1. Track the touches
let touches = {
start: [],
end: [],
};
// 2. When the touch events end, calculate if its pinching inwards or outwards
const handleTouchEnd = () => {
if (touches.start.length === 0 || touches.end.length === 0) {
return;
View jestTestDST.js
// jest tests
describe("getTickValues method", () => {
const dispformat = "DD-MMM-YYYY hh:mm";
beforeAll(() => {
moment.tz.setDefault("Europe/London");
});
it("generates tick values with DST", () => {