Hi,
This thread comes in trying to answer to a post from Richard.
I would just like it to "move to and center" on double-click - just like Google street view.
After some search in the forum it seems there is a way to do...
Look at these post from KLAUS.
Explanation of jsmouse.swf plugin
Example to download
Also, it seems that an ondoubleclick event it is not yet implemented (but planned)... see here for reference: Any way to "double-click" to zoom?
So, as Klaus explains on the post above, I have used the jsmouse.swf plugin to be able to retrieve the mouse coordinates mouse.x and mouse.y and the screentosphere() function (note: these variables seem to be already implemented in Krpano 1.0.8 beta9 but the screentosphere() function does not... so the jsmouse.swf plugin is needed ) ...
And I have made a pseudo krpanodbclick() function to simulate an ondoubleclick event ...
So a code would be:
xml file: (Edited: I forgot the jsmouse.swf plugin)
<krpano version="1.0.8">
<events onclick="js(krpanodbclick(movetoscreentosphere()));" />
<plugin name="jsmouse" url="jsmouse.swf" keep="true" />
<image>
<cubestrip url="pano.jpg" />
</image>
</krpano>
Alles anzeigen
JavaScript to be added inside the html file:
<script type="text/javascript">
// <![CDATA[
function krpano()
{
return document.getElementById("krpanoSWFObject");
}
function krpanodbclick(arg) {
setTimeout("numclick = 0",300);
numclick = numclick + 1;
if (numclick == 2) {
eval(arg);
}
}
function movetoscreentosphere(){
var mousex = krpano().get("mouse.x");
var mousey = krpano().get("mouse.y");
var hvs = krpano().get("screentosphere("+mousex +","+mousey +")");
var hva = hvs.split(",");
var ath = Number( hva[0] );
var atv = Number( hva[1] );
krpano().call("moveto("+ ath +","+ atv +")");
}
// ]]>
</script>
Alles anzeigen
I have tried this and it works ...
SAlut.