Hi there,
I've just modified a little bit this module to add the mouse-click event on nodes, which will rotate until the node clicked (by the shorter way). Here is the new function on NodeRotator.js, NodeRotator.prototype.displayTo:
NodeRotator.prototype.displayTo = function(nodeTo, profile){
var newNode = (this.nodes.length - nodeTo) % this.nodes.length;
var currentAngle = this.offsetAngle[this.currentNode];
var nextAngle = this.offsetAngle[newNode];
if(Math.abs(nextAngle - currentAngle) > 180)
{
if(nextAngle > currentAngle)
currentAngle += 360;
else
nextAngle += 360;
}
if(nextAngle > currentAngle)
{
var range = nextAngle - currentAngle;
for (angle = currentAngle; angle <= nextAngle; angle += profile[parseInt((angle - currentAngle) / range * profile.length)]){
this.enqueueFrame(this.renderFrameInfo(angle));
}
}
else
{
var range = currentAngle - nextAngle;
for (angle = currentAngle; angle >= nextAngle; angle -= profile[parseInt((currentAngle - angle) / range * profile.length)]){
this.enqueueFrame(this.renderFrameInfo(angle));
}
}
this.play();
this.currentNode = newNode;
}
Also is needed to add the next portion of code at the end of buttonBehaviour (inside the function!) at NodeRotator.js:
for(var i = 0; i < this.nodes.length; i++){
this.nodeObjects[i].data("turntable-pos", i);
$(this.nodeObjects[i]).click(
function(){
thisObject.displayTo($(this).data("turntable-pos"),NodeRotator.profileSmooth);
return false;
}
);
}
These changes alone will give you on-click control. Also, you can add options in setting page to control wether or not to use this behaviour.
See you!!
emi
Comments
Comment #1
Scheepers de Bruin commentedFantastic! Thanks so much for this, I'll include in the next release!
See you
s
Comment #2
Scheepers de Bruin commentedHmmm.... this does, however leave links in the nodes unclickable...
Comment #3
lolandese commentedOn the demosite (http://opencontent.uct.ac.za/) this seems to be solved. I tried to reproduce using the resources of that page, but with no luck. :(
Great module! Really hope you continue. :)