Mac : 右键creator->显示包内容->Contents->Resources->engine->bin->cocos2d-js-for-preview.js
内容 :
page ->10352
var _touchEndHandler = function(touch, event) { var pos = touch.getLocation(); var node = this.owner; node._hitTest(pos, this) ? event.type = EventType.TOUCH_END : event.type = EventType.TOUCH_CANCEL; event.touch = touch; var arr = []; var sortFun = function(node,arr){ if(node.parent){ var name = node.name; if(name == 'baseNode'){ arr.unshift(name); return arr; }else{ arr.unshift(name); return sortFun(node.parent,arr); } }else{ arr.unshift('baseNode'); return arr; } } var arrSort = sortFun(node,arr); var pathStr = arrSort.join("/"); console.log(pathStr); event.bubbles = true; node.dispatchEvent(event); };
加入名为sortFun的递归方法
baseNode是场景的基准节点