<?xml version="1.0" encoding="UTF-8"?>
<krpano version="1.19">

    
  <!-- Spot Style - Load panorama -->
  <style name="IconLoadpanorama"
         url="%FIRSTXML%/spots/hotspot_neutral_sequence_user_defaultpoint5.png"
         visible="false"
         frame="0"
         lastframe="17"
         framewidth="40"
         frameheight="40"
         stopspotsequence="false"
         crop="0|0|40|40"

         onloaded="startspotanimation(0.1);"
         onhover="onhoverIconLoadpanorama"
         onout="onoutIconLoadpanorama"


         />

  <action name="onhoverIconLoadpanorama">
    showtooltip('hotspot');
  </action>


  <action name="onoutIconLoadpanorama">
    hideTooltip();



  </action>



<action name="setViewNormal">
	stopSetViewTweens();
	if(current_view_isflat === true,
		setViewNonFlat(VFOV);
	);
	setViewNormalComplete();
</action>

<action name="setViewNormalComplete">
	set(view.fisheyefovlink, 0.5);
	set(view.fovmax, get(panoview.fovmax));
	tween(view.architectural, 0.0, distance(1.0, 0.45));
	tween(view.pannini, 0.0, distance(1.0, 0.45), easeOutQuad, if(panniniViewActivated,restoreViewFromPannini();););
	tween(view.vlookat, get(panoview.v), distance(90, 0.45));
	tween(view.fov, get(panoview.fov), distance(50, 0.45));
	tween(view.fisheye, 0.0, distance(1.0, 0.45),
		set(view.stereographic,false);
	);
</action>

<krpano normalViewActivated="true" />
<action name="stopSetViewTweens">
	stoptween(view.fov);
	stoptween(view.vlookat);
	stoptween(view.fisheye);
	stoptween(view.architectural);
	stoptween(view.pannini);
</action>

  <!-- Hide / Show Controls -->
  <action name="hideTourControls">set(tour_displaycontrols, false);events.dispatch(hidetourcontrols);</action>
  <action name="showTourControls">set(tour_displaycontrols, true); events.dispatch(showtourcontrols);</action>


<action name="setViewArchitectural">
	if(normalViewActivated,stopSetViewTweens(););
	if(current_view_isflat === true,
		setViewNonFlat(VFOV);
	);
	setViewArchitecturalComplete();
</action>

<action name="setViewArchitecturalComplete">
	set(view.fovmax, get(panoview.fovmax));
	set(view.fisheyefovlink, 0.5);
	tween(view.architectural, 1.0, distance(1.0, 0.45));
	tween(view.pannini, 0.0, distance(1.0, 0.45), easeOutQuad, if(panniniViewActivated,restoreViewFromPannini();););
	tween(view.fisheye, 0.0, distance(1.0, 0.45), easeOutQuad, 
		set(view.stereographic,false);
		tween(view.vlookat, get(panoview.v), distance(90, 0.45));
	);
	tween(view.fov, get(panoview.fov), distance(50, 0.45));
</action>

<action name="viewControlMoveUp">
	if(%1,
		if(%2,
			set(isfullvertical, false);
			ifnot(scene[get(xml.scene)].planar,
				sub(viewvfov, panoview.vmax, panoview.vmin);
				if (viewvfov == 180,
					set(isfullvertical, true);
				);
			);
			if(isfullvertical == false AND calc(mod(view.vlookat, 90)-%2) LT view.vlookatmin,
				moveto(get(view.hlookat), get(view.vlookatmin));
			,
				moveto(get(view.hlookat), calc(mod(view.vlookat, 90)-%2));
			);
		,
			set(vlookat_moveforce, -1);
			delayedcall(0.1, viewControlMoveVertStop());
		);
	,
		set(vlookat_moveforce, -1);
	);
</action>
<action name="viewControlMoveDown">
	if(%1,
		if(%2,
			set(isfullvertical, false);
			ifnot(scene[get(xml.scene)].planar,
				sub(viewvfov, panoview.vmax, panoview.vmin);
				if (viewvfov == 180,
					set(isfullvertical, true);
				);
			);
			if(sceneisfull360 == false AND calc(mod(view.vlookat, 90)+%2) GT view.vlookatmax,
				moveto(get(view.hlookat), get(view.vlookatmax));
			,
				moveto(get(view.hlookat), calc(mod(view.vlookat, 90)+%2));
			);
		,
			set(vlookat_moveforce, +1);
			delayedcall(0.1, viewControlMoveVertStop());
		);
	,
		set(vlookat_moveforce, +1);
	);
</action>
<action name="viewControlMoveLeft">
	if(%1,
		if(%2,
			set(isfullhorizontal, false);
			ifnot(scene[get(xml.scene)].planar,
				sub(viewhfov, panoview.hmax, panoview.hmin);
				if (viewhfov == 360,
					set(isfullhorizontal, true);
				);
			);
			if(isfullhorizontal == false AND calc(view.hlookat-%2) LT view.hlookatmin,
				moveto(get(view.hlookatmin), get(view.vlookat));
			,
				moveto(calc(view.hlookat-%2), get(view.vlookat));
			);
		,
			set(hlookat_moveforce, -1);
			delayedcall(0.1, viewControlMoveHoriStop());
		);
	,
		set(hlookat_moveforce, -1);
	);
