You are not logged in.

1

Saturday, March 22nd 2014, 8:44pm

hotspot coordinates on the screen to use them in js code

How to get current coordinates of hotspot that depend on current view? I mean x and y not ath, atv. Then how to display them to let me read them. I have been doing sth like that in javascript:

Source code

1
alert(myVariable);


How to send them to javascript funcion.

I need this help because my js code should display an information iframe box that should be positioned in a certain distance from hotspot on click event.
Thank you

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

2

Sunday, March 23rd 2014, 6:56am

Hello!
http://krpano.com/docu/actions/#spheretoscreen
Documentation always helps :)

Regards
Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

3

Sunday, March 23rd 2014, 1:47pm

Thanks for the advice, Andrey. I try to use that function but not succeeded yet. What could be wrong in that code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
	<hotspot name="close" url="plugins/textfield.swf"
		handcursor="true"
		selectable="false"
		children="false"
		width="100" height="20"
		ath=".03" atv="-.05"
		html="[p]salut[/p]"
		css="p{color:#ff0000; font-family:Arial; font-weight:bold; font-size:24; margin-left:5; margin-right:5;}"
		background="false"
		autosize="center"
		alpha=".7"
		onclick="js(makeFrame());"
		onhover="showtext(spheretoscreen(get('ath'),get('atv')))"
		/>

The last line (with onhover) displays just the code not screen coordinates values as I expected.

EDIT------------------------------------------------------
it nearly worked but I cannot make showtext display both coordinates but one.
So that worked:

Source code

1
2
3
4
	<action name='showCoor'>
 		spheretoscreen(ath,atv,q,w);
 		showtext(get(q));
	</action>

and that not:

Source code

1
2
3
4
	<action name='showCoor'>
 		spheretoscreen(ath,atv,q,w);
 		showtext(get(q) + ' ' + get(w));
	</action>

Any ideas?

EDIT-----------------------------------------
I've managed it succesfully:

Source code

1
2
3
4
5
	<action name='showCoor'>
 		spheretoscreen(ath,atv,q,w);
 		txtadd(e ,get(q),'___',get(w),);
 		showtext(get(e));
	</action>

Thank you

This post has been edited 6 times, last edit by "trzczy" (Mar 23rd 2014, 3:01pm)


Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

4

Sunday, March 23rd 2014, 4:36pm

hi!
well, you make a lot of errors :)
krpano actiona can't calculate variables directly in actions.
for example
showtext(x + y); is not possible
showtext can show an variable or text
so you need to do so
txtadd(new_text,get(x),' ',get(y));
result is text as new_text variable value.
and you can't call actions in attributes or in actions

Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

5

Sunday, March 23rd 2014, 10:41pm

Ok, so now it's clear for me. :)