
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
micro-touch
Advanced tools
Super basic mobile gesture support tool.
NPM page: https://www.npmjs.com/package/micro-touch
npm install micro-touch --save
import {TouchGesture} from "micro-touch";
tou = new TouchGesture(DOM);
let t2d = new Transform2D(tou.el)
// tou.on("tap", tap);
// tou.on("longTap", longTap);
// tou.on("doubleTap", doubleTap);
// tou.on("pressMove", function (e) {
// let {moveDistance, startDistance} = e;
// console.log(moveDistance, startDistance);
// });
tou.on("pinch", function (e) {
let {pointAngle,startAngle,pointSpace,startSpace,scale,rotate} = e;
t2d.setRotate(rotate);
})
结合mmicro-transform2d实现拖拽阻力
let pullN = 0.2;
let tg = new TouchGesture(divDom.current);
let t2d = new Transform2D(divDom.current);
t2d.setTranslate(50, 0);
tg.on("tapDown", function () {
divDom.current.style.removeProperty("transition");
t2d.setTranslate(50, 0);
});
tg.on("pressMove", function (e) {
let {moveDistance: {x, y, d}} = e;
let [nowX, nowY] = t2d.getTranslate();
if (nowY > 50) {
y *= pullN;
}
t2d.setTranslate(50, nowY + y);
});
tg.on("tapUp", function () {
divDom.current.style.transition = "500ms";
t2d.setTranslate(50, 0);
});
传入一个DOM对象,对其进行方法监听
new TouchGesture(DOM)
on(gesture,callback) : 注册事件监听回调函数
off() : 取消注册的回调函数
destroy() : 销毁注册实例
interval(lastTime: number, duration: number = 500) : Promise对象判定给定时间是否和当前时间满足间隔
getMove(p1: point, p2: point) : 获取两个点之间的距离对象
getAngle(move: move) : 解析move对象,返回角度值(弧度制)
getMiddlePoint(p1: point, p2: point) : 获取两个点之间的中点坐标
radian2angle() : 弧度转角度
angle2radian() : 角度转弧度
You can read micro-touch Documentation online for more information.
micro-touch uses the MIT license, see LICENSE file for the details.
FAQs
Super basic mobile gesture support tool.
We found that micro-touch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.