官方API:

 

 

 groupOut全局坐标(50,50)

gourpIn全局坐标(100,100),并嵌套在groupOut里

btn全局坐标(150,150),并嵌套在groupIn里

 

获取组件全局坐标时,必须调用自己上层容器的localToGlobal方法

 获取btn的全局坐标

console.log(this.groupIn.localToGlobal(this.btn.x, this.btn.y)); //150,150

获取groupIn的全局坐标

console.log(this.groupOut.localToGlobal(this.groupIn.x, this.groupIn.y)); //100,100

 

 

全局坐标转成groupIn的局部坐标

console.log(this.groupIn.globalToLocal(150,150));  //50,50

 

posted on 2017-11-14 09:44  gamedaybyday  阅读(1382)  评论(0编辑  收藏  举报