krpano.call Unable to create action call

  • Hello everyone, javascript inside krpano.call action can not be written less than a call to action function, it is that so?
    Attach source, I hope you can answer, thank you very much!


    function show_addkrpano(){
    krpano.call(
    "addhotspot(hotspot_line);"+
    "set(hotspot[hotspot_line].url,'./comm_line.png');"+
    "set(hotspot[hotspot_line].ath,get(view.hlookat));"+
    "set(hotspot[hotspot_line].atv,get(view.vlookat));"+
    "set(hotspot[hotspot_line].zoom,false);"+
    "set(hotspot[hotspot_line].ondown,draghotspot());"+

    "<action name='draghotspot'> spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery, 'l');sub(drag_adjustx, mouse.stagex, hotspotcenterx);sub(drag_adjusty, mouse.stagey, hotspotcentery);if(%1 != null,asyncloop(plugin[%1].pressed,sub(dx, mouse.stagex, drag_adjustx);sub(dy, mouse.stagey, drag_adjusty);screentosphere(dx, dy, ath, atv););,asyncloop(pressed,sub(dx, mouse.stagex, drag_adjustx);sub(dy, mouse.stagey, drag_adjusty);screentosphere(dx, dy, ath, atv);););</action>")
    }

  • thank you very much! Klaus.
    I come inside javascript drag hotspot can be achieved? I wrote a function that should work together, mouse clicks, he would go in the middle of the screen? Help it look? thank you very much!



    function show_addkrpano(){
    krpano.call("addhotspot(hotspot_line);");
    krpano.set("hotspot[hotspot_line].url",'./comm_line.png');
    krpano.set("hotspot[hotspot_line].ath",krpano.get("view.hlookat"));
    krpano.set("hotspot[hotspot_line].atv",krpano.get("view.vlookat"));
    krpano.set("hotspot[hotspot_line].zoom",false);
    krpano.set("hotspot[hotspot_line].ondown",draghotspot);
    }

    function draghotspot(){
    var wu = krpano.get("hotspot[hotspot_line].pressed");
    var mouse_at_x = krpano.get("mouse.stagex");
    var mouse_at_y = krpano.get("mouse.stagey");
    var mouse_at_h = krpano.get("view.hlookat");
    var mouse_at_v = krpano.get("view.vlookat");
    var drag = krpano.spheretoscreen(mouse_at_h,mouse_at_v);
    var drag_x = mouse_at_x - drag.x;
    var drag_y = mouse_at_y - drag.y;
    var dx = mouse_at_x - drag_x;
    var dy = mouse_at_y - drag_y;
    var screarr = krpano.screentosphere(dx, dy);
    //console.log(screarr);
    console.log(mouse_at_h);
    console.log(mouse_at_v);
    var screarr_x = screarr.x;
    var screarr_y = screarr.y;
    krpano.set("hotspot[hotspot_line].ath",screarr_x);
    krpano.set("hotspot[hotspot_line].atv",screarr_y);
    }

    Einmal editiert, zuletzt von xinxin (15. September 2016 um 19:45)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!