移动端手势缩放旋转库

阅读 117

2022-03-11

列子 http://alloyteam.github.io/AlloyFinger/
代码地址 https://github.com/AlloyTeam/AlloyFinger
AlloyFinger

常规引入方式

<script src="http://alloyteam.github.io/AlloyFinger/asset/transform.js"></script>
<script src="http://alloyteam.github.io/AlloyFinger/alloy_finger.js"></script>
<script src="http://alloyteam.github.io/AlloyFinger/asset/to.js"></script>

使用方法

//element为需要缩放的节点dom
var af = new AlloyFinger(element, {
    touchStart: function () { },
    touchMove: function () { },
    touchEnd:  function () { },
    touchCancel: function () { },
    multipointStart: function () { },
    multipointEnd: function () { },
    tap: function () { },
    doubleTap: function () { },
    longTap: function () { },
    singleTap: function () { },
    rotate: function (evt) {
        console.log(evt.angle);
    },
    pinch: function (evt) {
        console.log(evt.zoom);
    },
    pressMove: function (evt) {
        console.log(evt.deltaX);
        console.log(evt.deltaY);
    },
    swipe: function (evt) {
        console.log("swipe" + evt.direction);
    }
});

精彩评论(0)

0 0 举报