﻿<krpano>
<!-- pic-player.xml 1.19 -->

<action name="pic_open">
if(layer[_pic_bg_],
	<!-- error -->
	,

	<!-- step one - add a background layer and fade it in -->
	addlayer(_pic_bg_);
	set(layer[_pic_bg_].type, container);
	set(layer[_pic_bg_].zorder, 999999);
	set(layer[_pic_bg_].align, lefttop);
	set(layer[_pic_bg_].width, 100%);
	set(layer[_pic_bg_].height, 100%);
	set(layer[_pic_bg_].bgcolor, 0x000000);
	set(layer[_pic_bg_].bgalpha, 0.8);
	set(layer[_pic_bg_].bgcapture, true);
	set(layer[_pic_bg_].handcursor, false);
	set(layer[_pic_bg_].alpha, 0.0);
	set(layer[_pic_bg_].onclick, pic_close() );
	tween(layer[_pic_bg_].alpha, 1.0, 0.5, default,
		<!-- step two - after the fade-in add the pic plugin -->
		addlayer(pic_plugin);
		set(layer[pic_plugin].parent, layer[_pic_bg_]);
		set(layer[pic_plugin].align, center);
		set(layer[pic_plugin].onclick, pic_close());
		set(layer[pic_plugin].alpha, 0.0);
		set(layer[pic_plugin].scale, 0.0);
		if('%2' != null, set(layer[pic_plugin].width, %2););
		if('%3' != null, set(layer[pic_plugin].height, %3););
		set(layer[pic_plugin].onloaded, pic_plugin_ready(%1) );
		set(layer[pic_plugin].url,%1);
		);
	);
</action>

<action name="pic_plugin_ready">
if(layer[pic_plugin],
	pic_plugin_resize();
	tween(scale,1,0.5,easeOutBack);
	tween(alpha,1,0.5,default);
	);
</action>

<action name="pic_plugin_resize">
<!-- use 90% width or height of available screen size -->
div(aspect, layer[pic_plugin].imagewidth, layer[pic_plugin].imageheight);
mul(new_picwidth, stagewidth, 0.90);
div(new_picheight, new_picwidth, aspect);
mul(max_picheight, stageheight, 0.90);
if(new_picheight GT max_picheight,
	copy(new_picheight, max_picheight);
	mul(new_picwidth, new_picheight, aspect);
	);
roundval(new_picwidth);
roundval(new_picheight);
copy(layer[pic_plugin].width, new_picwidth);
copy(layer[pic_plugin].height, new_picheight);
</action>

<action name="pic_close">

set(layer[_pic_bg_].onclick, null);

tween(layer[pic_plugin].scale, 0.0, 0.5, easeInBack);
tween(layer[_pic_bg_].alpha, 0.0, 0.5, default,
	removelayer(pic_plugin);
	removelayer(_pic_bg_);
	);
<!-- if (!global.back_visible,skin_showskin()); -->
</action>

</krpano>
