Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

Cocos-js鼠标滚轮监听事件

$
0
0

@yuchu123456 写道:

cc.eventManager.addListener(
{
event:cc.EventListener.MOUSE,
swallow:true,
//鼠标滚轮监听事件
onMouseScroll:function(event)
{
var content = self.m_clipper.getChildByName("stencil");
var yy = event.getScrollY();//滚轮上滑yy值大于0,下滑yy值小于0
if(yy > 0)
{
var curScale = content.getScale();
curScale += 0.01;
if(self.isScaleLimit(content,curScale))
content.setScale(curScale,curScale);
}
else{
var curScale = content.getScale();
curScale -= 0.01;
if(self.isScaleLimit(content,curScale))
content.setScale(curScale,curScale);
}
}

        },this);

帖子: 1

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>