其实。这个就是写来玩玩的,也没有用上,就是仿照Jtopo的搜索查询功能写了一个单击闪烁并居中的函数
/**
* 单击时居中闪烁
* */
function clickCenter() {
var location = currentNode.getCenterLocation();
// 单击后居中
stage.setCenter(location.x, location.y);
// 居中时边框闪烁几下
var node = currentNode;
function nodeFlash(node, n){
if(n == 0) {
node.selected = false;
return;
};
node.selected = !node.selected;
setTimeout(function(){
nodeFlash(node, n-1);
}, 300);
}
// 闪烁n/2下
nodeFlash(node,6);
node.selectedLocation = null;
node.selectedSize = null;
scene.removeFromSelected(node);
}
然后在click事件中调用就可以了
node.addEventListener('click', function(event){
// 单击时居中闪烁
clickCenter();
});