0
点赞
收藏
分享

微信扫一扫

移动端手势缩放旋转库

陈情雅雅 2022-03-11 阅读 117
javascript

列子 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 条评论