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.

1

Tuesday, October 2nd 2018, 7:26pm

stage.mouse.x not getting the right value

hello,
i'm a beginer at krpano and i have a cylinder pano image and i'm trying to make an if sentence

Source code

1
if(		mouse.stagex LT 1000 	,			if( 				mouse.stagex GT 1500 	, 					rightside();					, 					middleside();			);			, 			leftside();	);

but i don't get x of the whole image (for example if i click on left side of the screen even though i'm on the right side of pano image it says it's lower) any tip would be much appreciated or correction if i'm doing this completely wrong

thank you and best regards
tom

2

Wednesday, October 3rd 2018, 4:51am

What event do you put this action on? *question*

3

Wednesday, October 3rd 2018, 10:45am

on view change

i made an event on view change to check where mouse.stagex was clicked. Am i doing it wrong?

4

Wednesday, October 3rd 2018, 1:27pm

When you change the view or click of the mouse?
On click:

Source code

1
2
3
<events  onclick="if(mouse.stagex LT 1000,if(mouse.stagex GT 1500,rightside();,middleside();),leftside(););"
    
        />

5

Wednesday, October 3rd 2018, 4:35pm

but the problem still persist that when i click on the left side of the screen it thinks we are lt then 1000 even though i'm on the right side of the pano image :/

Alexey Tkachenko

Professional

Posts: 734

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

6

Wednesday, October 3rd 2018, 4:45pm

Hi)

Try this one:

Source code

1
<action name="check_screen_pos" scope="local" >		div(screen_section, stagewidth, 3);				if(mouse.stagex LE screen_section, trace(left));				if(mouse.stagex GE calc(stagewidth - screen_section), trace(right));				if(mouse.stagex GT screen_section AND mouse.stagex LT calc(stagewidth - screen_section), trace(middle));	</action>



Note that "screen_section" variable needs to be updated when the screen resizes
Regards,

Alexey

7

Wednesday, October 3rd 2018, 4:45pm

You have a contradiction in the code.

If "x" mice are less than 1000, then execute - if "x" mice are more than 1500 .... this condition will never be fulfilled.

8

Thursday, October 4th 2018, 9:31am

Hi,

first - you shouldn't use absolute values when checking for sizes, not everyone is using the same browser window size ;-)

Here an example code for testing if the click is in the left, the middle or the right third of the screen:

Source code

1
2
3
4
5
6
7
8
9
10
11
<events onclick="test();" />

<action name="test">
    if(mouse.stagex LT stagewidth*1/3,
        trace(left side);
    , mouse.stagex GT stagewidth*2/3,
        trace(right side);
    ,
        trace(middle);
    );
</action>



Best regards,
Klaus

9

Friday, October 5th 2018, 1:00pm

Thank you all for your answers!

is there a way to do this function but instead of checking in which area of screen was clicked, but for a whole pano? i thought that stage.x check on the whole image not just screen

best regards
tom

This post has been edited 1 times, last edit by "ploteus" (Oct 8th 2018, 6:56pm) with the following reason: rephrasing the question


10

Wednesday, October 17th 2018, 12:26pm

Sorry for bumping in this thread but i've tried so many options and i'm lost. Is there any way to get mouse position on screen regarding whole size of pano image?

best regards and thank you for your answers
tom

Alexey Tkachenko

Professional

Posts: 734

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

11

Wednesday, October 17th 2018, 2:05pm

Hi)

what exactly do you want to implement? There's 'spheretoscreen' option, but it will calculate panorama coordinates into screen coordinates only for the pano section currently inside the vieving area (Klaus explained this somewhere on the forum and even provided a simple illuastation of this principle).
Regards,

Alexey

12

Wednesday, October 17th 2018, 2:22pm

well i'm trying to implement minimap on a pano image and my thinking was that i could move mimimap overlay depending which area of whole image is clicked. so if i was on the left side of the screen i would have overlay on left etc

hmm i guess i need to go back to drawing board :)
thank you for your answer!
best regards

Alexey Tkachenko

Professional

Posts: 734

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

13

Wednesday, October 17th 2018, 2:47pm

Regards,

Alexey

14

Wednesday, October 17th 2018, 2:55pm

o wow ok haven't seen that thread thank you will try it, you think this might work for flat pano image (gigapixel)?

15

Wednesday, November 28th 2018, 10:43am

just want to share my solution

so the problem was i was using the wrong function because with stage.x you just get numbers from the actual screen not whole stage so i've used

Source code

1
<action name="overlaypostion">    if(view.hlookat LT -0.19,       left();    , view.hlookat GT +0.2,        right();    , 		middle();    );</action>



there is probably a better way but with this function i did a minimap overlay which changes depending where you are looking right now, thank you all for your answers it helped me a lot! :)

best regards
Tom