[]点击区域问题
发现精灵的点击区域不对,要怎么弄呢,下面是代码
var space = Browser.clientWidth / 12;
var btnWidth = (Browser.clientWidth - space * 5) / 4;
var btnHeight = btnWidth;
btn_bottom.size(btnWidth, btnHeight);
scaleX = btnWidth / btn_imgWidth;
scaleY = btnHeight / btn_imgHeight;
var scaleMin = scaleX > scaleY ? scaleY : scaleX;
btn_bottom[i].pos(btnWidth * i + space * (i + 1), Browser.clientHeight - btnHeight - 10);
btn_bottom[i].scale(scaleMin, scaleMin);
var rect = new Laya.Rectangle(btnWidth * i + space * (i + 1), Browser.clientHeight - btnHeight - 10, btnWidth, btnHeight);
console.log("rect"+i+":"+rect);
// btn_bottom[i].hitArea = rect;
btn_bottom[i].on("click", this, bottomClick, [i]);[/i][/i][/i][/i][/i]
不加hitArea时,点击区域在左上方一小块,加了后完全无效
var space = Browser.clientWidth / 12;
var btnWidth = (Browser.clientWidth - space * 5) / 4;
var btnHeight = btnWidth;
btn_bottom.size(btnWidth, btnHeight);
scaleX = btnWidth / btn_imgWidth;
scaleY = btnHeight / btn_imgHeight;
var scaleMin = scaleX > scaleY ? scaleY : scaleX;
btn_bottom[i].pos(btnWidth * i + space * (i + 1), Browser.clientHeight - btnHeight - 10);
btn_bottom[i].scale(scaleMin, scaleMin);
var rect = new Laya.Rectangle(btnWidth * i + space * (i + 1), Browser.clientHeight - btnHeight - 10, btnWidth, btnHeight);
console.log("rect"+i+":"+rect);
// btn_bottom[i].hitArea = rect;
btn_bottom[i].on("click", this, bottomClick, [i]);[/i][/i][/i][/i][/i]
不加hitArea时,点击区域在左上方一小块,加了后完全无效
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
cuixueying
赞同来自: