trace('In Edit Mode / No Google nav displayed')
trace('In Edit Mode / No follow mouse effect')
//CONSERVER FICHIER XML ET URL
copy(xml_file,xml.content);
copy(xml_url,xml.url);
//TOOLS
//LIST ALL SCENES
for(set(i,0), i LT scene.count, inc(i),
caller.addNameditem(calc(scene[get(i)].name),calc('[img src=[dq]' + scene[get(i)].thumburl + '[dq] style=[dq]border:1px solid rgba(255,255,255,1);width:160px;height:80px;vertical-align:middle;margin-right:8px;object-fit: cover;[dq]/] '+scene[get(i)].title), calc('set(scene_to_link,'+scene[get(i)].name+');') );
);
//KEYBOARD ACTIONS
loadscene(get(scene_to_link));
add(iy,0.8);
calc(image.prealign,ix+'|'+iy+'|'+iz);
sub(iy,0.8);
calc(image.prealign,ix+'|'+iy+'|'+iz);
//NORTH LINE
//HORIZON LINE
//INTIAL VIEW SET
tween(layer[viewset].alpha,1,,,
delayedcall(2,tween(layer[viewset].alpha,0))
)
//GENERATE HOTSPOTS
copy(drag_currentx, x);
copy(drag_currenty, y);
copy(drag_stagex, mouse.stagex);
copy(drag_stagey, mouse.stagey);
indexoftxt(align_contains_right, get(align), 'right');
indexoftxt(align_contains_bottom, get(align), 'bottom');
calc(drag_align_x, align_contains_right GE 0 ? -1 : +1);
calc(drag_align_y, align_contains_bottom GE 0 ? -1 : +1);
asyncloop(pressed,
calc(x, drag_currentx + (mouse.stagex - drag_stagex)*drag_align_x);
calc(y, drag_currenty + (mouse.stagey - drag_stagey)*drag_align_y);
);
if(%1 != dragging,
spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery);
sub(drag_adjustx, mouse.stagex, hotspotcenterx);
sub(drag_adjusty, mouse.stagey, hotspotcentery);
edit_drag_spots(dragging);
,
if(pressed,
sub(dx, mouse.stagex, drag_adjustx);
sub(dy, mouse.stagey, drag_adjusty);
screentosphere(dx, dy, ath, atv);
delayedcall(0, edit_drag_spots(dragging) );
);
);
if(%1 != dragging,
spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery);
sub(drag_adjustx, mouse.stagex, hotspotcenterx);
sub(drag_adjusty, mouse.stagey, hotspotcentery);
edit_drag_shop_spots(dragging);
,
if(pressed,
sub(dx, mouse.stagex, drag_adjustx);
sub(dy, mouse.stagey, drag_adjusty);
screentosphere(dx, dy, ath, atv);
screentosphere(dx, dy, hotspot[get(myicon)].ath, hotspot[get(myicon)].atv);
screentosphere(dx, dy, hotspot[get(mytext)].ath, hotspot[get(mytext)].atv);
screentosphere(dx, dy, hotspot[get(mypulse)].ath, hotspot[get(mypulse)].atv);
delayedcall(0, edit_drag_shop_spots(dragging) );
);
);
//DOUBLE CLICK ACTION
inc(clicks);
if(clicks == 2,
set(clicks,0);
stopdelayedcall(doubleclickdetector);
if((((mouse.x-downx)^2 + (mouse.y-downy)^2)^0.5) LT (device.touch ? 10 : 2),
ondoubleclick();
,
onsingleclick();
onsingleclick();
);
,
copy(downx, mouse.x);
copy(downy, mouse.y);
delayedcall(doubleclickdetector, 0.3,
set(clicks,0);
onsingleclick();
);
);
// MANIPULATE XML ACTIONS
if(scene_to_link,
addhotspot(auto, dhs);
dhs.loadstyle(%1);
set(dhs,
ath=calc(roundval(view.hlookat,2)),
atv=calc(roundval(view.vlookat,2)),
onfirstloaded=edit_addHStoscene
);
copy(dhs.linkedscene,scene_to_link);
callwith(dhs,onfirstloaded);
);
if(scene_to_link,
addhotspot(auto, fhs);
fhs.loadstyle(%1);
set(fhs,
ath=calc(roundval(view.hlookat,2)),
atv=calc(roundval(view.vlookat,2)),
down=false,
rotate=180,
onfirstloaded=edit_addFloorHStoscene
);
copy(fhs.linkedscene,scene_to_link);
callwith(fhs,onfirstloaded);
);
if(scene_to_link,
addhotspot(auto, fhs);
fhs.loadstyle(%1);
set(fhs,
ath=calc(roundval(view.hlookat,2)),
atv=calc(roundval(view.vlookat,2)),
down=true,
onfirstloaded=edit_addFloorHStoscene
);
copy(fhs.linkedscene,scene_to_link);
callwith(fhs,onfirstloaded);
);
jsget(unitkey, prompt('Shop unit-key', '') );
if(unitkey,
addhotspot(auto, shs);
shs.loadstyle(%1);
set(shs,
ath=calc(roundval(view.hlookat,2)),
atv=calc(roundval(view.vlookat,2)),
onfirstloaded=edit_addShopHStoscene
);
copy(shs.unit_key,unitkey);
callwith(shs,onfirstloaded);
);
';
scenecontent = scenecontent.replace("", val);
}else{
debut +=10;
let fin = scenecontent.indexOf('"', debut);
let oldval = scenecontent.substring(debut,fin);
scenecontent = scenecontent.replace(oldval, val);
}
krpano.set("scene[get(xml.scene)].content",scenecontent);
]]>
';
scene = scene + hotspot + "\n";
krpano.set("scene[get(xml.scene)].content",scene);
]]>
';
scene = scene + hotspot + "\n";
krpano.set("scene[get(xml.scene)].content",scene);
]]>
';
scene = scene + hotspot + "\n";
krpano.set("scene[get(xml.scene)].content",scene);
krpano.call("set_hotspot_data");
]]>
//BOUTON SAUVEGARDER
for(set(i,0),i LT scene.count, inc(i),
edit_updateSCENEcontent(get(scene[get(i)].name));
if(i == scene.count -1,edit_send_to_local(get(xml_url),get(xml_file)))
);
//GENERATE THUMBNAIL