mul(stagescale,get(vrtourdevicescale));
setControlMode(drag);
setControlMode(moveto);
if (device.desktop,
set(control.mouse, %1);
set(tour_controlmodemousetype, %1);
,
set(control.touch, %1);
set(tour_controlmodetouchtype, %1);
);
events.dispatch(oncontrolmodechanged);
txtadd(real_message_id, get(tour_language), "_", %2);
set(%1, get(data[get(real_message_id)].content));
set(tour_displayspots, false);
set(nb_spots, get(hotspot.count));
if (nb_spots != 0, hidepanospotsaction(); );
events.dispatch(hotspots_visibility_changed);
set(tour_displayspots, true);
set(nb_spots, get(hotspot.count));
if (nb_spots != 0, showpanospotsaction(); );
events.dispatch(hotspots_visibility_changed);
set(nb_spots, get(hotspot.count));
if (nb_spots != 0,
if (tour_displayspots, showpanospotsaction(); , hidepanospotsaction(); );
);
ifnot (tour_firststartactiondone,
set(tour_firststartactiondone, true);
events.dispatch(onTourStart);
);
events.dispatch(onPanoStart);
js(eventTourStarted());
loadscene(%1, get(projection_current_params), MERGE);
if (xml.scene != %1,
events.dispatch(onleavingscene, true);
interruptAnimation();
loadscene(%1, get(projection_current_params), MERGE, get(ptblendmode));
);
copy(sceneprevnexti, scene[get(xml.scene)].index);
dec(sceneprevnexti);
if (sceneprevnexti LT 0, sub(sceneprevnexti, scene.count, 1););
mainloadscene(get(scene[get(sceneprevnexti)].name));
copy(sceneprevnexti, scene[get(xml.scene)].index);
inc(sceneprevnexti);
if (sceneprevnexti GE scene.count, set(sceneprevnexti, 0););
mainloadscene(get(scene[get(sceneprevnexti)].name));
if(tour_autorotation_pausecounter LE 0,
set(tour_autorotateenabled, true );
invalidatescreen();
set(autorotate.enabled, true);
set(tour_autorotation_pausecounter, 0);
events.dispatch(onstartautorotation);
if(tour_autotourenabled,
resetautotourvariables();
);
);
set(tour_autorotateenabled, false);
set(autorotate.enabled, false);
events.dispatch(onstopautorotation);
if(tour_autotourenabled,
stopautotourtimer();
);
if(%1 == forceplugin,
inc(tour_autorotation_pauseplugin);
);
inc(tour_autorotation_pausecounter);
if(tour_autorotateenabled,
set(autorotate.enabled, false);
events.dispatch(onpauseautorotation);
if(tour_autotourenabled AND useautotourdelay == false,
stopautotourtimer();
);
);
if(%1 == forceplugin,
if (tour_autorotation_pauseplugin GT 0,
dec(tour_autorotation_pauseplugin);
);
);
if (tour_autorotation_pausecounter GE 0,
if(%1 != forceresume,
if ((tour_autorotation_pausecounter GT 0) AND (tour_autorotation_pausecounter GT tour_autorotation_pauseplugin),
dec(tour_autorotation_pausecounter);
);
);
);
if(tour_autorotateenabled,
if(tour_autorotation_pausecounter == 0,
if(%1 != forceresume,
set(autorotate.enabled, true);
events.dispatch(onresumeautorotation);
if(tour_autotourenabled,
resetautotourvariables();
);
);
);
,
if(%1 != forceresume,
if(%1 != forceplugin,
if(%1 != forcehotspot,
startautorotation();
);
,
set(forceAutorotationFromPluginUnload, false);
if(action['autorotationatstart'],
set(forceAutorotationFromPluginUnload, true);
);
if(action['autotouratstart'],
set(forceAutorotationFromPluginUnload, true);
);
if(forceAutorotationFromPluginUnload,
if(tour_autorotation_openatstartplugin == 1,
if((tour_autorotation_pauseplugin LE 0) AND (tour_autorotation_pausecounter LE 0),
startautorotation();
);
);
);
);
);
);
if (norotation === null, startautorotation(););
set(events[autorotationstartevents].keep, false);
set(tour_autotourenabled, true);
startautorotation();
events.dispatch(onstartautotour);
stopautotourtimer();
if (scene[get(xml.scene)].planar,
set(autotourdelay, 10);
delayedcall(autotour_call_id, get(autotourdelay), autotourtimer);
,
set(autotourHorizontalStartValue, get(view.hlookat));
if ((panoview.hmin == -180) AND (panoview.hmax == 180),
delayedcallAutotourFull360();
,
set(previousStep, 0);
set(panoramaHorizontalSize, 0);
set(totalPartialSize, 0);
set(firstBorderSize, 0);
set(secondBorderSize, 0);
set(firstStep, 0);
set(firstStepTest, 0);
set(firstStepKeep, 0);
set(borderCounter, 0);
sub(panoramaHorizontalSize, get(panoview.hmax), get(panoview.hmin));
Math.abs(panoramaHorizontalSize);
delayedcallAutotourPartial();
);
);
sub(tempPosition, get(view.hlookat), get(autotourHorizontalStartValue));
Math.ceil(tempPosition);
Math.abs(tempPosition);
if(borderCounter == 0 AND tempPosition LT previousStep,
inc(borderCounter);
Math.abs(firstStep, get(previousStep));
sub(firstStepTest, get(previousStep), get(firstStep));
set(firstStepKeep, get(firstStepTest));
Math.abs(firstBorderSize, get(previousStep));
add(totalPartialSize, get(firstBorderSize));
);
if(borderCounter GE 1,
if(firstBorderSize != 0,
sub(firstStepTest, get(previousStep), get(firstStep));
Math.abs(firstStepTest, get(firstStepTest));
if(firstStepTest LT firstStepKeep,
add(totalPartialSize, get(firstBorderSize));
set(firstBorderSize, 0);
);
set(firstStepKeep, get(firstStepTest));
,
if(tempPosition LT previousStep,
inc(borderCounter);
Math.abs(secondBorderSize, get(previousStep));
add(totalPartialSize, get(secondBorderSize));
);
);
);
set(previousStep, get(tempPosition));
if(borderCounter GE 2 AND totalPartialSize GT panoramaHorizontalSize,
delete(previousStep, panoramaHorizontalSize, totalPartialSize, firstBorderSize, secondBorderSize, firstStep, firstStepTest, firstStepKeep, borderCounter);
autotourtimer();
,
delayedcall(autotour_call_id, 0.5, delayedcallAutotourPartial);
);
sub(tempPosition, get(view.hlookat), get(autotourHorizontalStartValue));
mod(tempPositionMod, get(tempPosition), 360);
Math.ceil(tempPosition);
Math.ceil(tempPositionMod);
if(tempPositionMod == tempPosition,
delayedcall(autotour_call_id, 0.5, delayedcallAutotourFull360);
,
autotourtimer();
);
set(tour_autotourenabled, false);
stopautotourtimer();
stopautorotation();
events.dispatch(onstopautotour);
if(tour_autotourenabled,
if(tour_autorotateenabled,
if(autorotate.enabled,
stopautotour();loadNextScene();
startautotour();
);
);
);
stopdelayedcall(autotour_call_id);
if(tour_autotourenabled, resetautotourvariables(););
if(tour_autotourenabled, if(%1, resetautotourvariables();, stopautotourtimer();););
txtadd(tour_deeplinkingvars, "s=", get(xml.scene));
set(viewhlookat, get(view.hlookat));roundval(viewhlookat, 4);
mod(viewhlookat, 360);
if (viewhlookat GT 180,
sub(viewhlookat, 360);
,
if (viewhlookat LT -180, add(viewhlookat, 360));
);
set(viewvlookat, get(view.vlookat));roundval(viewvlookat, 4);
set(viewfov, get(view.fov));roundval(viewfov, 4);
txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&h=", get(viewhlookat));
txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&v=", get(viewvlookat));
txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&f=", get(viewfov));
if (%1 !== null,if (%1, txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&skipintro");););
if (%2 !== null,if (%2, txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&norotation");););
if (tour_stopsequence == false,
if (stopspotsequence == false,
txtadd(delayedname, %1, 'delay');
if(hotspot[%1].loaded,
inc(hotspot[%1].frame,1,get(hotspot[%1].lastframe),0);
mul(hotspot[%1].ypos,get(hotspot[%1].frame),get(hotspot[%1].frameheight));
txtadd(hotspot[%1].crop,'0|',get(hotspot[%1].ypos),'|',get(hotspot[%1].framewidth),'|',get(hotspot[%1].frameheight));
);
delayedcall(get(delayedname),%2,animate(%1,%2));
);
);
set(tour_stopsequence, false);
set(stopspotsequence , false);
animate(get(name), %1);
set(hotspot[%1].stopspotsequence, true);
txtadd(delayedname, %1, 'delay');
stopdelayedcall(get(delayedname));
if(tour_stopsequence == false,
set(tour_stopsequence, true);
);
if (tooltip !== null,
getmessage(currentTooltipText, get(tooltip));
if (%2 == null,
set(tooltipCurrentTextfieldLayer, "panotourTooltipDefaultText");
,
set(tooltipCurrentTextfieldLayer, %2);
);
ifnot (currentTooltipText == "",
tooltipTextSettingsUpdate(%1, %3, %4, %5, %6);
set(tooltipHtmlText, get(currentTooltipText));
escape(tooltipHtmlText);
set(layer[get(tooltipCurrentTextfieldLayer)].html, get(tooltipHtmlText));
set(layer[get(tooltipCurrentTextfieldLayer)].visible, true);
set(layer[get(tooltipCurrentTextfieldLayer)].tag, "tooltip");
div(halfWidth, get(layer[get(tooltipCurrentTextfieldLayer)].width), 2);
div(halfHeight, get(layer[get(tooltipCurrentTextfieldLayer)].height), 2);
set(usedWidth, get(halfWidth));
set(usedHeight, get(halfHeight));
if(layer[get(tooltipCurrentTextfieldLayer)].edge == "left",
set(usedWidth, get(layer[get(tooltipCurrentTextfieldLayer)].width));
add(rightMargin, get(mouse.x), get(usedWidth));
set(leftMargin, get(mouse.x));
,
if(layer[get(tooltipCurrentTextfieldLayer)].edge == "right",
set(usedWidth, get(layer[get(tooltipCurrentTextfieldLayer)].width));
set(rightMargin, get(mouse.x));
sub(leftMargin, get(mouse.x), get(usedWidth));
,
add(rightMargin, get(mouse.x), get(usedWidth));
sub(leftMargin, get(mouse.x), get(usedWidth));
);
);
add(rightMargin, get(layer[get(tooltipCurrentTextfieldLayer)].xoffset));
add(leftMargin, get(layer[get(tooltipCurrentTextfieldLayer)].xoffset));
if(layer[get(tooltipCurrentTextfieldLayer)].edge == "bottom",
set(usedHeight, get(layer[get(tooltipCurrentTextfieldLayer)].height));
sub(topMargin, get(mouse.y), get(usedHeight));
set(bottomMargin, get(mouse.y));
,
if(layer[get(tooltipCurrentTextfieldLayer)].edge == "top",
set(usedHeight, get(layer[get(tooltipCurrentTextfieldLayer)].height));
set(topMargin, get(mouse.y));
add(bottomMargin, get(mouse.y), get(usedHeight));
,
sub(topMargin, get(mouse.y), get(usedHeight));
add(bottomMargin, get(mouse.y), get(usedHeight));
);
);
add(topMargin, get(layer[get(tooltipCurrentTextfieldLayer)].yoffset));
add(bottomMargin, get(layer[get(tooltipCurrentTextfieldLayer)].yoffset));
if(leftMargin LT 0,
set(layer[get(tooltipCurrentTextfieldLayer)].align, "left");
set(tooltipPositionX, get(usedWidth));
,
set(tooltipstagewidth, get(stagewidth));
if(area.left, sub(tooltipstagewidth, get(area.left)));
if(area.right, sub(tooltipstagewidth, get(area.right)));
if(rightMargin GT tooltipstagewidth,
set(layer[get(tooltipCurrentTextfieldLayer)].align, "right");
set(tooltipPositionX, get(usedWidth));
,
div(tooltipPositionX, get(tooltipstagewidth), 2);
sub(tooltipPositionX, get(mouse.x), get(tooltipPositionX));
add(tooltipPositionX, get(layer[get(tooltipCurrentTextfieldLayer)].xoffset));
);
);
set(layer[get(tooltipCurrentTextfieldLayer)].x, get(tooltipPositionX));
if(topMargin LT 0,
if(layer[get(tooltipCurrentTextfieldLayer)].align == "center",
set(layer[get(tooltipCurrentTextfieldLayer)].align, "top");
,
txtadd(layer[get(tooltipCurrentTextfieldLayer)].align, "top");
);
set(tooltipPositionY, get(usedHeight));
,
set(tooltipstageheight, get(stageheight));
if(area.top, sub(tooltipstageheight, get(area.top)));
if(area.bottom, sub(tooltipstageheight, get(area.bottom)));
if(bottomMargin GT tooltipstageheight,
if(layer[get(tooltipCurrentTextfieldLayer)].align == "center",
set(layer[get(tooltipCurrentTextfieldLayer)].align, "bottom");
,
txtadd(layer[get(tooltipCurrentTextfieldLayer)].align, "bottom");
);
set(tooltipPositionY, get(usedHeight));
,
div(tooltipPositionY, get(tooltipstageheight), 2);
sub(tooltipPositionY, get(mouse.y), get(tooltipPositionY));
add(tooltipPositionY, get(layer[get(tooltipCurrentTextfieldLayer)].yoffset));
);
);
set(layer[get(tooltipCurrentTextfieldLayer)].y, get(tooltipPositionY));
);
);
if(get(tooltipCurrentTextfieldLayer) != "",
set(layer[get(tooltipCurrentTextfieldLayer)].align, "center");
if (%2 == null,
set(layer[get(tooltipCurrentTextfieldLayer)].edge, "bottom");
,
set(layer[get(tooltipCurrentTextfieldLayer)].edge, %2);
);
if (%3 != null,
set(layer[get(tooltipCurrentTextfieldLayer)].wordwrap, true);
set(layer[get(tooltipCurrentTextfieldLayer)].width, %3);
);
if (%4 != null,
set(layer[get(tooltipCurrentTextfieldLayer)].xoffset, %4);
);
if (%5 != null,
set(layer[get(tooltipCurrentTextfieldLayer)].yoffset, %5);
);
set(layer[get(tooltipCurrentTextfieldLayer)].zorder, 99);
);
set(layer[get(tooltipCurrentTextfieldLayer)].visible, false);
set(layer[get(tooltipCurrentTextfieldLayer)].html, '');
if (tooltip !== null,
getmessage(currentTooltipText, get(tooltip));
ifnot (currentTooltipText == "",
txtadd(permanentTooltipForSpot, get(tooltip), '_permanent');
set(activateUsePermanentTooltip, false);
if(%1 == "std",
if(device.desktop,
set(activateUsePermanentTooltip, true);
);
,
if(%1 == "touch",
if(device.tablet OR device.mobile,
set(activateUsePermanentTooltip, true);
);
,
set(activateUsePermanentTooltip, true);
);
);
if(activateUsePermanentTooltip,
addlayer(get(permanentTooltipForSpot));
txtadd(layer[get(permanentTooltipForSpot)].parent, 'hotspot[', get(name), ']');
if(rotate,
sub(newRotate, 0, get(rotate));
if(rotate GE 0 AND rotate LT 45 OR rotate GE 315 AND rotate LT 360,
set(layer[get(permanentTooltipForSpot)].rotate,get(newRotate));
if (%2 == null,
set(layer[get(permanentTooltipForSpot)].align,bottom);
,
set(layer[get(permanentTooltipForSpot)].align,top);
);
,
if(rotate GE 45 AND rotate LT 135,
set(layer[get(permanentTooltipForSpot)].rotate,get(newRotate));
if (%2 == null,
set(layer[get(permanentTooltipForSpot)].align,right);
,
set(layer[get(permanentTooltipForSpot)].align,left);
);
,
if(rotate GE 135 AND rotate LT 225,
set(layer[get(permanentTooltipForSpot)].rotate,get(newRotate));
if (%2 == null,
set(layer[get(permanentTooltipForSpot)].align,top);
,
set(layer[get(permanentTooltipForSpot)].align,bottom);
);
,
set(layer[get(permanentTooltipForSpot)].rotate,get(newRotate));
if (%2 == null,
set(layer[get(permanentTooltipForSpot)].align,left);
,
set(layer[get(permanentTooltipForSpot)].align,right);
);
);
);
);
,
if (%2 == null,
set(layer[get(permanentTooltipForSpot)].align,bottom);
,
set(layer[get(permanentTooltipForSpot)].align,top);
);
);
if (%2 == null,
set(layer[get(permanentTooltipForSpot)].edge,top);
,
set(layer[get(permanentTooltipForSpot)].edge,bottom);
);
set(layer[get(permanentTooltipForSpot)].enabled,false);
set(layer[get(permanentTooltipForSpot)].capture,false);
set(layer[get(permanentTooltipForSpot)].visible, true);
set(layer[get(permanentTooltipForSpot)].tag,"tooltip");
set(layer[get(permanentTooltipForSpot)].type,text);
set(layer[get(permanentTooltipForSpot)].bg,false);
set(layer[get(permanentTooltipForSpot)].bgborder,0);
set(layer[get(permanentTooltipForSpot)].txtshadow,'1.0 1.0 4.0 0x000000 1');
set(layer[get(permanentTooltipForSpot)].css,'color:#ffffff;font-family:Arial;font-weight:bold;font-size:14px;text-align:center;');
set(layer[get(permanentTooltipForSpot)].interactivecontent, false);
set(layer[get(permanentTooltipForSpot)].zorder,3);
set(layer[get(permanentTooltipForSpot)].padding,2);
set(tooltipHtmlText, get(currentTooltipText));
escape(tooltipHtmlText);
set(layer[get(permanentTooltipForSpot)].html, get(tooltipHtmlText));
);
);
);
for(set(hsi, 0), hsi LT hotspot.count, inc(hsi),
if(hotspot[get(hsi)].tooltip !== NULL AND hotspot[get(hsi)].tooltip != "",
txtadd(permTooltipName, get(hotspot[get(hsi)].tooltip), '_permanent');
if(permTooltipName,
getmessage(changeTooltipTxt, get(hotspot[get(hsi)].tooltip));
escape(changeTooltipTxt);
set(layer[get(permTooltipName)].html, get(changeTooltipTxt));
);
);
);
if(keycode==17,set(tour_ctrlPressed,true);,if(tour_ctrlPressed==true,if(keycode==96,hideTooltip();lookto(get(panoview.h),get(panoview.v),get(panoview.fov)););););
if(keycode==17,set(tour_ctrlPressed,false););
ifnot (scene[get(xml.scene)].seen,
set(scene[get(xml.scene)].seen, true);
events.dispatch(onSeenStateChanged);
if (scene[get(xml.scene)].group,
copy(currentgroup, scene[get(xml.scene)].group);
ifnot (panoramagroup[get(currentgroup)].seen,
set(groupseen, true);
for( copy(sceneindex, scene[get(panoramagroup[get(currentgroup)].mainscene)].index),
(scene[get(sceneindex)].group == currentgroup) AND groupseen,
inc(sceneindex),
ifnot (scene[get(sceneindex)].seen,
set(groupseen, false);
);
);
if (groupseen,
set(panoramagroup[get(currentgroup)].seen, true);
events.dispatch(ongroupseenstatechanged);
);
);
);
inc(tour_nbseenscenes);
if (tour_nbseenscenes == scene.count,
events.dispatch(onallsceneseen);
);
);
if (tour_controlmodemousetype == moveto,
setarrowcursors();
,
sethandcursors();
);
if (device.flash,
ifnot(device.mac,
set(cursors.url , %FIRSTXML%/graphics/cursors_move.png);
set(cursors.type , 8way);
set(cursors.move , 0|0|16|16);
set(cursors.drag , 16|0|16|16);
set(cursors.arrow_u , 32|0|16|16);
set(cursors.arrow_d , 48|0|16|16);
set(cursors.arrow_l , 64|0|16|16);
set(cursors.arrow_r , 80|0|16|16);
set(cursors.arrow_lu, 96|0|16|16);
set(cursors.arrow_ru, 112|0|16|16);
set(cursors.arrow_rd, 128|0|16|16);
set(cursors.arrow_ld, 144|0|16|16);
);
,
js(kpanotour.Cursors.setMoveCursor());
);
if (device.flash,
ifnot(device.mac,
set(cursors.url , %FIRSTXML%/graphics/cursors_drag.png);
set(cursors.type, 2way);
set(cursors.move, 0|0|32|32);
set(cursors.drag, 32|0|32|32);
);
,
js(kpanotour.Cursors.setDragCursor());
);