You are not logged in.

JBA

Trainee

  • "JBA" started this thread

Posts: 89

Location: All over

Occupation: this

  • Send private message

1

Thursday, January 13th 2011, 3:45am

Crosshair to follow mouse and become static on click

Hi Guys =

Im trying to make a crosshair plugin perform an action to make it clear to the user where a hotspot is going to be created.

I tried this - to no avail - Anyone mave any better ideas? - I already have js detecting the mouse location but I also want a crosshair to make it obvious where the hotspot is going

<plugin name="crosshair" url="images/crosshair.png" visible="true" autopos="center"/>

<action name="moveCrosshair">
set(plugin[crosshair].visible,true);
set(plugin[crosshair].ath,screentosphere(get(mouse.x)));
set(plugin[crosshair].atv,screentosphere(get(mouse.x)));
</action>

Thanks in Advance

JB

jpdeglet69

Intermediate

Posts: 215

Location: France

Occupation: VR Maker and Document Management Expert

  • Send private message

2

Thursday, January 13th 2011, 11:39am

Hi,

Just a remark, what are plugin[].ath, plugin[].atv : spherical coordinates ???

From documentation:

- The mouse.x and mouse.y coordinates are relative to the left top edge of the area and the mouse.stagex and mouse.stagey coordinates to the left top edge of the whole flash stage/window.
So probably you will use
-The plungin[].x and plugin[].y which are distance from the align point to the edge point.
This can be a absolute pixel value or a relative (to the screenwidth or screenheight) percent value.
Best regards,
JPhD
VR-GuideĀ®/Eleana CEO
https://eleana.online

JBA

Trainee

  • "JBA" started this thread

Posts: 89

Location: All over

Occupation: this

  • Send private message

3

Thursday, January 13th 2011, 1:56pm

Thanks jpdeglet69

Yeah but it needs to be a hotspot not a plugin - its ok to detect the x and y of the mouse location as long as it registers on the pano layer as a hotspot.

I know its possible as the editor plugin does it (and more) -

Zephyr

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

4

Thursday, January 13th 2011, 2:26pm

try
screentosphere(mouse.x,mouse.y,plugin[crosshair].ath,plugin[crosshair].atv);

JBA

Trainee

  • "JBA" started this thread

Posts: 89

Location: All over

Occupation: this

  • Send private message

5

Thursday, January 13th 2011, 3:23pm

Thanks Zephyr but not yet -

I also use

var hvs = krpano.get("screentosphere("+mousex +","+mousey +")");

in my js which is called

FLumoxed *smile*

VN2009

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

6

Thursday, January 13th 2011, 3:28pm

i use this to move pluigins it will have to be adapted for hotspots withthe code Zepher provided.

<action name="follow_the_mouse">
if(dragging,
set(plugin[%1].align, topleft);
set(plugin[%1].edge, topleft);
add(plugin[%1].x, mouse.x, 0);
add(plugin[%1].y, mouse.y, 5);
delayedcall(0, follow_the_mouse(%1));
);
</action>

and on the plugin i use

ondown="set(dragging,true); follow_the_mouse(get(name));"
onup="set(dragging,false);"

Similar threads