我想拖动结束时获取到鼠标底下的节点,但是看了一下好像没有类似u3d的event.gameobject的api,不知道有没有别的方法可以实现类似的效果?
start() {
this.sprite = this.node.getComponent(cc.Sprite);
this.originPos = this.node.position;
cc.log(this.originPos);
//开启监听
this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
},
onTouchStart: function (event) {
this.node.setScale(1, 1);
},
onTouchMove: function (event) {
var location = event.getLocation();
this.node.position = this.node.parent.convertToNodeSpaceAR(location);
},
onTouchEnd: function (event) {
this.node.setScale(0.8, 0.8);
///////
},