[LayaAirIDE2]鼠标滑轮只能放大模型,不能缩小模型
Laya.stage.on(Laya.Event.MOUSE_WHEEL,this,function(e){
console.log(e)
if(e.delta>0){
let currScale =this.scene.getChildByName("AirPlayer").transform.scale;
let newScale;
if (e.delta > 0) {
newScale = currScale.x + 0.1 > 2 ? 2 : (currScale.x + 0.1 < 0.2 ? 0.2 : (currScale.x + 0.1));
}
else if (e.delta < 0)
{
newScale = currScale.x - 0.1 > 2 ? 2 : (currScale.x - 0.1 < 0.2 ? 0.2 : (currScale.x - 0.1));
}
this.scene.getChildByName("AirPlayer").transform.scale = new Laya.Vector3(newScale,newScale,newScale);
}
})
没有找到相关结果
已邀请:
1 个回复
layabox
赞同来自: