<krpano version="1.0.8" idletime="2.0" onstart="startrotateright2()">

	<view fovtype="HFOV"
	      limitview="fullrange"
	      maxpixelzoom="1.0"
	      />

	<control zoomtocursor="true"
	         zoomoutcursor="true"
	         mousetype="drag2D"
	         mousespeed="0"
	         />

	<display flash10="on"
	         movequality="HIGH" stillquality="HIGHSHARP"
	         movequality10="HIGH" stillquality10="HIGH"
	         />

	<events onenterfullscreen="set(plugin[openfs].visible,false); set(plugin[closefs].visible,true);"
	        onexitfullscreen ="set(plugin[openfs].visible,true);  set(plugin[closefs].visible,false);"
	        onmousedown="mdown();"
	        onmouseup="mup();"
	        onidle="showup_rotate_buttons();"
	        onviewchange="if(fullviewfov===null, if(view.fov != 90, copy(fullviewfov,view.fov);roundval(fullviewfov,1); ));
	                      copy(fovrounded,view.fov);
	                      roundval(fovrounded,1);
	                      if(fovrounded LT fullviewfov, set(control.mousespeed,10), set(control.mousespeed,0));"
	        />


	<!-- object mouse rotate action -->
	<action name="mdown">
		if(control.mousespeed == 0,
			set(mbdown, true);
			set(lastframepos,null);
			objectrotate();
		  );
	</action>

	<action name="mup">
		set(mbdown, false);
	</action>

	<action name="objectrotate">
		div(mxpos, mouse.x, stagewidth);
		mul(framepos, mxpos, image.frames);
		roundval(framepos);

		if(lastframepos == null, copy(lastframepos,framepos));

		sub(framemove, lastframepos, framepos);
		copy(lastframepos,framepos);

		set(rotatedirection, right);
		if(framemove LT 0, mul(framemove,framemove,-1); set(rotatedirection, left); );

		if(mbdown,
			if(framemove != 0,
				if(rotatedirection == left,
					dec(image.frame,get(framemove),1,get(image.frames));
				   ,
					inc(image.frame,get(framemove),get(image.frames),1);
				  );
			  );

			delayedcall(0.01,objectrotate());
		  );
	</action>

	<textstyle name="buttonstyle" font="Arial" fontsize="12" bold="true" italic="true"
	           textcolor="0x000000" background="false" border="false"
	           blendmode="layer" effect="glow(0xFFFFFF,0.85,4,4);dropshadow(2,45,0x000000,4,1);"
	           origin="cursor" edge="bottom" xoffset="15" yoffset="-5" showtime="0.1" fadeintime="0.1" fadetime="0.1"
	           />

	<style name="button" url="%SWFPATH%/skin/buttons.png" zorder="3" keep="true" />

	
	<action name="showup_rotate_buttons">
		tween(plugin[rotaterightbg].alpha, 0.7, 1.5, easeOutQuad, tween(plugin[rotaterightbg].alpha, 0.0, 2.5, easeInExpo));
		tween(plugin[rotateleftbg].alpha,  0.7, 1.5, easeOutQuad, tween(plugin[rotateleftbg].alpha,  0.0, 2.5, easeInExpo));
	</action>


	<action name="startrotateleft">
		set(rotateing,true);
		rotateleft();
	</action>

	<action name="startrotateright">
		set(rotateing,true);
		rotateright();
	</action>

	<action name="rotateleft">
		dec(image.frame,1,1,get(image.frames));
		delayedcall(0.02, if(rotateing,rotateleft()) );
	</action>

	<action name="rotateright">
		inc(image.frame,1,get(image.frames),1);
		delayedcall(0.02,  if(rotateing,rotateright()) );
	</action>

	<action name="startrotateright2">
		set(rotateing,true);
		rotateright2();
	</action>
		<action name="rotateright2">
		inc(image.frame,1,get(image.frames),1);
		delayedcall(0.1,  if(rotateing,rotateright2()) );
	</action>

	<action name="stoprotate">
		set(rotateing,false);
	</action>

</krpano>
