🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

domhammer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domhammer - npm Package Compare versions

Comparing version
1.0.0
to
1.0.2
+1
-1
domhammer.js

@@ -1,1 +0,1 @@

var hamjs=require("hammerjs"),hammerAry=[],GuoInit={},xy={},i=0,removeListener=[];GuoInit.GuoImgHam={Fun:function(e,t,n){var a="obj_"+i;e.datahamnum=i,i++;var o=new GuoInit.Guonewobj.Fun(0,0,1,0);xy[a]=o;var r=new Hammer.Manager(e);hammerAry.push(r),module.exports.destroy=function(e){hammerAry[e.datahamnum].element&&removeListener.push(e.datahamnum),hammerAry[e.datahamnum].destroy()},r.add(new Hammer.Pan({threshold:0})),r.add(new Hammer.Pinch({enable:!0,threshold:0})),r.add(new Hammer.Rotate({enable:!0,threshold:0})),r.get("pinch").recognizeWith(r.get("rotate"));var u=0,m=0;r.on("panstart panmove panend",function(e){1==e.maxPointers&&(xy[a].x=e.deltaX+u,xy[a].y=e.deltaY+m,e.type,"panend"==e.type&&(u=xy[a].x,m=xy[a].y),"function"==typeof t&&t(xy[a]))});var h=1;r.on("pinchend pinchmove",function(e){xy[a].scale=e.scale*h,"pinchend"==e.type&&(h=xy[a].scale),"function"==typeof t&&t(xy[a])});var s=0,d=s,y=s;r.on("rotatestart rotateend rotatemove",function(e){"rotatestart"==e.type&&(d=e.rotation),"rotatemove"==e.type&&(xy[a].rotate=y=e.rotation-d+s,360<=Math.abs(y)&&(xy[a].rotate=y=0)),"rotateend"==e.type&&(s=y),"function"==typeof t&&t(xy[a])}),"boolean"!=typeof n&&void 0!==n||n&&GuoInit.DOMmousewheel.Fun(e,t)}},GuoInit.Guonewobj={Fun:function(e,t,n,a){this.x=e,this.y=t,this.scale=n,this.rotate=a}},GuoInit.DOMmousewheel={Fun:function(e,t){window.addEventListener?e.addEventListener("onmousewheel"in window?"mousewheel":"DOMMouseScroll",function(){0<=removeListener.indexOf(e.datahamnum)||GuoInit.DOMmousewheel.FunListener(e,t)},!1):window.attachEvent&&e.attachEvent("onmousewheel",function(){0<=removeListener.indexOf(e.datahamnum)||GuoInit.DOMmousewheel.FunListener(e,t)},!1)},FunListener:function(e,t){event.returnValue?event.returnValue=!1:event.preventDefault();var n="obj_"+e.datahamnum;GuoInit.DOMmousewheel.FunEvent(n),"function"==typeof t&&t(xy[n])},FunEvent:function(e){event.type;return 0<event.wheelDelta||event.detail<0?(xy[e].scale*=.96,1):event.wheelDelta<0||0<event.detail?(xy[e].scale*=1.04,-1):void 0}},module.exports=GuoInit.GuoImgHam.Fun;
var hamjs=require("hammerjs"),hammerAry=[],GuoInit={},xy={},i=0,removeListener=[];GuoInit.GuoImgHam={Fun:function(e,t,n){var o="obj_"+i;e.datahamnum=i,i++;var a=new GuoInit.Guonewobj.Fun(0,0,1,0);xy[o]=a;var r=new Hammer.Manager(e);hammerAry.push(r),module.exports.destroy=function(e){hammerAry[e.datahamnum].element&&removeListener.push(e.datahamnum),hammerAry[e.datahamnum].destroy()},r.add(new Hammer.Pan({threshold:0})),r.add(new Hammer.Pinch({enable:!0,threshold:0})),r.add(new Hammer.Rotate({enable:!0,threshold:0})),r.get("pinch").recognizeWith(r.get("rotate"));var u=0,m=0;r.on("panstart panmove panend",function(e){1==e.maxPointers&&(e.type,"panmove"==e.type&&(xy[o].x=e.deltaX+u,xy[o].y=e.deltaY+m),"panend"==e.type&&(u=xy[o].x,m=xy[o].y),"function"==typeof t&&t(xy[o]))});var h=1;r.on("pinchend pinchmove",function(e){xy[o].scale=Math.floor(e.scale*h*100)/100==0?.01:Math.floor(e.scale*h*100)/100,"pinchend"==e.type&&(h=xy[o].scale),"function"==typeof t&&t(xy[o])});var s=0,l=s,d=s;r.on("rotatestart rotateend rotatemove",function(e){"rotatestart"==e.type&&(l=Math.floor(100*e.rotation)/100),"rotatemove"==e.type&&(xy[o].rotate=d=Math.floor(100*(e.rotation-l+s))/100,360<=Math.abs(d)&&(xy[o].rotate=d=0)),"rotateend"==e.type&&(s=d),"function"==typeof t&&t(xy[o])}),"boolean"!=typeof n&&void 0!==n||n&&GuoInit.DOMmousewheel.Fun(e,t)}},GuoInit.Guonewobj={Fun:function(e,t,n,o){this.x=e,this.y=t,this.scale=n,this.rotate=o}},GuoInit.DOMmousewheel={Fun:function(e,t){window.addEventListener?e.addEventListener("onmousewheel"in window?"mousewheel":"DOMMouseScroll",function(){0<=removeListener.indexOf(e.datahamnum)||GuoInit.DOMmousewheel.FunListener(e,t)},!1):window.attachEvent&&e.attachEvent("onmousewheel",function(){0<=removeListener.indexOf(e.datahamnum)||GuoInit.DOMmousewheel.FunListener(e,t)},!1)},FunListener:function(e,t){event.returnValue?event.returnValue=!1:event.preventDefault();var n="obj_"+e.datahamnum;GuoInit.DOMmousewheel.FunEvent(n),"function"==typeof t&&t(xy[n])},FunEvent:function(e){event.type;return 0<event.wheelDelta||event.detail<0?(xy[e].scale=Math.floor(.96*xy[e].scale*100)/100,1):event.wheelDelta<0||0<event.detail?(xy[e].scale=Math.floor(1.04*xy[e].scale*100)/100,-1):void 0}},module.exports=GuoInit.GuoImgHam.Fun;
{
"name": "domhammer",
"version": "1.0.0",
"version": "1.0.2",
"description": "控制DOM结构移动、缩放、旋转的集成方法,支持鼠标开启部分功能操作;Move, zoom, rotate the mobile device DOM element, then output the total amount of change.Pc device partial support.",

@@ -24,3 +24,3 @@ "main": "domhammer.js",

"dependencies":{
"screen-pl": "^1.0.0",
"screen-pl": "^1.0.1",
"hammerjs": "^2.0.8"

@@ -27,0 +27,0 @@ }