It is likely because of your custom onNodeTypeClicked handler, that captures clicks in objects and prevents note placement from receiving information about these clicks:
viewer.onNodeTypeClicked(function (node, position, distance) {
var nodeTypePath = [];
while (node) {
nodeTypePath.push(node.type);
node = node.parent;
}
document.getElementById('distance').innerHTML = distance.toFixed(2);
return true;
});
Try removing this custom handler or returning false from it and checks if this fixes the problem.