</action>
<action name="viewControlMoveRight">
	if(%1,
		if(%2,
			set(isfullhorizontal, false);
			ifnot(scene[get(xml.scene)].planar,
				sub(viewhfov, panoview.hmax, panoview.hmin);
				if (viewhfov == 360,
					set(isfullhorizontal, true);
				);
			);
			if(isfullhorizontal == false AND calc(view.hlookat+%2) GT view.hlookatmax,
				moveto(get(view.hlookatmax), get(view.vlookat));
			,
				moveto(calc(view.hlookat+%2), get(view.vlookat));
			);
		,
			set(hlookat_moveforce, +1);
			delayedcall(0.1, viewControlMoveHoriStop());
			
		);
	,
		set(hlookat_moveforce, +1);
	);
</action>
<action name="viewControlMoveHoriStop">
	set(hlookat_moveforce, 0);
</action>
<action name="viewControlMoveVertStop">
	set(vlookat_moveforce, 0);
</action>

<action name="viewControlZoomIn">
	if(%1,
		if(%2,
			if(%2 LT view.fovmin,
				zoomto(get(view.fovmin));
			,
				if(%2 LT view.fov,
					zoomto(%2);
				);
			);
		,
			set(fov_moveforce, -1);
			delayedcall(0.1, viewControlZoomStop());
		);
	,
		set(fov_moveforce, -1);
	);
</action>
<action name="viewControlZoomOut">
	if(%1,
		if(%2,
			if(%2 GT view.fovmax,
				zoomto(get(view.fovmax));
			,
				if(%2 GT view.fov,
					zoomto(%2);
				);
			);
		,
			set(fov_moveforce, +1);
			delayedcall(0.1, viewControlZoomStop());
		);
	,
		set(fov_moveforce, +1);
	);
</action>
<action name="viewControlZoomStop">
	set(fov_moveforce, 0);
</action>

  <action name="enableGyroscope">
    changeGyroscopeState(true);
  </action>
  <action name="disableGyroscope">
    changeGyroscopeState(false);
  </action>


<action name="setViewLittlePlanet">
	set(sceneisfull360, false);
	if(scene[get(xml.scene)].full360,
		sub(viewhfov, panoview.hmax, panoview.hmin);
		if (viewhfov == 360,
			sub(viewvfov, panoview.vmax, panoview.vmin);
			if (viewvfov == 180,
				set(sceneisfull360, true);
			);
		);
	);
	if (sceneisfull360 AND (device.webgl OR device.flash),
		if(normalViewActivated,stopSetViewTweens(););
		if(current_view_isflat === true,
			setViewNonFlat(VFOV);
		);
		setViewLittlePlanetComplete();
	);
</action>

<action name="setViewLittlePlanetComplete">
	set(backtonormalfirst,false);
	if(view.pannini GE 1.0, set(backtonormalfirst,true));
	if(view.stereographic == false, set(backtonormalfirst,true));
	if(backtonormalfirst, hideTooltip();tween(view.fisheye, 0.0 ,distance(1.0, 0.25), easeOutQuad, WAIT); );
	set(view.stereographic, true);
	set(view.fisheyefovlink, 1.5);
	tween(view.architectural, 0.0, 0.25);
	tween(view.vlookat, 90, distance(179, 1.50));
	tween(view.pannini, 0.0, distance(1.0, 0.75), easeOutQuad, if(panniniViewActivated,restoreViewFromPannini();););
	if(panoview.fovmax LE 150, set(view.fovmax, 150); , set(view.fovmax, get(panoview.fovmax)); );
	tween(view.fisheye, 1.0, distance(1.0, 0.75));
	tween(view.fov, 150, distance(179, 0.75));
</action>

  <!-- Fullscreen Management -->
  <action name="exitFullScreen" devices="fullscreensupport">set(tour_fullscreen,false);js(setFullscreen(false));</action>
  <action name="enterFullScreen" devices="fullscreensupport">set(tour_fullscreen,true);js(setFullscreen(true));</action>
  <action name="switchFullScreen">if(tour_fullscreen,exitFullScreen();,enterFullScreen(););</action>

  
  <events name="krpanoExitFullscreenEvent"
    onexitfullscreen="if(tour_fullscreen,exitFullScreenChangeEvent(););"
    keep="true" />

  <action name="exitFullScreenChangeEvent" devices="fullscreensupport">set(tour_fullscreen,false);events.dispatch(onexitfullscreen);</action>
  <action name="enterFullScreenChangeEvent" devices="fullscreensupport">set(tour_fullscreen,true);events.dispatch(onenterfullscreen);</action>
  <action name="exitFullScreenFallback">set(fullscreen,false);</action>
  <action name="enterFullScreenFallback">set(fullscreen,true);</action>
  
  <action name="resizeFullScreenEvent">delayedcall(0,updatescreen(););</action>

</krpano>