You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

nautama

Trainee

  • "nautama" started this thread

Posts: 82

Location: La Paz, Baja California Sur, México

Occupation: KRpano programmer at www.imagen360.com

  • Send private message

1

Saturday, August 23rd 2014, 7:27pm

SPHERETOSCREEN action works a bit strangely

Hello, I'm trying to make a moving layer [tag] match the position of a series of hotspots on the onover event, for that I'm using a style with:

Source code

1
onover="spheretoscreen(hotspot[get(name)].ath,hotspot[get(name)].atv,layer[tag].x,layer[tag].y);"


It mostly works well, but when the hotspots are located nearer to the edge of the screen then the center of the layer and the hotspot begin to proportionally mismatch, it actually starts to go beyond depending on the side the hotspot is in (or up or down), I'm posting three images so you understand the problem.

My question is, is there any way to correct this mismatching alignment, I'd like to see the layer centered right on the hotspot no matter where in the screen it is.

Thank you
nautama has attached the following images:
  • Tag center.png
  • Tag right.png
  • Tag left.png

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Sunday, August 24th 2014, 1:07am

Why don't you simply set your textfield layer to have its parent be the hotspot and then set its position with ox and oy.
Thats what I do.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

nautama

Trainee

  • "nautama" started this thread

Posts: 82

Location: La Paz, Baja California Sur, México

Occupation: KRpano programmer at www.imagen360.com

  • Send private message

3

Monday, August 25th 2014, 11:09pm

Thank you very much, Sachagriffin, I never thought hotspots could be parents to layers! I set it manually and it works great

Source code

1
set(layer[tag].parent,hotspot[hs1]));


but I ran into problems while trying to change it dynamically:

Source code

1
2
3
4
5
6
<style name="infos"
 onhover="tag_call();"/>

<action name="tag_call">
set(layer[tag].parent,get(hotspot[get(name)].name));
</action>


it gives me the error 'No parent "hs1" found' and of course nothing happens. Do you have any ideas on what might be happening?

Thank you very much again!

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

4

Monday, August 25th 2014, 11:46pm

Source code

1
2
3
<action name="tag_call">
	txtadd(layer[tag].parent,"hotspot[",get(%1),"]");
</action>



something like that.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

nautama

Trainee

  • "nautama" started this thread

Posts: 82

Location: La Paz, Baja California Sur, México

Occupation: KRpano programmer at www.imagen360.com

  • Send private message

5

Tuesday, August 26th 2014, 6:24pm

IT WORKED!!!

the final code line was:

Source code

1
txtadd(layer[tag].parent,'hotspot[',get(name),']');


Thank you so much, Sachagriffin!

And, going back to the opening subject of this thread, is something wrong with the action spheretoscreen?, It should work exactly as this fix you gave me, but it doesn't.

nautama

Trainee

  • "nautama" started this thread

Posts: 82

Location: La Paz, Baja California Sur, México

Occupation: KRpano programmer at www.imagen360.com

  • Send private message

6

Tuesday, August 26th 2014, 7:15pm

Hotspot children="false" doesn't work in FLASH

Hello, I have successfully with the kind help from Sachagriffin made a layer have multiple parent hotspots and move from one to another on the onhover event. The thing is that in the Flash version the children layer acts as an extension of the hotspot (it can be clicked on and hovered) and I don't want this to occur, I set children="false" in the hotspot style and the layer is set enabled="false "which works great in HTML5, but in Flash it doesn't seem to work.

Do you have any ideas on what can I do to fix this?

Tuur

Sage

Posts: 3,203

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

7

Tuesday, August 26th 2014, 7:31pm

Maybe i'm wrong and misunderstand but maybe you can forget the parent thing and just pass the x and y (after spheretoscreen calculation) and maybe some vars from the hotspot to the layer?

Do you have a link so we can see?

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

nautama

Trainee

  • "nautama" started this thread

Posts: 82

Location: La Paz, Baja California Sur, México

Occupation: KRpano programmer at www.imagen360.com

  • Send private message

8

Tuesday, August 26th 2014, 8:43pm

Hello, Tuur!, your instinct is right on the spot, however I've done that (actually I tried that before anything else) and the results were not what I expected, you can see in my other post how it turned out with the spheretoscreen action:

SPHERETOSCREEN action works a bit strangely

It almost works well but not entirely, there's some strange behaviour happening that I cannot understand and think is more a bug than anything else, Sachagriffin suggested this new method of parenting the layer with the hotspots and it works great, except for this little problem I described above. It seems like the children attribute doesn't work in flash, or at least in my flash browser.

I'm still working on the project but I will post an example soon!

9

Tuesday, August 26th 2014, 9:10pm

Hi,

please note that there is here a fundamental real and mathematical limitation - when the 3d-world positions of the hotspots are 'behind' the screen, it not possible to project them to 2d-screen coordinates.

I have tried to illustrate the case here - look at the 'projection rays' from the center to the screen:
spheretoscreen for hotspots outside the viewport

The spheretoscreen() action would return 'NaN' (Not-A-Number) for these out-of-screen-plane cases.

You could add a check like this to check the values and set the layer invisible for this case:

Source code

1
2
3
4
5
spheretoscreen(h,v,x,y);
set(is_visible,true);
if(x != 0, ifnot(x, set(is_visible,false); ));
copy(layer[NAME].visible, is_visible);
if(is_visible, copy(layer[NAME].x,x); copy(layer[NAME].y,y); );


Best regards,
Klaus

nautama

Trainee

  • "nautama" started this thread

Posts: 82

Location: La Paz, Baja California Sur, México

Occupation: KRpano programmer at www.imagen360.com

  • Send private message

10

Tuesday, August 26th 2014, 9:57pm

Klaus, thank you for the answer, I think I understand the problem, but in my case I don't want to obtain the screen coordinates of a hotspot outside of the viewing area, instead I want to match the coordinates of a layer with the screen coordinates of a hotspot, that's why I used the spheretoscreen action, the problem is that there is a noticeable delta in X and Y happening proportionally to where in the screen the hotspot is, as you see in the pictures above the layer tends to go beyond the coordinates of the hotspot depending on which side of the screen it is. I traced both the x and y of the layer and the spheretoscreen coordinates of the hotspot. They match almost perfectly (there is a variation of about .0000000005 pixels), but visually they are obviously on different positions, that's the main issue I ran into, I'm not sure if this is related to the problem you explained or not.

Another thought that occured to me was that when I made the hotspots parents of the layer, somehow the computer had to calculate these coordinates and make them match, at least that's what comes to mind, so it's working perfectly that way but not through the spheretoscreen action.

Any thoughts?

11

Tuesday, August 26th 2014, 10:05pm

the problem is that there is a noticeable delta in X and Y happening proportionally to where in the screen the hotspot is
In this case I would say that the the wrong edge settings is used...

The hotspot itself is aligned with its 'edge' point at the ath/atv coordinates (additionally optionally shifted the ox/oy settings).

Best regards,
Klaus

nautama

Trainee

  • "nautama" started this thread

Posts: 82

Location: La Paz, Baja California Sur, México

Occupation: KRpano programmer at www.imagen360.com

  • Send private message

12

Wednesday, August 27th 2014, 1:25am

I finally discovered what whas going on, I had a flying="0.01" in the hotspot style, that's why it was moving them around suspiciously.

My mistake, the action screentosphere/spheretoscreen works great!

Alberto.