Skip to content

tPoint.rotation 范围问题 #6

@mask2012

Description

@mask2012

先支持一个!

我想做图片的缩放,旋转和拖动位置,目前试验到旋转,代码如下
mCallback:function(tPoint){
var _this=tPoint.self,
img=_this.find("img");
if(tPoint.mutiTouch){
if(!tPoint.startScale){
tPoint.setAttr("startScale",1);
tPoint.setAttr("startRotation",0);
}else{
_curScale=tPoint.startScale_tPoint.scale;
_curRotation=tPoint.startRotation+tPoint.rotation;
// img.css("-webkit-transform-origin","0 0");
img.css({
// width: _curScale_100+"%",
'-webkit-transform': 'scale('+_curScale+') rotate('+_curRotation+'deg)'
});
tPoint.setAttr("curScale",_curScale);
//$("#showT").html("起始缩放:"+tPoint.startScale+"
当前缩放:"+tPoint.curScale);
$("#showT").html("手势缩放比例:"+_curScale+"
旋转角度:"+tPoint.rotation);
}
}
//$("#showT").html(tPoint.gStartDis+" "+tPoint.gEndDis);
//$("#showT").html(tPoint.rotation+" "+tPoint.gStartAngle+" "+tPoint.gEndAngle);
},
eCallback:function(tPoint){
if(tPoint.curScale){
tPoint.setAttr("startScale",tPoint.curScale);
tPoint.setAttr("startRotation",_curRotation);
}
}

我用的-webkit-transform的scale 和rotate 来做的,但是有个小bug。

当我监测tPoint.rotatioin的时候,发现一个规律,就是在第一次开始转动的方向上,角度最多到达140度,就瞬间变成-40度 差总在180度。这样会造成图片的跳动,怎么破?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions