Hi,
a few weeks ago i was experimenting to put the drag3d at the right mouse button.
As there seems to be no pressed and pressedelement on the rightbutton i came to this.
I have some question though.
so..
This seems to work quite nice
<style name="drag3dright" onover.addevent="hithot = name;" onout.addevent="hithot= '';hit = false;" />
<events name="rightmousebutton" keep="true" ondown="Drag3DDown();" onup="Drag3DUp();" />
<action name="Drag3DDown" type="js" >
<![CDATA[
var hot = krpano.get("hithot");
if(hot){
var mouse = krpano.mouse;
var hs = krpano.get("hotspot["+hot+"]");
var hit = hs.hit;
hs.onup = "hit = false;";
if(hit){
var view = krpano.view;
var mouse = krpano.mouse;
var viewx = view.tx - view.ox_rotated;
var viewy = view.ty - view.oy_rotated;
var viewz = view.tz - view.oz_rotated;
var distance = view.dir.x*(hit.x - viewx) + view.dir.y*(hit.y - viewy) + view.dir.z*(hit.z - viewz);
var startx = hs.tx - viewx;
var starty = hs.ty - viewy;
var startz = hs.tz - viewz;
var p1 = view.unproject(mouse.x, mouse.y, distance, true);
var loopid = krpano.actions.renderloop( function()
{
var p2 = view.unproject(mouse.x, mouse.y, distance, true);
hs.tx = startx + view.tx - view.ox_rotated + (p2.x - p1.x);
hs.ty = starty + view.ty - view.oy_rotated + (p2.y - p1.y);
hs.tz = startz + view.tz - view.oz_rotated + (p2.z - p1.z);
});
}
}
krpano.drag3dup = function(){
krpano.actions.stoprenderloop(loopid);
}
]]>
</action>
Display More
You can see that working here:
test
When you set the capture of the hotspot to false you need to change this (otherwise it behaves strange when you change view values ) :
<events name="rightmousebutton" keep="true" ondown="if(mouse.rightbutton, Drag3DDown());" onup="Drag3DUp();" />
Find that here:
test
My question basically is, why does the first example works in the first place on the rightmouse button?
My brain is a bit cracked
Obviously you could do something like this quite easily ( i didn't take the effort of making it nice etc.. just tech example):
test
You can shift click a model to rotate it and just click it again to remove the rotation helper.
Tuur